From 4fdadeee63374c2bbc233a974406c66a7d8f621e Mon Sep 17 00:00:00 2001 From: zaihuaji Date: Wed, 29 Apr 2026 14:35:00 -0500 Subject: [PATCH] render --> flow blocks as code-block:: none with equal-width lines In create_table, detect when any line in a ptype=1 block contains --> and render the block as a .. code-block:: none directive with each line padded to equal character width using ljust. Co-Authored-By: Claude Sonnet 4.6 --- src/rda_python_miscs/pg_rst.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/rda_python_miscs/pg_rst.py b/src/rda_python_miscs/pg_rst.py index bfe932e..8b98468 100755 --- a/src/rda_python_miscs/pg_rst.py +++ b/src/rda_python_miscs/pg_rst.py @@ -873,6 +873,13 @@ def create_table(self, lines, cnt, secid): str: RST-formatted table or list content. """ line0 = lines[0] + if any('-->' in line for line in lines): + max_width = max(len(line) for line in lines) + content = ".. code-block:: none\n\n" + for line in lines: + content += " " + line.ljust(max_width) + "\n" + content += "\n" + return content ms = re.match(r'^\s+-\s+(.*)', line0) if ms: content = "* " + self.replace_option_link(ms.group(1), secid, 1)