|
From: <mi...@us...> - 2022-04-29 16:24:21
|
Revision: 9054
http://sourceforge.net/p/docutils/code/9054
Author: milde
Date: 2022-04-29 16:24:18 +0000 (Fri, 29 Apr 2022)
Log Message:
-----------
Small fixes to HTML5 output.
Stop writing an empty line before the "footer" closing tag.
Add space before "charset" meta tag closing sequence.
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/docutils/writers/_html_base.py
trunk/docutils/docutils/writers/html5_polyglot/__init__.py
trunk/docutils/test/functional/expected/footnotes_html5.html
trunk/docutils/test/functional/expected/math_output_mathml.html
trunk/docutils/test/functional/expected/misc_rst_html5.html
trunk/docutils/test/functional/expected/standalone_rst_html5.html
trunk/docutils/test/test_writers/test_html5_polyglot_parts.py
Added Paths:
-----------
trunk/docutils/test/test_writers/test_html5_template.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2022-04-14 14:52:57 UTC (rev 9053)
+++ trunk/docutils/HISTORY.txt 2022-04-29 16:24:18 UTC (rev 9054)
@@ -81,7 +81,12 @@
- Add 'html writers' to `config_section_dependencies`. Fixes bug #443.
- Write table column widths with 3 digits precision. Fixes bug #444.
+ - Stop writing an empty line before the "footer" closing tag.
+* docutils/writers/html5_polyglot/__init__.py
+
+ - Add space before "charset" meta tag closing sequence.
+
* docutils/writers/pep_html/
- Use "https:" scheme in "python_home" URL default.
Modified: trunk/docutils/docutils/writers/_html_base.py
===================================================================
--- trunk/docutils/docutils/writers/_html_base.py 2022-04-14 14:52:57 UTC (rev 9053)
+++ trunk/docutils/docutils/writers/_html_base.py 2022-04-29 16:24:18 UTC (rev 9054)
@@ -239,7 +239,7 @@
head_prefix_template = ('<html xmlns="http://www.w3.org/1999/xhtml"'
' xml:lang="%(lang)s" lang="%(lang)s">\n<head>\n')
- content_type = '<meta charset="%s"/>\n'
+ content_type = '<meta charset="%s" />\n'
generator = ('<meta name="generator" content="Docutils %s: '
'https://docutils.sourceforge.io/" />\n')
Modified: trunk/docutils/docutils/writers/html5_polyglot/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/html5_polyglot/__init__.py 2022-04-14 14:52:57 UTC (rev 9053)
+++ trunk/docutils/docutils/writers/html5_polyglot/__init__.py 2022-04-29 16:24:18 UTC (rev 9054)
@@ -248,7 +248,7 @@
start = self.context.pop()
footer = [self.starttag(node, 'footer')]
footer.extend(self.body[start:])
- footer.append('\n</footer>\n')
+ footer.append('</footer>\n')
self.footer.extend(footer)
self.body_suffix[:0] = footer
del self.body[start:]
Modified: trunk/docutils/test/functional/expected/footnotes_html5.html
===================================================================
--- trunk/docutils/test/functional/expected/footnotes_html5.html 2022-04-14 14:52:57 UTC (rev 9053)
+++ trunk/docutils/test/functional/expected/footnotes_html5.html 2022-04-29 16:24:18 UTC (rev 9054)
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
-<meta charset="utf-8"/>
+<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="generator" content="Docutils 0.19b.dev: https://docutils.sourceforge.io/" />
<title>Test footnote and citation rendering</title>
Modified: trunk/docutils/test/functional/expected/math_output_mathml.html
===================================================================
--- trunk/docutils/test/functional/expected/math_output_mathml.html 2022-04-14 14:52:57 UTC (rev 9053)
+++ trunk/docutils/test/functional/expected/math_output_mathml.html 2022-04-29 16:24:18 UTC (rev 9054)
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
-<meta charset="utf-8"/>
+<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="generator" content="Docutils 0.19b.dev: https://docutils.sourceforge.io/" />
<title>Mathematics</title>
Modified: trunk/docutils/test/functional/expected/misc_rst_html5.html
===================================================================
--- trunk/docutils/test/functional/expected/misc_rst_html5.html 2022-04-14 14:52:57 UTC (rev 9053)
+++ trunk/docutils/test/functional/expected/misc_rst_html5.html 2022-04-29 16:24:18 UTC (rev 9054)
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
-<meta charset="utf-8"/>
+<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="generator" content="Docutils 0.19b.dev: https://docutils.sourceforge.io/" />
<title>Additional tests with HTML 5</title>
Modified: trunk/docutils/test/functional/expected/standalone_rst_html5.html
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_html5.html 2022-04-14 14:52:57 UTC (rev 9053)
+++ trunk/docutils/test/functional/expected/standalone_rst_html5.html 2022-04-29 16:24:18 UTC (rev 9054)
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
-<meta charset="utf-8"/>
+<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="generator" content="Docutils 0.19b.dev: https://docutils.sourceforge.io/" />
<title>reStructuredText Test Document</title>
@@ -1783,7 +1783,6 @@
<footer>
<p>Document footer</p>
<p><a class="reference external image-reference" href="http://www.w3.org/TR/html5/"><img alt="Conforms to HTML 5" src="http://www.w3.org/html/logo/badge/html5-badge-h-css3-semantics.png" style="width: 88px; height: 31px;" /></a> <a class="reference external image-reference" href="http://validator.w3.org/check?uri=referer"><img alt="Check validity!" src="https://www.w3.org/Icons/ValidatorSuite/vs-blue-190.png" style="width: 88px; height: 31px;" /></a> <a class="reference external image-reference" href="http://jigsaw.w3.org/css-validator/check/referer"><img alt="Valid CSS 2.1!" src="http://jigsaw.w3.org/css-validator/images/vcss" style="width: 88px; height: 31px;" /></a></p>
-
</footer>
</body>
</html>
Modified: trunk/docutils/test/test_writers/test_html5_polyglot_parts.py
===================================================================
--- trunk/docutils/test/test_writers/test_html5_polyglot_parts.py 2022-04-14 14:52:57 UTC (rev 9053)
+++ trunk/docutils/test/test_writers/test_html5_polyglot_parts.py 2022-04-29 16:24:18 UTC (rev 9054)
@@ -26,7 +26,7 @@
settings_default_overrides = HtmlWriterPublishPartsTestCase.settings_default_overrides.copy()
settings_default_overrides['section_self_link'] = True
- standard_content_type_template = '<meta charset="%s"/>\n'
+ standard_content_type_template = '<meta charset="%s" />\n'
standard_generator_template = '<meta name="generator"' \
' content="Docutils %s: https://docutils.sourceforge.io/" />\n'
standard_viewport_template = '<meta name="viewport"' \
Added: trunk/docutils/test/test_writers/test_html5_template.py
===================================================================
--- trunk/docutils/test/test_writers/test_html5_template.py (rev 0)
+++ trunk/docutils/test/test_writers/test_html5_template.py 2022-04-29 16:24:18 UTC (rev 9054)
@@ -0,0 +1,234 @@
+#!/usr/bin/env python3
+
+# $Id$
+# Author: David Goodger <go...@py...>
+# Copyright: This module has been placed in the public domain.
+
+"""
+Tests for the HTML writer.
+"""
+
+import os
+import platform
+
+if __name__ == '__main__':
+ import __init__ # noqa: F401
+from test_writers import DocutilsTestSupport
+
+
+def suite():
+ settings = {'template': os.path.join(DocutilsTestSupport.testroot,
+ 'data', 'full-template.txt'),
+ 'stylesheet_path': '/test.css',
+ 'embed_stylesheet': 0}
+ s = DocutilsTestSupport.PublishTestSuite('html5', suite_settings=settings)
+ s.generateTests(totest)
+ return s
+
+
+if platform.system() == "Windows":
+ drive_prefix = os.path.splitdrive(os.getcwd())[0]
+else:
+ drive_prefix = ""
+
+
+totest = {}
+
+totest['template'] = [
+["""\
+================
+ Document Title
+================
+----------
+ Subtitle
+----------
+
+:Author: Me
+
+.. footer:: footer text
+
+Section
+=======
+
+Some text.
+""",
+r'''head_prefix = """\
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>"""
+
+
+head = """\
+<meta charset="utf-8" />
+<meta name="viewport" content="width=device-width, initial-scale=1" />
+<meta name="generator" content="Docutils %(version)s: https://docutils.sourceforge.io/" />
+<title>Document Title</title>
+<meta name="author" content="Me" />"""
+
+
+stylesheet = """\
+<link rel="stylesheet" href="%(drive)s/test.css" type="text/css" />"""
+
+
+body_prefix = """\
+</head>
+<body>
+<main id="document-title">"""
+
+
+body_pre_docinfo = """\
+<h1 class="title">Document Title</h1>
+<p class="subtitle" id="subtitle">Subtitle</p>"""
+
+
+docinfo = """\
+<dl class="docinfo simple">
+<dt class="author">Author<span class="colon">:</span></dt>
+<dd class="author"><p>Me</p></dd>
+</dl>"""
+
+
+body = """\
+<section id="section">
+<h2>Section</h2>
+<p>Some text.</p>
+</section>"""
+
+
+body_suffix = """\
+</main>
+<footer>
+<p>footer text</p>
+</footer>
+</body>
+</html>"""
+
+
+head_prefix = """\
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>"""
+
+
+head = """\
+<meta charset="utf-8" />
+<meta name="viewport" content="width=device-width, initial-scale=1" />
+<meta name="generator" content="Docutils %(version)s: https://docutils.sourceforge.io/" />
+<title>Document Title</title>
+<meta name="author" content="Me" />"""
+
+
+stylesheet = """\
+<link rel="stylesheet" href="%(drive)s/test.css" type="text/css" />"""
+
+
+body_prefix = """\
+</head>
+<body>
+<main id="document-title">"""
+
+
+body_pre_docinfo = """\
+<h1 class="title">Document Title</h1>
+<p class="subtitle" id="subtitle">Subtitle</p>"""
+
+
+docinfo = """\
+<dl class="docinfo simple">
+<dt class="author">Author<span class="colon">:</span></dt>
+<dd class="author"><p>Me</p></dd>
+</dl>"""
+
+
+body = """\
+<section id="section">
+<h2>Section</h2>
+<p>Some text.</p>
+</section>"""
+
+
+body_suffix = """\
+</main>
+<footer>
+<p>footer text</p>
+</footer>
+</body>
+</html>"""
+
+
+title = """\
+Document Title"""
+
+
+subtitle = """\
+Subtitle"""
+
+
+header = """\
+"""
+
+
+footer = """\
+<footer>
+<p>footer text</p>
+</footer>"""
+
+
+meta = """\
+<meta charset="utf-8" />
+<meta name="viewport" content="width=device-width, initial-scale=1" />
+<meta name="generator" content="Docutils %(version)s: https://docutils.sourceforge.io/" />
+<meta name="author" content="Me" />"""
+
+
+fragment = """\
+<section id="section">
+<h2>Section</h2>
+<p>Some text.</p>
+</section>"""
+
+
+html_prolog = """\
+<!DOCTYPE html>"""
+
+
+html_head = """\
+<meta charset="%%s" />
+<meta name="viewport" content="width=device-width, initial-scale=1" />
+<meta name="generator" content="Docutils %(version)s: https://docutils.sourceforge.io/" />
+<title>Document Title</title>
+<meta name="author" content="Me" />"""
+
+
+html_title = """\
+<h1 class="title">Document Title</h1>"""
+
+
+html_subtitle = """\
+<p class="subtitle" id="subtitle">Subtitle</p>"""
+
+
+html_body = """\
+<main id="document-title">
+<h1 class="title">Document Title</h1>
+<p class="subtitle" id="subtitle">Subtitle</p>
+<dl class="docinfo simple">
+<dt class="author">Author<span class="colon">:</span></dt>
+<dd class="author"><p>Me</p></dd>
+</dl>
+<section id="section">
+<h2>Section</h2>
+<p>Some text.</p>
+</section>
+</main>
+<footer>
+<p>footer text</p>
+</footer>"""
+''' % {'version': DocutilsTestSupport.docutils.__version__,
+ 'drive': drive_prefix,
+ }]
+]
+
+if __name__ == '__main__':
+ import unittest
+ unittest.main(defaultTest='suite')
Property changes on: trunk/docutils/test/test_writers/test_html5_template.py
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|