diff options
author | Jeff Epler <jepler@gmail.com> | 2025-05-09 22:08:23 +0200 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2025-05-16 11:52:03 +1000 |
commit | a19d3f742e84eb72fd8fb2a0f4e38822392ea88e (patch) | |
tree | 78e3cb1582540c12f2d127a337f1cd999e01fcea | |
parent | 8648e6d1cf19afec1485ed204b2135ca322c6a8b (diff) |
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 <jepler@gmail.com>
-rw-r--r-- | tools/gen-cpydiff.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/gen-cpydiff.py b/tools/gen-cpydiff.py index 744cde8d7..278023a4b 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/<filename>_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": |