From a19d3f742e84eb72fd8fb2a0f4e38822392ea88e Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 9 May 2025 22:08:23 +0200 Subject: [PATCH] tools/gen-cpydiff.py: Fix RST heading generation. The heading character for the difference title was always "~", but items had been added which had just a single heading level. This made the generated table of contents confused about heading levels, because heading levels are not fixed in rst, but are inferred from the order they appear in the document. Signed-off-by: Jeff Epler --- tools/gen-cpydiff.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/gen-cpydiff.py b/tools/gen-cpydiff.py index 744cde8d7b..278023a4bd 100644 --- a/tools/gen-cpydiff.py +++ b/tools/gen-cpydiff.py @@ -228,8 +228,8 @@ def gen_rst(results): filename = section[i].replace(" ", "_").lower() rst = open(os.path.join(DOCPATH, filename + ".rst"), "w") rst.write(HEADER) - rst.write(section[i] + "\n") - rst.write(RSTCHARS[0] * len(section[i])) + rst.write(section[0] + "\n") + rst.write(RSTCHARS[0] * len(section[0]) + "\n\n") rst.write(time.strftime("\nGenerated %a %d %b %Y %X UTC\n\n", time.gmtime())) # If a file docs/differences/_preamble.txt exists # then its output is inserted after the top-level heading, @@ -247,7 +247,7 @@ def gen_rst(results): class_ = section rst.write(".. _cpydiff_%s:\n\n" % os.path.splitext(output.name)[0]) rst.write(output.desc + "\n") - rst.write("~" * len(output.desc) + "\n\n") + rst.write(RSTCHARS[min(i + 1, len(RSTCHARS) - 1)] * len(output.desc) + "\n\n") if output.cause != "Unknown": rst.write("**Cause:** " + output.cause + "\n\n") if output.workaround != "Unknown":