save for stable readthedocs#19
Conversation
There was a problem hiding this comment.
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.pyfor 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.
| 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 |
There was a problem hiding this comment.
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.
| 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) |
There was a problem hiding this comment.
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.
No description provided.