|
From: <mi...@us...> - 2023-12-01 13:25:43
|
Revision: 9496
http://sourceforge.net/p/docutils/code/9496
Author: milde
Date: 2023-12-01 13:25:40 +0000 (Fri, 01 Dec 2023)
Log Message:
-----------
New image directive option "loading".
The new option sets the `<image>` element's "loading" attribute
to one of "embed", "link", "lazy" as an indication for the
preferred handling of the image by the writer.
Default and actual handling depend on the writer.
Currently only observed by the HTML5 writer, where it overrides the
"image_loading" configuration setting for the respective image.
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/RELEASE-NOTES.txt
trunk/docutils/docs/ref/doctree.txt
trunk/docutils/docs/ref/docutils.dtd
trunk/docutils/docs/ref/rst/directives.txt
trunk/docutils/docs/user/config.txt
trunk/docutils/docutils/parsers/rst/directives/images.py
trunk/docutils/docutils/writers/_html_base.py
trunk/docutils/test/functional/expected/misc_rst_html5.html
trunk/docutils/test/functional/expected/standalone_rst_html5.html
trunk/docutils/test/functional/input/data/embed_images.txt
trunk/docutils/test/functional/input/data/html5-features.txt
trunk/docutils/test/test_parsers/test_rst/test_directives/test_figures.py
trunk/docutils/test/test_parsers/test_rst/test_directives/test_images.py
trunk/docutils/test/test_writers/test_html5_polyglot_parts.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2023-11-30 21:55:47 UTC (rev 9495)
+++ trunk/docutils/HISTORY.txt 2023-12-01 13:25:40 UTC (rev 9496)
@@ -17,13 +17,19 @@
Changes since 0.20.1
====================
-* Drop support for Python 3.7 and 3.8.
+* General
-* Updated build stystem to use Flit_ (cf. patch #186 by Adam Turner).
- Removed ``setup.py``.
+ - Drop support for Python 3.7 and 3.8.
+ - Updated build stystem to use Flit_ (patch #186 by Adam Turner).
+ Removed ``setup.py``.
+
.. _Flit: https://github.com/pypa/flit/
+* docs/ref/docutils.dtd
+
+ - The <image> element accepts the new attribute "loading".
+
* docutils/io.py
- Simpler and more secure `input encoding`_ default behaviour:
@@ -54,6 +60,10 @@
- Remove compatibility hacks `nodes.reprunicode` and `nodes.ensure_str()`.
+* docutils/parsers/rst/directives/images.py
+
+ - New "image" directive option "loading".
+
* docutils/parsers/rst/directives/tables.py
- Use the same CSV format for the ``:header:`` option and the main data
@@ -96,6 +106,7 @@
CWD and output directory differ.
- Consider the root-prefix_ setting when converting an image URI
to a local filesystem path.
+ - New <image> attribute "loading" overrides "image-loading" setting.
* docutils/writers/latex2e/__init__.py
Modified: trunk/docutils/RELEASE-NOTES.txt
===================================================================
--- trunk/docutils/RELEASE-NOTES.txt 2023-11-30 21:55:47 UTC (rev 9495)
+++ trunk/docutils/RELEASE-NOTES.txt 2023-12-01 13:25:40 UTC (rev 9496)
@@ -188,6 +188,12 @@
configuration setting is None, '', 'utf-8-sig', 'utf-16', or 'utf-32'.
Do not remove other ZWNBSPs.
+* New attribute loading__ for the Docutils doctree node: <image> storing
+ the new "loading" option of the `"image" directive`_.
+
+ __ docs/ref/doctree.html#loading
+ .. _"image" directive: docs/ref/rst/directives.html#image
+
* Configuration changes:
- New configuration setting root-prefix_.
Modified: trunk/docutils/docs/ref/doctree.txt
===================================================================
--- trunk/docutils/docs/ref/doctree.txt 2023-11-30 21:55:47 UTC (rev 9495)
+++ trunk/docutils/docs/ref/doctree.txt 2023-12-01 13:25:40 UTC (rev 9496)
@@ -2563,7 +2563,7 @@
:Attributes:
The ``image`` element contains the `common attributes`_
- plus uri, align_, alt, height_, width_, and scale_.
+ plus uri, alt_, align_, height_, width_, scale_, and loading_.
:Parameter Entities:
The `%body.elements;`_ parameter entity directly includes
@@ -4957,6 +4957,26 @@
The ``ltrim`` attribute is used in the substitution_definition_ element.
+``loading``
+===========
+
+Attribute type: EnumeratedType_, one of "embed", "link", or "lazy".
+Default value: none.
+
+The ``loading`` attribute is used in the image_ element to
+indicate the preferred handling by the Docutils writer_. [#]_
+The default depends on the writer and the image_loading_
+configuration setting.
+
+.. [#] Currently only recognized by the HTML5 writer.
+ The ODF/ODT writer always embeds images in the
+ output document, XML and LaTeX writers link to the image.
+ The behaviour may change for the ODT and XML writers
+ (images cannot be embedded in a LaTeX source).
+
+.. _image_loading: ../user/config.html#image-loading
+
+
``morecols``
============
@@ -5508,7 +5528,6 @@
reference_, revision_, status_, strong_, substitution_definition_,
substitution_reference_, subtitle_, target_, term_, title_, version_
-
..
Local Variables:
Modified: trunk/docutils/docs/ref/docutils.dtd
===================================================================
--- trunk/docutils/docs/ref/docutils.dtd 2023-11-30 21:55:47 UTC (rev 9495)
+++ trunk/docutils/docs/ref/docutils.dtd 2023-12-01 13:25:40 UTC (rev 9496)
@@ -563,7 +563,8 @@
alt CDATA #IMPLIED
height %measure; #IMPLIED
width %measure; #IMPLIED
- scale %number; #IMPLIED>
+ scale %number; #IMPLIED
+ loading (embed | link | lazy) #IMPLIED>
<!ELEMENT caption %text.model;>
<!ATTLIST caption %basic.atts;>
Modified: trunk/docutils/docs/ref/rst/directives.txt
===================================================================
--- trunk/docutils/docs/ref/rst/directives.txt 2023-11-30 21:55:47 UTC (rev 9495)
+++ trunk/docutils/docs/ref/rst/directives.txt 2023-12-01 13:25:40 UTC (rev 9496)
@@ -213,6 +213,7 @@
:Directive Arguments: one, required (image URI_)
:Directive Options: `see below <image options_>`__
:Directive Content: none
+:Configuration Setting: image_loading_ (only `HTML5 writer`_)
An "image" is a simple picture::
@@ -236,6 +237,7 @@
:height: 100px
:width: 200 px
:scale: 50 %
+ :loading: embed
:alt: alternate text
:align: right
@@ -284,7 +286,30 @@
option argument may be a URI (relative or absolute), or a
`reference name`_ with underscore suffix (e.g. ```a name`_``).
+``loading`` : ["embed", "link", "lazy"]
+ Indicate the preferred handling by the Docutils Writer. [#]_
+ :embed: Embed the image into the output document.
+ :link: Refer to the image via its URI.
+ :lazy: Refer to the image. The HTML5 writer additionally
+ specifies the `lazy loading attribute`_.
+
+ (New in Docutils 0.21.)
+
+.. [#] Currently only recognized by the `HTML5 writer`_
+ (overriding the `image_loading`_ configuration setting).
+ The ODF/ODT writer always embeds images in the
+ ``*.odt`` document, XML and LaTeX writers link to the image.
+ The behaviour may change for the ODT and XML writers but
+ images cannot be embedded in a LaTeX source.
+
+.. _image element: ../doctree.html#image
+.. _"loading" attribute: ../doctree.html#loading
+.. _image_loading: ../../user/config.html#image-loading
+.. _lazy loading attribute: https://html.spec.whatwg.org/multipage/
+ urls-and-fetching.html#lazy-loading-attributes
+
+
Figure
======
Modified: trunk/docutils/docs/user/config.txt
===================================================================
--- trunk/docutils/docs/user/config.txt 2023-11-30 21:55:47 UTC (rev 9495)
+++ trunk/docutils/docs/user/config.txt 2023-12-01 13:25:40 UTC (rev 9496)
@@ -1088,7 +1088,7 @@
initial_header_level
~~~~~~~~~~~~~~~~~~~~
-The initial level for header elements. This does not affect the
+The initial level for section header elements. This does not affect the
document title & subtitle; see doctitle_xform_.
Default: writer dependent (see `[html4css1 writer]`_, `[html5 writer]`_,
@@ -1424,18 +1424,24 @@
"""""""""""""
Indicate at which point images should be loaded.
+Overridden by the `"image" directive`_'s ``:loading:`` option.
+
Supported values:
+ embed:
+ Embed images into the HTML document
+ (ignored for videos).
+ link:
+ Refer to images in the HTML document (default).
+ lazy:
+ Refer to images. Additionally specify the
+ `lazy loading attribute`_ to defer fetching the image.
-:embed: Embed images into the HTML document
- (ignored for videos).
-:link: Refer to images in the HTML document (default).
-:lazy: Refer to images. Additionally specify the `lazy loading attribute`_
- to defer fetching the image.
Default: "link". Option: ``--image-loading``.
New in Docutils 0.18.
+.. _"image" directive: ../ref/rst/directives.html#image
.. _lazy loading attribute: https://html.spec.whatwg.org/multipage/
urls-and-fetching.html#lazy-loading-attributes
Modified: trunk/docutils/docutils/parsers/rst/directives/images.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/directives/images.py 2023-11-30 21:55:47 UTC (rev 9495)
+++ trunk/docutils/docutils/parsers/rst/directives/images.py 2023-12-01 13:25:40 UTC (rev 9496)
@@ -32,13 +32,18 @@
align_h_values = ('left', 'center', 'right')
align_v_values = ('top', 'middle', 'bottom')
align_values = align_v_values + align_h_values
+ loading_values = ('embed', 'link', 'lazy')
def align(argument):
- # This is not callable as self.align. We cannot make it a
+ # This is not callable as `self.align()`. We cannot make it a
# staticmethod because we're saving an unbound method in
# option_spec below.
return directives.choice(argument, Image.align_values)
+ def loading(argument):
+ # This is not callable as `self.loading()` (see above).
+ return directives.choice(argument, Image.loading_values)
+
required_arguments = 1
optional_arguments = 0
final_argument_whitespace = True
@@ -48,6 +53,7 @@
'scale': directives.percentage,
'align': align,
'target': directives.unchanged_required,
+ 'loading': loading,
'class': directives.class_option,
'name': directives.unchanged}
Modified: trunk/docutils/docutils/writers/_html_base.py
===================================================================
--- trunk/docutils/docutils/writers/_html_base.py 2023-11-30 21:55:47 UTC (rev 9495)
+++ trunk/docutils/docutils/writers/_html_base.py 2023-12-01 13:25:40 UTC (rev 9496)
@@ -1033,6 +1033,7 @@
def visit_image(self, node):
uri = node['uri']
+ alt = node.get('alt', uri)
uri_parts = urllib.parse.urlparse(uri)
imagepath = ''
mimetype = mimetypes.guess_type(uri)[0]
@@ -1095,6 +1096,7 @@
del atts[att_name]
if style:
atts['style'] = ' '.join(style)
+
# No newlines around inline images or if surrounded by <a>...</a>.
if (isinstance(node.parent, nodes.TextElement)
or (isinstance(node.parent, nodes.reference)
@@ -1103,20 +1105,16 @@
else:
suffix = '\n'
- # moving image -> use <video>
+ # ``:loading:`` option (embed, link, lazy)
+ # get default from config setting
+ # exception: only embed videos if told via directive option
if mimetype in self.videotypes:
- fallback = node.get('alt', uri)
- atts['title'] = fallback
- if 'controls' in node['classes']:
- node['classes'].remove('controls')
- atts['controls'] = 'controls'
- self.body.append(
- self.starttag(node, "video", suffix, src=uri, **atts)
- + f'<a href="{uri}">{fallback}</a>{suffix}</video>{suffix}')
- return
+ loading = 'link'
+ else:
+ loading = getattr(self.settings, 'image_loading', 'link')
+ loading = node.get('loading', loading)
- # Embed image file (embedded SVG or data URI):
- if self.image_loading == 'embed':
+ if loading == 'embed':
if uri_parts.scheme not in ('', 'file'):
self.document.reporter.error(
f'Cannot embed remote image "{uri}"')
@@ -1129,24 +1127,31 @@
self.document.reporter.error('Cannot embed image %r: %s'
% (uri, err.strerror))
else:
- self.settings.record_dependencies.add(
- urllib.parse.unquote(uri))
+ self.settings.record_dependencies.add(imagepath)
# TODO: insert SVG as-is?
# if mimetype == 'image/svg+xml':
# read/parse, apply arguments,
# insert as <svg ....> ... </svg> # (about 1/3 less data)
data64 = base64.b64encode(imagedata).decode()
- uri = 'data:%s;base64,%s' % (mimetype, data64)
- elif self.image_loading == 'lazy':
+ uri = f'data:{mimetype};base64,{data64}'
+ elif loading == 'lazy':
atts['loading'] = 'lazy'
- if mimetype == 'application/x-shockwave-flash':
+ if mimetype in self.videotypes:
+ atts['title'] = alt
+ alt_link = node['uri'] # use original URI also when embedding
+ if 'controls' in node['classes']:
+ node['classes'].remove('controls')
+ atts['controls'] = 'controls'
+ tag = (self.starttag(node, "video", suffix, src=uri, **atts)
+ + f'<a href="{alt_link}">{alt}</a>{suffix}</video>{suffix}')
+ elif mimetype == 'application/x-shockwave-flash':
atts['type'] = mimetype
# do NOT use an empty tag: incorrect rendering in browsers
tag = (self.starttag(node, 'object', '', data=uri, **atts)
- + node.get('alt', uri) + '</object>' + suffix)
+ + alt + '</object>' + suffix)
else:
- atts['alt'] = node.get('alt', node['uri'])
+ atts['alt'] = alt
tag = self.emptytag(node, 'img', suffix, src=uri, **atts)
self.body.append(tag)
Modified: trunk/docutils/test/functional/expected/misc_rst_html5.html
===================================================================
--- trunk/docutils/test/functional/expected/misc_rst_html5.html 2023-11-30 21:55:47 UTC (rev 9495)
+++ trunk/docutils/test/functional/expected/misc_rst_html5.html 2023-12-01 13:25:40 UTC (rev 9496)
@@ -119,6 +119,9 @@
</figcaption>
</figure>
<p>Embedded inline image <img alt="inline-embedded" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAABGdBTUEAANkE3LLaAgAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAAZQTFRF////AAAAVcLTfgAAAAF0Uk5TAEDm2GYAAAA2SURBVHicYmBRYOAQYJCQYJC+wSBjAUL2fxjq6hgueTNM7AQh3g0MzAdAiP0BUBYAAAD//wMA4pkLDrFBDzUAAAAASUVORK5CYII=" style="height: 0.8em;" /> scaled to a height of 0.8 em.</p>
+<img alt="../../../docs/user/rst/images/biohazard.svg" class="align-left" loading="lazy" src="../../../docs/user/rst/images/biohazard.svg" style="width: 2em; height: 2em;" />
+<p>The <span class="docutils literal">:loading:</span> option of <a class="reference external" href="https://docutils.sourceforge.io/docs/ref/rst/directives.html#images">image and figure directives</a> overrides the
+<a class="reference external" href="https://docutils.sourceforge.io/docs/user/config.html#image-loading">image_loading</a> setting for the respective image.</p>
</section>
<section id="moving-images-video">
<h2><a class="toc-backref" href="#contents" role="doc-backlink">Moving images (video)</a><a class="self-link" title="link to this section" href="#moving-images-video"></a></h2>
Modified: trunk/docutils/test/functional/expected/standalone_rst_html5.html
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_html5.html 2023-11-30 21:55:47 UTC (rev 9495)
+++ trunk/docutils/test/functional/expected/standalone_rst_html5.html 2023-12-01 13:25:40 UTC (rev 9496)
@@ -142,7 +142,7 @@
<li><p><a class="reference internal" href="#custom-roles" id="toc-entry-42"><span class="sectnum">2.23 </span>Custom Roles</a></p></li>
</ul>
</li>
-<li><p><a class="reference internal" href="#changes-to-the-html4css1-writer" id="toc-entry-43"><span class="sectnum">3 </span>Changes to the <cite>html4css1</cite> Writer</a></p>
+<li><p><a class="reference internal" href="#differences-to-the-html4css1-writer" id="toc-entry-43"><span class="sectnum">3 </span>Differences to the <cite>html4css1</cite> Writer</a></p>
<ul class="auto-toc">
<li><p><a class="reference internal" href="#field-list-rendering" id="toc-entry-44"><span class="sectnum">3.1 </span>Field List Rendering</a></p></li>
<li><p><a class="reference internal" href="#styling-with-class-arguments" id="toc-entry-45"><span class="sectnum">3.2 </span>Styling with Class Arguments</a></p>
@@ -194,7 +194,7 @@
(<a class="reference external" href="http://www.python.org">http://www.python.org</a>), external hyperlinks (<a class="reference external" href="http://www.python.org/">Python</a> <a class="brackets" href="#footnote-7" id="footnote-reference-18" role="doc-noteref"><span class="fn-bracket">[</span>7<span class="fn-bracket">]</span></a>), internal
cross-references (<a class="reference internal" href="#example">example</a>), external hyperlinks with embedded URIs
(<a class="reference external" href="http://www.python.org">Python web site</a>), <a class="reference external" href="http://www.python.org/">anonymous hyperlink
-references</a> <a class="brackets" href="#footnote-7" id="footnote-reference-26" role="doc-noteref"><span class="fn-bracket">[</span>7<span class="fn-bracket">]</span></a> (<a class="reference external" href="https://docutils.sourceforge.io/">a second reference</a> <a class="brackets" href="#footnote-13" id="footnote-reference-27" role="doc-noteref"><span class="fn-bracket">[</span>13<span class="fn-bracket">]</span></a>), footnote references (manually
+references</a> <a class="brackets" href="#footnote-7" id="footnote-reference-27" role="doc-noteref"><span class="fn-bracket">[</span>7<span class="fn-bracket">]</span></a> (<a class="reference external" href="https://docutils.sourceforge.io/">a second reference</a> <a class="brackets" href="#footnote-14" id="footnote-reference-28" role="doc-noteref"><span class="fn-bracket">[</span>14<span class="fn-bracket">]</span></a>), footnote references (manually
numbered <a class="brackets" href="#footnote-1" id="footnote-reference-1" role="doc-noteref"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></a>, anonymous auto-numbered <a class="brackets" href="#footnote-2" id="footnote-reference-2" role="doc-noteref"><span class="fn-bracket">[</span>3<span class="fn-bracket">]</span></a>, labeled auto-numbered
<a class="brackets" href="#label" id="footnote-reference-3" role="doc-noteref"><span class="fn-bracket">[</span>2<span class="fn-bracket">]</span></a>, or symbolic <a class="brackets" href="#footnote-3" id="footnote-reference-4" role="doc-noteref"><span class="fn-bracket">[</span>*<span class="fn-bracket">]</span></a>), citation references (see <a class="citation-reference" href="#cit2002" id="citation-reference-1" role="doc-biblioref">[CIT2002]</a>),
substitution references (<img alt="EXAMPLE" src="../../../docs/user/rst/images/biohazard.png" /> &
@@ -575,7 +575,7 @@
</ul>
</nav>
<p>These are just a sample of the many reStructuredText Directives. For
-others, please see <a class="reference external" href="https://docutils.sourceforge.io/docs/ref/rst/directives.html">reStructuredText Directives</a> <a class="brackets" href="#footnote-14" id="footnote-reference-28" role="doc-noteref"><span class="fn-bracket">[</span>14<span class="fn-bracket">]</span></a>.</p>
+others, please see <a class="reference external" href="https://docutils.sourceforge.io/docs/ref/rst/directives.html">reStructuredText Directives</a> <a class="brackets" href="#footnote-15" id="footnote-reference-29" role="doc-noteref"><span class="fn-bracket">[</span>15<span class="fn-bracket">]</span></a>.</p>
<section id="document-parts">
<h4><a class="toc-backref" href="#toc-entry-55" role="doc-backlink"><span class="sectnum">2.14.1 </span>Document Parts</a></h4>
<p>An example of the "contents" directive can be seen above this section
@@ -836,7 +836,7 @@
<aside class="footnote-list brackets">
<aside class="footnote brackets" id="footnote-7" role="doc-footnote">
<span class="label"><span class="fn-bracket">[</span>7<span class="fn-bracket">]</span></span>
-<span class="backrefs">(<a role="doc-backlink" href="#footnote-reference-18">1</a>,<a role="doc-backlink" href="#footnote-reference-19">2</a>,<a role="doc-backlink" href="#footnote-reference-20">3</a>,<a role="doc-backlink" href="#footnote-reference-26">4</a>)</span>
+<span class="backrefs">(<a role="doc-backlink" href="#footnote-reference-18">1</a>,<a role="doc-backlink" href="#footnote-reference-19">2</a>,<a role="doc-backlink" href="#footnote-reference-20">3</a>,<a role="doc-backlink" href="#footnote-reference-27">4</a>)</span>
<p><a class="reference external" href="http://www.python.org/">http://www.python.org/</a></p>
</aside>
<aside class="footnote brackets" id="footnote-8" role="doc-footnote">
@@ -845,46 +845,50 @@
</aside>
<aside class="footnote brackets" id="footnote-9" role="doc-footnote">
<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#footnote-reference-22">9</a><span class="fn-bracket">]</span></span>
-<p><a class="reference external" href="https://www.w3.org/TR/html52/interactive-elements.html#the-details-element">https://www.w3.org/TR/html52/interactive-elements.html#the-details-element</a></p>
+<p><a class="reference external" href="https://docutils.sourceforge.io/docs/user/config.html#image-loading">https://docutils.sourceforge.io/docs/user/config.html#image-loading</a></p>
</aside>
<aside class="footnote brackets" id="footnote-10" role="doc-footnote">
<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#footnote-reference-23">10</a><span class="fn-bracket">]</span></span>
-<p><a class="reference external" href="https://docutils.sourceforge.io/docs/user/config.html#table-style">https://docutils.sourceforge.io/docs/user/config.html#table-style</a></p>
+<p><a class="reference external" href="https://www.w3.org/TR/html52/interactive-elements.html#the-details-element">https://www.w3.org/TR/html52/interactive-elements.html#the-details-element</a></p>
</aside>
<aside class="footnote brackets" id="footnote-11" role="doc-footnote">
<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#footnote-reference-24">11</a><span class="fn-bracket">]</span></span>
-<p><a class="reference external" href="http://tug.ctan.org/tex-archive/macros/latex/contrib/booktabs/booktabs.pdf">http://tug.ctan.org/tex-archive/macros/latex/contrib/booktabs/booktabs.pdf</a></p>
+<p><a class="reference external" href="https://docutils.sourceforge.io/docs/user/config.html#table-style">https://docutils.sourceforge.io/docs/user/config.html#table-style</a></p>
</aside>
<aside class="footnote brackets" id="footnote-12" role="doc-footnote">
<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#footnote-reference-25">12</a><span class="fn-bracket">]</span></span>
-<p><a class="reference external" href="https://docutils.sourceforge.io/docs/dev/todo.html#interpreted-text">https://docutils.sourceforge.io/docs/dev/todo.html#interpreted-text</a></p>
+<p><a class="reference external" href="http://tug.ctan.org/tex-archive/macros/latex/contrib/booktabs/booktabs.pdf">http://tug.ctan.org/tex-archive/macros/latex/contrib/booktabs/booktabs.pdf</a></p>
</aside>
<aside class="footnote brackets" id="footnote-13" role="doc-footnote">
-<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#footnote-reference-27">13</a><span class="fn-bracket">]</span></span>
-<p><a class="reference external" href="https://docutils.sourceforge.io/">https://docutils.sourceforge.io/</a></p>
+<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#footnote-reference-26">13</a><span class="fn-bracket">]</span></span>
+<p><a class="reference external" href="https://docutils.sourceforge.io/docs/dev/todo.html#interpreted-text">https://docutils.sourceforge.io/docs/dev/todo.html#interpreted-text</a></p>
</aside>
<aside class="footnote brackets" id="footnote-14" role="doc-footnote">
<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#footnote-reference-28">14</a><span class="fn-bracket">]</span></span>
-<p><a class="reference external" href="https://docutils.sourceforge.io/docs/ref/rst/directives.html">https://docutils.sourceforge.io/docs/ref/rst/directives.html</a></p>
+<p><a class="reference external" href="https://docutils.sourceforge.io/">https://docutils.sourceforge.io/</a></p>
</aside>
<aside class="footnote brackets" id="footnote-15" role="doc-footnote">
<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#footnote-reference-29">15</a><span class="fn-bracket">]</span></span>
-<p><a class="reference external" href="https://docutils.sourceforge.io/docs/ref/rst/directives.html#metadata">https://docutils.sourceforge.io/docs/ref/rst/directives.html#metadata</a></p>
+<p><a class="reference external" href="https://docutils.sourceforge.io/docs/ref/rst/directives.html">https://docutils.sourceforge.io/docs/ref/rst/directives.html</a></p>
</aside>
<aside class="footnote brackets" id="footnote-16" role="doc-footnote">
<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#footnote-reference-30">16</a><span class="fn-bracket">]</span></span>
-<p><a class="reference external" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Viewport_meta_tag">https://developer.mozilla.org/en-US/docs/Web/HTML/Viewport_meta_tag</a></p>
+<p><a class="reference external" href="https://docutils.sourceforge.io/docs/ref/rst/directives.html#metadata">https://docutils.sourceforge.io/docs/ref/rst/directives.html#metadata</a></p>
</aside>
<aside class="footnote brackets" id="footnote-17" role="doc-footnote">
<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#footnote-reference-31">17</a><span class="fn-bracket">]</span></span>
-<p><a class="reference external" href="https://stackoverflow.com/questions/39547412/same-font-size-for-h1-and-h2-in-article">https://stackoverflow.com/questions/39547412/same-font-size-for-h1-and-h2-in-article</a></p>
+<p><a class="reference external" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Viewport_meta_tag">https://developer.mozilla.org/en-US/docs/Web/HTML/Viewport_meta_tag</a></p>
</aside>
<aside class="footnote brackets" id="footnote-18" role="doc-footnote">
<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#footnote-reference-32">18</a><span class="fn-bracket">]</span></span>
-<p><a class="reference external" href="https://html.spec.whatwg.org/#text-level-semantics">https://html.spec.whatwg.org/#text-level-semantics</a></p>
+<p><a class="reference external" href="https://stackoverflow.com/questions/39547412/same-font-size-for-h1-and-h2-in-article">https://stackoverflow.com/questions/39547412/same-font-size-for-h1-and-h2-in-article</a></p>
</aside>
<aside class="footnote brackets" id="footnote-19" role="doc-footnote">
<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#footnote-reference-33">19</a><span class="fn-bracket">]</span></span>
+<p><a class="reference external" href="https://html.spec.whatwg.org/#text-level-semantics">https://html.spec.whatwg.org/#text-level-semantics</a></p>
+</aside>
+<aside class="footnote brackets" id="footnote-20" role="doc-footnote">
+<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#footnote-reference-34">20</a><span class="fn-bracket">]</span></span>
<p><a class="reference external" href="https://html.spec.whatwg.org/multipage/edits.html">https://html.spec.whatwg.org/multipage/edits.html</a></p>
</aside>
</aside>
@@ -1036,7 +1040,7 @@
</section>
<section id="meta">
<h4><a class="toc-backref" href="#toc-entry-65" role="doc-backlink"><span class="sectnum">2.14.11 </span>Meta</a></h4>
-<p>The <a class="reference external" href="https://docutils.sourceforge.io/docs/ref/rst/directives.html#metadata">“meta” directive</a> <a class="brackets" href="#footnote-15" id="footnote-reference-29" role="doc-noteref"><span class="fn-bracket">[</span>15<span class="fn-bracket">]</span></a> is used to specify metadata to be stored in,
+<p>The <a class="reference external" href="https://docutils.sourceforge.io/docs/ref/rst/directives.html#metadata">“meta” directive</a> <a class="brackets" href="#footnote-16" id="footnote-reference-30" role="doc-noteref"><span class="fn-bracket">[</span>16<span class="fn-bracket">]</span></a> is used to specify metadata to be stored in,
e.g., HTML META tags or ODT file properties.</p>
</section>
</section>
@@ -1251,13 +1255,13 @@
</ul>
</section>
</section>
-<section id="changes-to-the-html4css1-writer">
-<h2><a class="toc-backref" href="#toc-entry-43" role="doc-backlink"><span class="sectnum">3 </span>Changes to the <cite>html4css1</cite> Writer</a></h2>
+<section id="differences-to-the-html4css1-writer">
+<h2><a class="toc-backref" href="#toc-entry-43" role="doc-backlink"><span class="sectnum">3 </span>Differences to the <cite>html4css1</cite> Writer</a></h2>
<ul>
<li><p>Use only <a class="reference internal" href="#meta">meta</a> keywords recognized by HTML 5.
Add HTML5-compatible meta tags for docinfo items
"authors", "date", and "copyright".</p>
-<p>Add a <a class="reference external" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Viewport_meta_tag">viewport meta tag</a> <a class="brackets" href="#footnote-16" id="footnote-reference-30" role="doc-noteref"><span class="fn-bracket">[</span>16<span class="fn-bracket">]</span></a> to tell mobile browsers
+<p>Add a <a class="reference external" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Viewport_meta_tag">viewport meta tag</a> <a class="brackets" href="#footnote-17" id="footnote-reference-31" role="doc-noteref"><span class="fn-bracket">[</span>17<span class="fn-bracket">]</span></a> to tell mobile browsers
to use the device-width as viewport.</p>
</li>
<li><p>Set table column widths with <style="width: ...">, not "width" argument.</p></li>
@@ -1269,7 +1273,7 @@
<footer>, <aside>, <figure>, and <figcaption>.
See <span class="docutils literal">minimal.css</span> and <span class="docutils literal">responsive.css</span> for styling rule examples.</p>
<p>Change the <cite>initial_header_level</cite> setting default to "2", as browsers
-use the <a class="reference external" href="https://stackoverflow.com/questions/39547412/same-font-size-for-h1-and-h2-in-article">same style for <h1> and <h2> when nested in a <section></a> <a class="brackets" href="#footnote-17" id="footnote-reference-31" role="doc-noteref"><span class="fn-bracket">[</span>17<span class="fn-bracket">]</span></a>.</p>
+use the <a class="reference external" href="https://stackoverflow.com/questions/39547412/same-font-size-for-h1-and-h2-in-article">same style for <h1> and <h2> when nested in a <section></a> <a class="brackets" href="#footnote-18" id="footnote-reference-32" role="doc-noteref"><span class="fn-bracket">[</span>18<span class="fn-bracket">]</span></a>.</p>
</li>
<li><p>Use HTML5 tags <small>, <s>, <q>, <dfn>, <var>, <samp>, <kbd>,
<i>, <b>, <u>, <mark>, and <bdi> if a matching class value
@@ -1278,6 +1282,15 @@
is found in <cite>inline</cite>, <cite>literal</cite>, or <cite>container</cite> elements.
(See <a class="reference internal" href="#text-level-semantics">text-level semantics</a> and <a class="reference internal" href="#indicating-edits">indicating edits</a>.)</p></li>
<li><p>Use <img> tags for SVG images and <video> for video formats.</p></li>
+<li><img alt="blue square" class="align-right" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAAALElEQVR4nO3NMQEAMAjAsDFjvIhHFCbgSwU0kdXvsn96BwAAAAAAAAAAAIsNnEwBk52VRuMAAAAASUVORK5CYII=" />
+<p>Embed images or defer fetching images with the <a class="reference external" href="https://docutils.sourceforge.io/docs/user/config.html#image-loading">image-loading</a> <a class="brackets" href="#footnote-9" id="footnote-reference-22" role="doc-noteref"><span class="fn-bracket">[</span>9<span class="fn-bracket">]</span></a>
+configuration setting or the "loading" option of the "image" directive.</p>
+<img alt="../../../docs/user/rst/images/biohazard.png" class="align-right" loading="lazy" src="../../../docs/user/rst/images/biohazard.png" style="width: 16.0px; height: 16.0px;" />
+<p>Especially with "lazy" loading images, it is strongly recommended to
+specify both width and height of the image to prevent content layout
+shifts. (Or use the "scale" option to let the writer insert the size
+determined from the image file.)</p>
+</li>
</ul>
<section id="field-list-rendering">
<h3><a class="toc-backref" href="#toc-entry-44" role="doc-backlink"><span class="sectnum">3.1 </span>Field List Rendering</a></h3>
@@ -1306,7 +1319,7 @@
<section id="styling-with-class-arguments">
<h3><a class="toc-backref" href="#toc-entry-45" role="doc-backlink"><span class="sectnum">3.2 </span>Styling with Class Arguments</a></h3>
<p>The <span class="docutils literal">plain.css</span> style sheet comes with some pre-defined style variants
-that can be choosen via a class argument.</p>
+that can be chosen via a class argument.</p>
<section id="description-lists">
<h4><a class="toc-backref" href="#toc-entry-46" role="doc-backlink"><span class="sectnum">3.2.1 </span>Description Lists</a></h4>
<p>Definition lists with the "description" class argument:</p>
@@ -1349,7 +1362,7 @@
<section id="details-disclosure-elements">
<h4><a class="toc-backref" href="#toc-entry-47" role="doc-backlink"><span class="sectnum">3.2.2 </span>Details disclosure elements</a></h4>
<p>Items of <a class="reference internal" href="#definition-lists">definition lists</a> with class argument "details" are converted
-to <a class="reference external" href="https://www.w3.org/TR/html52/interactive-elements.html#the-details-element">details</a> <a class="brackets" href="#footnote-9" id="footnote-reference-22" role="doc-noteref"><span class="fn-bracket">[</span>9<span class="fn-bracket">]</span></a> disclosure elements with the term becoming the "summary".</p>
+to <a class="reference external" href="https://www.w3.org/TR/html52/interactive-elements.html#the-details-element">details</a> <a class="brackets" href="#footnote-10" id="footnote-reference-23" role="doc-noteref"><span class="fn-bracket">[</span>10<span class="fn-bracket">]</span></a> disclosure elements with the term becoming the "summary".</p>
<div class="details" id="closed-details">
<details>
<summary>A summary</summary>
@@ -1418,7 +1431,7 @@
</dd>
<dt>Use<span class="colon">:</span></dt>
<dd><p>class value starting with <span class="docutils literal"><span class="pre">field-indent-</span></span> followed by
-a valid lenght, e.g. <span class="docutils literal"><span class="pre">field-indent-3em</span></span>.</p>
+a valid length, e.g. <span class="docutils literal"><span class="pre">field-indent-3em</span></span>.</p>
</dd>
<dt>The writer<span class="colon">:</span></dt>
<dd><p>will convert this class value to a <span class="docutils literal">style</span> attribute setting.</p>
@@ -1448,7 +1461,7 @@
<section id="table-variants">
<h4><a class="toc-backref" href="#toc-entry-49" role="doc-backlink"><span class="sectnum">3.2.4 </span>Table Variants</a></h4>
<p>The following styles can be applied to individual tables via a class
-argument or as document wide setting with the <a class="reference external" href="https://docutils.sourceforge.io/docs/user/config.html#table-style">table-style</a> <a class="brackets" href="#footnote-10" id="footnote-reference-23" role="doc-noteref"><span class="fn-bracket">[</span>10<span class="fn-bracket">]</span></a> configuration
+argument or as document wide setting with the <a class="reference external" href="https://docutils.sourceforge.io/docs/user/config.html#table-style">table-style</a> <a class="brackets" href="#footnote-11" id="footnote-reference-24" role="doc-noteref"><span class="fn-bracket">[</span>11<span class="fn-bracket">]</span></a> configuration
setting (or command line argument).</p>
<ul>
<li><p>Numbered tables can be achieved with the "numbered" class option:</p>
@@ -1483,7 +1496,7 @@
common request and already on the <cite>TODO list</cite>.</p>
</li>
<li><p>A table with "booktabs" class value, is rendered similar to the style
-from the <a class="reference external" href="http://tug.ctan.org/tex-archive/macros/latex/contrib/booktabs/booktabs.pdf">booktabs</a> <a class="brackets" href="#footnote-11" id="footnote-reference-24" role="doc-noteref"><span class="fn-bracket">[</span>11<span class="fn-bracket">]</span></a> LaTeX package.</p>
+from the <a class="reference external" href="http://tug.ctan.org/tex-archive/macros/latex/contrib/booktabs/booktabs.pdf">booktabs</a> <a class="brackets" href="#footnote-12" id="footnote-reference-25" role="doc-noteref"><span class="fn-bracket">[</span>12<span class="fn-bracket">]</span></a> LaTeX package.</p>
</li>
</ul>
<p>"Booktabs" style table, numbered, centre-aligned, with auto-sized columns:</p>
@@ -1524,9 +1537,9 @@
<h4><a class="toc-backref" href="#toc-entry-50" role="doc-backlink"><span class="sectnum">3.2.5 </span>Numbered Figures</a></h4>
<p>Numbered figures can be achieved with the "numbered" <span class="docutils literal">:figclass:</span> option:</p>
<figure class="numbered">
-<img alt="reStructuredText, the markup syntax" src="../../../docs/user/rst/images/title.svg" style="width: 100%;" />
+<img alt="reStructuredText, the markup syntax" src="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMjAzcHQiIGhlaWdodD0iMjRwdCIgdmVyc2lvbj0iMS4xIgogICB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogPHRleHQgeD0iLTIuMjUiIHk9IjI0IiBmaWxsPSIjMDAwMDAwIgogICBmb250LWZhbWlseT0iVGltZXMgTmV3IFJvbWFuLCBMaWJlcmF0aW9uIFNlcmlmLCBGcmVlU2VyaWYsIHNlcmlmIgogICBmb250LXNpemU9IjMycHgiIGZvbnQtc3R5bGU9Iml0YWxpYyIgbGV0dGVyLXNwYWNpbmc9IjBweCIKICAgc3Ryb2tlLXdpZHRoPSIxcHgiIHdvcmQtc3BhY2luZz0iMHB4Ij48dHNwYW4KICAgICB4PSIwIiB5PSIyNCI+cmU8dHNwYW4KICAgICBmb250LWZhbWlseT0iSGVsdmV0aWNhLCBMaWJlcmF0aW9uIFNhbnMsIEZyZWVTYW5zLCBzYW5zLXNlcmlmIgogICAgIGZvbnQtc3R5bGU9Im5vcm1hbCI+U3RydWN0dXJlZDwvdHNwYW4+VGV4dDwvdHNwYW4+PC90ZXh0Pgo8L3N2Zz4K" style="width: 100%;" />
<figcaption>
-<p>SVG image in a numbered figure.</p>
+<p>Embedded SVG image in a numbered figure.</p>
</figcaption>
</figure>
</section>
@@ -1534,7 +1547,7 @@
<section id="text-level-semantics">
<h3><a class="toc-backref" href="#toc-entry-51" role="doc-backlink"><span class="sectnum">3.3 </span>Text-Level Semantics</a></h3>
<p>This section describes the <a class="reference external" href="https://html.spec.whatwg.org/#text-level-semantics">HTML 5 tags for representation of text-level
-semantics</a> <a class="brackets" href="#footnote-18" id="footnote-reference-32" role="doc-noteref"><span class="fn-bracket">[</span>18<span class="fn-bracket">]</span></a> and their reStructuredText equivalents.</p>
+semantics</a> <a class="brackets" href="#footnote-19" id="footnote-reference-33" role="doc-noteref"><span class="fn-bracket">[</span>19<span class="fn-bracket">]</span></a> and their reStructuredText equivalents.</p>
<dl class="description">
<dt>a</dt>
<dd><p>Hyperlinks</p>
@@ -1733,7 +1746,7 @@
<span class="label"><span class="fn-bracket">[</span>5<span class="fn-bracket">]</span></span>
<span class="backrefs">(<a role="doc-backlink" href="#footnote-reference-10">1</a>,<a role="doc-backlink" href="#footnote-reference-14">2</a>,<a role="doc-backlink" href="#footnote-reference-16">3</a>,<a role="doc-backlink" href="#footnote-reference-17">4</a>)</span>
<p>Would gain from support for attributes/arguments
-to inline roles. See <a class="reference external" href="https://docutils.sourceforge.io/docs/dev/todo.html#interpreted-text">TODO</a> <a class="brackets" href="#footnote-12" id="footnote-reference-25" role="doc-noteref"><span class="fn-bracket">[</span>12<span class="fn-bracket">]</span></a></p>
+to inline roles. See <a class="reference external" href="https://docutils.sourceforge.io/docs/dev/todo.html#interpreted-text">TODO</a> <a class="brackets" href="#footnote-13" id="footnote-reference-26" role="doc-noteref"><span class="fn-bracket">[</span>13<span class="fn-bracket">]</span></a></p>
</aside>
<aside class="footnote brackets" id="attribute-required" role="doc-footnote">
<span class="label"><span class="fn-bracket">[</span>6<span class="fn-bracket">]</span></span>
@@ -1745,7 +1758,7 @@
</section>
<section id="indicating-edits">
<h3><a class="toc-backref" href="#toc-entry-52" role="doc-backlink"><span class="sectnum">3.4 </span>Indicating Edits</a></h3>
-<p>The <a class="reference external" href="https://html.spec.whatwg.org/multipage/edits.html">HTML tags for representation of edits to the document</a> <a class="brackets" href="#footnote-19" id="footnote-reference-33" role="doc-noteref"><span class="fn-bracket">[</span>19<span class="fn-bracket">]</span></a> and their
+<p>The <a class="reference external" href="https://html.spec.whatwg.org/multipage/edits.html">HTML tags for representation of edits to the document</a> <a class="brackets" href="#footnote-20" id="footnote-reference-34" role="doc-noteref"><span class="fn-bracket">[</span>20<span class="fn-bracket">]</span></a> and their
reStructuredText equivalents are:</p>
<dl class="description">
<dt>ins</dt>
Modified: trunk/docutils/test/functional/input/data/embed_images.txt
===================================================================
--- trunk/docutils/test/functional/input/data/embed_images.txt 2023-11-30 21:55:47 UTC (rev 9495)
+++ trunk/docutils/test/functional/input/data/embed_images.txt 2023-12-01 13:25:40 UTC (rev 9496)
@@ -17,7 +17,18 @@
.. |inline-embedded| image:: file:../../../docs/user/rst/images/biohazard.png
:height: 0.8 em
+.. image:: ../../../docs/user/rst/images/biohazard.svg
+ :align: left
+ :width: 2em
+ :height: 2em
+ :loading: lazy
+
+The ``:loading:`` option of `image and figure directives`_ overrides the
+image_loading_ setting for the respective image.
+
.. _image_loading:
https://docutils.sourceforge.io/docs/user/config.html#image-loading
.. _base64: https://en.wikipedia.org/wiki/Base64
.. _data URI: https://en.wikipedia.org/wiki/Data_URI_scheme
+.. _image and figure directives:
+ https://docutils.sourceforge.io/docs/ref/rst/directives.html#images
Modified: trunk/docutils/test/functional/input/data/html5-features.txt
===================================================================
--- trunk/docutils/test/functional/input/data/html5-features.txt 2023-11-30 21:55:47 UTC (rev 9495)
+++ trunk/docutils/test/functional/input/data/html5-features.txt 2023-12-01 13:25:40 UTC (rev 9496)
@@ -1,5 +1,5 @@
-Changes to the `html4css1` Writer
-=================================
+Differences to the `html4css1` Writer
+=====================================
* Use only meta_ keywords recognized by HTML 5.
Add HTML5-compatible meta tags for docinfo items
@@ -37,6 +37,28 @@
* Use <img> tags for SVG images and <video> for video formats.
+* .. image:: ../input/data/blue%20square.png
+ :loading: embed
+ :alt: blue square
+ :align: right
+
+ Embed images or defer fetching images with the image-loading_
+ configuration setting or the "loading" option of the "image" directive.
+
+ .. image:: ../../../docs/user/rst/images/biohazard.png
+ :loading: lazy
+ :scale: 100%
+ :align: right
+
+ Especially with "lazy" loading images, it is strongly recommended to
+ specify both width and height of the image to prevent content layout
+ shifts. (Or use the "scale" option to let the writer insert the size
+ determined from the image file.)
+
+.. _image-loading:
+ https://docutils.sourceforge.io/docs/user/config.html#image-loading
+
+
Field List Rendering
--------------------
@@ -65,7 +87,7 @@
----------------------------
The ``plain.css`` style sheet comes with some pre-defined style variants
-that can be choosen via a class argument.
+that can be chosen via a class argument.
Description Lists
`````````````````
@@ -161,7 +183,7 @@
:Feature: Field body indented by custom amount.
:Use: class value starting with ``field-indent-`` followed by
- a valid lenght, e.g. ``field-indent-3em``.
+ a valid length, e.g. ``field-indent-3em``.
:The writer:
will convert this class value to a ``style`` attribute setting.
@@ -238,5 +260,6 @@
:alt: reStructuredText, the markup syntax
:figclass: numbered
:width: 100%
+ :loading: embed
- SVG image in a numbered figure.
+ Embedded SVG image in a numbered figure.
Modified: trunk/docutils/test/test_parsers/test_rst/test_directives/test_figures.py
===================================================================
--- trunk/docutils/test/test_parsers/test_rst/test_directives/test_figures.py 2023-11-30 21:55:47 UTC (rev 9495)
+++ trunk/docutils/test/test_parsers/test_rst/test_directives/test_figures.py 2023-12-01 13:25:40 UTC (rev 9496)
@@ -23,6 +23,8 @@
class ParserTestCase(unittest.TestCase):
+ maxDiff = None
+
def test_parser(self):
parser = Parser()
settings = get_default_settings(Parser)
@@ -96,6 +98,7 @@
:height: 100
:width: 200
:scale: 50
+ :loading: embed
A picture with image options and a caption.
""",
@@ -102,7 +105,7 @@
"""\
<document source="test data">
<figure>
- <image height="100" scale="50" uri="picture.png" width="200">
+ <image height="100" loading="embed" scale="50" uri="picture.png" width="200">
<caption>
A picture with image options and a caption.
"""],
@@ -112,6 +115,7 @@
:alt: alternate text
:width: 200
:scale: 50
+ :loading: lazy
:figwidth: 300
:figclass: class1 class2
:name: fig:pix
@@ -121,7 +125,7 @@
"""\
<document source="test data">
<figure classes="class1 class2" width="300px">
- <image alt="alternate text" height="100" ids="fig-pix" names="fig:pix" scale="50" uri="picture.png" width="200">
+ <image alt="alternate text" height="100" ids="fig-pix" loading="lazy" names="fig:pix" scale="50" uri="picture.png" width="200">
<caption>
A picture with image options on individual lines, and this caption.
"""],
Modified: trunk/docutils/test/test_parsers/test_rst/test_directives/test_images.py
===================================================================
--- trunk/docutils/test/test_parsers/test_rst/test_directives/test_images.py 2023-11-30 21:55:47 UTC (rev 9495)
+++ trunk/docutils/test/test_parsers/test_rst/test_directives/test_images.py 2023-12-01 13:25:40 UTC (rev 9496)
@@ -477,6 +477,20 @@
<reference refuri="path with spaces/target with spaces across lines.html">
<image uri="path with spaces/name with spaces.png">
"""],
+["""
+.. image:: test.png
+ :loading: embed
+.. image:: test.png
+ :loading: link
+.. image:: test.png
+ :loading: lazy
+""",
+"""\
+<document source="test data">
+ <image loading="embed" uri="test.png">
+ <image loading="link" uri="test.png">
+ <image loading="lazy" uri="test.png">
+"""],
]
Modified: trunk/docutils/test/test_writers/test_html5_polyglot_parts.py
===================================================================
--- trunk/docutils/test/test_writers/test_html5_polyglot_parts.py 2023-11-30 21:55:47 UTC (rev 9495)
+++ trunk/docutils/test/test_writers/test_html5_polyglot_parts.py 2023-12-01 13:25:40 UTC (rev 9496)
@@ -475,17 +475,22 @@
["""\
.. image:: dummy.png
-""",
-{'fragment': '''\
-<img alt="dummy.png" loading="lazy" src="dummy.png" />\n''',
-}],
-["""\
+.. image:: dummy.png
+ :loading: link
.. figure:: dummy.png
+.. figure:: dummy.png
+ :loading: link
""",
{'fragment': '''\
+<img alt="dummy.png" loading="lazy" src="dummy.png" />
+<img alt="dummy.png" src="dummy.png" />
<figure>
<img alt="dummy.png" loading="lazy" src="dummy.png" />
-</figure>\n''',
+</figure>
+<figure>
+<img alt="dummy.png" src="dummy.png" />
+</figure>
+''',
}],
])
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|