Skip to content

save for stable readthedocs#19

Merged
zaihuaji merged 1 commit into
mainfrom
hua-work-miscs
Mar 31, 2026
Merged

save for stable readthedocs#19
zaihuaji merged 1 commit into
mainfrom
hua-work-miscs

Conversation

@zaihuaji

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR appears to adjust the generated reStructuredText (RST) output/templates to be more compatible with a stable ReadTheDocs/Sphinx build, and removes unused/backup template/code artifacts.

Changes:

  • Remove unused legacy artifacts (toc.rst.temp, pg_rst.py.bck).
  • Tweak RST templates (index.rst.temp, section.rst.temp) to use proper line-block formatting for navigation links.
  • Adjust RST generation in pg_rst.py for certain table/synopsis rendering cases.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/rda_python_miscs/rst_templates/toc.rst.temp Deleted legacy TOC template file.
src/rda_python_miscs/rst_templates/section.rst.temp Fix formatting of “Back to …” refs as RST line blocks.
src/rda_python_miscs/rst_templates/index.rst.temp Fix formatting of “Back to Top” ref as an RST line block.
src/rda_python_miscs/pg_rst.py.bck Deleted backup copy of the RST generator.
src/rda_python_miscs/pg_rst.py Update table/synopsis rendering output formatting.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +974 to +985
content = ".. list-table::\n :widths: auto\n :header-rows: 1\n"
for row in rows:
v = row[0] + "\n"
if len(row) == 1:
content += " " + row[0]
continue
v = row[0]
if len(v) > 1 and v[0] == '-': v = v[1:]
content += " * - " + v
content += "\n * - " + v
for c in range(1, ncols):
v = row[c] + "\n"
v = row[c]
if len(v) > 1 and v[0] == '-': v = v[1:]
content += " - " + v
content += "\n - " + v

Copilot AI Mar 31, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The len(row) == 1 branch appends raw text inside a .. list-table:: directive without starting a * - row (and without ensuring a newline), which can produce invalid RST output. Also, iterating for c in range(1, ncols): v = row[c] will raise IndexError when rows have fewer columns than ncols (possible with re.split(r'\s{2,}', ...)). Consider normalizing each row to ncols by padding missing cells with empty strings (or guarding c < len(row)), and always emitting proper list-table row markup for every row.

Copilot uses AI. Check for mistakes.
Comment on lines 884 to 890
elif re.search(r'=>$', line0):
line = re.sub(r'={1,}', '=', line0)
content = "| {}\n".format(line)
# line = re.sub(r'={1,}', '=', line0)
content = "| {}\n".format(line0)
for i in range(1, cnt):
line = lines[i]
line = re.sub(r'={2,}', '=', line)
# line = re.sub(r'={2,}', '=', line)
content += "| {}\n".format(line)

Copilot AI Mar 31, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are commented-out re.sub(...) lines left in the =>$ table branch. If these substitutions are no longer needed for ReadTheDocs/Sphinx compatibility, it would be clearer to remove them; if they are sometimes needed, consider making the behavior explicit (e.g., a flag) and add a short comment explaining why the substitutions were disabled.

Copilot uses AI. Check for mistakes.
@zaihuaji zaihuaji merged commit c3f8db9 into main Mar 31, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants