Double use of citation name

Based on #8320 and https://github.com/doxygen/doxygen/pull/11157 creating an assertion for builds from scratch when a citation name is used multiple times.
(doxygen cannot catch these here as they are directly written into html code).
This commit is contained in:
albert-github 2024-09-27 18:20:29 +02:00 committed by Sébastien Loriot
parent 9601e96724
commit 837be259dc
1 changed files with 11 additions and 0 deletions

View File

@ -278,7 +278,9 @@ def main():
encoding="utf-8", encoding="utf-8",
) )
k = 2 k = 2
citeDic = {}
for line in f: for line in f:
foundDouble=False
match = pattern.match(line) match = pattern.match(line)
if match: if match:
pkg = match.group(1) pkg = match.group(1)
@ -304,6 +306,10 @@ def main():
match = pattern_bib.match(pkg_line) match = pattern_bib.match(pkg_line)
if match: if match:
bib = match.group(1) bib = match.group(1)
if bib in citeDic:
foundDouble=True
else:
citeDic[bib] = pkg
continue continue
assert len(bib) > 0, "Did you forget a \\cgalPkgBib{} in %r?" % filename assert len(bib) > 0, "Did you forget a \\cgalPkgBib{} in %r?" % filename
assert len(authors) > 0, ( assert len(authors) > 0, (
@ -313,6 +319,11 @@ def main():
"Did you forget the anchor in \\cgalPkgDescriptionBegin{} in %r?" "Did you forget the anchor in \\cgalPkgDescriptionBegin{} in %r?"
% filename % filename
) )
assert not foundDouble, (
"""Multiple use of citation name '{}' package '{}'
first occurence package '{}'
""".format(bib,pkg,citeDic[bib])
)
result_txt += gen_txt_entry(title, authors, bib, anchor, k) result_txt += gen_txt_entry(title, authors, bib, anchor, k)
# convert title and author to bibtex format # convert title and author to bibtex format
title = protect_upper_case(title) title = protect_upper_case(title)