Skip to content

Commit ad0f24f

Browse files
authored
🔧 test fixes for sphinx 7.4 (#945)
1 parent d448abf commit ad0f24f

File tree

12 files changed

+42
-35
lines changed

12 files changed

+42
-35
lines changed

.github/workflows/test-formats.yml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -54,23 +54,23 @@ jobs:
5454
- name: Build docs
5555
run: |
5656
sphinx-build -nW --keep-going -b ${{ matrix.format }} docs/ docs/_build/${{ matrix.format }}
57-
58-
- name: Make PDF
59-
uses: xu-cheng/latex-action@v2
60-
with:
61-
working_directory: docs/_build/latex
62-
root_file: "mystparser.tex"
63-
# https://github.com/marketplace/actions/github-action-for-latex#it-fails-due-to-xindy-cannot-be-found
64-
pre_compile: |
65-
ln -sf /opt/texlive/texdir/texmf-dist/scripts/xindy/xindy.pl /opt/texlive/texdir/bin/x86_64-linuxmusl/xindy
66-
ln -sf /opt/texlive/texdir/texmf-dist/scripts/xindy/texindy.pl /opt/texlive/texdir/bin/x86_64-linuxmusl/texindy
67-
wget https://sourceforge.net/projects/xindy/files/xindy-source-components/2.4/xindy-kernel-3.0.tar.gz
68-
tar xf xindy-kernel-3.0.tar.gz
69-
cd xindy-kernel-3.0/src
70-
apk add make
71-
apk add clisp --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community
72-
make
73-
cp -f xindy.mem /opt/texlive/texdir/bin/x86_64-linuxmusl/
74-
cd ../../
75-
env:
76-
XINDYOPTS: -L english -C utf8 -M sphinx.xdy
57+
# TODO https://github.com/sphinx-doc/sphinx/issues/12594
58+
# - name: Make PDF
59+
# uses: xu-cheng/latex-action@v2
60+
# with:
61+
# working_directory: docs/_build/latex
62+
# root_file: "mystparser.tex"
63+
# # https://github.com/marketplace/actions/github-action-for-latex#it-fails-due-to-xindy-cannot-be-found
64+
# pre_compile: |
65+
# ln -sf /opt/texlive/texdir/texmf-dist/scripts/xindy/xindy.pl /opt/texlive/texdir/bin/x86_64-linuxmusl/xindy
66+
# ln -sf /opt/texlive/texdir/texmf-dist/scripts/xindy/texindy.pl /opt/texlive/texdir/bin/x86_64-linuxmusl/texindy
67+
# wget https://sourceforge.net/projects/xindy/files/xindy-source-components/2.4/xindy-kernel-3.0.tar.gz
68+
# tar xf xindy-kernel-3.0.tar.gz
69+
# cd xindy-kernel-3.0/src
70+
# apk add make
71+
# apk add clisp --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community
72+
# make
73+
# cp -f xindy.mem /opt/texlive/texdir/bin/x86_64-linuxmusl/
74+
# cd ../../
75+
# env:
76+
# XINDYOPTS: -L english -C utf8 -M sphinx.xdy

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ repos:
3434
args: [--config-file=pyproject.toml]
3535
additional_dependencies:
3636
- types-urllib3
37-
- sphinx~=7.3
37+
- sphinx~=7.4
3838
- markdown-it-py~=3.0
3939
- mdit-py-plugins~=0.4.0
4040
files: >

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ Full Changelog: [v0.18.1...v0.19.0](https://github.com/executablebooks/MyST-Pars
135135
### 📚 Rewritten documentation
136136

137137
The documentation has been almost completely rewritten,
138-
with a clearer structure, many more examples, rich hover tips, and a new live preview page ⚡️ (powered by [pyscript](https://pyscript.readthedocs.io/), <gh-pr:717>).
138+
with a clearer structure, many more examples, rich hover tips, and a new live preview page (powered by [pyscript](https://pyscript.readthedocs.io/), <gh-pr:717>).
139139

140140
The code base API is also now fully documented by [sphinx-autodoc2](https://sphinx-autodoc2.readthedocs.io/), which even allows for MyST docstrings! (<gh-pr:704>).
141141

docs/develop/background.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ but there is no community standard around various syntactic choices for these fe
1111
Sphinx is a documentation generation framework written in Python. It heavily-utilizes
1212
reStructuredText syntax, which is another markup language for writing documents. In
1313
particular, Sphinx defines two extension points that are extremely useful:
14-
**{ref}`in-line roles<sphinx:rst-roles-alt>`** and **{ref}`block-level directives <sphinx:rst-directives>`**.
14+
**{ref}`in-line roles<sphinx:rst-roles>`** and **{ref}`block-level directives <sphinx:rst-directives>`**.
1515

1616
**This project is an attempt at combining the simplicity and readability of Markdown
1717
with the power and flexibility of reStructuredText and the Sphinx platform.** It

docs/live-preview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ py-config:
88
- pygments
99
---
1010

11-
# Live Preview
11+
# ⚡ Live Preview
1212

1313
This is a live preview of the MyST Markdown [docutils renderer](docutils.md).
1414
You can edit the text/configuration below and see the live output.

myst_parser/mdit_to_docutils/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1596,7 +1596,7 @@ def render_dl(self, token: SyntaxTreeNode) -> None:
15961596
term = make_glossary_term(
15971597
self.sphinx_env, # type: ignore[arg-type]
15981598
term.children,
1599-
None, # type: ignore[arg-type]
1599+
None,
16001600
term.source,
16011601
term.line,
16021602
node_id=None,

myst_parser/sphinx_ext/main.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from typing import Any
44

5+
import sphinx
56
from docutils import nodes
67
from sphinx.application import Sphinx
78

@@ -42,9 +43,11 @@ def setup_sphinx(app: Sphinx, load_parser: bool = False) -> None:
4243

4344
# override only the html writer visit methods for rubric, to use the "level" attribute
4445
# this allows for nested headers to be correctly rendered
45-
app.add_node(
46-
nodes.rubric, override=True, html=(visit_rubric_html, depart_rubric_html)
47-
)
46+
if sphinx.version_info < (7, 4):
47+
# This is now added in sphinx: https://github.com/sphinx-doc/sphinx/pull/12506
48+
app.add_node(
49+
nodes.rubric, override=True, html=(visit_rubric_html, depart_rubric_html)
50+
)
4851
# override only the html writer visit methods for container,
4952
# to remove the "container" class for divs
5053
# this avoids CSS clashes with the bootstrap theme

myst_parser/sphinx_ext/mathjax.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def override_mathjax(app: Sphinx):
6161

6262
if "mathjax3_config" in app.config:
6363
# sphinx 4 + mathjax 3
64-
app.config.mathjax3_config = app.config.mathjax3_config or {} # type: ignore[attr-defined]
64+
app.config.mathjax3_config = app.config.mathjax3_config or {}
6565
app.config.mathjax3_config.setdefault("options", {})
6666
if (
6767
"processHtmlClass" in app.config.mathjax3_config["options"]
@@ -77,7 +77,7 @@ def override_mathjax(app: Sphinx):
7777
app.config.mathjax3_config["options"]["processHtmlClass"] = mjax_classes
7878
elif "mathjax_config" in app.config:
7979
# sphinx 3 + mathjax 2
80-
app.config.mathjax_config = app.config.mathjax_config or {} # type: ignore[attr-defined]
80+
app.config.mathjax_config = app.config.mathjax_config or {}
8181
app.config.mathjax_config.setdefault("tex2jax", {})
8282
if (
8383
"processClass" in app.config.mathjax_config["tex2jax"]

tests/test_sphinx/test_sphinx_builds.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,8 @@ def test_gettext(
432432
output = re.sub(r"POT-Creation-Date: [0-9: +-]+", "POT-Creation-Date: ", output)
433433
output = re.sub(r"Copyright \(C\) [0-9]{4}", "Copyright (C) XXXX", output)
434434

435+
if sphinx.version_info < (7, 4):
436+
output = output.replace("Python ", "Project name not set ")
435437
file_regression.check(output, extension=".pot")
436438

437439

@@ -512,6 +514,8 @@ def test_gettext_additional_targets(
512514
output = re.sub(r"POT-Creation-Date: [0-9: +-]+", "POT-Creation-Date: ", output)
513515
output = re.sub(r"Copyright \(C\) [0-9]{4}", "Copyright (C) XXXX", output)
514516

517+
if sphinx.version_info < (7, 4):
518+
output = output.replace("Python ", "Project name not set ")
515519
file_regression.check(output, extension=".pot")
516520

517521

tests/test_sphinx/test_sphinx_builds/test_gettext.pot

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# SOME DESCRIPTIVE TITLE.
22
# Copyright (C) XXXX, Executable Book Project
3-
# This file is distributed under the same license as the Python package.
3+
# This file is distributed under the same license as the Project name not set package.
44
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
55
#
66
#, fuzzy
77
msgid ""
88
msgstr ""
9-
"Project-Id-Version: Python \n"
9+
"Project-Id-Version: Project name not set \n"
1010
"Report-Msgid-Bugs-To: \n"
1111
"POT-Creation-Date: \n"
1212
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"

tests/test_sphinx/test_sphinx_builds/test_gettext_additional_targets.pot

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# SOME DESCRIPTIVE TITLE.
22
# Copyright (C) XXXX, Executable Book Project
3-
# This file is distributed under the same license as the Python package.
3+
# This file is distributed under the same license as the Project name not set package.
44
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
55
#
66
#, fuzzy
77
msgid ""
88
msgstr ""
9-
"Project-Id-Version: Python \n"
9+
"Project-Id-Version: Project name not set \n"
1010
"Report-Msgid-Bugs-To: \n"
1111
"POT-Creation-Date: \n"
1212
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ commands = pytest {posargs}
2929
extras =
3030
linkify
3131
rtd
32-
whitelist_externals =
32+
allowlist_externals =
3333
rm
3434
echo
3535
passenv =

0 commit comments

Comments
 (0)