Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ repos:
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 24.3.0
rev: 24.4.0
hooks:
- id: black
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: check-ast
- id: check-case-conflict
Expand All @@ -26,7 +26,7 @@ repos:
- id: check-yaml
- id: debug-statements
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.3.5'
rev: 'v0.3.7'
hooks:
- id: ruff
args: ['--fix']
Expand Down
5 changes: 5 additions & 0 deletions docs/release/ablog-v0.11-released.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,8 @@ Pull Requests merged in:


`Add span to more items in templates <https://github.com/sunpy/ablog/pull/270>`__ from `Nabil Freij <https://github.com/nabobalis>`__.

ABlog v0.11.8 released
----------------------

Added support for ``sphinx`` >=7.3.0
9 changes: 8 additions & 1 deletion src/ablog/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from pathlib import PurePath

from sphinx.builders.html import StandaloneHTMLBuilder
from sphinx.errors import ThemeError
from sphinx.jinja2glue import BuiltinTemplateLoader, SphinxFileSystemLoader
from sphinx.locale import get_translation

Expand Down Expand Up @@ -118,7 +119,13 @@ def builder_inited(app):
theme = app.builder.theme
loaders = app.builder.templates.loaders
templatepathlen = app.builder.templates.templatepathlen
if theme.get_config("ablog", "inject_templates_after_theme", False):
try:
# Modern Sphinx now errors instead of returning the default if there is not a value
# in any of the config files.
Comment on lines +123 to +124
Copy link

Choose a reason for hiding this comment

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

I think it is worse than that, new version of sphinx always return the default. It never looks in config files for things that are not theme, or options.

Copy link
Member Author

Choose a reason for hiding this comment

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

Did that patch that? I need to learn how sphinx works in more detail.

Copy link

Choose a reason for hiding this comment

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

Well, the code will work but the comment is not technically correct. Sphinx 7.3.0 to 7.3.6 will indeed error.

But sphinx 7.3.7 and above will just ignore the config and return the default value (False in this case).

https://github.com/sphinx-doc/sphinx/blob/de4ac2fbdebae529a973910e96794645158f0401/sphinx/theming.py#L123-L134

Basically sphinx removed support for custom sections.

Copy link
Member Author

Choose a reason for hiding this comment

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

In that case, I will need to work out how to handle this in a manner that sphinx likes.

But for now, I will just ignore this and pretend it didn't break.

Copy link

Choose a reason for hiding this comment

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

sounds like a plan.

after_theme = theme.get_config("ablog", "inject_templates_after_theme", False)
except ThemeError:
after_theme = False
if after_theme:
# Inject *after* the user templates and the theme templates,
# allowing themes to override the templates provided by this
# extension while those templates still serve as a fallback.
Expand Down