From de3aa8a3187cafee937af5f07957458e150f757a Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Fri, 14 Jul 2023 06:52:25 +0100 Subject: [PATCH 1/6] Replace non-functional Bitbucket URLs - ``sphinx-contrib`` has moved to GitHub - Replace personal project links with links to the Bitbucket archive --- doc/faq.rst | 9 +++++---- doc/usage/restructuredtext/domains.rst | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/doc/faq.rst b/doc/faq.rst index 68eb4745f6b..9c3dd2b6ad1 100644 --- a/doc/faq.rst +++ b/doc/faq.rst @@ -40,7 +40,7 @@ How do I... For many more extensions and other contributed stuff, see the sphinx-contrib_ repository. -.. _sphinx-contrib: https://bitbucket.org/birkenfeld/sphinx-contrib/ +.. _sphinx-contrib: https://github.com/sphinx-contrib/ .. _usingwith: @@ -63,7 +63,8 @@ Doxygen SCons Glenn Hutchings has written a SCons build script to build Sphinx - documentation; it is hosted here: https://bitbucket.org/zondo/sphinx-scons + documentation; it is hosted here: + https://bitbucket-archive.softwareheritage.org/projects/zo/zondo/sphinx-scons.html PyPI Jannis Leidel wrote a `setuptools command @@ -77,8 +78,8 @@ GitHub Pages GitHub Pages on building HTML document automatically. MediaWiki - See https://bitbucket.org/kevindunn/sphinx-wiki/wiki/Home, a project by - Kevin Dunn. + See https://bitbucket-archive.softwareheritage.org/projects/ke/kevindunn/sphinx-wiki.html, + a project by Kevin Dunn. Google Analytics You can use a custom ``layout.html`` template, like this: diff --git a/doc/usage/restructuredtext/domains.rst b/doc/usage/restructuredtext/domains.rst index cbece86e826..23ac543a41f 100644 --- a/doc/usage/restructuredtext/domains.rst +++ b/doc/usage/restructuredtext/domains.rst @@ -2179,5 +2179,5 @@ Jinja_, Operation_, and Scala_. .. _MATLAB: https://pypi.org/project/sphinxcontrib-matlabdomain/ .. _Operation: https://pypi.org/project/sphinxcontrib-operationdomain/ .. _PHP: https://pypi.org/project/sphinxcontrib-phpdomain/ -.. _Ruby: https://bitbucket.org/birkenfeld/sphinx-contrib/src/default/rubydomain +.. _Ruby: https://github.com/sphinx-contrib/rubydomain .. _Scala: https://pypi.org/project/sphinxcontrib-scaladomain/ From 7c8eda24a13ce9e27a8e3f797957c2d4a40d6f6f Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Fri, 14 Jul 2023 06:55:18 +0100 Subject: [PATCH 2/6] Resolve ``sphinx-lint`` warnings --- doc/faq.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/faq.rst b/doc/faq.rst index 9c3dd2b6ad1..85ccb245ea3 100644 --- a/doc/faq.rst +++ b/doc/faq.rst @@ -78,8 +78,9 @@ GitHub Pages GitHub Pages on building HTML document automatically. MediaWiki - See https://bitbucket-archive.softwareheritage.org/projects/ke/kevindunn/sphinx-wiki.html, - a project by Kevin Dunn. + See `sphinx-wiki`_, a project by Kevin Dunn. + + .. _sphinx-wiki: https://bitbucket-archive.softwareheritage.org/projects/ke/kevindunn/sphinx-wiki.html Google Analytics You can use a custom ``layout.html`` template, like this: From 0858c3b841381fb25ead479cbcb9a2630db7cac8 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Fri, 14 Jul 2023 07:06:46 +0100 Subject: [PATCH 3/6] Resolve ``mypy`` warnings --- sphinx/io.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sphinx/io.py b/sphinx/io.py index 335502e57ba..efd2b4ea9cc 100644 --- a/sphinx/io.py +++ b/sphinx/io.py @@ -182,7 +182,7 @@ def create_publisher(app: Sphinx, filetype: str) -> Publisher: defaults = {"traceback": True, **app.env.settings} # Set default settings if docutils.__version_info__[:2] >= (0, 19): - pub.get_settings(**defaults) # type: ignore[arg-type] + pub.get_settings(**defaults) else: - pub.settings = pub.setup_option_parser(**defaults).get_default_values() # type: ignore + pub.settings = pub.setup_option_parser(**defaults).get_default_values() return pub From 571becb6afb5383f28aee2d26e4a255b9fdaae11 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Fri, 14 Jul 2023 07:50:01 +0100 Subject: [PATCH 4/6] Re-instate the footnote-reference class --- sphinx/writers/html5.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sphinx/writers/html5.py b/sphinx/writers/html5.py index e7d932286c5..5aea3ddb817 100644 --- a/sphinx/writers/html5.py +++ b/sphinx/writers/html5.py @@ -887,3 +887,12 @@ def depart_math_block(self, node: Element, math_env: str = '') -> None: _, depart = self.builder.app.registry.html_block_math_renderers[name] if depart: # type: ignore[truthy-function] depart(self, node) + + # See Docutils r9413 + # Re-instate the footnote-reference class + def visit_footnote_reference(self, node): + href = '#' + node['refid'] + classes = ['footnote-reference', self.settings.footnote_references] + self.body.append(self.starttag(node, 'a', suffix='', classes=classes, + role='doc-noteref', href=href)) + self.body.append('[') From 037b6194d1451215bbec624365874aaf6da6019d Mon Sep 17 00:00:00 2001 From: picnixz <10796600+picnixz@users.noreply.github.com> Date: Thu, 20 Jul 2023 19:07:43 +0200 Subject: [PATCH 5/6] Use RFC 8081 font file MIME types in the EPUB builder (#11486) The "font" top-level media type was formalised via :rfc:`8081` in 2017. Standard MIME types for OTF and TTF fonts have been `registered with IANA`_ as ``font/otf`` and ``font/ttf``. These are also listed in the EPUB 3 `core media types`_ specification. Sphinx-generated EPUB documents including custom OTF or TTF fonts specify a MIME type for those fonts in ``content.opf`` of ``application/x-font-otf`` or ``application/x-font-ttf`` respectively. The ``epubcheck`` application presents informational warnings that these MIME types are non-standard when checking such a generated EPUB document. Adding the correct MIME type will prevent those messages and will also result in a valid EPUB. .. _core media types: https://www.w3.org/TR/epub/#sec-core-media-types .. _registered with IANA: https://www.iana.org/assignments/media-types/media-types.xhtml#font --- sphinx/builders/_epub_base.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sphinx/builders/_epub_base.py b/sphinx/builders/_epub_base.py index dfe4877ec81..1609c4995f2 100644 --- a/sphinx/builders/_epub_base.py +++ b/sphinx/builders/_epub_base.py @@ -65,9 +65,9 @@ '.svg': 'image/svg+xml', '.jpg': 'image/jpeg', '.jpeg': 'image/jpeg', - '.otf': 'application/x-font-otf', - '.ttf': 'application/x-font-ttf', - '.woff': 'application/font-woff', + '.otf': 'font/otf', + '.ttf': 'font/ttf', + '.woff': 'font/woff', } VECTOR_GRAPHICS_EXTENSIONS = ('.svg',) From cc78e2a8d81624769c6120ac5798cb7de153a0f6 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Thu, 20 Jul 2023 13:14:18 -0400 Subject: [PATCH 6/6] Provide timezone information in ``datetime.fromtimestamp`` (#11468) Python 3.12 has deprecated ``datetime.utcfromtimestamp``. Resolve the warning by working out ``tzdelta`` via explicit timezone calculations. Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> --- sphinx/builders/gettext.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sphinx/builders/gettext.py b/sphinx/builders/gettext.py index 697b75e4053..ee2f8bcd687 100644 --- a/sphinx/builders/gettext.py +++ b/sphinx/builders/gettext.py @@ -4,7 +4,7 @@ from codecs import open from collections import defaultdict -from datetime import datetime, timedelta, tzinfo +from datetime import datetime, timedelta, timezone, tzinfo from os import getenv, path, walk from time import time from typing import Any, Generator, Iterable @@ -163,8 +163,10 @@ def write_doc(self, docname: str, doctree: nodes.document) -> None: # determine tzoffset once to remain unaffected by DST change during build timestamp = time() -tzdelta = datetime.fromtimestamp(timestamp) - \ - datetime.utcfromtimestamp(timestamp) +local_time = datetime.fromtimestamp(timestamp) +utc_time = datetime.fromtimestamp(timestamp, tz=timezone.utc) +tzdelta = local_time - utc_time.replace(tzinfo=None) + # set timestamp from SOURCE_DATE_EPOCH if set # see https://reproducible-builds.org/specs/source-date-epoch/ source_date_epoch = getenv('SOURCE_DATE_EPOCH')