From 9890b78c2b0d9054bf7c059385dc89de2e10b1d5 Mon Sep 17 00:00:00 2001 From: Jimmy Brush Date: Tue, 7 Sep 2021 07:10:06 -0400 Subject: [PATCH] manual: Remove some extra spaces after texttt Extra spaces are inserted after texttt tags when generating doxygen comments in order to ensure that xmlonly tags are readable by doxygen. The extra spaces cause a description like this: ``` Testing , 2, 3 ``` To be rendered like this: ``` Testing 1 , 2, 3 ``` This change identifies text runs that start with extra spaces and either a period or a comma and removes the extra spaces, allowing at least common punctuation to be rendered correctly. Signed-off-by: Jimmy Brush --- manual/tools/parse_doxygen_xml.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/manual/tools/parse_doxygen_xml.py b/manual/tools/parse_doxygen_xml.py index d75404b22..27fe9ba6f 100755 --- a/manual/tools/parse_doxygen_xml.py +++ b/manual/tools/parse_doxygen_xml.py @@ -72,6 +72,23 @@ class Generator(object): string = soup.get_text() if string is not None: + # HACK: Due to the extra spacing that gets inserted by our scripts between XML + # elements to ensure doxygen can read xmlonly tags, we can no longer tell here + # if the text after an xml tag should have been flush against the result + # of the xml tag or not. + # + # For example, the following in an IDL file: + # Testing , 2, 3 + # Generates these C comments: + # Testing @xmlonly @endxmlonly , 2, 3 + # Which generates this doxygen output: + # Testing , 2, 3 + # + # To deal with this, just pick out punctuation that looks like it should have been + # flush against the xml and remove the leading spaces. + if string.startswith(" ,") or string.startswith(" ."): + string = string[2:] + if escape: return self.text_escape(string) else: