From: Vladimír Vondruš Date: Fri, 13 Sep 2024 23:13:59 +0000 (+0200) Subject: documentation/doxygen: anonymous namespaces no longer garbage in 1.9.7+. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~cjwatson/git?a=commitdiff_plain;h=8ed4a9fe0d23f22ec068d3e9d71eecc083f75b24;p=blog.git documentation/doxygen: anonymous namespaces no longer garbage in 1.9.7+. They no longer have containing some randomly generated string containing @, but it's empty instead. Similar as with enums that were adapted to in c0194a3eb81057a3b029e66cf389a35f64375eef. --- diff --git a/documentation/doxygen.py b/documentation/doxygen.py index c56ae60b..0e688489 100755 --- a/documentation/doxygen.py +++ b/documentation/doxygen.py @@ -2406,8 +2406,10 @@ def extract_metadata(state: State, xml): compound.id = compounddef.attrib['id'] compound.kind = compounddef.attrib['kind'] # Compound name is page filename, so we have to use title there. The same - # is for groups. - compound.name = html.escape(compounddef.find('title').text if compound.kind in ['page', 'group'] and compounddef.findtext('title') else compounddef.find('compoundname').text) + # is for groups. In some cases, such as anonymous namespaces in Doxygen + # 1.9.7+, is empty. Corresponding test case is in + # test_compound.Ignored. https://github.com/doxygen/doxygen/commit/a18e4c76ed6415893800c7d77a2f798614fb638b + compound.name = html.escape(compounddef.find('title').text if compound.kind in ['page', 'group'] and compounddef.findtext('title') else compounddef.findtext('compoundname')) # Compound URL is ID, except for index page, where it is named "indexpage" # and so I have to override it back to "index". Can't use # for pages because that doesn't reflect CASE_SENSE_NAMES. THANKS DOXYGEN. @@ -2672,7 +2674,12 @@ def parse_xml(state: State, xml: str): # Ignoring private structs/classes and unnamed namespaces if ((compounddef.attrib['kind'] in ['struct', 'class', 'union'] and compounddef.attrib['prot'] == 'private') or - (compounddef.attrib['kind'] == 'namespace' and '@' in compounddef.find('compoundname').text)): + # Doxygen 1.9.7+ makes empty for anonymous namespaces, + # earlier versions put a generated name with @ there. See + # test_compound.Ignored for a corresponding test case. Similar + # difference is with anonymous enums. + # https://github.com/doxygen/doxygen/commit/a18e4c76ed6415893800c7d77a2f798614fb638b + (compounddef.attrib['kind'] == 'namespace' and (compounddef.find('compoundname').text is None or '@' in compounddef.find('compoundname').text))): logging.debug("{}: only private things, skipping".format(state.current)) return None