summaryrefslogtreecommitdiff
path: root/docutils
diff options
context:
space:
mode:
authormilde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2022-05-06 10:29:55 +0000
committermilde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2022-05-06 10:29:55 +0000
commit53cf89cac38019200636e976c5e6b3ec3dda83b4 (patch)
tree96ed78f1dc37f20f396f0858b4c3b07e2a3e0fe3 /docutils
parent51f553bc343689a4c202c7cfae659c04f36ff921 (diff)
downloaddocutils-53cf89cac38019200636e976c5e6b3ec3dda83b4.tar.gz
Remove class value "controls" from an `image` node with video content
after converting it to a "control" attribute of the `<video>` tag. Thanks to Agathe Porte for the hint. TODO: discuss other special `<video>` attributes. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9056 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'docutils')
-rw-r--r--docutils/HISTORY.txt2
-rw-r--r--docutils/docutils/writers/html5_polyglot/__init__.py1
-rw-r--r--docutils/test/functional/expected/misc_rst_html5.html2
3 files changed, 4 insertions, 1 deletions
diff --git a/docutils/HISTORY.txt b/docutils/HISTORY.txt
index 3e88d9ac1..1119f5246 100644
--- a/docutils/HISTORY.txt
+++ b/docutils/HISTORY.txt
@@ -86,6 +86,8 @@ Changes Since 0.18.1
* docutils/writers/html5_polyglot/__init__.py
- Add space before "charset" meta tag closing sequence.
+ - Remove class value "controls" from an `image` node with video content
+ after converting it to a "control" attribute of the <video> tag.
* docutils/writers/pep_html/
diff --git a/docutils/docutils/writers/html5_polyglot/__init__.py b/docutils/docutils/writers/html5_polyglot/__init__.py
index e8c67da28..f5a796819 100644
--- a/docutils/docutils/writers/html5_polyglot/__init__.py
+++ b/docutils/docutils/writers/html5_polyglot/__init__.py
@@ -284,6 +284,7 @@ class HTMLTranslator(_html_base.HTMLTranslator):
atts['class'] = 'align-%s' % node['align']
if 'controls' in node['classes']:
atts['controls'] = 'controls'
+ node['classes'].remove('controls')
atts['title'] = node.get('alt', uri)
if getattr(self.settings, 'image_loading', None) == 'lazy':
atts['loading'] = 'lazy'
diff --git a/docutils/test/functional/expected/misc_rst_html5.html b/docutils/test/functional/expected/misc_rst_html5.html
index 2fd610a2e..0f992d0c5 100644
--- a/docutils/test/functional/expected/misc_rst_html5.html
+++ b/docutils/test/functional/expected/misc_rst_html5.html
@@ -134,7 +134,7 @@ 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>
<figure class="align-center">
-<video class="controls" controls="controls" src="../../../docs/user/rst/images/pens.mp4" title="test video in a figure" width="200">
+<video controls="controls" src="../../../docs/user/rst/images/pens.mp4" title="test video in a figure" width="200">
<a href="../../../docs/user/rst/images/pens.mp4">test video in a figure</a>
</video>
<figcaption>