From fda61f477e7f8a61ffc3bc3f81141a8b7b276c76 Mon Sep 17 00:00:00 2001 From: milde Date: Thu, 18 Aug 2016 21:40:00 +0000 Subject: [PATCH] Rename html_plain writer to html5_polyglott. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@7969 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- docs/user/html.txt | 26 ++++++------ docutils/writers/__init__.py | 5 +-- docutils/writers/html4css1/__init__.py | 2 +- .../{html_plain => html5_polyglot}/__init__.py | 4 +- .../{html_plain => html5_polyglot}/math.css | 0 .../{html_plain => html5_polyglot}/minimal.css | 0 .../{html_plain => html5_polyglot}/plain.css | 0 .../{html_plain => html5_polyglot}/template.txt | 0 setup.py | 12 +++--- ...ml_plain.html => footnotes_html5_polyglot.html} | 0 ...ain.html => standalone_rst_html5_polyglot.html} | 0 test/functional/input/data/math.css | 2 +- test/functional/input/data/minimal.css | 2 +- test/functional/input/data/plain.css | 2 +- ...plain.txt => standalone_rst_html5_polyglot.txt} | 0 ...s_html_plain.py => footnotes_html5_polyglot.py} | 2 +- test/functional/tests/standalone_rst_html_plain.py | 4 +- test/test_writers/test_html4css1_misc.py | 2 +- ...l_plain_misc.py => test_html5_polyglot_misc.py} | 46 +++++++++++----------- 19 files changed, 54 insertions(+), 55 deletions(-) rename docutils/writers/{html_plain => html5_polyglot}/__init__.py (99%) rename docutils/writers/{html_plain => html5_polyglot}/math.css (100%) rename docutils/writers/{html_plain => html5_polyglot}/minimal.css (100%) rename docutils/writers/{html_plain => html5_polyglot}/plain.css (100%) rename docutils/writers/{html_plain => html5_polyglot}/template.txt (100%) rename test/functional/expected/{footnotes_html_plain.html => footnotes_html5_polyglot.html} (100%) rename test/functional/expected/{standalone_rst_html_plain.html => standalone_rst_html5_polyglot.html} (100%) rename test/functional/input/{standalone_rst_html_plain.txt => standalone_rst_html5_polyglot.txt} (100%) rename test/functional/tests/{footnotes_html_plain.py => footnotes_html5_polyglot.py} (89%) rename test/test_writers/{test_html_plain_misc.py => test_html5_polyglot_misc.py} (87%) diff --git a/docs/user/html.txt b/docs/user/html.txt index d30aa8d75..e104b3ed5 100644 --- a/docs/user/html.txt +++ b/docs/user/html.txt @@ -12,17 +12,17 @@ Overview * `Generic HTML writers`_ - =========== ============== ============== ================= =========== - name alias(es) `front-end`_ HTML version CSS version - =========== ============== ============== ================= =========== - html4css1_ html4 rst2html4.py `XHTML 1 `CSS 1`_ + =============== ========== ============== ================= =========== + name alias(es) `front-end`_ HTML version CSS version + =============== ========== ============== ================= =========== + html4css1_ html4 rst2html4.py `XHTML 1 `CSS 1`_ Transitional`_ - .. html_ rst2html.py `XHTML 1 `CSS 1`_ + .. html_ rst2html.py `XHTML 1 `CSS 1`_ Transitional`_ - html_plain_ html5_ rst2html5.py `HTML5`_ `CSS 3`_ - =========== ============== ============== ================= =========== + html5_polyglot_ html5_ rst2html5.py `HTML5`_ `CSS 3`_ + =============== ========== ============== ================= =========== * `Special HTML writers`_ @@ -87,14 +87,14 @@ formatting hints and are tagged as "text/html" (instead of .. _html4css1.css: ../../docutils/writers/html4css1/html4css1.css -html_plain -~~~~~~~~~~ +html5_polyglot +~~~~~~~~~~~~~~ :aliases: html5_ :front-end: rst2html5.py_ -:config: `[html-plain writer]`_ +:config: `[html-polyglot writer]`_ -The ``html_plain`` writer generates `polyglot HTML`_ output, valid XML that +The ``html5_polyglot`` writer generates `polyglot HTML`_ output, valid XML that is compatible with `HTML5`_. New features and elements will only be used if they are widely supported to make documents `viewable with any browser`_. @@ -109,8 +109,8 @@ New in Docutils 0.13 .. _rst2html5.py: tools.html#rst2html5-py .. _[html-plain writer]: config.html#html-plain-writer -.. _minimal.css: ../../docutils/writers/html_plain/minimal.css -.. _plain.css: ../../docutils/writers/html_plain/plain.css +.. _minimal.css: ../../docutils/writers/html5_polyglot/minimal.css +.. _plain.css: ../../docutils/writers/html5_polyglot/plain.css .. _custom style sheets: ../howto/html-stylesheets.html .. _viewable with any browser: http://www.anybrowser.org/campaign diff --git a/docutils/writers/__init__.py b/docutils/writers/__init__.py index b7129b84b..70b028f81 100644 --- a/docutils/writers/__init__.py +++ b/docutils/writers/__init__.py @@ -122,15 +122,14 @@ class UnfilteredWriter(Writer): _writer_aliases = { 'html': 'html4css1', # may change to html5 some day 'html4': 'html4css1', - 'html5': 'html_plain', # may be replaced with a special HTML 5 writer - 'html-plain': 'html_plain', + 'html5': 'html5_polyglot', 'latex': 'latex2e', 'pprint': 'pseudoxml', 'pformat': 'pseudoxml', 'pdf': 'rlpdf', 's5': 's5_html', 'xelatex': 'xetex', - 'xhtml': 'html_plain', + 'xhtml': 'html5_polyglot', 'xhtml10': 'html4css1', 'xml': 'docutils_xml'} diff --git a/docutils/writers/html4css1/__init__.py b/docutils/writers/html4css1/__init__.py index 5d97cf548..6b5f35b47 100644 --- a/docutils/writers/html4css1/__init__.py +++ b/docutils/writers/html4css1/__init__.py @@ -47,7 +47,7 @@ class Writer(writers.Writer): os.path.abspath(os.path.dirname(__file__)), # for math.css os.path.abspath(os.path.join( - os.path.dirname(os.path.dirname(__file__)), 'html_plain')) + os.path.dirname(os.path.dirname(__file__)), 'html5_polyglot')) ] default_template = 'template.txt' diff --git a/docutils/writers/html_plain/__init__.py b/docutils/writers/html5_polyglot/__init__.py similarity index 99% rename from docutils/writers/html_plain/__init__.py rename to docutils/writers/html5_polyglot/__init__.py index ca1313ec6..d938c0d10 100644 --- a/docutils/writers/html_plain/__init__.py +++ b/docutils/writers/html5_polyglot/__init__.py @@ -203,7 +203,7 @@ class Writer(writers.Writer): class HTMLTranslator(nodes.NodeVisitor): """ - This writer generates `polyglott markup`: HTML 5 that is also valid XML. + This writer generates `polyglot markup`: HTML 5 that is also valid XML. """ xml_declaration = '\n' @@ -1255,7 +1255,7 @@ class HTMLTranslator(nodes.NodeVisitor): pass # never reached # Meta tags: 'lang' attribute replaced by 'xml:lang' in XHTML 1.1 - # HTML5/polyglott recommends using both + # HTML5/polyglot recommends using both def visit_meta(self, node): if node.hasattr('lang'): node['xml:lang'] = node['lang'] diff --git a/docutils/writers/html_plain/math.css b/docutils/writers/html5_polyglot/math.css similarity index 100% rename from docutils/writers/html_plain/math.css rename to docutils/writers/html5_polyglot/math.css diff --git a/docutils/writers/html_plain/minimal.css b/docutils/writers/html5_polyglot/minimal.css similarity index 100% rename from docutils/writers/html_plain/minimal.css rename to docutils/writers/html5_polyglot/minimal.css diff --git a/docutils/writers/html_plain/plain.css b/docutils/writers/html5_polyglot/plain.css similarity index 100% rename from docutils/writers/html_plain/plain.css rename to docutils/writers/html5_polyglot/plain.css diff --git a/docutils/writers/html_plain/template.txt b/docutils/writers/html5_polyglot/template.txt similarity index 100% rename from docutils/writers/html_plain/template.txt rename to docutils/writers/html5_polyglot/template.txt diff --git a/setup.py b/setup.py index 2da25655c..9d3cf0aba 100755 --- a/setup.py +++ b/setup.py @@ -135,7 +135,7 @@ what-you-see-is-what-you-get plaintext markup syntax.""", # wrap at col 60 'docutils.utils.math', 'docutils.writers', 'docutils.writers.html4css1', - 'docutils.writers.html_plain', + 'docutils.writers.html5_polyglot', # 'docutils.writers.xhtml11', # moved to the sandbox 'docutils.writers.pep_html', 'docutils.writers.s5_html', @@ -146,11 +146,11 @@ what-you-see-is-what-you-get plaintext markup syntax.""", # wrap at col 60 ], 'data_files': ([('docutils/parsers/rst/include', glob.glob('docutils/parsers/rst/include/*.txt')), - ('docutils/writers/html_plain', - ['docutils/writers/html_plain/minimal.css', - 'docutils/writers/html_plain/plain.css', - 'docutils/writers/html_plain/math.css', - 'docutils/writers/html_plain/template.txt']), + ('docutils/writers/html5_polyglot', + ['docutils/writers/html5_polyglot/minimal.css', + 'docutils/writers/html5_polyglot/plain.css', + 'docutils/writers/html5_polyglot/math.css', + 'docutils/writers/html5_polyglot/template.txt']), ('docutils/writers/html4css1', ['docutils/writers/html4css1/html4css1.css', 'docutils/writers/html4css1/template.txt']), diff --git a/test/functional/expected/footnotes_html_plain.html b/test/functional/expected/footnotes_html5_polyglot.html similarity index 100% rename from test/functional/expected/footnotes_html_plain.html rename to test/functional/expected/footnotes_html5_polyglot.html diff --git a/test/functional/expected/standalone_rst_html_plain.html b/test/functional/expected/standalone_rst_html5_polyglot.html similarity index 100% rename from test/functional/expected/standalone_rst_html_plain.html rename to test/functional/expected/standalone_rst_html5_polyglot.html diff --git a/test/functional/input/data/math.css b/test/functional/input/data/math.css index 4e0ec724d..7756f5b1a 120000 --- a/test/functional/input/data/math.css +++ b/test/functional/input/data/math.css @@ -1 +1 @@ -../../../../docutils/writers/html_plain/math.css \ No newline at end of file +../../../../docutils/writers/html5_polyglot/math.css \ No newline at end of file diff --git a/test/functional/input/data/minimal.css b/test/functional/input/data/minimal.css index 899b6bbba..daee5f660 120000 --- a/test/functional/input/data/minimal.css +++ b/test/functional/input/data/minimal.css @@ -1 +1 @@ -../../../../docutils/writers/html_plain/minimal.css \ No newline at end of file +../../../../docutils/writers/html5_polyglot/minimal.css \ No newline at end of file diff --git a/test/functional/input/data/plain.css b/test/functional/input/data/plain.css index 77def792e..8febee3af 120000 --- a/test/functional/input/data/plain.css +++ b/test/functional/input/data/plain.css @@ -1 +1 @@ -../../../../docutils/writers/html_plain/plain.css \ No newline at end of file +../../../../docutils/writers/html5_polyglot/plain.css \ No newline at end of file diff --git a/test/functional/input/standalone_rst_html_plain.txt b/test/functional/input/standalone_rst_html5_polyglot.txt similarity index 100% rename from test/functional/input/standalone_rst_html_plain.txt rename to test/functional/input/standalone_rst_html5_polyglot.txt diff --git a/test/functional/tests/footnotes_html_plain.py b/test/functional/tests/footnotes_html5_polyglot.py similarity index 89% rename from test/functional/tests/footnotes_html_plain.py rename to test/functional/tests/footnotes_html5_polyglot.py index 27437927e..64b2f66b7 100644 --- a/test/functional/tests/footnotes_html_plain.py +++ b/test/functional/tests/footnotes_html5_polyglot.py @@ -2,7 +2,7 @@ exec(open('functional/tests/_standalone_rst_defaults.py').read()) # Source and destination file names. test_source = "footnotes.txt" -test_destination = "footnotes_html_plain.html" +test_destination = "footnotes_html5_polyglot.html" # Keyword parameters passed to publish_file. writer_name = "html-plain" diff --git a/test/functional/tests/standalone_rst_html_plain.py b/test/functional/tests/standalone_rst_html_plain.py index 1ea058c3c..225a35f9f 100644 --- a/test/functional/tests/standalone_rst_html_plain.py +++ b/test/functional/tests/standalone_rst_html_plain.py @@ -1,8 +1,8 @@ exec(open('functional/tests/_standalone_rst_defaults.py').read()) # Source and destination file names. -test_source = "standalone_rst_html_plain.txt" -test_destination = "standalone_rst_html_plain.html" +test_source = "standalone_rst_html5_polyglot.txt" +test_destination = "standalone_rst_html5_polyglot.html" # Keyword parameters passed to publish_file. writer_name = "html-plain" diff --git a/test/test_writers/test_html4css1_misc.py b/test/test_writers/test_html4css1_misc.py index a24502c4c..a9f95c31b 100755 --- a/test/test_writers/test_html4css1_misc.py +++ b/test/test_writers/test_html4css1_misc.py @@ -100,7 +100,7 @@ class SettingsTestCase(DocutilsTestSupport.StandardTestCase): styles = core.publish_parts(self.data, writer_name='html4css1', settings_overrides=mysettings)['stylesheet'] self.assertIn('docutils/writers/html4css1/html4css1.css', styles) - self.assertIn('docutils/writers/html_plain/math.css', styles) + self.assertIn('docutils/writers/html5_polyglot/math.css', styles) def test_custom_stylesheet_linked(self): # default + custom style sheet, linked diff --git a/test/test_writers/test_html_plain_misc.py b/test/test_writers/test_html5_polyglot_misc.py similarity index 87% rename from test/test_writers/test_html_plain_misc.py rename to test/test_writers/test_html5_polyglot_misc.py index c31c098ed..eae188c00 100644 --- a/test/test_writers/test_html_plain_misc.py +++ b/test/test_writers/test_html5_polyglot_misc.py @@ -25,7 +25,7 @@ class EncodingTestCase(DocutilsTestSupport.StandardTestCase): 'stylesheet': '', '_disable_config': True,} result = core.publish_string( - u'EUR = \u20ac', writer_name='html_plain', + u'EUR = \u20ac', writer_name='html5_polyglot', settings_overrides=settings_overrides) # Encoding a euro sign with latin1 doesn't work, so the # xmlcharrefreplace handler is used. @@ -50,7 +50,7 @@ first term: second term: second def """ - result = core.publish_string(data, writer_name='html_plain', + result = core.publish_string(data, writer_name='html5_polyglot', settings_overrides=self.settings_overrides) self.assertIn(b('
second term:
'), result) @@ -67,7 +67,7 @@ first term: second term: second def """ - result = core.publish_string(data, writer_name='html_plain', + result = core.publish_string(data, writer_name='html5_polyglot', settings_overrides=self.settings_overrides) self.assertIn(b('
second term:
'), result) @@ -79,7 +79,7 @@ class SettingsTestCase(DocutilsTestSupport.StandardTestCase): def test_default_stylesheet(self): # default style sheet, embedded mysettings = {'_disable_config': True,} - styles = core.publish_parts(self.data, writer_name='html_plain', + styles = core.publish_parts(self.data, writer_name='html5_polyglot', settings_overrides=mysettings)['stylesheet'] self.assertIn('Minimal style sheet ' 'for the HTML output of Docutils.', styles) @@ -88,19 +88,19 @@ class SettingsTestCase(DocutilsTestSupport.StandardTestCase): # default style sheet, linked mysettings = {'_disable_config': True, 'embed_stylesheet': False} - styles = core.publish_parts(self.data, writer_name='html_plain', + styles = core.publish_parts(self.data, writer_name='html5_polyglot', settings_overrides=mysettings)['stylesheet'] - self.assertIn('docutils/writers/html_plain/minimal.css', styles) + self.assertIn('docutils/writers/html5_polyglot/minimal.css', styles) def test_math_stylesheet_linked(self): # default + math style sheet, linked mysettings = {'_disable_config': True, 'embed_stylesheet': False, 'stylesheet_path': 'minimal.css, math.css'} - styles = core.publish_parts(self.data, writer_name='html_plain', + styles = core.publish_parts(self.data, writer_name='html5_polyglot', settings_overrides=mysettings)['stylesheet'] - self.assertIn('docutils/writers/html_plain/minimal.css', styles) - self.assertIn('docutils/writers/html_plain/math.css', styles) + self.assertIn('docutils/writers/html5_polyglot/minimal.css', styles) + self.assertIn('docutils/writers/html5_polyglot/math.css', styles) def test_custom_stylesheet_linked(self): # default + custom style sheet, linked @@ -108,30 +108,30 @@ class SettingsTestCase(DocutilsTestSupport.StandardTestCase): 'embed_stylesheet': False, 'stylesheet_path': 'minimal.css, ' 'data/ham.css'} - styles = core.publish_parts(self.data, writer_name='html_plain', + styles = core.publish_parts(self.data, writer_name='html5_polyglot', settings_overrides=mysettings)['stylesheet'] - self.assertIn('docutils/writers/html_plain/minimal.css', styles) + self.assertIn('docutils/writers/html5_polyglot/minimal.css', styles) self.assertIn('href="data/ham.css"', styles) def test_custom_stylesheet_dir(self): mysettings = {'_disable_config': True, 'embed_stylesheet': False, - 'stylesheet_dirs': ('../docutils/writers/html_plain/', + 'stylesheet_dirs': ('../docutils/writers/html5_polyglot/', 'data'), 'stylesheet_path': 'minimal.css, ham.css'} - styles = core.publish_parts(self.data, writer_name='html_plain', + styles = core.publish_parts(self.data, writer_name='html5_polyglot', settings_overrides=mysettings)['stylesheet'] - if os.path.isdir('../docutils/writers/html_plain/'): - self.assertIn('docutils/writers/html_plain/minimal.css', styles) + if os.path.isdir('../docutils/writers/html5_polyglot/'): + self.assertIn('docutils/writers/html5_polyglot/minimal.css', styles) self.assertIn('href="data/ham.css"', styles) def test_custom_stylesheet_dir_embedded(self): mysettings = {'_disable_config': True, 'embed_stylesheet': True, - 'stylesheet_dirs': ('../docutils/writers/html_plain/', + 'stylesheet_dirs': ('../docutils/writers/html5_polyglot/', 'data'), 'stylesheet_path': 'ham.css'} - styles = core.publish_parts(self.data, writer_name='html_plain', + styles = core.publish_parts(self.data, writer_name='html5_polyglot', settings_overrides=mysettings)['stylesheet'] self.assertIn('dl.docutils dd {\n margin-bottom: 0.5em }', styles) @@ -150,7 +150,7 @@ class MathTestCase(DocutilsTestSupport.StandardTestCase): def test_math_output_default(self): # HTML with math.css stylesheet (since 0.11) mysettings = {'_disable_config': True,} - styles = core.publish_parts(self.data, writer_name='html_plain', + styles = core.publish_parts(self.data, writer_name='html5_polyglot', settings_overrides=mysettings)['stylesheet'] self.assertIn('convert LaTeX equations to HTML output.', styles) @@ -159,7 +159,7 @@ class MathTestCase(DocutilsTestSupport.StandardTestCase): # use default MathJax URL mysettings = {'_disable_config': True, 'math_output': 'MathJax'} - head = core.publish_parts(self.data, writer_name='html_plain', + head = core.publish_parts(self.data, writer_name='html5_polyglot', settings_overrides=mysettings)['head'] self.assertIn(self.mathjax_script % self.default_mathjax_url, head) @@ -168,14 +168,14 @@ class MathTestCase(DocutilsTestSupport.StandardTestCase): mysettings = {'_disable_config': True, 'math_output': 'mathjax %s' % self.custom_mathjax_url} - head = core.publish_parts(self.data, writer_name='html_plain', + head = core.publish_parts(self.data, writer_name='html5_polyglot', settings_overrides=mysettings)['head'] self.assertIn(self.mathjax_script % self.custom_mathjax_url, head) def test_math_output_html(self): mysettings = {'_disable_config': True, 'math_output': 'HTML'} - head = core.publish_parts(self.data, writer_name='html_plain', + head = core.publish_parts(self.data, writer_name='html5_polyglot', settings_overrides=mysettings)['head'] # There should be no MathJax script when math_output is not MathJax self.assertNotIn('MathJax.js', head) @@ -185,7 +185,7 @@ class MathTestCase(DocutilsTestSupport.StandardTestCase): 'math_output': 'HTML math.css,custom/style.css', 'stylesheet_dirs': ('.', 'functional/input/data'), 'embed_stylesheet': False} - styles = core.publish_parts(self.data, writer_name='html_plain', + styles = core.publish_parts(self.data, writer_name='html5_polyglot', settings_overrides=mysettings)['stylesheet'] self.assertEqual(u"""\ @@ -198,7 +198,7 @@ class MathTestCase(DocutilsTestSupport.StandardTestCase): mysettings = {'_disable_config': True, 'math_output': 'MathJax'} # There should be no math script when text does not contain math - head = core.publish_parts('No math.', writer_name='html_plain')['head'] + head = core.publish_parts('No math.', writer_name='html5_polyglot')['head'] self.assertNotIn('MathJax', head) -- 2.11.4.GIT