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}
|
||||
# Write the articles in alphabetical order
|
||||
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")
|
||||
alphabetical_order = sorted(
|
||||
articles,
|
||||
|
@ -71,6 +71,7 @@ def build_contents_page(articles, config):
|
|||
css=css,
|
||||
logo=config["LOGO_FILENAME"],
|
||||
prompt=config["PROMPT"],
|
||||
sort=config["DEFAULT_SORT"],
|
||||
content=content,
|
||||
citeblock="")
|
||||
|
||||
|
@ -88,6 +89,7 @@ def build_rules_page(config):
|
|||
css=css,
|
||||
logo=config["LOGO_FILENAME"],
|
||||
prompt=config["PROMPT"],
|
||||
sort=config["DEFAULT_SORT"],
|
||||
content=content,
|
||||
citeblock="")
|
||||
|
||||
|
@ -105,6 +107,7 @@ def build_formatting_page(config):
|
|||
css=css,
|
||||
logo=config["LOGO_FILENAME"],
|
||||
prompt=config["PROMPT"],
|
||||
sort=config["DEFAULT_SORT"],
|
||||
content=content,
|
||||
citeblock="")
|
||||
|
||||
|
@ -121,6 +124,7 @@ def build_session_page(config):
|
|||
css=css,
|
||||
logo=config["LOGO_FILENAME"],
|
||||
prompt=config["PROMPT"],
|
||||
sort=config["DEFAULT_SORT"],
|
||||
content=config["SESSION_PAGE"],
|
||||
citeblock="")
|
||||
|
||||
|
@ -251,6 +255,7 @@ def build_statistics_page(articles, config):
|
|||
css=css,
|
||||
logo=config["LOGO_FILENAME"],
|
||||
prompt=config["PROMPT"],
|
||||
sort=config["DEFAULT_SORT"],
|
||||
content=content,
|
||||
citeblock="")
|
||||
|
||||
|
@ -352,7 +357,7 @@ def build_all(path_prefix, lexicon_name):
|
|||
# Write the redirect page
|
||||
print("Writing redirect page...")
|
||||
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
|
||||
print("Deleting old article pages...")
|
||||
|
@ -374,6 +379,7 @@ def build_all(path_prefix, lexicon_name):
|
|||
css = css,
|
||||
logo = config["LOGO_FILENAME"],
|
||||
prompt = config["PROMPT"],
|
||||
sort = config["DEFAULT_SORT"],
|
||||
content = content,
|
||||
citeblock = citeblock)
|
||||
f.write(article_html)
|
||||
|
|
|
@ -15,7 +15,9 @@ contentsToggle = function() {
|
|||
}
|
||||
window.onload = function(){
|
||||
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>
|
||||
<button id="toggle-button" onClick="javascript:contentsToggle()">Switch to turn order</button>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<img id="logo" src="../{logo}">
|
||||
<p><span style="font-size:1.5em;">{lexicon}</span></p>
|
||||
<p>
|
||||
<a href="../contents/">Contents</a> —
|
||||
<a href="../contents/{sort}">Contents</a> —
|
||||
<a href="../rules/">Rules</a> —
|
||||
<a href="../formatting/">Formatting</a> —
|
||||
<a href="../session/">Session</a> —
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>{lexicon}</title>
|
||||
<meta http-equiv="refresh" content="0; url=contents/" />
|
||||
<meta http-equiv="refresh" content="0; url=contents/{sort}" />
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="contents/">{lexicon}</a>...</p>
|
||||
<p>Redirecting to <a href="contents/{sort}">{lexicon}</a>...</p>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue