summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--debian/changelog8
-rw-r--r--debian/patches/data_uris.diff66
-rw-r--r--debian/patches/series1
3 files changed, 75 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog
index 4a5ef6a..7bda4f9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+sphinx (7.3.7-3) unstable; urgency=medium
+
+ * Backport upstream patch to fix support for data: URIs in builders that
+ do not support them natively (closes: #1073500).
+ * Upload to unstable.
+
+ -- Dmitry Shachnev <mitya57@debian.org> Wed, 03 Jul 2024 10:18:22 +0300
+
sphinx (7.3.7-2~progress7.99u1) graograman-backports; urgency=medium
* Uploading to graograman-backports, remaining changes:
diff --git a/debian/patches/data_uris.diff b/debian/patches/data_uris.diff
new file mode 100644
index 0000000..37dd50a
--- /dev/null
+++ b/debian/patches/data_uris.diff
@@ -0,0 +1,66 @@
+From: James Addison <55152140+jayaddison@users.noreply.github.com>
+Date: Wed, 3 Jul 2024 02:16:43 +0100
+Subject: Regression: restore extraction of data-URI images from source for
+ builders whose output formats do not support them natively (#12344)
+
+(cherry picked from commit 778013f91a650f585bd7bf346d781d5bd9392e46)
+---
+ sphinx/transforms/post_transforms/images.py | 4 +---
+ tests/roots/test-images/index.rst | 5 +++++
+ tests/test_builders/test_build_latex.py | 1 +
+ tests/test_builders/test_build_texinfo.py | 1 +
+ 4 files changed, 8 insertions(+), 3 deletions(-)
+
+diff --git a/sphinx/transforms/post_transforms/images.py b/sphinx/transforms/post_transforms/images.py
+index 18ad51d..9a6e1be 100644
+--- a/sphinx/transforms/post_transforms/images.py
++++ b/sphinx/transforms/post_transforms/images.py
+@@ -115,10 +115,8 @@ class DataURIExtractor(BaseImageConverter):
+ default_priority = 150
+
+ def match(self, node: nodes.image) -> bool:
+- if not self.app.builder.supported_remote_images:
+- return False
+ if self.app.builder.supported_data_uri_images is True:
+- return False
++ return False # do not transform the image; data URIs are valid in the build output
+ return node['uri'].startswith('data:')
+
+ def handle(self, node: nodes.image) -> None:
+diff --git a/tests/roots/test-images/index.rst b/tests/roots/test-images/index.rst
+index 9b9aac1..f6d7160 100644
+--- a/tests/roots/test-images/index.rst
++++ b/tests/roots/test-images/index.rst
+@@ -27,3 +27,8 @@ test-image
+
+ .. non-exist remote image
+ .. image:: http://localhost:7777/NOT_EXIST.PNG
++
++.. a self-contained image within a data URI
++ This image was generated using ImageMagick 6.9 with the command ``convert -pointsize 32 -font Noto-Sans-Egyptian-Hieroglyphs-Regular caption:$(printf '\U13080') -trim -border 2 -monochrome eoh.png``
++.. image:: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACoAAAAjAQAAAADKt6U+AAAAAmJLR0QAAd2KE6QAAAAHdElNRQfoBQIVBgOBlOMTAAAAEGNhTnYAAAAtAAAAOwAAAAEAAAATst46RgAAAJtJREFUCNdNz70KwkAMAOA8iOhjuGh9HB9BCtoTHHwMH0Mc7KWTmx0dHDpovUk6HCil3sUmATHLR/4IAeJA+LEWPmbEeHJMWbTMZDA0CNFn8x1COFPaIHQ55R7hlZGdIjwj2aovRjJbhPvMLNN+r0g2vB7ByIWbHqqVh3LR3lhZWM0qYV8qjU6+lc4J7ZVx4SjEINBKOSinv/+YL1xvsJE6ztdqAAAADHRFWHRjYXB0aW9uAPCTgoD4hdKUAAAAD3RFWHRjYXB0aW9uOmxpbmVzADGoBz2RAAAAAElFTkSuQmCC
++ :alt: The Eye of Horus in a black font on a white background.
+diff --git a/tests/test_builders/test_build_latex.py b/tests/test_builders/test_build_latex.py
+index 0776c74..ba8fc62 100644
+--- a/tests/test_builders/test_build_latex.py
++++ b/tests/test_builders/test_build_latex.py
+@@ -1710,6 +1710,7 @@ def test_copy_images(app, status, warning):
+ }
+ images.discard('sphinx.png')
+ assert images == {
++ 'ba30773957c3fe046897111afd65a80b81cad089.png', # latex: image from data:image/png URI in source
+ 'img.pdf',
+ 'rimg.png',
+ 'testimäge.png',
+diff --git a/tests/test_builders/test_build_texinfo.py b/tests/test_builders/test_build_texinfo.py
+index f9effb2..3b8e276 100644
+--- a/tests/test_builders/test_build_texinfo.py
++++ b/tests/test_builders/test_build_texinfo.py
+@@ -124,6 +124,7 @@ def test_copy_images(app, status, warning):
+ images = {image.name for image in images_dir.rglob('*')}
+ images.discard('python-logo.png')
+ assert images == {
++ 'ba30773957c3fe046897111afd65a80b81cad089.png', # texinfo: image from data:image/png URI in source
+ 'img.png',
+ 'rimg.png',
+ 'testimäge.png',
diff --git a/debian/patches/series b/debian/patches/series
index 951abc3..c1297eb 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -7,3 +7,4 @@ move_sphinxcontrib_to_extras_require.diff
intersphinx_local.diff
docutils_manpage_macros.diff
python_3.12.4.diff
+data_uris.diff