diff --git a/src/build.py b/src/build.py index ac5ccf5..c7198a0 100644 --- a/src/build.py +++ b/src/build.py @@ -398,6 +398,24 @@ def build_all(path_prefix, lexicon_name): f.write(build_compiled_page(articles, config)) print(" Wrote compiled page to " + config["PRINTABLE_FILE"]) + with open(pathto("editor.html"), "w", encoding="utf-8") as f: + editor = utils.load_resource("editor.html") + writtenArticles = "" + phantomArticles = "" + for article in articles: + if article.player is None: + phantomArticles += "{{title: \"{0}\"}},".format(article.title.replace("\"", "\\\"")) + else: + writtenArticles += "{{title: \"{0}\", author: \"{1.player}\"}},".format( + article.title.replace("\"", "\\\""), article) + nextTurn = 0 + if articles: + nextTurn = max([article.turn for article in articles if article.player is not None]) + 1 + editor = editor.replace("//writtenArticles", writtenArticles) + editor = editor.replace("//phantomArticles", phantomArticles) + editor = editor.replace("TURNNUMBER", str(nextTurn)) + f.write(editor) + # Check that authors aren't citing themselves print("Running citation checks...") for parent in articles: diff --git a/src/resources/editor.html b/src/resources/editor.html new file mode 100644 index 0000000..cdaaa55 --- /dev/null +++ b/src/resources/editor.html @@ -0,0 +1,183 @@ + + +Lexicon Editor + + + + +
+

Lexicon Editor

+
+ +
+
+ + + + + + + + + + +
# Player:
# Turn:
# Title:
+ +
+
+
+
+
+
+ +