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
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
default_language_version:
python: "3.12"
python: "3.10"
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "v4.4.0"
Expand Down
11 changes: 10 additions & 1 deletion sphinx_js/renderers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from docutils.utils import new_document
from jinja2 import Environment, PackageLoader
from sphinx import addnodes
from sphinx import version_info as sphinx_version_info
from sphinx.application import Sphinx
from sphinx.config import Config
from sphinx.errors import SphinxError
Expand Down Expand Up @@ -778,8 +779,16 @@ def extract_summary(self, descr: str) -> str:
# extract_summary seems to have trouble if there are Sphinx
# directives in descr
descr, _, _ = descr.partition("\n..")
document = self._directive.state.document
# In Sphinx 9.x, extract_summary takes document.settings directly
# instead of the document object.
doc_or_settings: Any
if sphinx_version_info >= (9, 0):
doc_or_settings = document.settings
else:
doc_or_settings = document
return extract_summary(
[descr.replace(":", colon_esc)], self._directive.state.document
[descr.replace(":", colon_esc)], doc_or_settings
).replace(colon_esc, ":")

def get_sig(self, obj: TopLevel) -> str:
Expand Down
8 changes: 6 additions & 2 deletions tests/test_incremental.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@

import pytest
from sphinx.environment import CONFIG_NEW, CONFIG_OK
from sphinx.testing.util import strip_escseq

try:
from sphinx.util.console import strip_colors
except ImportError:
from sphinx.testing.util import strip_escseq as strip_colors


def build(app):
Expand Down Expand Up @@ -36,7 +40,7 @@ def doctree_resolved(app, doctree, docname):
app.disconnect(doctree_resolved_id)

return (
strip_escseq(app._status.getvalue()),
strip_colors(app._status.getvalue()),
list(sorted(reads)),
list(sorted(writes)),
)
Expand Down
Loading