Skip to content

Commit ea3bebc

Browse files
Merge branch 'main' into translation/source
2 parents 400f387 + 4538176 commit ea3bebc

3 files changed

Lines changed: 34 additions & 4 deletions

File tree

‎requirements.txt‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
furo==2024.8.6
22
sphinx==7.2.6
3-
sphinx-autobuild==2021.3.14
3+
sphinx-autobuild==2024.10.3
44
sphinx-inline-tabs==2023.4.21
55
sphinx-copybutton==0.5.2
66
sphinx-toolbox==3.5.0
77
sphinx-jsonschema==1.19.1
8+
sphinx-notfound-page==1.1.0

‎source/404.rst‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
:orphan:
2+
3+
==============
4+
Page not found
5+
==============
6+
7+
The page you requested does not exist. It may have moved or been removed.
8+
Please return to the :doc:`main page <index>`.

‎source/conf.py‎

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
import pathlib
66
import sys
77

8+
from docutils import nodes
9+
from notfound.utils import replace_uris
10+
811
_ROOT = pathlib.Path(__file__).resolve().parent.parent
912
sys.path.append(os.fspath(_ROOT))
1013

@@ -35,6 +38,7 @@
3538
"sphinx_copybutton",
3639
"sphinx_toolbox.collapse",
3740
"sphinx-jsonschema",
41+
"notfound.extension",
3842
]
3943

4044
nitpicky = True
@@ -211,9 +215,9 @@
211215
intersphinx_mapping = {
212216
"boltons": ("https://boltons.readthedocs.io/en/latest/", None),
213217
"bottle": ("https://bottlepy.org/docs/dev/", None),
214-
"build": ("https://pypa-build.readthedocs.io/en/stable/", None),
218+
"build": ("https://build.pypa.io/en/stable/", None),
215219
"cffi": ("https://cffi.readthedocs.io/en/latest/", None),
216-
"conda": ("https://conda.io/en/latest/", None),
220+
"conda": ("https://docs.conda.io/en/latest/", None),
217221
"devpi": ("https://devpi.net/docs/devpi/devpi/latest/+doc", None),
218222
"dh-virtualenv": ("https://dh-virtualenv.readthedocs.io/en/latest/", None),
219223
"distlib": ("https://distlib.readthedocs.io/en/latest/", None),
@@ -232,7 +236,7 @@
232236
"python": ("https://docs.python.org/3", None),
233237
"python-guide": ("https://docs.python-guide.org", None),
234238
"setuptools": ("https://setuptools.pypa.io/en/latest/", None),
235-
"setuptools-scm": ("https://setuptools-scm.rtfd.io/latest", None),
239+
"setuptools-scm": ("https://setuptools-scm.readthedocs.io/latest", None),
236240
"spack": ("https://spack.readthedocs.io/en/latest/", None),
237241
"sphinx": ("https://www.sphinx-doc.org/en/master", None),
238242
"tox": ("https://tox.wiki/en/latest/", None),
@@ -250,3 +254,20 @@
250254

251255
copybutton_prompt_text = r">>> |\.\.\. |\$ |> "
252256
copybutton_prompt_is_regexp = True
257+
258+
# -- Options for sphinx-notfound-page --------------------------------------------------
259+
# https://sphinx-notfound-page.readthedocs.io/en/latest/configuration.html
260+
261+
# Local builds are served from the root, RtD seves from /<language>/<version>/
262+
if not RTD_BUILD:
263+
notfound_urls_prefix = "/"
264+
265+
266+
def fix_notfound_links(app, doctree, docname):
267+
# The extension only makes theme links absolute, not links in the page body
268+
if app.builder.format == "html" and docname == app.config.notfound_pagename:
269+
replace_uris(app, doctree, nodes.reference, "refuri")
270+
271+
272+
def setup(app):
273+
app.connect("doctree-resolved", fix_notfound_links)

0 commit comments

Comments
 (0)