Skip to content

Commit 2e3ac8d

Browse files
authored
support sphinx i hope (#278)
1 parent b39f90b commit 2e3ac8d

3 files changed

Lines changed: 16 additions & 4 deletions

File tree

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ repos:
1212
hooks:
1313
- id: isort
1414
- repo: https://github.com/psf/black
15-
rev: 24.3.0
15+
rev: 24.4.0
1616
hooks:
1717
- id: black
1818
- repo: https://github.com/pre-commit/pre-commit-hooks
19-
rev: v4.5.0
19+
rev: v4.6.0
2020
hooks:
2121
- id: check-ast
2222
- id: check-case-conflict
@@ -26,7 +26,7 @@ repos:
2626
- id: check-yaml
2727
- id: debug-statements
2828
- repo: https://github.com/astral-sh/ruff-pre-commit
29-
rev: 'v0.3.5'
29+
rev: 'v0.3.7'
3030
hooks:
3131
- id: ruff
3232
args: ['--fix']

docs/release/ablog-v0.11-released.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,8 @@ Pull Requests merged in:
8585

8686

8787
`Add span to more items in templates <https://github.com/sunpy/ablog/pull/270>`__ from `Nabil Freij <https://github.com/nabobalis>`__.
88+
89+
ABlog v0.11.8 released
90+
----------------------
91+
92+
Added support for ``sphinx`` >=7.3.0

src/ablog/__init__.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from pathlib import PurePath
88

99
from sphinx.builders.html import StandaloneHTMLBuilder
10+
from sphinx.errors import ThemeError
1011
from sphinx.jinja2glue import BuiltinTemplateLoader, SphinxFileSystemLoader
1112
from sphinx.locale import get_translation
1213

@@ -118,7 +119,13 @@ def builder_inited(app):
118119
theme = app.builder.theme
119120
loaders = app.builder.templates.loaders
120121
templatepathlen = app.builder.templates.templatepathlen
121-
if theme.get_config("ablog", "inject_templates_after_theme", False):
122+
try:
123+
# Modern Sphinx now errors instead of returning the default if there is not a value
124+
# in any of the config files.
125+
after_theme = theme.get_config("ablog", "inject_templates_after_theme", False)
126+
except ThemeError:
127+
after_theme = False
128+
if after_theme:
122129
# Inject *after* the user templates and the theme templates,
123130
# allowing themes to override the templates provided by this
124131
# extension while those templates still serve as a fallback.

0 commit comments

Comments
 (0)