Add missing addendum config check
This commit is contained in:
parent
31f401400c
commit
699dce47af
|
@ -167,7 +167,7 @@ class LexiconArticle:
|
||||||
return articles
|
return articles
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def interlink(lexicon_articles):
|
def interlink(lexicon_articles, config):
|
||||||
"""
|
"""
|
||||||
Fills out fields on articles that require other articles for context.
|
Fills out fields on articles that require other articles for context.
|
||||||
Creates phantom articles.
|
Creates phantom articles.
|
||||||
|
@ -175,10 +175,17 @@ class LexiconArticle:
|
||||||
# Preliminary assertion that title/turn is unique
|
# Preliminary assertion that title/turn is unique
|
||||||
keys = set()
|
keys = set()
|
||||||
for article in lexicon_articles:
|
for article in lexicon_articles:
|
||||||
if (article.title, article.turn) in keys:
|
if config['ALLOW_ADDENDA'].lower() == "true":
|
||||||
|
key = (article.title, article.turn)
|
||||||
|
if key in keys:
|
||||||
raise ValueError("Found two articles with title '{}' and turn '{}'".format(
|
raise ValueError("Found two articles with title '{}' and turn '{}'".format(
|
||||||
article.title, article.turn))
|
*key))
|
||||||
keys.add((article.title, article.turn))
|
else:
|
||||||
|
key = article.title
|
||||||
|
if key in keys:
|
||||||
|
raise ValueError("Found two articles with title '{}'".format(
|
||||||
|
article.title))
|
||||||
|
keys.add(key)
|
||||||
# Sort out which articles are addendums and which titles are phantoms
|
# Sort out which articles are addendums and which titles are phantoms
|
||||||
written_titles = set()
|
written_titles = set()
|
||||||
cited_titles = set()
|
cited_titles = set()
|
||||||
|
|
|
@ -416,7 +416,7 @@ def build_all(path_prefix, lexicon_name):
|
||||||
# Once they've been populated, the articles list has the titles of all articles
|
# Once they've been populated, the articles list has the titles of all articles
|
||||||
# Sort this by turn before title so prev/next links run in turn order
|
# Sort this by turn before title so prev/next links run in turn order
|
||||||
articles = sorted(
|
articles = sorted(
|
||||||
LexiconArticle.interlink(articles),
|
LexiconArticle.interlink(articles, config),
|
||||||
key=lambda a: (a.turn, utils.titlesort(a.title)))
|
key=lambda a: (a.turn, utils.titlesort(a.title)))
|
||||||
|
|
||||||
def pathto(*els):
|
def pathto(*els):
|
||||||
|
|
Loading…
Reference in New Issue