Skip to content

Commit

Permalink
fix: support for sphinx v8.1.0 (#393)
Browse files Browse the repository at this point in the history
* Sphin 8.1.0 and MathDomain import

Sphinx 8.1.0 removed import of MathDomain into sphinx.ext.mathjax
that resulted in sphinx-immaterial crashing with ImportError. Replaced
with import from actual package that defines MathDomain.

Sphinx seems to be moving away from using get_domain to get domain
instances, however it is available only from versions >=8.1.0, so I left
get_domain call as it is currently.

Verified to work with Sphinx 8.0.2 and 8.1.0 but I'm not using mathjax
domain.

* let mypy infer type changes from sphinx upstream

---------

Co-authored-by: Maciej Nowak <[email protected]>
  • Loading branch information
2bndy5 and Novakov authored Oct 11, 2024
1 parent 0aabb88 commit da75ebe
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion sphinx_immaterial/apidoc/generic_synopses.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def after_content(self: GenericObject) -> None:

orig_merge_domaindata = StandardDomain.merge_domaindata

def merge_domaindata(self, docnames: List[str], otherdata: dict) -> None:
def merge_domaindata(self, docnames, otherdata: dict) -> None:
orig_merge_domaindata(self, docnames, otherdata)
self.data["synopses"].update(otherdata["synopses"])

Expand Down
2 changes: 1 addition & 1 deletion sphinx_immaterial/apidoc/json/domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -1150,7 +1150,7 @@ def get_objects(self) -> Iterator[Tuple[str, str, str, str, str, int]]:
else OBJECT_PRIORITY_UNIMPORTANT,
)

def merge_domaindata(self, docnames: List[str], otherdata: Dict) -> None:
def merge_domaindata(self, docnames, otherdata: Dict) -> None:
self.schemas.update(otherdata["schemas"])

def _find_schema(
Expand Down
2 changes: 1 addition & 1 deletion sphinx_immaterial/apidoc/python/synopses.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def after_content(self: PyObject) -> None:

orig_merge_domaindata = PythonDomain.merge_domaindata

def merge_domaindata(self, docnames: List[str], otherdata: dict) -> None:
def merge_domaindata(self, docnames, otherdata: dict) -> None:
orig_merge_domaindata(self, docnames, otherdata)
self.data["synopses"].update(otherdata["synopses"])

Expand Down
3 changes: 2 additions & 1 deletion sphinx_immaterial/local_mathjax.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
from sphinx.application import Sphinx
from sphinx.config import Config
from sphinx.errors import ExtensionError
from sphinx.ext.mathjax import MATHJAX_URL, MathDomain
from sphinx.domains.math import MathDomain
from sphinx.ext.mathjax import MATHJAX_URL
from sphinx.environment import BuildEnvironment


Expand Down

0 comments on commit da75ebe

Please sign in to comment.