Skip to content

Support Sphinx up to version 7.4.#184

Open
sayravai wants to merge 1 commit intoapluslms:masterfrom
sayravai:fix_177
Open

Support Sphinx up to version 7.4.#184
sayravai wants to merge 1 commit intoapluslms:masterfrom
sayravai:fix_177

Conversation

@sayravai
Copy link
Copy Markdown
Contributor

@sayravai sayravai commented Mar 4, 2026

Fixes #177

Description

Add support for Sphinx version 7.4. The main changes to RST tools 1.4 from the user perspective are:

  1. master_doc is replaced by root_doc in the project settings (this change was made already in Sphinx 4.0).
  2. custom stylesheets are now loaded from the "styles" array instead of a "style" string.

Also the Python 3.12+ warnings about regex patterns (SyntaxWarning: invalid escape sequence '\d', SyntaxWarning: invalid escape sequence '\w') are fixed in this PR.

This could become RST tools v1.5 and we could then later make a version 1.6 with support for Sphinx 9.x if deemed necessary.

Testing

This PR still needs more testing. I have tested that the rst compilation process for A+ manual (the version fixed for Sphinx 7's stricter rules) succeeds without warnings using Sphinx v7.4.7, but I haven't checked what the resulting HTML looks like in A+. This should be tested, and preferably compiling some actual course also.

What type of test did you run?

  • Accessibility test using the WAVE extension.
  • Django unit tests.
  • Selenium tests.
  • Other test. (Add a description below)
  • Manual testing.

[ADD A DESCRIPTION ABOUT WHAT YOU TESTED MANUALLY]

Did you test the changes in

  • Chrome
  • Firefox
  • This pull request cannot be tested in the browser.

Think of what is affected by these changes and could become broken

Translation

Programming style

  • Did you follow our style guides?
  • Did you use Python type hinting in all functions that you added or edited? (type hints for function parameters and return values)

Have you updated the README or other relevant documentation?

  • documents inside the doc directory.
  • README.md.
  • Aplus Manual.
  • Other documentation (mention below which documentation).

Is it Done?

  • Reviewer has finished the code review
  • After the review, the developer has made changes accordingly
  • Customer/Teacher has accepted the implementation of the feature

Clean up your git commit history before submitting the pull request!

Copy link
Copy Markdown
Contributor

@ihalaij1 ihalaij1 left a comment

Choose a reason for hiding this comment

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

Great!

I tested this with the aplus-manual PR and did not notice any obvious issues on the A+ manual materials.

I added some comments.

Comment thread theme/aplus/layout.html
Comment on lines 94 to 97
<ul class="dropdown-menu">
<li role="presentation">
<a href="{{ pathto(master_doc) }}">
Index
<a href="{{ pathto(root_doc) }}">
</a>
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.

Is there a reason "Index" was removed here but not in some of the other places?

Comment on lines 94 to 97
<ul class="dropdown-menu">
<li role="presentation">
<a href="{{ pathto(master_doc) }}">
Index
<a href="{{ pathto(root_doc) }}">
</a>
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.

Is there a reason "Index" was removed here but not in some of the other places? x2

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't think it makes sense to create empty links there, so I guess it's a copy-paste or search & replace error or something...

Comment thread README.md
Comment on lines 14 to +16

* a-plus-rst-tools v1.4 support Sphinx v4.1.
* a-plus-rst-tools v1.5 and later support Sphinx v7.x (up to v7.4).
* a-plus-rst-tools v1.4 supports Sphinx v4.1.
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.

We already have existing a-plus-rst-tools versions 1.5, 1.6, 1.7, and 1.8.
The latest version is 2.0.0 with BS5 support, so shouldn't the next version be 2.1.0?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Seems I didn't check the actual versions from GitHub, but just blindly updated the README...

Comment thread README.md
Comment on lines +21 to +34
If you are upgrading from RST tools v1.4 or earlier to v1.5, one change is
required in your course `conf.py`: the Sphinx setting `master_doc` was renamed
to `root_doc`. Open `conf.py` and replace the line

master_doc = 'index'

with

root_doc = 'index'

Note also that v1.5 (with Sphinx v7) changes how custom stylesheets are passed to the
theme. If your course uses a custom CSS file via `html_style` in `conf.py`,
you should verify that the stylesheet still loads correctly after the upgrade.
The a-plus theme templates have been updated accordingly.
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.

Isn't there also another change required for the rst_prolog setting in conf.py (mentioned in the aplus-manual PR).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hmm, doesn't ring a bell. Which PR are we talking about?

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't see rst_prolog mentioned in there. Or should I understand what the setting actually does...?

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.

It's the comment you added that is required so that the first content isn't considered as part of the last directive.

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.

If you expand the code in the diff view, you see it is part of rst_prolog.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah, now I see what you mean. Indeed, if someone has copied that conf.py for the course, it needs to be pached there as well. Sorry, I'm really not very familiar with building courses in A+.

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.

At least Y1 is using the rst_prolog setting in conf.py, but with different directives than A+ manual.

@ihalaij1 ihalaij1 self-assigned this Apr 7, 2026
@ihalaij1
Copy link
Copy Markdown
Contributor

ihalaij1 commented Apr 7, 2026

I created a PR for compile-rst to update it to use Sphinx 7:
apluslms/compile-rst#8

@sayravai
Copy link
Copy Markdown
Contributor Author

sayravai commented Apr 7, 2026

I created a PR for compile-rst to update it to use Sphinx 7: apluslms/compile-rst#8

Nice. Debian bullseye support ends this June, so those references could be upgraded (and tested) soon as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

Support new Sphinx releases

3 participants