Add self-citation sanity check

This commit is contained in:
Tim Van Baak 2018-08-16 17:03:16 -07:00
parent 2e4f7f60a3
commit 7cd5883734
1 changed files with 12 additions and 1 deletions

View File

@ -411,4 +411,15 @@ def build_all(path_prefix, lexicon_name):
if "PRINTABLE_FILE" in config and config["PRINTABLE_FILE"]:
with open(pathto(config["PRINTABLE_FILE"]), "w", encoding="utf-8") as f:
f.write(build_compiled_page(articles, config))
print(" Wrote compiled page to " + config["PRINTABLE_FILE"])
print(" Wrote compiled page to " + config["PRINTABLE_FILE"])
# Check that authors aren't citing themselves
print("Running citation checks...")
article_by_title = {article.title : article for article in articles}
for article in articles:
for _, tup in article.citations.items():
cited = article_by_title[tup[1]]
if article.player == cited.player:
print(" {2}: {0} cites {1}".format(article.title, cited.title, cited.player))
print()