Skip to content

Commit 1ec169c

Browse files
JihaoXinclaude
andcommitted
Fix citation NEEDS-CHECK: missing comma before note field breaks BibTeX
fix_bib() stripped trailing "}" then appended note field, but the previous field (e.g., year={2026}) had no trailing comma. BibTeX parsed this as a syntax error and skipped the entire entry. Fix: ensure last field has trailing comma before injecting note. Affected 6 entries in marco-web-new project. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 07f5b8c commit 1ec169c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

ark/citation.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -970,7 +970,11 @@ def fix_bib(bib_path: str, results: list[VerificationResult]) -> None:
970970
# Add note field inside the entry so it shows in PDF
971971
if "note" not in r.original_bibtex.lower():
972972
modified_entry = r.original_bibtex.rstrip().rstrip("}")
973-
modified_entry += r' note = {\textcolor{red}{[NEEDS-CHECK: citation not verified]}},' + "\n}"
973+
# Ensure last field has a trailing comma before adding note
974+
modified_entry = modified_entry.rstrip()
975+
if modified_entry and not modified_entry.endswith(","):
976+
modified_entry += ","
977+
modified_entry += "\n" + r' note = {\textcolor{red}{[NEEDS-CHECK: citation not verified]}}' + "\n}"
974978
content = content.replace(r.original_bibtex, modified_entry)
975979

976980
bib_file.write_text(content)

0 commit comments

Comments
 (0)