Implement sorting config
This commit is contained in:
parent
16db91f5f1
commit
f2e07cf471
10
src/build.py
10
src/build.py
|
@ -27,7 +27,7 @@ def build_contents_page(articles, config):
|
||||||
for article in articles}
|
for article in articles}
|
||||||
# Write the articles in alphabetical order
|
# Write the articles in alphabetical order
|
||||||
content += utils.load_resource("contents.html")
|
content += utils.load_resource("contents.html")
|
||||||
content += "<div id=\"index-order\" style=\"display:block\">\n<ul>\n"
|
content += "<div id=\"index-order\" style=\"display:none\">\n<ul>\n"
|
||||||
indices = config["INDEX_LIST"].split("\n")
|
indices = config["INDEX_LIST"].split("\n")
|
||||||
alphabetical_order = sorted(
|
alphabetical_order = sorted(
|
||||||
articles,
|
articles,
|
||||||
|
@ -71,6 +71,7 @@ def build_contents_page(articles, config):
|
||||||
css=css,
|
css=css,
|
||||||
logo=config["LOGO_FILENAME"],
|
logo=config["LOGO_FILENAME"],
|
||||||
prompt=config["PROMPT"],
|
prompt=config["PROMPT"],
|
||||||
|
sort=config["DEFAULT_SORT"],
|
||||||
content=content,
|
content=content,
|
||||||
citeblock="")
|
citeblock="")
|
||||||
|
|
||||||
|
@ -88,6 +89,7 @@ def build_rules_page(config):
|
||||||
css=css,
|
css=css,
|
||||||
logo=config["LOGO_FILENAME"],
|
logo=config["LOGO_FILENAME"],
|
||||||
prompt=config["PROMPT"],
|
prompt=config["PROMPT"],
|
||||||
|
sort=config["DEFAULT_SORT"],
|
||||||
content=content,
|
content=content,
|
||||||
citeblock="")
|
citeblock="")
|
||||||
|
|
||||||
|
@ -105,6 +107,7 @@ def build_formatting_page(config):
|
||||||
css=css,
|
css=css,
|
||||||
logo=config["LOGO_FILENAME"],
|
logo=config["LOGO_FILENAME"],
|
||||||
prompt=config["PROMPT"],
|
prompt=config["PROMPT"],
|
||||||
|
sort=config["DEFAULT_SORT"],
|
||||||
content=content,
|
content=content,
|
||||||
citeblock="")
|
citeblock="")
|
||||||
|
|
||||||
|
@ -121,6 +124,7 @@ def build_session_page(config):
|
||||||
css=css,
|
css=css,
|
||||||
logo=config["LOGO_FILENAME"],
|
logo=config["LOGO_FILENAME"],
|
||||||
prompt=config["PROMPT"],
|
prompt=config["PROMPT"],
|
||||||
|
sort=config["DEFAULT_SORT"],
|
||||||
content=config["SESSION_PAGE"],
|
content=config["SESSION_PAGE"],
|
||||||
citeblock="")
|
citeblock="")
|
||||||
|
|
||||||
|
@ -251,6 +255,7 @@ def build_statistics_page(articles, config):
|
||||||
css=css,
|
css=css,
|
||||||
logo=config["LOGO_FILENAME"],
|
logo=config["LOGO_FILENAME"],
|
||||||
prompt=config["PROMPT"],
|
prompt=config["PROMPT"],
|
||||||
|
sort=config["DEFAULT_SORT"],
|
||||||
content=content,
|
content=content,
|
||||||
citeblock="")
|
citeblock="")
|
||||||
|
|
||||||
|
@ -352,7 +357,7 @@ def build_all(path_prefix, lexicon_name):
|
||||||
# Write the redirect page
|
# Write the redirect page
|
||||||
print("Writing redirect page...")
|
print("Writing redirect page...")
|
||||||
with open(pathto("index.html"), "w", encoding="utf8") as f:
|
with open(pathto("index.html"), "w", encoding="utf8") as f:
|
||||||
f.write(utils.load_resource("redirect.html").format(lexicon=config["LEXICON_TITLE"]))
|
f.write(utils.load_resource("redirect.html").format(lexicon=config["LEXICON_TITLE"], sort=config["DEFAULT_SORT"]))
|
||||||
|
|
||||||
# Write the article pages
|
# Write the article pages
|
||||||
print("Deleting old article pages...")
|
print("Deleting old article pages...")
|
||||||
|
@ -374,6 +379,7 @@ def build_all(path_prefix, lexicon_name):
|
||||||
css = css,
|
css = css,
|
||||||
logo = config["LOGO_FILENAME"],
|
logo = config["LOGO_FILENAME"],
|
||||||
prompt = config["PROMPT"],
|
prompt = config["PROMPT"],
|
||||||
|
sort = config["DEFAULT_SORT"],
|
||||||
content = content,
|
content = content,
|
||||||
citeblock = citeblock)
|
citeblock = citeblock)
|
||||||
f.write(article_html)
|
f.write(article_html)
|
||||||
|
|
|
@ -15,7 +15,9 @@ contentsToggle = function() {
|
||||||
}
|
}
|
||||||
window.onload = function(){
|
window.onload = function(){
|
||||||
if (location.search.search("byturn") > 0)
|
if (location.search.search("byturn") > 0)
|
||||||
contentsToggle();
|
document.getElementById("turn-order").style.display = "block";
|
||||||
|
if (location.search.search("byindex") > 0)
|
||||||
|
document.getElementById("index-order").style.display = "block";
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<button id="toggle-button" onClick="javascript:contentsToggle()">Switch to turn order</button>
|
<button id="toggle-button" onClick="javascript:contentsToggle()">Switch to turn order</button>
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<img id="logo" src="../{logo}">
|
<img id="logo" src="../{logo}">
|
||||||
<p><span style="font-size:1.5em;">{lexicon}</span></p>
|
<p><span style="font-size:1.5em;">{lexicon}</span></p>
|
||||||
<p>
|
<p>
|
||||||
<a href="../contents/">Contents</a> —
|
<a href="../contents/{sort}">Contents</a> —
|
||||||
<a href="../rules/">Rules</a> —
|
<a href="../rules/">Rules</a> —
|
||||||
<a href="../formatting/">Formatting</a> —
|
<a href="../formatting/">Formatting</a> —
|
||||||
<a href="../session/">Session</a> —
|
<a href="../session/">Session</a> —
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>{lexicon}</title>
|
<title>{lexicon}</title>
|
||||||
<meta http-equiv="refresh" content="0; url=contents/" />
|
<meta http-equiv="refresh" content="0; url=contents/{sort}" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<p>Redirecting to <a href="contents/">{lexicon}</a>...</p>
|
<p>Redirecting to <a href="contents/{sort}">{lexicon}</a>...</p>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
Loading…
Reference in New Issue