diff options
| author | milde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2021-03-09 12:53:57 +0000 |
|---|---|---|
| committer | milde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2021-03-09 12:53:57 +0000 |
| commit | ea5ffb7b7be37d64c7ea8711aaf74b960c1f1e06 (patch) | |
| tree | 40a77e9b9c6dda297596f06224db87abe28e14be /test | |
| parent | 817647c5565dfea3893dbab50a561f12295af800 (diff) | |
| download | docutils-ea5ffb7b7be37d64c7ea8711aaf74b960c1f1e06.tar.gz | |
HTML5 writer: Add a `viewport` meta tag to fix rendering in mobile browsers.
The default behaviour of many mobile browsers is to render for a
virtual viewport size and scale.
This breaks CSS styling with the default stylesheets.
git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@8632 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'test')
| -rw-r--r-- | test/functional/expected/embed_images_html5.html | 1 | ||||
| -rw-r--r-- | test/functional/expected/footnotes_html5.html | 1 | ||||
| -rw-r--r-- | test/functional/expected/math_output_mathml.xhtml | 1 | ||||
| -rw-r--r-- | test/functional/expected/standalone_rst_html5.html | 15 | ||||
| -rw-r--r-- | test/functional/input/data/html5-features.txt | 18 | ||||
| -rw-r--r-- | test/test_writers/test_html5_polyglot_parts.py | 9 |
6 files changed, 21 insertions, 24 deletions
diff --git a/test/functional/expected/embed_images_html5.html b/test/functional/expected/embed_images_html5.html index d211de431..c949a9e88 100644 --- a/test/functional/expected/embed_images_html5.html +++ b/test/functional/expected/embed_images_html5.html @@ -2,6 +2,7 @@ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta charset="utf-8"/> +<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="generator" content="Docutils 0.17b2.dev: http://docutils.sourceforge.net/" /> <title>Embedded Images</title> <link rel="stylesheet" href="../../../docutils/writers/html5_polyglot/minimal.css" type="text/css" /> diff --git a/test/functional/expected/footnotes_html5.html b/test/functional/expected/footnotes_html5.html index a4fc70fe5..2370985bf 100644 --- a/test/functional/expected/footnotes_html5.html +++ b/test/functional/expected/footnotes_html5.html @@ -2,6 +2,7 @@ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta charset="utf-8"/> +<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="generator" content="Docutils 0.17b2.dev: http://docutils.sourceforge.net/" /> <title>Test footnote and citation rendering</title> <link rel="stylesheet" href="../input/data/minimal.css" type="text/css" /> diff --git a/test/functional/expected/math_output_mathml.xhtml b/test/functional/expected/math_output_mathml.xhtml index 2714ff464..bdc05fe6c 100644 --- a/test/functional/expected/math_output_mathml.xhtml +++ b/test/functional/expected/math_output_mathml.xhtml @@ -2,6 +2,7 @@ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta charset="utf-8"/> +<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="generator" content="Docutils 0.17b2.dev: http://docutils.sourceforge.net/" /> <title>Mathematics</title> <link rel="stylesheet" href="../input/data/minimal.css" type="text/css" /> diff --git a/test/functional/expected/standalone_rst_html5.html b/test/functional/expected/standalone_rst_html5.html index c0da96d80..bc864690f 100644 --- a/test/functional/expected/standalone_rst_html5.html +++ b/test/functional/expected/standalone_rst_html5.html @@ -2,6 +2,7 @@ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta charset="utf-8"/> +<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="generator" content="Docutils 0.17b2.dev: http://docutils.sourceforge.net/" /> <title>reStructuredText Test Document</title> <meta name="author" content="David Goodger" /> @@ -12,7 +13,6 @@ <meta name="dcterms.rights" content="This document has been placed in the public domain. You may do with it as you wish. You may copy, modify, redistribute, reattribute, sell, buy, rent, lease, destroy, or improve it, quote it at length, excerpt, incorporate, collate, fold, staple, or mutilate it, or do anything else to it that your or anyone else's heart desires." /> <meta content="reStructuredText, test, parser" name="keywords" /> <meta content="A test document, containing at least one example of each reStructuredText construct." lang="en" name="description" xml:lang="en" /> -<meta content="width=device-width, initial-scale=1" name="viewport" /> <link rel="schema.dcterms" href="http://purl.org/dc/terms/"/> <link rel="stylesheet" href="../input/data/minimal.css" type="text/css" /> <link rel="stylesheet" href="../input/data/plain.css" type="text/css" /> @@ -1256,18 +1256,14 @@ crunchy, now would it?</p></td> <section id="changes-to-the-html4css1-writer"> <h2><a class="toc-backref" href="#toc-entry-43"><span class="sectnum">3</span> Changes to the <cite>html4css1</cite> Writer</a></h2> <ul> -<li><p>Use only meta keywords recognized by HTML 5. +<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> -<div class="admonition hint"> -<p class="admonition-title">Hint</p> -<p>Use a <a class="reference external" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Viewport_meta_tag">viewport meta tag</a> <a class="footnote-reference brackets" href="#footnote-15" id="footnote-reference-29">15</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="footnote-reference brackets" href="#footnote-15" id="footnote-reference-29">15</a> to tell mobile browsers to use the device-width as viewport.</p> -</div> </li> <li><p>Set table column widths with <style="width: ...">, not "width" argument.</p></li> <li><p>Horizontal alignment of table heads with CSS.</p></li> -<li><p>Field lists as styled definition lists.</p></li> <li><p>Do not drop paragraph objects, use CSS rules to prevent unwanted vertical space.</p></li> <li><p>Put subtitles in <p> elements.</p></li> @@ -1277,11 +1273,12 @@ See <span class="docutils literal">minimal.css</span> and <span class="docutils <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="footnote-reference brackets" href="#footnote-16" id="footnote-reference-30">16</a>.</p> </li> -<li><p>Use HTML text-level tags <small>, <s>, <q>, <dfn>, <var>, <samp>, <kbd>, +<li><p>Use HTML5 tags <small>, <s>, <q>, <dfn>, <var>, <samp>, <kbd>, <i>, <b>, <u>, <mark>, and <bdi> if a matching class value is found in <cite>inline</cite> and <cite>literal</cite> elements. Use <ins> and <del> if a matching class value -is found in <cite>inline</cite>, <cite>literal</cite>, or <cite>container</cite> elements.</p></li> +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> </ul> <section id="field-list-rendering"> <h3><a class="toc-backref" href="#toc-entry-44"><span class="sectnum">3.1</span> Field List Rendering</a></h3> diff --git a/test/functional/input/data/html5-features.txt b/test/functional/input/data/html5-features.txt index 8f6475b08..b51f7f5d0 100644 --- a/test/functional/input/data/html5-features.txt +++ b/test/functional/input/data/html5-features.txt @@ -1,26 +1,19 @@ Changes to the `html4css1` Writer ================================= -* Use only meta keywords recognized by HTML 5. +* Use only meta_ keywords recognized by HTML 5. Add HTML5-compatible meta tags for docinfo items "authors", "date", and "copyright". - .. hint:: - - Use a `viewport meta tag`__ to tell mobile browsers - to use the device-width as viewport. + Add a `viewport meta tag`__ to tell mobile browsers + to use the device-width as viewport. - .. meta:: - :viewport: width=device-width, initial-scale=1 - - __ https://developer.mozilla.org/en-US/docs/Web/HTML/Viewport_meta_tag + __ https://developer.mozilla.org/en-US/docs/Web/HTML/Viewport_meta_tag * Set table column widths with <style="width: ...">, not "width" argument. * Horizontal alignment of table heads with CSS. -* Field lists as styled definition lists. - * Do not drop paragraph objects, use CSS rules to prevent unwanted vertical space. @@ -35,11 +28,12 @@ Changes to the `html4css1` Writer __ https://stackoverflow.com/questions/39547412/same-font-size-for-h1-and-h2-in-article -* Use HTML text-level tags <small>, <s>, <q>, <dfn>, <var>, <samp>, <kbd>, +* Use HTML5 tags <small>, <s>, <q>, <dfn>, <var>, <samp>, <kbd>, <i>, <b>, <u>, <mark>, and <bdi> if a matching class value is found in `inline` and `literal` elements. Use <ins> and <del> if a matching class value is found in `inline`, `literal`, or `container` elements. + (See `text-level semantics`_ and `indicating edits`_.) Field List Rendering -------------------- diff --git a/test/test_writers/test_html5_polyglot_parts.py b/test/test_writers/test_html5_polyglot_parts.py index 325eac380..4927f614a 100644 --- a/test/test_writers/test_html5_polyglot_parts.py +++ b/test/test_writers/test_html5_polyglot_parts.py @@ -26,11 +26,14 @@ class Html5WriterPublishPartsTestCase(HtmlWriterPublishPartsTestCase): writer_name = 'html5' standard_content_type_template = ('<meta charset="%s"/>\n') - standard_generator_template = ( - '<meta name="generator"' + standard_generator_template = ('<meta name="generator"' ' content="Docutils %s: http://docutils.sourceforge.net/" />\n') + standard_viewport_template = ('<meta name="viewport"' + ' content="width=device-width, initial-scale=1" />\n') + standard_html_meta_value = (standard_content_type_template - + standard_generator_template % __version__) + + standard_viewport_template + + standard_generator_template % __version__) standard_meta_value = standard_html_meta_value % 'utf-8' standard_html_prolog = '<!DOCTYPE html>\n' |
