From: Peter Maydell Date: Fri, 28 Feb 2020 15:36:08 +0000 (+0000) Subject: doc/scripts/hxtool.py: Strip trailing ':' from DEFHEADING/ARCHHEADING X-Git-Tag: v5.0.0-rc0~54^2~11 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=705f48cc221fea128abdcc334606931e971229e4;p=users%2Fdwmw2%2Fqemu.git doc/scripts/hxtool.py: Strip trailing ':' from DEFHEADING/ARCHHEADING In hxtool files, section headings defined with the DEFHEADING and ARCHHEADING macros have a trailing ':' DEFHEADING(Standard options:) This is for the benefit of the --help output. For consistency with the rest of the rST documentation, strip any trailing ':' when we construct headings with the Sphinx hxtool extension. This makes the table of contents look neater. This only affects generation of documentation from qemu-options.hx, which we will start doing in a later commit. Signed-off-by: Peter Maydell Reviewed-by: Alex Bennée Tested-by: Alex Bennée Message-id: 20200228153619.9906-23-peter.maydell@linaro.org --- diff --git a/docs/sphinx/hxtool.py b/docs/sphinx/hxtool.py index 5d6736f300..7dd223fe36 100644 --- a/docs/sphinx/hxtool.py +++ b/docs/sphinx/hxtool.py @@ -60,8 +60,9 @@ def parse_defheading(file, lnum, line): # empty we ignore the directive -- these are used only to add # blank lines in the plain-text content of the --help output. # - # Return the heading text - match = re.match(r'DEFHEADING\((.*)\)', line) + # Return the heading text. We strip out any trailing ':' for + # consistency with other headings in the rST documentation. + match = re.match(r'DEFHEADING\((.*?):?\)', line) if match is None: serror(file, lnum, "Invalid DEFHEADING line") return match.group(1) @@ -72,8 +73,9 @@ def parse_archheading(file, lnum, line): # though note that the 'some string' could be the empty string. # As with DEFHEADING, empty string ARCHHEADINGs will be ignored. # - # Return the heading text - match = re.match(r'ARCHHEADING\((.*),.*\)', line) + # Return the heading text. We strip out any trailing ':' for + # consistency with other headings in the rST documentation. + match = re.match(r'ARCHHEADING\((.*?):?,.*\)', line) if match is None: serror(file, lnum, "Invalid ARCHHEADING line") return match.group(1)