|
From: <mi...@us...> - 2023-11-25 21:08:35
|
Revision: 9483
http://sourceforge.net/p/docutils/code/9483
Author: milde
Date: 2023-11-25 21:08:33 +0000 (Sat, 25 Nov 2023)
Log Message:
-----------
Support moving images (video) in the "html4" writer.
Include image files in the formats "mp4", "ogg", and "webm"
as `<object>` nodes to get image support on par with the "html5" writer.
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/docs/ref/rst/directives.txt
trunk/docutils/docutils/writers/html4css1/__init__.py
trunk/docutils/test/functional/expected/misc_rst_html4css1.html
trunk/docutils/test/functional/input/misc_rst_html4css1.txt
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2023-11-20 18:13:55 UTC (rev 9482)
+++ trunk/docutils/HISTORY.txt 2023-11-25 21:08:33 UTC (rev 9483)
@@ -77,6 +77,10 @@
(patch #206 by Chris Sewell); simplify regexps; skip replacement
rules if there is nothing to replace.
+* docutils/writers/html4css1/__init__.py
+
+ - Support video inclusion via `<object>` tags.
+
* docutils/writers/latex2e/__init__.py
- Fix placement of hyperlink target (label) for tables (bug #440).
Modified: trunk/docutils/docs/ref/rst/directives.txt
===================================================================
--- trunk/docutils/docs/ref/rst/directives.txt 2023-11-20 18:13:55 UTC (rev 9482)
+++ trunk/docutils/docs/ref/rst/directives.txt 2023-11-25 21:08:33 UTC (rev 9483)
@@ -169,7 +169,7 @@
----------- ------------- ----------------------------- -----------------
.. SVG PDF PNG JPG GIF APNG AVIF WebM MP4 OGG
=========== ====== ====== ===== ===== ===== ===== ===== ===== ===== =====
- HTML4_ ✓ [#]_ ✓ ✓ ✓ (✓) (✓)
+ HTML4_ [#]_ ✓ ✓ ✓ ✓ (✓) (✓) ✓ ✓ ✓
HTML5_ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓
@@ -182,8 +182,9 @@
ends with an extension matching one of the listed video formats
(since Docutils 0.17).
- .. [#] The html4 writer uses an ``<object>`` tag for SVG images
- for better compatibility with older browsers.
+ .. [#] The html4 writer uses an ``<object>`` tag for SVG images and
+ videos for compatibility with older browsers and for XHTML1.1
+ conformance respectively.
.. [#] When compiling with ``pdflatex``, ``xelatex``, or ``lualatex``.
The original ``latex`` engine supports only the EPS image format.
Modified: trunk/docutils/docutils/writers/html4css1/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/html4css1/__init__.py 2023-11-20 18:13:55 UTC (rev 9482)
+++ trunk/docutils/docutils/writers/html4css1/__init__.py 2023-11-25 21:08:33 UTC (rev 9483)
@@ -541,7 +541,11 @@
# (SVG not supported by IE up to version 8,
# html4css1 strives for IE6 compatibility.)
object_image_types = {'.svg': 'image/svg+xml',
- '.swf': 'application/x-shockwave-flash'}
+ '.swf': 'application/x-shockwave-flash',
+ '.mp4': 'video/mp4',
+ '.webm': 'video/webm',
+ '.ogg': 'video/ogg',
+ }
def visit_image(self, node):
atts = {}
Modified: trunk/docutils/test/functional/expected/misc_rst_html4css1.html
===================================================================
--- trunk/docutils/test/functional/expected/misc_rst_html4css1.html 2023-11-20 18:13:55 UTC (rev 9482)
+++ trunk/docutils/test/functional/expected/misc_rst_html4css1.html 2023-11-25 21:08:33 UTC (rev 9483)
@@ -61,6 +61,24 @@
IDs after <a class="reference external" href="https://docutils.sourceforge.io/docs/ref/rst/directives.html#identifier-normalization">identifier normalization</a> of the section's reference name.</p>
</div>
</div>
+<div class="section" id="moving-images-video">
+<h1>Moving images (video)</h1>
+<p>If the URL given to <cite>images and figures</cite> hints to a video format
+supported by HTML 5 (MIME types 'video/mp4', 'video/webm', or
+'video/ogg'), the HTML5 writer will place it in a <a class="reference external" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video">video element</a>.</p>
+<object class="align-left" data="../../../docs/user/rst/images/pens.mp4" type="video/mp4">left-aligned test video</object>
+<p>A class option value "controls" tells the browser to display controls
+for video playback.</p>
+<p>It is a good idea to include width and height attributes. If
+height and width are not set, the page might flicker while the video
+loads. According to the <a class="reference external" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video">HTML5 spec</a>, hight and width must be
+specified as pixel values.</p>
+<div class="figure align-center">
+<object class="controls" data="../../../docs/user/rst/images/pens.mp4" style="width: 200px;" type="video/mp4">test video in a figure</object>
+<p class="caption">Simple test video in a centered figure</p>
</div>
+<p>A video like this <object data="../../../docs/user/rst/images/pens.mp4" style="width: 60px;" type="video/mp4">rotating pens video</object> can be included inline via substitution.</p>
+</div>
+</div>
</body>
</html>
Modified: trunk/docutils/test/functional/input/misc_rst_html4css1.txt
===================================================================
--- trunk/docutils/test/functional/input/misc_rst_html4css1.txt 2023-11-20 18:13:55 UTC (rev 9482)
+++ trunk/docutils/test/functional/input/misc_rst_html4css1.txt 2023-11-25 21:08:33 UTC (rev 9483)
@@ -3,3 +3,5 @@
===============================
.. include:: data/section_titles.txt
+
+.. include:: data/video.txt
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|