From deec81882948f2d910738be7571513d21323c517 Mon Sep 17 00:00:00 2001 From: Gerwin Klein Date: Tue, 29 Jul 2025 16:55:04 +1000 Subject: [PATCH] manual: gracefully handle dangling references Recent doxygen versions generate references for constants that are named in the text. Since we do not produce a constant table in the manual (neither markdown nor tex), these references point to nowhere and produce a KeyError in the ref_dict on lookup. The corresponding xml nodes are of this form: seL4_TCBFlag Ignore such dangling references and return the content (seL4_TCBFlag in the example) instead. Run text escape on the content to cover underscores etc in LaTeX. Does not produce a warning since we expect this to be normal behaviour. Signed-off-by: Gerwin Klein --- manual/tools/parse_doxygen_xml.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/manual/tools/parse_doxygen_xml.py b/manual/tools/parse_doxygen_xml.py index 8bbd817a7..2b3594086 100755 --- a/manual/tools/parse_doxygen_xml.py +++ b/manual/tools/parse_doxygen_xml.py @@ -96,10 +96,11 @@ class Generator(object): return "" def ref_to_format(self, para, ref_dict): - """Convert a reference by id to a latex command by looking up refid in para""" - if len(ref_dict) > 0: + """Format a reference by id by looking up refid in para. Return escaped content if not found.""" + try: return self.ref_format(para["refid"], ref_dict) - return "" + except KeyError: + return self.text_escape(para.contents[0]) def nref_to_format(self, para, ref_dict): """Convert a reference by name to a latex command by looking up refid in para"""