Add missing addendum config check
This commit is contained in:
parent
31f401400c
commit
699dce47af
|
@ -167,7 +167,7 @@ class LexiconArticle:
|
|||
return articles
|
||||
|
||||
@staticmethod
|
||||
def interlink(lexicon_articles):
|
||||
def interlink(lexicon_articles, config):
|
||||
"""
|
||||
Fills out fields on articles that require other articles for context.
|
||||
Creates phantom articles.
|
||||
|
@ -175,10 +175,17 @@ class LexiconArticle:
|
|||
# Preliminary assertion that title/turn is unique
|
||||
keys = set()
|
||||
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(
|
||||
article.title, article.turn))
|
||||
keys.add((article.title, article.turn))
|
||||
*key))
|
||||
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
|
||||
written_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
|
||||
# Sort this by turn before title so prev/next links run in turn order
|
||||
articles = sorted(
|
||||
LexiconArticle.interlink(articles),
|
||||
LexiconArticle.interlink(articles, config),
|
||||
key=lambda a: (a.turn, utils.titlesort(a.title)))
|
||||
|
||||
def pathto(*els):
|
||||
|
|
Loading…
Reference in New Issue