|
From: <mi...@us...> - 2021-06-30 07:47:49
|
Revision: 8783
http://sourceforge.net/p/docutils/code/8783
Author: milde
Date: 2021-06-30 07:47:46 +0000 (Wed, 30 Jun 2021)
Log Message:
-----------
HTML5: Support details disclosure elements
Items of a definition list with class argument "details" are
converted to `details disclosure elements`.
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/RELEASE-NOTES.txt
trunk/docutils/docutils/writers/_html_base.py
trunk/docutils/docutils/writers/html4css1/__init__.py
trunk/docutils/docutils/writers/html5_polyglot/minimal.css
trunk/docutils/docutils/writers/html5_polyglot/plain.css
trunk/docutils/docutils/writers/html5_polyglot/responsive.css
trunk/docutils/test/functional/expected/standalone_rst_html5.html
trunk/docutils/test/functional/input/data/html5-features.txt
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2021-06-30 07:47:30 UTC (rev 8782)
+++ trunk/docutils/HISTORY.txt 2021-06-30 07:47:46 UTC (rev 8783)
@@ -76,10 +76,13 @@
- Removed attribute ``HTMLTranslator.topic_classes``
+ - Items of a definition list with class argument "details" are
+ converted to `details disclosure elements` (not with HTML4).
+
* docutils/writers/html4css1/__init__.py:
- - Overwrite methods using semantic tags and roles to keep backwards
- compatibility.
+ - Overwrite methods in _html_base.HTMLTranslator that use HTM5 tags.
+
* docutils/writers/latex2e/__init__.py
Modified: trunk/docutils/RELEASE-NOTES.txt
===================================================================
--- trunk/docutils/RELEASE-NOTES.txt 2021-06-30 07:47:30 UTC (rev 8782)
+++ trunk/docutils/RELEASE-NOTES.txt 2021-06-30 07:47:46 UTC (rev 8783)
@@ -22,9 +22,6 @@
* `html5` writer:
- - Use <summary> and <details> tags for term and definition of a
- definition list with class value "details".
-
- Do not longer set the "footnote-reference" class value for footnote
references. Since 0.18, you can use the CSS selector
``[role="doc-noteref"]`` instead of ``.footnote-reference``
@@ -94,6 +91,9 @@
Use class value "backrefs" instead of "fn-backref" for a span of
back-references.
+ Items of a definition list with class argument "details" are
+ converted to `details disclosure elements`_.
+
LaTeX:
`legacy_class_functions`_ setting default changed to "False":
admonitions are now environments.
@@ -119,6 +119,8 @@
docs/ref/rst/directives.html#identifier-normalization
.. _id_prefix: docs/user/config.html#id-prefix
.. _auto_id_prefix: docs/user/config.html#auto-id-prefix
+.. _details disclosure elements:
+ https://www.w3.org/TR/html52/interactive-elements.html#the-details-element
Release 0.17.1 (2021-04-16)
Modified: trunk/docutils/docutils/writers/_html_base.py
===================================================================
--- trunk/docutils/docutils/writers/_html_base.py 2021-06-30 07:47:30 UTC (rev 8782)
+++ trunk/docutils/docutils/writers/_html_base.py 2021-06-30 07:47:46 UTC (rev 8783)
@@ -727,24 +727,36 @@
pass
def visit_definition(self, node):
- self.body.append('</dt>\n')
- self.body.append(self.starttag(node, 'dd', ''))
+ if "details" in node.parent.parent['classes']:
+ self.body.append('</summary>\n')
+ else:
+ self.body.append('</dt>\n')
+ self.body.append(self.starttag(node, 'dd', ''))
def depart_definition(self, node):
- self.body.append('</dd>\n')
+ if "details" not in node.parent.parent['classes']:
+ self.body.append('</dd>\n')
def visit_definition_list(self, node):
- classes = ['simple'] if self.is_compactable(node) else []
- self.body.append(self.starttag(node, 'dl', classes=classes))
+ if "details" not in node['classes']:
+ classes = ['simple'] if self.is_compactable(node) else []
+ self.body.append(self.starttag(node, 'dl', classes=classes))
def depart_definition_list(self, node):
- self.body.append('</dl>\n')
+ if "details" not in node['classes']:
+ self.body.append('</dl>\n')
+ # Use a "details" disclosure element if parent has "class" arg "details".
def visit_definition_list_item(self, node):
- pass
+ if "details" in node.parent['classes']:
+ atts = {}
+ if "open" in node.parent['classes']:
+ atts['open'] = 'open'
+ self.body.append(self.starttag(node, 'details', **atts))
def depart_definition_list_item(self, node):
- pass
+ if "details" in node.parent['classes']:
+ self.body.append('</details>\n')
def visit_description(self, node):
self.body.append(self.starttag(node, 'dd', ''))
@@ -1567,10 +1579,13 @@
self.body.append('</tbody>\n')
def visit_term(self, node):
- # The parent node (definition_list_item) is omitted in HTML.
- self.body.append(self.starttag(node, 'dt', '',
- classes=node.parent['classes'],
- ids=node.parent['ids']))
+ if "details" in node.parent.parent['classes']:
+ self.body.append(self.starttag(node, 'summary', ''))
+ else:
+ # The parent node (definition_list_item) is omitted in HTML.
+ self.body.append(self.starttag(node, 'dt', '',
+ classes=node.parent['classes'],
+ ids=node.parent['ids']))
def depart_term(self, node):
# Leave the end tag to `self.visit_definition()`,
Modified: trunk/docutils/docutils/writers/html4css1/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/html4css1/__init__.py 2021-06-30 07:47:30 UTC (rev 8782)
+++ trunk/docutils/docutils/writers/html4css1/__init__.py 2021-06-30 07:47:46 UTC (rev 8783)
@@ -292,7 +292,7 @@
def depart_compound(self, node):
self.body.append('</div>\n')
- # ersatz for first/last pseudo-classes
+ # ersatz for first/last pseudo-classes, no special handling of "details"
def visit_definition(self, node):
self.body.append('</dt>\n')
self.body.append(self.starttag(node, 'dd', ''))
@@ -308,6 +308,13 @@
def depart_definition_list(self, node):
self.body.append('</dl>\n')
+ # no special handling of "details"
+ def visit_definition_list_item(self, node):
+ pass
+
+ def depart_definition_list_item(self, node):
+ pass
+
# use a table for description lists
def visit_description(self, node):
self.body.append(self.starttag(node, 'td', ''))
@@ -870,7 +877,16 @@
def depart_thead(self, node):
self.body.append('</thead>\n')
+ # no special handling of "details" in definition list
+ def visit_term(self, node):
+ self.body.append(self.starttag(node, 'dt', '',
+ classes=node.parent['classes'],
+ ids=node.parent['ids']))
+ def depart_term(self, node):
+ pass
+
+
class SimpleListChecker(writers._html_base.SimpleListChecker):
"""
Modified: trunk/docutils/docutils/writers/html5_polyglot/minimal.css
===================================================================
--- trunk/docutils/docutils/writers/html5_polyglot/minimal.css 2021-06-30 07:47:30 UTC (rev 8782)
+++ trunk/docutils/docutils/writers/html5_polyglot/minimal.css 2021-06-30 07:47:46 UTC (rev 8783)
@@ -75,6 +75,7 @@
/* Nested Paragraphs */
p:first-child { margin-top: 0; }
p:last-child { margin-bottom: 0; }
+details > p:last-child { margin-bottom: 1em; }
/* Table of Contents */
.contents ul.auto-toc { /* section numbers present */
@@ -265,7 +266,7 @@
/* Images are block-level by default in Docutils */
/* New HTML5 block elements: set display for older browsers */
-img, header, section, footer, aside, nav, main, article, figure, video {
+img, header, footer, main, aside, nav, section, figure, video, details {
display: block;
}
/* inline images */
Modified: trunk/docutils/docutils/writers/html5_polyglot/plain.css
===================================================================
--- trunk/docutils/docutils/writers/html5_polyglot/plain.css 2021-06-30 07:47:30 UTC (rev 8782)
+++ trunk/docutils/docutils/writers/html5_polyglot/plain.css 2021-06-30 07:47:46 UTC (rev 8783)
@@ -80,7 +80,8 @@
margin-bottom: 0.5em;
}
-h1, h2, h3, h4, h5, h6, dd {
+h1, h2, h3, h4, h5, h6,
+dd, details > p:last-child {
margin-bottom: 0.5em;
}
@@ -142,6 +143,10 @@
font-style: normal;
}
+/* disclosures */
+details { padding-left: 1em; }
+summary { margin-left: -1em; }
+
/* Text Blocks */
/* =========== */
Modified: trunk/docutils/docutils/writers/html5_polyglot/responsive.css
===================================================================
--- trunk/docutils/docutils/writers/html5_polyglot/responsive.css 2021-06-30 07:47:30 UTC (rev 8782)
+++ trunk/docutils/docutils/writers/html5_polyglot/responsive.css 2021-06-30 07:47:46 UTC (rev 8783)
@@ -55,7 +55,7 @@
margin-bottom: 0.5em;
}
h1, h2, h3, h4, h5, h6,
-dl > dd {
+dl > dd, details > p:last-child {
margin-bottom: 0.5em;
}
@@ -165,6 +165,10 @@
clear: left;
}
+/* disclosures */
+details { padding-left: 1em; }
+summary { margin-left: -1em; }
+
/* Footnotes and Citations */
.footnote {
font-size: small;
Modified: trunk/docutils/test/functional/expected/standalone_rst_html5.html
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_html5.html 2021-06-30 07:47:30 UTC (rev 8782)
+++ trunk/docutils/test/functional/expected/standalone_rst_html5.html 2021-06-30 07:47:46 UTC (rev 8783)
@@ -148,16 +148,17 @@
<li><p><a class="reference internal" href="#styling-with-class-arguments" id="toc-entry-45"><span class="sectnum">3.2</span> Styling with Class Arguments</a></p>
<ul class="auto-toc">
<li><p><a class="reference internal" href="#description-lists" id="toc-entry-46"><span class="sectnum">3.2.1</span> Description Lists</a></p></li>
-<li><p><a class="reference internal" href="#field-list-variants" id="toc-entry-47"><span class="sectnum">3.2.2</span> Field List Variants</a></p></li>
-<li><p><a class="reference internal" href="#table-variants" id="toc-entry-48"><span class="sectnum">3.2.3</span> Table Variants</a></p></li>
-<li><p><a class="reference internal" href="#numbered-figures" id="toc-entry-49"><span class="sectnum">3.2.4</span> Numbered Figures</a></p></li>
+<li><p><a class="reference internal" href="#details-disclosure-elements" id="toc-entry-47"><span class="sectnum">3.2.2</span> Details disclosure elements</a></p></li>
+<li><p><a class="reference internal" href="#field-list-variants" id="toc-entry-48"><span class="sectnum">3.2.3</span> Field List Variants</a></p></li>
+<li><p><a class="reference internal" href="#table-variants" id="toc-entry-49"><span class="sectnum">3.2.4</span> Table Variants</a></p></li>
+<li><p><a class="reference internal" href="#numbered-figures" id="toc-entry-50"><span class="sectnum">3.2.5</span> Numbered Figures</a></p></li>
</ul>
</li>
-<li><p><a class="reference internal" href="#text-level-semantics" id="toc-entry-50"><span class="sectnum">3.3</span> Text-Level Semantics</a></p></li>
-<li><p><a class="reference internal" href="#indicating-edits" id="toc-entry-51"><span class="sectnum">3.4</span> Indicating Edits</a></p></li>
+<li><p><a class="reference internal" href="#text-level-semantics" id="toc-entry-51"><span class="sectnum">3.3</span> Text-Level Semantics</a></p></li>
+<li><p><a class="reference internal" href="#indicating-edits" id="toc-entry-52"><span class="sectnum">3.4</span> Indicating Edits</a></p></li>
</ul>
</li>
-<li><p><a class="reference internal" href="#error-handling" id="toc-entry-52"><span class="sectnum">4</span> Error Handling</a></p></li>
+<li><p><a class="reference internal" href="#error-handling" id="toc-entry-53"><span class="sectnum">4</span> Error Handling</a></p></li>
</ul>
</nav>
<section id="structural-elements">
@@ -192,7 +193,7 @@
(<a class="reference external" href="http://www.python.org">http://www.python.org</a>), external hyperlinks (<a class="reference external" href="http://www.python.org/">Python</a> <a class="footnote-reference brackets" href="#footnote-7" id="footnote-reference-18" role="doc-noteref"><span class="fn-bracket">[</span>7<span class="fn-bracket">]</span></a>), internal
cross-references (<a class="reference internal" href="#example">example</a>), external hyperlinks with embedded URIs
(<a class="reference external" href="http://www.python.org">Python web site</a>), <a class="reference external" href="http://www.python.org/">anonymous hyperlink
-references</a> <a class="footnote-reference brackets" href="#footnote-7" id="footnote-reference-25" role="doc-noteref"><span class="fn-bracket">[</span>7<span class="fn-bracket">]</span></a> (<a class="reference external" href="https://docutils.sourceforge.io/">a second reference</a> <a class="footnote-reference brackets" href="#footnote-12" id="footnote-reference-26" role="doc-noteref"><span class="fn-bracket">[</span>12<span class="fn-bracket">]</span></a>), footnote references (manually
+references</a> <a class="footnote-reference brackets" href="#footnote-7" id="footnote-reference-26" role="doc-noteref"><span class="fn-bracket">[</span>7<span class="fn-bracket">]</span></a> (<a class="reference external" href="https://docutils.sourceforge.io/">a second reference</a> <a class="footnote-reference brackets" href="#footnote-13" id="footnote-reference-27" role="doc-noteref"><span class="fn-bracket">[</span>13<span class="fn-bracket">]</span></a>), footnote references (manually
numbered <a class="footnote-reference brackets" href="#footnote-1" id="footnote-reference-1" role="doc-noteref"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></a>, anonymous auto-numbered <a class="footnote-reference brackets" href="#footnote-2" id="footnote-reference-2" role="doc-noteref"><span class="fn-bracket">[</span>3<span class="fn-bracket">]</span></a>, labeled auto-numbered
<a class="footnote-reference brackets" href="#label" id="footnote-reference-3" role="doc-noteref"><span class="fn-bracket">[</span>2<span class="fn-bracket">]</span></a>, or symbolic <a class="footnote-reference brackets" href="#footnote-3" id="footnote-reference-4" role="doc-noteref"><span class="fn-bracket">[</span>*<span class="fn-bracket">]</span></a>), citation references (see <a class="citation-reference" href="#cit2002" id="citation-reference-1" role="doc-biblioref">[CIT2002]</a>),
substitution references (<img alt="EXAMPLE" src="../../../docs/user/rst/images/biohazard.png" /> &
@@ -550,29 +551,29 @@
<h3><a class="toc-backref" href="#toc-entry-22"><span class="sectnum">2.14</span> Directives</a></h3>
<nav class="contents local" id="contents">
<ul class="auto-toc simple">
-<li><p><a class="reference internal" href="#document-parts" id="toc-entry-53"><span class="sectnum">2.14.1</span> Document Parts</a></p></li>
-<li><p><a class="reference internal" href="#images-and-figures" id="toc-entry-54"><span class="sectnum">2.14.2</span> Images and Figures</a></p></li>
-<li><p><a class="reference internal" href="#tables" id="toc-entry-55"><span class="sectnum">2.14.3</span> Tables</a></p></li>
-<li><p><a class="reference internal" href="#admonitions" id="toc-entry-56"><span class="sectnum">2.14.4</span> Admonitions</a></p></li>
-<li><p><a class="reference internal" href="#topics-sidebars-and-rubrics" id="toc-entry-57"><span class="sectnum">2.14.5</span> Topics, Sidebars, and Rubrics</a></p></li>
-<li><p><a class="reference internal" href="#target-footnotes" id="toc-entry-58"><span class="sectnum">2.14.6</span> Target Footnotes</a></p></li>
-<li><p><a class="reference internal" href="#replacement-text" id="toc-entry-59"><span class="sectnum">2.14.7</span> Replacement Text</a></p></li>
-<li><p><a class="reference internal" href="#compound-paragraph" id="toc-entry-60"><span class="sectnum">2.14.8</span> Compound Paragraph</a></p></li>
-<li><p><a class="reference internal" href="#parsed-literal-blocks" id="toc-entry-61"><span class="sectnum">2.14.9</span> Parsed Literal Blocks</a></p></li>
-<li><p><a class="reference internal" href="#code" id="toc-entry-62"><span class="sectnum">2.14.10</span> Code</a></p></li>
-<li><p><a class="reference internal" href="#meta" id="toc-entry-63"><span class="sectnum">2.14.11</span> Meta</a></p></li>
+<li><p><a class="reference internal" href="#document-parts" id="toc-entry-54"><span class="sectnum">2.14.1</span> Document Parts</a></p></li>
+<li><p><a class="reference internal" href="#images-and-figures" id="toc-entry-55"><span class="sectnum">2.14.2</span> Images and Figures</a></p></li>
+<li><p><a class="reference internal" href="#tables" id="toc-entry-56"><span class="sectnum">2.14.3</span> Tables</a></p></li>
+<li><p><a class="reference internal" href="#admonitions" id="toc-entry-57"><span class="sectnum">2.14.4</span> Admonitions</a></p></li>
+<li><p><a class="reference internal" href="#topics-sidebars-and-rubrics" id="toc-entry-58"><span class="sectnum">2.14.5</span> Topics, Sidebars, and Rubrics</a></p></li>
+<li><p><a class="reference internal" href="#target-footnotes" id="toc-entry-59"><span class="sectnum">2.14.6</span> Target Footnotes</a></p></li>
+<li><p><a class="reference internal" href="#replacement-text" id="toc-entry-60"><span class="sectnum">2.14.7</span> Replacement Text</a></p></li>
+<li><p><a class="reference internal" href="#compound-paragraph" id="toc-entry-61"><span class="sectnum">2.14.8</span> Compound Paragraph</a></p></li>
+<li><p><a class="reference internal" href="#parsed-literal-blocks" id="toc-entry-62"><span class="sectnum">2.14.9</span> Parsed Literal Blocks</a></p></li>
+<li><p><a class="reference internal" href="#code" id="toc-entry-63"><span class="sectnum">2.14.10</span> Code</a></p></li>
+<li><p><a class="reference internal" href="#meta" id="toc-entry-64"><span class="sectnum">2.14.11</span> Meta</a></p></li>
</ul>
</nav>
<p>These are just a sample of the many reStructuredText Directives. For
-others, please see <a class="reference external" href="https://docutils.sourceforge.io/docs/ref/rst/directives.html">reStructuredText Directives</a> <a class="footnote-reference brackets" href="#footnote-13" id="footnote-reference-27" role="doc-noteref"><span class="fn-bracket">[</span>13<span class="fn-bracket">]</span></a>.</p>
+others, please see <a class="reference external" href="https://docutils.sourceforge.io/docs/ref/rst/directives.html">reStructuredText Directives</a> <a class="footnote-reference brackets" href="#footnote-14" id="footnote-reference-28" role="doc-noteref"><span class="fn-bracket">[</span>14<span class="fn-bracket">]</span></a>.</p>
<section id="document-parts">
-<h4><a class="toc-backref" href="#toc-entry-53"><span class="sectnum">2.14.1</span> Document Parts</a></h4>
+<h4><a class="toc-backref" href="#toc-entry-54"><span class="sectnum">2.14.1</span> Document Parts</a></h4>
<p>An example of the "contents" directive can be seen above this section
(a local, untitled table of <a class="reference internal" href="#contents">contents</a>) and at the beginning of the
document (a document-wide <a class="reference internal" href="#table-of-contents">table of contents</a>).</p>
</section>
<section id="images-and-figures">
-<h4><a class="toc-backref" href="#toc-entry-54"><span class="sectnum">2.14.2</span> Images and Figures</a></h4>
+<h4><a class="toc-backref" href="#toc-entry-55"><span class="sectnum">2.14.2</span> Images and Figures</a></h4>
<p>An image directive (also clickable -- a hyperlink reference):</p>
<a class="reference internal image-reference" href="#directives"><img alt="../../../docs/user/rst/images/title.png" class="class1 class2" src="../../../docs/user/rst/images/title.png" style="width: 70%;" /></a>
<p>Image with multiple IDs:</p>
@@ -670,7 +671,7 @@
upon the style sheet and the browser or rendering software used.</p>
</section>
<section id="tables">
-<h4><a class="toc-backref" href="#toc-entry-55"><span class="sectnum">2.14.3</span> Tables</a></h4>
+<h4><a class="toc-backref" href="#toc-entry-56"><span class="sectnum">2.14.3</span> Tables</a></h4>
<p>Tables may be given titles and additional arguments with the <em>table</em>
directive:</p>
<table class="align-left">
@@ -764,7 +765,7 @@
</table>
</section>
<section id="admonitions">
-<h4><a class="toc-backref" href="#toc-entry-56"><span class="sectnum">2.14.4</span> Admonitions</a></h4>
+<h4><a class="toc-backref" href="#toc-entry-57"><span class="sectnum">2.14.4</span> Admonitions</a></h4>
<aside class="admonition attention">
<p class="admonition-title">Attention!</p>
<p>Directives at large.</p>
@@ -813,7 +814,7 @@
</aside>
</section>
<section id="topics-sidebars-and-rubrics">
-<h4><a class="toc-backref" href="#toc-entry-57"><span class="sectnum">2.14.5</span> Topics, Sidebars, and Rubrics</a></h4>
+<h4><a class="toc-backref" href="#toc-entry-58"><span class="sectnum">2.14.5</span> Topics, Sidebars, and Rubrics</a></h4>
<p><em>Sidebars</em> are like miniature, parallel documents.</p>
<aside class="sidebar">
<p class="sidebar-title">Optional Sidebar Title</p>
@@ -837,10 +838,10 @@
allowed (e.g. inside a directive).</p>
</section>
<section id="target-footnotes">
-<h4><a class="toc-backref" href="#toc-entry-58"><span class="sectnum">2.14.6</span> Target Footnotes</a></h4>
+<h4><a class="toc-backref" href="#toc-entry-59"><span class="sectnum">2.14.6</span> Target Footnotes</a></h4>
<aside class="footnote brackets" id="footnote-7" role="note">
<span class="label"><span class="fn-bracket">[</span>7<span class="fn-bracket">]</span></span>
-<span class="backrefs">(<a role="doc-backlink" href="#footnote-reference-18">1</a>,<a role="doc-backlink" href="#footnote-reference-19">2</a>,<a role="doc-backlink" href="#footnote-reference-20">3</a>,<a role="doc-backlink" href="#footnote-reference-25">4</a>)</span>
+<span class="backrefs">(<a role="doc-backlink" href="#footnote-reference-18">1</a>,<a role="doc-backlink" href="#footnote-reference-19">2</a>,<a role="doc-backlink" href="#footnote-reference-20">3</a>,<a role="doc-backlink" href="#footnote-reference-26">4</a>)</span>
<p><a class="reference external" href="http://www.python.org/">http://www.python.org/</a></p>
</aside>
<aside class="footnote brackets" id="footnote-8" role="note">
@@ -849,51 +850,55 @@
</aside>
<aside class="footnote brackets" id="footnote-9" role="note">
<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#footnote-reference-22">9</a><span class="fn-bracket">]</span></span>
-<p><a class="reference external" href="http://docutils.sourceforge.net/docs/user/config.html#table-style">http://docutils.sourceforge.net/docs/user/config.html#table-style</a></p>
+<p><a class="reference external" href="https://www.w3.org/TR/html52/interactive-elements.html#the-details-element">https://www.w3.org/TR/html52/interactive-elements.html#the-details-element</a></p>
</aside>
<aside class="footnote brackets" id="footnote-10" role="note">
<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#footnote-reference-23">10</a><span class="fn-bracket">]</span></span>
-<p><a class="reference external" href="http://tug.ctan.org/tex-archive/macros/latex/contrib/booktabs/booktabs.pdf">http://tug.ctan.org/tex-archive/macros/latex/contrib/booktabs/booktabs.pdf</a></p>
+<p><a class="reference external" href="http://docutils.sourceforge.net/docs/user/config.html#table-style">http://docutils.sourceforge.net/docs/user/config.html#table-style</a></p>
</aside>
<aside class="footnote brackets" id="footnote-11" role="note">
<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#footnote-reference-24">11</a><span class="fn-bracket">]</span></span>
-<p><a class="reference external" href="http://docutils.sourceforge.net/docs/dev/todo.html#interpreted-text">http://docutils.sourceforge.net/docs/dev/todo.html#interpreted-text</a></p>
+<p><a class="reference external" href="http://tug.ctan.org/tex-archive/macros/latex/contrib/booktabs/booktabs.pdf">http://tug.ctan.org/tex-archive/macros/latex/contrib/booktabs/booktabs.pdf</a></p>
</aside>
<aside class="footnote brackets" id="footnote-12" role="note">
-<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#footnote-reference-26">12</a><span class="fn-bracket">]</span></span>
-<p><a class="reference external" href="https://docutils.sourceforge.io/">https://docutils.sourceforge.io/</a></p>
+<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#footnote-reference-25">12</a><span class="fn-bracket">]</span></span>
+<p><a class="reference external" href="http://docutils.sourceforge.net/docs/dev/todo.html#interpreted-text">http://docutils.sourceforge.net/docs/dev/todo.html#interpreted-text</a></p>
</aside>
<aside class="footnote brackets" id="footnote-13" role="note">
<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#footnote-reference-27">13</a><span class="fn-bracket">]</span></span>
-<p><a class="reference external" href="https://docutils.sourceforge.io/docs/ref/rst/directives.html">https://docutils.sourceforge.io/docs/ref/rst/directives.html</a></p>
+<p><a class="reference external" href="https://docutils.sourceforge.io/">https://docutils.sourceforge.io/</a></p>
</aside>
<aside class="footnote brackets" id="footnote-14" role="note">
<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#footnote-reference-28">14</a><span class="fn-bracket">]</span></span>
-<p><a class="reference external" href="https://docutils.sourceforge.io/docs/ref/rst/directives.html#metadata">https://docutils.sourceforge.io/docs/ref/rst/directives.html#metadata</a></p>
+<p><a class="reference external" href="https://docutils.sourceforge.io/docs/ref/rst/directives.html">https://docutils.sourceforge.io/docs/ref/rst/directives.html</a></p>
</aside>
<aside class="footnote brackets" id="footnote-15" role="note">
<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#footnote-reference-29">15</a><span class="fn-bracket">]</span></span>
-<p><a class="reference external" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Viewport_meta_tag">https://developer.mozilla.org/en-US/docs/Web/HTML/Viewport_meta_tag</a></p>
+<p><a class="reference external" href="https://docutils.sourceforge.io/docs/ref/rst/directives.html#metadata">https://docutils.sourceforge.io/docs/ref/rst/directives.html#metadata</a></p>
</aside>
<aside class="footnote brackets" id="footnote-16" role="note">
<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#footnote-reference-30">16</a><span class="fn-bracket">]</span></span>
-<p><a class="reference external" href="https://stackoverflow.com/questions/39547412/same-font-size-for-h1-and-h2-in-article">https://stackoverflow.com/questions/39547412/same-font-size-for-h1-and-h2-in-article</a></p>
+<p><a class="reference external" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Viewport_meta_tag">https://developer.mozilla.org/en-US/docs/Web/HTML/Viewport_meta_tag</a></p>
</aside>
<aside class="footnote brackets" id="footnote-17" role="note">
<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#footnote-reference-31">17</a><span class="fn-bracket">]</span></span>
-<p><a class="reference external" href="https://html.spec.whatwg.org/#text-level-semantics">https://html.spec.whatwg.org/#text-level-semantics</a></p>
+<p><a class="reference external" href="https://stackoverflow.com/questions/39547412/same-font-size-for-h1-and-h2-in-article">https://stackoverflow.com/questions/39547412/same-font-size-for-h1-and-h2-in-article</a></p>
</aside>
<aside class="footnote brackets" id="footnote-18" role="note">
<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#footnote-reference-32">18</a><span class="fn-bracket">]</span></span>
+<p><a class="reference external" href="https://html.spec.whatwg.org/#text-level-semantics">https://html.spec.whatwg.org/#text-level-semantics</a></p>
+</aside>
+<aside class="footnote brackets" id="footnote-19" role="note">
+<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#footnote-reference-33">19</a><span class="fn-bracket">]</span></span>
<p><a class="reference external" href="https://html.spec.whatwg.org/multipage/edits.html">https://html.spec.whatwg.org/multipage/edits.html</a></p>
</aside>
</section>
<section id="replacement-text">
-<h4><a class="toc-backref" href="#toc-entry-59"><span class="sectnum">2.14.7</span> Replacement Text</a></h4>
+<h4><a class="toc-backref" href="#toc-entry-60"><span class="sectnum">2.14.7</span> Replacement Text</a></h4>
<p>I recommend you try <a class="reference external" href="http://www.python.org/">Python, <em>the</em> best language around</a> <a class="footnote-reference brackets" href="#footnote-7" id="footnote-reference-20" role="doc-noteref"><span class="fn-bracket">[</span>7<span class="fn-bracket">]</span></a>.</p>
</section>
<section id="compound-paragraph">
-<h4><a class="toc-backref" href="#toc-entry-60"><span class="sectnum">2.14.8</span> Compound Paragraph</a></h4>
+<h4><a class="toc-backref" href="#toc-entry-61"><span class="sectnum">2.14.8</span> Compound Paragraph</a></h4>
<p>The <em>compound</em> directive is used to create a "compound paragraph", which
is a single logical paragraph containing multiple physical body
elements. For example:</p>
@@ -1004,7 +1009,7 @@
</div>
</section>
<section id="parsed-literal-blocks">
-<h4><a class="toc-backref" href="#toc-entry-61"><span class="sectnum">2.14.9</span> Parsed Literal Blocks</a></h4>
+<h4><a class="toc-backref" href="#toc-entry-62"><span class="sectnum">2.14.9</span> Parsed Literal Blocks</a></h4>
<pre class=...
[truncated message content] |
|
From: <mi...@us...> - 2021-06-30 07:48:48
|
Revision: 8786
http://sourceforge.net/p/docutils/code/8786
Author: milde
Date: 2021-06-30 07:48:44 +0000 (Wed, 30 Jun 2021)
Log Message:
-----------
HTML5: Improve accessibility of section headings.
Mark the internal back-refences from section headings to the ToC
with DPub-ARIA role "doc-backref".
Use "aria-level" instead of a class argument value for section headings
with nesting level > 6 (for level 1 to 6, the level is determined by
the HTML tag).
Mind that in HTML5, heading level 1 is reserved for the document title
and section headings start with level 2.
Add functional test sample for deeply nested sections.
Merge functional tests for additonal HTML5 features.
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/docutils/writers/_html_base.py
trunk/docutils/docutils/writers/html4css1/__init__.py
trunk/docutils/test/functional/expected/standalone_rst_html5.html
trunk/docutils/test/functional/input/data/video.txt
Added Paths:
-----------
trunk/docutils/test/functional/expected/misc_rst_html5.html
trunk/docutils/test/functional/input/data/embed_images.txt
trunk/docutils/test/functional/input/misc_rst_html5.txt
trunk/docutils/test/functional/tests/misc_rst_html5.py
Removed Paths:
-------------
trunk/docutils/test/functional/expected/video.html
trunk/docutils/test/functional/input/embed_images.txt
trunk/docutils/test/functional/tests/embed_images_html5.py
trunk/docutils/test/functional/tests/html5_video.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2021-06-30 07:48:24 UTC (rev 8785)
+++ trunk/docutils/HISTORY.txt 2021-06-30 07:48:44 UTC (rev 8786)
@@ -69,6 +69,9 @@
the table of contents, footnote, references, footnotes, citations,
and backlinks.
+ - Use "aria-level" attribute instead of invalid tags <h7>, <h8>, ...
+ for headings of deeply nested sections.
+
- Do not set classes "compound-first", "compound-middle", or
"compound-last" to elements nested in a compound.
Use class value "backrefs" instead of "fn-backref" for a span of
@@ -77,13 +80,14 @@
- Removed attribute ``HTMLTranslator.topic_classes``
- Items of a definition list with class argument "details" are
- converted to `details disclosure elements` (not with HTML4).
+ converted to `details disclosure elements`.
* docutils/writers/html4css1/__init__.py:
- - Overwrite methods in _html_base.HTMLTranslator that use HTM5 tags.
-
+ - Overwrite methods in _html_base.HTMLTranslator that use HTM5 tags
+ (details, aside, nav, ...) and attributes (role, aria-level).
+
* docutils/writers/latex2e/__init__.py
- The setting `legacy_class_functions`_ now defaults to "False".
Modified: trunk/docutils/docutils/writers/_html_base.py
===================================================================
--- trunk/docutils/docutils/writers/_html_base.py 2021-06-30 07:48:24 UTC (rev 8785)
+++ trunk/docutils/docutils/writers/_html_base.py 2021-06-30 07:48:44 UTC (rev 8786)
@@ -1606,23 +1606,19 @@
self.body.append('</thead>\n')
def section_title_tags(self, node):
- classes = []
+ atts = {}
h_level = self.section_level + self.initial_header_level - 1
- if (len(node.parent) >= 2
- and isinstance(node.parent[1], nodes.subtitle)):
- classes.append('with-subtitle')
- # TODO: use '<h6 aria-level="%s">' % h_level
- # for h_level > 6 (HTML5 only)
+ # Only 6 heading levels have dedicated HTML tags.
+ tagname = 'h%i' % min(h_level, 6)
if h_level > 6:
- classes.append('h%i' % h_level)
- tagname = 'h%i' % min(h_level, 6)
- start_tag = self.starttag(node, tagname, '', classes=classes)
+ atts['aria-level'] = h_level
+ start_tag = self.starttag(node, tagname, '', **atts)
if node.hasattr('refid'):
atts = {}
atts['class'] = 'toc-backref'
- # atts['role'] = 'doc-backlink' # HTML5 only
+ atts['role'] = 'doc-backlink' # HTML5 only
atts['href'] = '#' + node['refid']
- start_tag += self.starttag({}, 'a', '', **atts)
+ start_tag += self.starttag(nodes.reference(), 'a', '', **atts)
close_tag = '</a></%s>\n' % tagname
else:
close_tag = '</%s>\n' % tagname
@@ -1629,7 +1625,6 @@
return start_tag, close_tag
def visit_title(self, node):
- """Only 6 section levels are supported by HTML."""
close_tag = '</p>\n'
if isinstance(node.parent, nodes.topic):
self.body.append(
@@ -1652,6 +1647,7 @@
self.in_document_title = len(self.body)
else:
assert isinstance(node.parent, nodes.section)
+ # Get correct heading and evt. backlink tags
start_tag, close_tag = self.section_title_tags(node)
self.body.append(start_tag)
self.context.append(close_tag)
Modified: trunk/docutils/docutils/writers/html4css1/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/html4css1/__init__.py 2021-06-30 07:48:24 UTC (rev 8785)
+++ trunk/docutils/docutils/writers/html4css1/__init__.py 2021-06-30 07:48:44 UTC (rev 8786)
@@ -870,13 +870,6 @@
def depart_tbody(self, node):
self.body.append('</tbody>\n')
- # hard-coded vertical alignment
- def visit_thead(self, node):
- self.body.append(self.starttag(node, 'thead', valign='bottom'))
- #
- def depart_thead(self, node):
- self.body.append('</thead>\n')
-
# no special handling of "details" in definition list
def visit_term(self, node):
self.body.append(self.starttag(node, 'dt', '',
@@ -886,7 +879,36 @@
def depart_term(self, node):
pass
+ # hard-coded vertical alignment
+ def visit_thead(self, node):
+ self.body.append(self.starttag(node, 'thead', valign='bottom'))
+ #
+ def depart_thead(self, node):
+ self.body.append('</thead>\n')
+ # auxilliary method, called by visit_title()
+ # "with-subtitle" class, no ARIA roles
+ def section_title_tags(self, node):
+ classes = []
+ h_level = self.section_level + self.initial_header_level - 1
+ if (len(node.parent) >= 2
+ and isinstance(node.parent[1], nodes.subtitle)):
+ classes.append('with-subtitle')
+ if h_level > 6:
+ classes.append('h%i' % h_level)
+ tagname = 'h%i' % min(h_level, 6)
+ start_tag = self.starttag(node, tagname, '', classes=classes)
+ if node.hasattr('refid'):
+ atts = {}
+ atts['class'] = 'toc-backref'
+ atts['href'] = '#' + node['refid']
+ start_tag += self.starttag({}, 'a', '', **atts)
+ close_tag = '</a></%s>\n' % tagname
+ else:
+ close_tag = '</%s>\n' % tagname
+ return start_tag, close_tag
+
+
class SimpleListChecker(writers._html_base.SimpleListChecker):
"""
Added: trunk/docutils/test/functional/expected/misc_rst_html5.html
===================================================================
--- trunk/docutils/test/functional/expected/misc_rst_html5.html (rev 0)
+++ trunk/docutils/test/functional/expected/misc_rst_html5.html 2021-06-30 07:48:44 UTC (rev 8786)
@@ -0,0 +1,102 @@
+<!DOCTYPE html>
+<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.18b.dev: http://docutils.sourceforge.net/" />
+<title>Additional tests with HTML 5</title>
+<link rel="stylesheet" href="../../../docutils/writers/html5_polyglot/minimal.css" type="text/css" />
+<link rel="stylesheet" href="../../../docutils/writers/html5_polyglot/plain.css" type="text/css" />
+<link rel="stylesheet" href="../../../docutils/writers/html5_polyglot/math.css" type="text/css" />
+</head>
+<body>
+<main id="additional-tests-with-html-5">
+<h1 class="title">Additional tests with HTML 5</h1>
+
+<section id="section-heading-levels">
+<h2>Section heading levels</h2>
+</section>
+<section id="level-1">
+<h2>Level 1</h2>
+<p>Nested sections</p>
+<section id="level-2">
+<h3>Level 2</h3>
+<p>reach at some level</p>
+<section id="level-3">
+<h4>Level 3</h4>
+<p>(depending on the document class and output format)</p>
+<section id="level-4">
+<h5>level 4</h5>
+<p>a level</p>
+<section id="level-5">
+<h6>level 5</h6>
+<p>that is not supported by the output format.</p>
+<section id="level-6">
+<h6 aria-level="7">level 6</h6>
+<p>Unsupported in LaTeX and HTML5
+(HTML5 reserves the 1st level for the document title).</p>
+<section id="level-7">
+<h6 aria-level="8">level 7</h6>
+<p>Unsupported in HTML4.</p>
+<section id="level-8">
+<h6 aria-level="9">level 8</h6>
+<p>Unsupported in ODT.</p>
+</section>
+</section>
+</section>
+</section>
+</section>
+</section>
+</section>
+</section>
+<section id="section-titles-with-inline-markup">
+<span id="references"></span><h2>Section titles with inline markup</h2>
+<section id="emphasized-h2o-x-2-and-references">
+<h3><em>emphasized</em>, H<sub>2</sub>O, <span class="formula"><i>x</i><sup>2</sup></span>, and <a class="reference internal" href="#references">references</a></h3>
+</section>
+<section id="substitutions-fail">
+<h3>Substitutions work</h3>
+</section>
+</section>
+<section id="embedded-images">
+<h2>Embedded Images</h2>
+<p>The “embed” flag tells Docutils that it should
+try to embed the image in the output document.</p>
+<p>If the image can be read from the local file system, it is <a class="reference external" href="https://en.wikipedia.org/wiki/Base64">base64</a>
+encoded and included as a <a class="reference external" href="https://en.wikipedia.org/wiki/Data_URI_scheme">data URI</a>.
+In future, SVG images may be directly inserted into HTML5.</p>
+<figure class="align-center">
+<img alt="biohazard" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAABGdBTUEAANkE3LLaAgAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAAZQTFRF////AAAAVcLTfgAAAAF0Uk5TAEDm2GYAAAA2SURBVHicYmBRYOAQYJCQYJC+wSBjAUL2fxjq6hgueTNM7AQh3g0MzAdAiP0BUBYAAAD//wMA4pkLDrFBDzUAAAAASUVORK5CYII=" />
+<figcaption>
+<p>Embedded image in a figure.</p>
+</figcaption>
+</figure>
+<p>Embedded inline image <img alt="inline-embedded" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAABGdBTUEAANkE3LLaAgAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAAZQTFRF////AAAAVcLTfgAAAAF0Uk5TAEDm2GYAAAA2SURBVHicYmBRYOAQYJCQYJC+wSBjAUL2fxjq6hgueTNM7AQh3g0MzAdAiP0BUBYAAAD//wMA4pkLDrFBDzUAAAAASUVORK5CYII=" style="height: 0.8em;" /> scaled to a height of 0.8 em.</p>
+</section>
+<section id="moving-images-video">
+<h2>Moving images (video)</h2>
+<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>
+<video class="align-left" src="../../../docs/user/rst/images/pens.mp4" title="left-aligned test video">
+<a href="../../../docs/user/rst/images/pens.mp4">left-aligned test video</a>
+</video>
+<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>
+<figure class="align-center">
+<video class="controls" 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>
+<p>Simple test video in a centered figure</p>
+</figcaption>
+</figure>
+<p>A video like this <video src="../../../docs/user/rst/images/pens.mp4" title="rotating pens video" width="60"><a href="../../../docs/user/rst/images/pens.mp4">rotating pens video</a></video> can be included inline via substitution.</p>
+</section>
+</main>
+</body>
+</html>
Property changes on: trunk/docutils/test/functional/expected/misc_rst_html5.html
___________________________________________________________________
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
Modified: trunk/docutils/test/functional/expected/standalone_rst_html5.html
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_html5.html 2021-06-30 07:48:24 UTC (rev 8785)
+++ trunk/docutils/test/functional/expected/standalone_rst_html5.html 2021-06-30 07:48:44 UTC (rev 8786)
@@ -162,9 +162,9 @@
</ul>
</nav>
<section id="structural-elements">
-<h2><a class="toc-backref" href="#toc-entry-1"><span class="sectnum">1</span> Structural Elements</a></h2>
+<h2><a class="toc-backref" href="#toc-entry-1" role="doc-backlink"><span class="sectnum">1</span> Structural Elements</a></h2>
<section id="section-title">
-<h3 class="with-subtitle"><a class="toc-backref" href="#toc-entry-2"><span class="sectnum">1.1</span> Section Title</a></h3>
+<h3><a class="toc-backref" href="#toc-entry-2" role="doc-backlink"><span class="sectnum">1.1</span> Section Title</a></h3>
<p class="section-subtitle" id="section-subtitle">Section Subtitle</p>
<p>Lone subsections are converted to a section subtitle by a transform
activated with the <span class="docutils literal"><span class="pre">--section-subtitles</span></span> command line option or the
@@ -171,10 +171,10 @@
<span class="docutils literal"><span class="pre">sectsubtitle-xform</span></span> configuration value.</p>
</section>
<section id="empty-section">
-<h3><a class="toc-backref" href="#toc-entry-3"><span class="sectnum">1.2</span> Empty Section</a></h3>
+<h3><a class="toc-backref" href="#toc-entry-3" role="doc-backlink"><span class="sectnum">1.2</span> Empty Section</a></h3>
</section>
<section id="transitions">
-<h3><a class="toc-backref" href="#toc-entry-4"><span class="sectnum">1.3</span> Transitions</a></h3>
+<h3><a class="toc-backref" href="#toc-entry-4" role="doc-backlink"><span class="sectnum">1.3</span> Transitions</a></h3>
<p>Here's a transition:</p>
<hr class="docutils" />
<p>It divides the section. Transitions may also occur between sections:</p>
@@ -182,12 +182,12 @@
</section>
<hr class="docutils" />
<section id="body-elements">
-<h2><a class="toc-backref" href="#toc-entry-5"><span class="sectnum">2</span> Body Elements</a></h2>
+<h2><a class="toc-backref" href="#toc-entry-5" role="doc-backlink"><span class="sectnum">2</span> Body Elements</a></h2>
<section id="paragraphs">
-<h3><a class="toc-backref" href="#toc-entry-6"><span class="sectnum">2.1</span> Paragraphs</a></h3>
+<h3><a class="toc-backref" href="#toc-entry-6" role="doc-backlink"><span class="sectnum">2.1</span> Paragraphs</a></h3>
<p>A paragraph.</p>
<section id="inline-markup">
-<h4><a class="toc-backref" href="#toc-entry-7"><span class="sectnum">2.1.1</span> Inline Markup</a></h4>
+<h4><a class="toc-backref" href="#toc-entry-7" role="doc-backlink"><span class="sectnum">2.1.1</span> Inline Markup</a></h4>
<p>Paragraphs contain text and may contain inline markup: <em>emphasis</em>,
<strong>strong emphasis</strong>, <span class="docutils literal">inline literals</span>, standalone hyperlinks
(<a class="reference external" href="http://www.python.org">http://www.python.org</a>), external hyperlinks (<a class="reference external" href="http://www.python.org/">Python</a> <a class="footnote-reference brackets" href="#footnote-7" id="footnote-reference-18" role="doc-noteref"><span class="fn-bracket">[</span>7<span class="fn-bracket">]</span></a>), internal
@@ -216,7 +216,7 @@
</section>
</section>
<section id="bullet-lists">
-<h3><a class="toc-backref" href="#toc-entry-8"><span class="sectnum">2.2</span> Bullet Lists</a></h3>
+<h3><a class="toc-backref" href="#toc-entry-8" role="doc-backlink"><span class="sectnum">2.2</span> Bullet Lists</a></h3>
<ul>
<li><p>A bullet list</p>
<ul class="simple">
@@ -243,7 +243,7 @@
</ul>
</section>
<section id="enumerated-lists">
-<h3><a class="toc-backref" href="#toc-entry-9"><span class="sectnum">2.3</span> Enumerated Lists</a></h3>
+<h3><a class="toc-backref" href="#toc-entry-9" role="doc-backlink"><span class="sectnum">2.3</span> Enumerated Lists</a></h3>
<ol class="arabic">
<li><p>Arabic numerals.</p>
<ol class="loweralpha simple">
@@ -279,7 +279,7 @@
</ol>
</section>
<section id="definition-lists">
-<h3><a class="toc-backref" href="#toc-entry-10"><span class="sectnum">2.4</span> Definition Lists</a></h3>
+<h3><a class="toc-backref" href="#toc-entry-10" role="doc-backlink"><span class="sectnum">2.4</span> Definition Lists</a></h3>
<dl>
<dt>Term</dt>
<dd><p>Definition</p>
@@ -297,7 +297,7 @@
</dl>
</section>
<section id="field-lists">
-<h3><a class="toc-backref" href="#toc-entry-11"><span class="sectnum">2.5</span> Field Lists</a></h3>
+<h3><a class="toc-backref" href="#toc-entry-11" role="doc-backlink"><span class="sectnum">2.5</span> Field Lists</a></h3>
<dl class="field-list">
<dt>what<span class="colon">:</span></dt>
<dd><p>Field lists map field names to field bodies, like database
@@ -317,7 +317,7 @@
</dl>
</section>
<section id="option-lists">
-<h3><a class="toc-backref" href="#toc-entry-12"><span class="sectnum">2.6</span> Option Lists</a></h3>
+<h3><a class="toc-backref" href="#toc-entry-12" role="doc-backlink"><span class="sectnum">2.6</span> Option Lists</a></h3>
<p>For listing command-line options:</p>
<dl class="option-list">
<dt><kbd><span class="option">-a</span></kbd></dt>
@@ -356,7 +356,7 @@
description.</p>
</section>
<section id="literal-blocks">
-<h3><a class="toc-backref" href="#toc-entry-13"><span class="sectnum">2.7</span> Literal Blocks</a></h3>
+<h3><a class="toc-backref" href="#toc-entry-13" role="doc-backlink"><span class="sectnum">2.7</span> Literal Blocks</a></h3>
<p>Literal blocks are indicated with a double-colon ("::") at the end of
the preceding paragraph (over there <span class="docutils literal"><span class="pre">--></span></span>). They can be indented:</p>
<pre class="literal-block">if literal_block:
@@ -369,7 +369,7 @@
> Why didn't I think of that?</pre>
</section>
<section id="line-blocks">
-<h3><a class="toc-backref" href="#toc-entry-14"><span class="sectnum">2.8</span> Line Blocks</a></h3>
+<h3><a class="toc-backref" href="#toc-entry-14" role="doc-backlink"><span class="sectnum">2.8</span> Line Blocks</a></h3>
<p>This section tests line blocks. Line blocks are body elements which
consist of lines and other line blocks. Nested line blocks cause
indentation.</p>
@@ -443,7 +443,7 @@
</div>
</section>
<section id="block-quotes">
-<h3><a class="toc-backref" href="#toc-entry-15"><span class="sectnum">2.9</span> Block Quotes</a></h3>
+<h3><a class="toc-backref" href="#toc-entry-15" role="doc-backlink"><span class="sectnum">2.9</span> Block Quotes</a></h3>
<p>Block quotes consist of indented body elements:</p>
<blockquote>
<p>My theory by A. Elk. Brackets Miss, brackets. This theory goes
@@ -462,7 +462,7 @@
</blockquote>
</section>
<section id="doctest-blocks">
-<h3><a class="toc-backref" href="#toc-entry-16"><span class="sectnum">2.10</span> Doctest Blocks</a></h3>
+<h3><a class="toc-backref" href="#toc-entry-16" role="doc-backlink"><span class="sectnum">2.10</span> Doctest Blocks</a></h3>
<pre class="code python doctest">>>> print 'Python-specific usage examples; begun with ">>>"'
Python-specific usage examples; begun with ">>>"
>>> print '(cut and pasted from interactive Python sessions)'
@@ -470,7 +470,7 @@
</pre>
</section>
<section id="footnotes">
-<h3><a class="toc-backref" href="#toc-entry-17"><span class="sectnum">2.11</span> Footnotes</a></h3>
+<h3><a class="toc-backref" href="#toc-entry-17" role="doc-backlink"><span class="sectnum">2.11</span> Footnotes</a></h3>
<aside class="footnote brackets" id="footnote-1" role="note">
<span class="label"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></span>
<span class="backrefs">(<a role="doc-backlink" href="#footnote-reference-1">1</a>,<a role="doc-backlink" href="#footnote-reference-5">2</a>,<a role="doc-backlink" href="#footnote-reference-9">3</a>)</span>
@@ -509,7 +509,7 @@
</aside>
</section>
<section id="citations">
-<h3><a class="toc-backref" href="#toc-entry-18"><span class="sectnum">2.12</span> Citations</a></h3>
+<h3><a class="toc-backref" href="#toc-entry-18" role="doc-backlink"><span class="sectnum">2.12</span> Citations</a></h3>
<div role="list" class="citation-list">
<div class="citation" id="cit2002" role="doc-biblioentry">
<span class="label"><span class="fn-bracket">[</span>CIT2002<span class="fn-bracket">]</span></span>
@@ -522,7 +522,7 @@
citation.</p>
</section>
<section id="targets">
-<span id="another-target"></span><h3><a class="toc-backref" href="#toc-entry-19"><span class="sectnum">2.13</span> Targets</a></h3>
+<span id="another-target"></span><h3><a class="toc-backref" href="#toc-entry-19" role="doc-backlink"><span class="sectnum">2.13</span> Targets</a></h3>
<p id="example">This paragraph is pointed to by the explicit "example" target. A
reference can be found under <a class="reference internal" href="#inline-markup">Inline Markup</a>, above. <a class="reference internal" href="#inline-hyperlink-targets">Inline
hyperlink targets</a> are also possible.</p>
@@ -535,13 +535,13 @@
<p>Here's a <a href="#system-message-4"><span class="problematic" id="problematic-2">`hyperlink reference without a target`_</span></a>, which generates an
error.</p>
<section id="duplicate-target-names">
-<h4><a class="toc-backref" href="#toc-entry-20"><span class="sectnum">2.13.1</span> Duplicate Target Names</a></h4>
+<h4><a class="toc-backref" href="#toc-entry-20" role="doc-backlink"><span class="sectnum">2.13.1</span> Duplicate Target Names</a></h4>
<p>Duplicate names in section headers or other implicit targets will
generate "info" (level-1) system messages. Duplicate names in
explicit targets will generate "warning" (level-2) system messages.</p>
</section>
<section id="duplicate-target-names-1">
-<h4><a class="toc-backref" href="#toc-entry-21"><span class="sectnum">2.13.2</span> Duplicate Target Names</a></h4>
+<h4><a class="toc-backref" href="#toc-entry-21" role="doc-backlink"><span class="sectnum">2.13.2</span> Duplicate Target Names</a></h4>
<p>Since there are two "Duplicate Target Names" section headers, we
cannot uniquely refer to either of them by name. If we try to (like
this: <a href="#system-message-5"><span class="problematic" id="problematic-3">`Duplicate Target Names`_</span></a>), an error is generated.</p>
@@ -548,7 +548,7 @@
</section>
</section>
<section id="directives">
-<h3><a class="toc-backref" href="#toc-entry-22"><span class="sectnum">2.14</span> Directives</a></h3>
+<h3><a class="toc-backref" href="#toc-entry-22" role="doc-backlink"><span class="sectnum">2.14</span> Directives</a></h3>
<nav class="contents local" id="contents">
<ul class="auto-toc simple">
<li><p><a class="reference internal" href="#document-parts" id="toc-entry-54"><span class="sectnum">2.14.1</span> Document Parts</a></p></li>
@@ -567,13 +567,13 @@
<p>These are just a sample of the many reStructuredText Directives. For
others, please see <a class="reference external" href="https://docutils.sourceforge.io/docs/ref/rst/directives.html">reStructuredText Directives</a> <a class="footnote-reference brackets" href="#footnote-14" id="footnote-reference-28" role="doc-noteref"><span class="fn-bracket">[</span>14<span class="fn-bracket">]</span></a>.</p>
<section id="document-parts">
-<h4><a class="toc-backref" href="#toc-entry-54"><span class="sectnum">2.14.1</span> Document Parts</a></h4>
+<h4><a class="toc-backref" href="#toc-entry-54" role="doc-backlink"><span class="sectnum">2.14.1</span> Document Parts</a></h4>
<p>An example of the "contents" directive can be seen above this section
(a local, untitled table of <a class="reference internal" href="#contents">contents</a>) and at the beginning of the
document (a document-wide <a class="reference internal" href="#table-of-contents">table of contents</a>).</p>
</section>
<section id="images-and-figures">
-<h4><a class="toc-backref" href="#toc-entry-55"><span class="sectnum">2.14.2</span> Images and Figures</a></h4>
+<h4><a class="toc-backref" href="#toc-entry-55" role="doc-backlink"><span class="sectnum">2.14.2</span> Images and Figures</a></h4>
<p>An image directive (also clickable -- a hyperlink reference):</p>
<a class="reference internal image-reference" href="#directives"><img alt="../../../docs/user/rst/images/title.png" class="class1 class2" src="../../../docs/user/rst/images/title.png" style="width: 70%;" /></a>
<p>Image with multiple IDs:</p>
@@ -671,7 +671,7 @@
upon the style sheet and the browser or rendering software used.</p>
</section>
<section id="tables">
-<h4><a class="toc-backref" href="#toc-entry-56"><span class="sectnum">2.14.3</span> Tables</a></h4>
+<h4><a class="toc-backref" href="#toc-entry-56" role="doc-backlink"><span class="sectnum">2.14.3</span> Tables</a></h4>
<p>Tables may be given titles and additional arguments with the <em>table</em>
directive:</p>
<table class="align-left">
@@ -765,7 +765,7 @@
</table>
</section>
<section id="admonitions">
-<h4><a class="toc-backref" href="#toc-entry-57"><span class="sectnum">2.14.4</span> Admonitions</a></h4>
+<h4><a class="toc-backref" href="#toc-entry-57" role="doc-backlink"><span class="sectnum">2.14.4</span> Admonitions</a></h4>
<aside class="admonition attention">
<p class="admonition-title">Attention!</p>
<p>Directives at large.</p>
@@ -814,7 +814,7 @@
</aside>
</section>
<section id="topics-sidebars-and-rubrics">
-<h4><a class="toc-backref" href="#toc-entry-58"><span class="sectnum">2.14.5</span> Topics, Sidebars, and Rubrics</a></h4>
+<h4><a class="toc-backref" href="#toc-entry-58" role="doc-backlink"><span class="sectnum">2.14.5</span> Topics, Sidebars, and Rubrics</a></h4>
<p><em>Sidebars</em> are like miniature, parallel documents.</p>
<aside class="sidebar">
<p class="sidebar-title">Optional Sidebar Title</p>
@@ -838,7 +838,7 @@
allowed (e.g. inside a directive).</p>
</section>
<section id="target-footnotes">
-<h4><a class="toc-backref" href="#toc-entry-59"><span class="sectnum">2.14.6</span> Target Footnotes</a></h4>
+<h4><a class="toc-backref" href="#toc-entry-59" role="doc-backlink"><span class="sectnum">2.14.6</span> Target Footnotes</a></h4>
<aside class="footnote brackets" id="footnote-7" role="note">
<span class="label"><span class="fn-bracket">[</span>7<span class="fn-bracket">]</span></span>
<span class="backrefs">(<a role="doc-backlink" href="#footnote-reference-18">1</a>,<a role="doc-backlink" href="#footnote-reference-19">2</a>,<a role="doc-backlink" href="#footnote-reference-20">3</a>,<a role="doc-backlink" href="#footnote-reference-26">4</a>)</span>
@@ -894,11 +894,11 @@
</aside>
</section>
<section id="replacement-text">
-<h4><a class="toc-backref" href="#toc-entry-60"><span class="sectnum">2.14.7</span> Replacement Text</a></h4>
+<h4><a class="toc-backref" href="#toc-entry-60" role="doc-backlink"><span class="sectnum">2.14.7</span> Replacement Text</a></h4>
<p>I recommend you try <a class="reference external" href="http://www.python.org/">Python, <em>the</em> best language around</a> <a class="footnote-reference brackets" href="#footnote-7" id="footnote-reference-20" role="doc-noteref"><span class="fn-bracket">[</span>7<span class="fn-bracket">]</span></a>.</p>
</section>
<section id="compound-paragraph">
-<h4><a class="toc-backref" href="#toc-entry-61"><span class="sectnum">2.14.8</span> Compound Paragraph</a></h4>
+<h4><a class="toc-backref" href="#toc-entry-61" role="doc-backlink"><span class="sectnum">2.14.8</span> Compound Paragraph</a></h4>
<p>The <em>compound</em> directive is used to create a "compound paragraph", which
is a single logical paragraph containing multiple physical body
elements. For example:</p>
@@ -1009,7 +1009,7 @@
</div>
</section>
<section id="parsed-literal-blocks">
-<h4><a class="toc-backref" href="#toc-entry-62"><span class="sectnum">2.14.9</span> Parsed Literal Blocks</a></h4>
+<h4><a class="toc-backref" href="#toc-entry-62" role="doc-backlink"><span class="sectnum">2.14.9</span> Parsed Literal Blocks</a></h4>
<pre class="literal-block">This is a parsed literal block.
This line is indented. The next line is blank.
@@ -1019,7 +1019,7 @@
footnotes <a class="footnote-reference brackets" href="#footnote-1" id="footnote-reference-9" role="doc-noteref"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></a>, <span class="target" id="hyperlink-targets">hyperlink targets</span>, and <a class="reference external" href="http://www.python.org/">references</a>.</pre>
</section>
<section id="code">
-<h4><a class="toc-backref" href="#toc-entry-63"><span class="sectnum">2.14.10</span> Code</a></h4>
+<h4><a class="toc-backref" href="#toc-entry-63" role="doc-backlink"><span class="sectnum">2.14.10</span> Code</a></h4>
<p>Blocks of source code can be set with the <cite>code</cite> directive. If the code
language is specified, the content is parsed and tagged by the <a class="reference external" href="http://pygments.org/">Pygments</a> <a class="footnote-reference brackets" href="#footnote-8" id="footnote-reference-21" role="doc-noteref"><span class="fn-bracket">[</span>8<span class="fn-bracket">]</span></a>
syntax highlighter and can be formatted with a style sheet. (Code parsing
@@ -1044,19 +1044,19 @@
</co...
[truncated message content] |
|
From: <mi...@us...> - 2021-07-05 19:25:23
|
Revision: 8787
http://sourceforge.net/p/docutils/code/8787
Author: milde
Date: 2021-07-05 19:25:20 +0000 (Mon, 05 Jul 2021)
Log Message:
-----------
HTML5: small tweaks
Move space character between section number and heading
into "sectnum" span. Simplify code in _html_base.py.
responsive.css: highlight target of current URL,
show an arrow when hovering over section heading
to hint at the target of toc-backlinks.
Test setting `--toc_backlinks=top` and the "responsive.css" stylesheet.
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/RELEASE-NOTES.txt
trunk/docutils/docutils/writers/_html_base.py
trunk/docutils/docutils/writers/html5_polyglot/responsive.css
trunk/docutils/test/functional/expected/footnotes_html5.html
trunk/docutils/test/functional/expected/latex_cornercases.tex
trunk/docutils/test/functional/expected/misc_rst_html4css1.html
trunk/docutils/test/functional/expected/misc_rst_html5.html
trunk/docutils/test/functional/expected/standalone_rst_html5.html
trunk/docutils/test/functional/input/data/section_titles.txt
trunk/docutils/test/functional/input/misc_rst_html5.txt
trunk/docutils/test/functional/tests/footnotes_html5.py
trunk/docutils/test/functional/tests/misc_rst_html5.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2021-06-30 07:48:44 UTC (rev 8786)
+++ trunk/docutils/HISTORY.txt 2021-07-05 19:25:20 UTC (rev 8787)
@@ -62,8 +62,9 @@
they are present also without CSS and when copying text.
Adapt ``minimal.css``.
- - Use semantic tags <aside> and <nav> for footnote text and citations,
- topics, admonitions, and system-messages.
+ - Use semantic tags <aside> for footnote text, topics, admonitions,
+ and system-messages and <nav> for the table of contents. Use <div>
+ for citations.
- Use ARIA roles to enable accessible HTML for abstract, dedication,
the table of contents, footnote, references, footnotes, citations,
@@ -76,6 +77,9 @@
"compound-last" to elements nested in a compound.
Use class value "backrefs" instead of "fn-backref" for a span of
back-references.
+
+ - Move space character between section number and heading into
+ "sectnum" span.
- Removed attribute ``HTMLTranslator.topic_classes``
Modified: trunk/docutils/RELEASE-NOTES.txt
===================================================================
--- trunk/docutils/RELEASE-NOTES.txt 2021-06-30 07:48:44 UTC (rev 8786)
+++ trunk/docutils/RELEASE-NOTES.txt 2021-07-05 19:25:20 UTC (rev 8787)
@@ -93,6 +93,9 @@
Items of a definition list with class argument "details" are
converted to `details disclosure elements`_.
+
+ Move space character between section number and heading into
+ "sectnum" span.
LaTeX:
`legacy_class_functions`_ setting default changed to "False":
Modified: trunk/docutils/docutils/writers/_html_base.py
===================================================================
--- trunk/docutils/docutils/writers/_html_base.py 2021-06-30 07:48:44 UTC (rev 8786)
+++ trunk/docutils/docutils/writers/_html_base.py 2021-07-05 19:25:20 UTC (rev 8787)
@@ -413,7 +413,6 @@
tagname = tagname.lower()
prefix = []
atts = {}
- ids = []
for (name, value) in attributes.items():
atts[name.lower()] = value
classes = atts.pop('classes', [])
@@ -430,7 +429,7 @@
if classes:
atts['class'] = ' '.join(classes)
assert 'id' not in atts
- ids.extend(node.get('ids', []))
+ ids = node.get('ids', [])
ids.extend(atts.pop('ids', []))
if ids:
atts['id'] = ids[0]
@@ -964,7 +963,7 @@
if 'sectnum' in node['classes']:
# get section number (strip trailing no-break-spaces)
sectnum = node.astext().rstrip(u' ')
- self.body.append('<span class="sectnum">%s</span> '
+ self.body.append('<span class="sectnum">%s </span>'
% self.encode(sectnum))
# Content already processed:
raise nodes.SkipNode
Modified: trunk/docutils/docutils/writers/html5_polyglot/responsive.css
===================================================================
--- trunk/docutils/docutils/writers/html5_polyglot/responsive.css 2021-06-30 07:48:44 UTC (rev 8786)
+++ trunk/docutils/docutils/writers/html5_polyglot/responsive.css 2021-07-05 19:25:20 UTC (rev 8787)
@@ -260,11 +260,8 @@
/* Hyperlink References */
a {
- text-decoration: none;
- /* text-decoration-skip-ink: auto; !!nonstandard, default in modern browsers */
-}
-/* Wrap links at any place, if this is the only way to prevent overflow */
-a:link{
+ text-decoration: none; /* for chromium */
+ /* Wrap links at any place, if this is the only way to prevent overflow */
overflow-wrap: break-word;
}
.contents a, a.toc-backref, a.citation-reference {
@@ -276,10 +273,22 @@
.citation a.fn-backref {
color: inherit;
}
-a:link:hover {
- text-decoration: underline;}
-/* highlight the active ToC entry */
-.contents :target {
+a:hover {
+ text-decoration: underline;
+}
+*:hover > a.toc-backref:after {
+ content: " \2191"; /* ↑ UPWARDS ARROW */
+ color: grey;
+}
+/* highlight the target of the current URL */
+/* section:target > h2, section:target > h3, section:target > h4, */
+/* section:target > h5, section:target > h6, */
+.contents :target,
+.contents:target > .topic-title,
+[role="doc-biblioentry"]:target > .label,
+[role="doc-biblioref"]:target,
+[role="note"]:target > .label,
+[role="doc-noteref"]:target {
background-color: #d2e6ec;
}
Modified: trunk/docutils/test/functional/expected/footnotes_html5.html
===================================================================
--- trunk/docutils/test/functional/expected/footnotes_html5.html 2021-06-30 07:48:44 UTC (rev 8786)
+++ trunk/docutils/test/functional/expected/footnotes_html5.html 2021-07-05 19:25:20 UTC (rev 8787)
@@ -6,7 +6,7 @@
<meta name="generator" content="Docutils 0.18b.dev: http://docutils.sourceforge.net/" />
<title>Test footnote and citation rendering</title>
<link rel="stylesheet" href="../input/data/minimal.css" type="text/css" />
-<link rel="stylesheet" href="../input/data/plain.css" type="text/css" />
+<link rel="stylesheet" href="../input/data/responsive.css" type="text/css" />
</head>
<body>
<main id="test-footnote-and-citation-rendering">
Modified: trunk/docutils/test/functional/expected/latex_cornercases.tex
===================================================================
--- trunk/docutils/test/functional/expected/latex_cornercases.tex 2021-06-30 07:48:44 UTC (rev 8786)
+++ trunk/docutils/test/functional/expected/latex_cornercases.tex 2021-07-05 19:25:20 UTC (rev 8787)
@@ -212,7 +212,11 @@
\label{substitutions-fail}%
}
+Note, that the \textquotedbl{}reference name\textquotedbl{} for this section is derived from the
+content \emph{before} substitution. This may be exploited to get intelligible
+IDs after \href{https://docutils.sourceforge.io/docs/ref/rst/directives.html\#identifier-normalization}{identifier normalization} of the section's reference name.
+
\section{More Tables%
\label{more-tables}%
}
Modified: trunk/docutils/test/functional/expected/misc_rst_html4css1.html
===================================================================
--- trunk/docutils/test/functional/expected/misc_rst_html4css1.html 2021-06-30 07:48:44 UTC (rev 8786)
+++ trunk/docutils/test/functional/expected/misc_rst_html4css1.html 2021-07-05 19:25:20 UTC (rev 8787)
@@ -56,6 +56,9 @@
</div>
<div class="section" id="substitutions-fail">
<h2>Substitutions work</h2>
+<p>Note, that the "reference name" for this section is derived from the
+content <em>before</em> substitution. This may be exploited to get intelligible
+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>
Modified: trunk/docutils/test/functional/expected/misc_rst_html5.html
===================================================================
--- trunk/docutils/test/functional/expected/misc_rst_html5.html 2021-06-30 07:48:44 UTC (rev 8786)
+++ trunk/docutils/test/functional/expected/misc_rst_html5.html 2021-07-05 19:25:20 UTC (rev 8787)
@@ -5,41 +5,84 @@
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="generator" content="Docutils 0.18b.dev: http://docutils.sourceforge.net/" />
<title>Additional tests with HTML 5</title>
-<link rel="stylesheet" href="../../../docutils/writers/html5_polyglot/minimal.css" type="text/css" />
-<link rel="stylesheet" href="../../../docutils/writers/html5_polyglot/plain.css" type="text/css" />
-<link rel="stylesheet" href="../../../docutils/writers/html5_polyglot/math.css" type="text/css" />
+<link rel="stylesheet" href="../input/data/minimal.css" type="text/css" />
+<link rel="stylesheet" href="../input/data/responsive.css" type="text/css" />
+<link rel="stylesheet" href="../input/data/math.css" type="text/css" />
</head>
-<body>
+<body class="with-toc">
<main id="additional-tests-with-html-5">
<h1 class="title">Additional tests with HTML 5</h1>
+<nav class="contents" id="contents" role="doc-toc">
+<p class="topic-title">Contents</p>
+<ul class="simple">
+<li><p><a class="reference internal" href="#section-heading-levels" id="toc-entry-1">Section heading levels</a></p></li>
+<li><p><a class="reference internal" href="#level-1" id="toc-entry-2">Level 1</a></p>
+<ul>
+<li><p><a class="reference internal" href="#level-2" id="toc-entry-3">Level 2</a></p>
+<ul>
+<li><p><a class="reference internal" href="#level-3" id="toc-entry-4">Level 3</a></p>
+<ul>
+<li><p><a class="reference internal" href="#level-4" id="toc-entry-5">level 4</a></p>
+<ul>
+<li><p><a class="reference internal" href="#level-5" id="toc-entry-6">level 5</a></p>
+<ul>
+<li><p><a class="reference internal" href="#level-6" id="toc-entry-7">level 6</a></p>
+<ul>
+<li><p><a class="reference internal" href="#level-7" id="toc-entry-8">level 7</a></p>
+<ul>
+<li><p><a class="reference internal" href="#level-8" id="toc-entry-9">level 8</a></p></li>
+</ul>
+</li>
+</ul>
+</li>
+</ul>
+</li>
+</ul>
+</li>
+</ul>
+</li>
+</ul>
+</li>
+</ul>
+</li>
+<li><p><a class="reference internal" href="#section-titles-with-inline-markup" id="toc-entry-10">Section titles with inline markup</a></p>
+<ul>
+<li><p><a class="reference internal" href="#emphasized-h2o-x-2-and-references" id="toc-entry-11"><em>emphasized</em>, H<sub>2</sub>O, <span class="formula"><i>x</i><sup>2</sup></span>, and references</a></p></li>
+<li><p><a class="reference internal" href="#substitutions-fail" id="toc-entry-12">Substitutions work</a></p></li>
+</ul>
+</li>
+<li><p><a class="reference internal" href="#embedded-images" id="toc-entry-13">Embedded Images</a></p></li>
+<li><p><a class="reference internal" href="#moving-images-video" id="toc-entry-14">Moving images (video)</a></p></li>
+</ul>
+</nav>
<section id="section-heading-levels">
-<h2>Section heading levels</h2>
+<h2><a class="toc-backref" href="#contents" role="doc-backlink">Section heading levels</a></h2>
</section>
<section id="level-1">
-<h2>Level 1</h2>
+<h2><a class="toc-backref" href="#contents" role="doc-backlink">Level 1</a></h2>
<p>Nested sections</p>
<section id="level-2">
-<h3>Level 2</h3>
+<h3><a class="toc-backref" href="#contents" role="doc-backlink">Level 2</a></h3>
<p>reach at some level</p>
<section id="level-3">
-<h4>Level 3</h4>
+<h4><a class="toc-backref" href="#contents" role="doc-backlink">Level 3</a></h4>
<p>(depending on the document class and output format)</p>
<section id="level-4">
-<h5>level 4</h5>
+<h5><a class="toc-backref" href="#contents" role="doc-backlink">level 4</a></h5>
<p>a level</p>
<section id="level-5">
-<h6>level 5</h6>
+<h6><a class="toc-backref" href="#contents" role="doc-backlink">level 5</a></h6>
<p>that is not supported by the output format.</p>
<section id="level-6">
-<h6 aria-level="7">level 6</h6>
+<h6 aria-level="7"><a class="toc-backref" href="#contents" role="doc-backlink">level 6</a></h6>
<p>Unsupported in LaTeX and HTML5
(HTML5 reserves the 1st level for the document title).</p>
<section id="level-7">
-<h6 aria-level="8">level 7</h6>
+<h6 aria-level="8"><a class="toc-backref" href="#contents" role="doc-backlink">level 7</a></h6>
<p>Unsupported in HTML4.</p>
<section id="level-8">
-<h6 aria-level="9">level 8</h6>
+<h6 aria-level="9"><a class="toc-backref" href="#contents" role="doc-backlink">level 8</a></h6>
<p>Unsupported in ODT.</p>
</section>
</section>
@@ -50,16 +93,19 @@
</section>
</section>
<section id="section-titles-with-inline-markup">
-<span id="references"></span><h2>Section titles with inline markup</h2>
+<span id="references"></span><h2><a class="toc-backref" href="#contents" role="doc-backlink">Section titles with inline markup</a></h2>
<section id="emphasized-h2o-x-2-and-references">
<h3><em>emphasized</em>, H<sub>2</sub>O, <span class="formula"><i>x</i><sup>2</sup></span>, and <a class="reference internal" href="#references">references</a></h3>
</section>
<section id="substitutions-fail">
-<h3>Substitutions work</h3>
+<h3><a class="toc-backref" href="#contents" role="doc-backlink">Substitutions work</a></h3>
+<p>Note, that the “reference name” for this section is derived from the
+content <em>before</em> substitution. This may be exploited to get intelligible
+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>
</section>
</section>
<section id="embedded-images">
-<h2>Embedded Images</h2>
+<h2><a class="toc-backref" href="#contents" role="doc-backlink">Embedded Images</a></h2>
<p>The “embed” flag tells Docutils that it should
try to embed the image in the output document.</p>
<p>If the image can be read from the local file system, it is <a class="reference external" href="https://en.wikipedia.org/wiki/Base64">base64</a>
@@ -74,7 +120,7 @@
<p>Embedded inline image <img alt="inline-embedded" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAABGdBTUEAANkE3LLaAgAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAAZQTFRF////AAAAVcLTfgAAAAF0Uk5TAEDm2GYAAAA2SURBVHicYmBRYOAQYJCQYJC+wSBjAUL2fxjq6hgueTNM7AQh3g0MzAdAiP0BUBYAAAD//wMA4pkLDrFBDzUAAAAASUVORK5CYII=" style="height: 0.8em;" /> scaled to a height of 0.8 em.</p>
</section>
<section id="moving-images-video">
-<h2>Moving images (video)</h2>
+<h2><a class="toc-backref" href="#contents" role="doc-backlink">Moving images (video)</a></h2>
<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>
Modified: trunk/docutils/test/functional/expected/standalone_rst_html5.html
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_html5.html 2021-06-30 07:48:44 UTC (rev 8786)
+++ trunk/docutils/test/functional/expected/standalone_rst_html5.html 2021-07-05 19:25:20 UTC (rev 8787)
@@ -85,86 +85,86 @@
<nav class="contents" id="table-of-contents" role="doc-toc">
<p class="topic-title">Table of Contents</p>
<ul class="auto-toc simple">
-<li><p><a class="reference internal" href="#structural-elements" id="toc-entry-1"><span class="sectnum">1</span> Structural Elements</a></p>
+<li><p><a class="reference internal" href="#structural-elements" id="toc-entry-1"><span class="sectnum">1 </span>Structural Elements</a></p>
<ul class="auto-toc">
-<li><p><a class="reference internal" href="#section-title" id="toc-entry-2"><span class="sectnum">1.1</span> Section Title</a></p></li>
-<li><p><a class="reference internal" href="#empty-section" id="toc-entry-3"><span class="sectnum">1.2</span> Empty Section</a></p></li>
-<li><p><a class="reference internal" href="#transitions" id="toc-entry-4"><span class="sectnum">1.3</span> Transitions</a></p></li>
+<li><p><a class="reference internal" href="#section-title" id="toc-entry-2"><span class="sectnum">1.1 </span>Section Title</a></p></li>
+<li><p><a class="reference internal" href="#empty-section" id="toc-entry-3"><span class="sectnum">1.2 </span>Empty Section</a></p></li>
+<li><p><a class="reference internal" href="#transitions" id="toc-entry-4"><span class="sectnum">1.3 </span>Transitions</a></p></li>
</ul>
</li>
-<li><p><a class="reference internal" href="#body-elements" id="toc-entry-5"><span class="sectnum">2</span> Body Elements</a></p>
+<li><p><a class="reference internal" href="#body-elements" id="toc-entry-5"><span class="sectnum">2 </span>Body Elements</a></p>
<ul class="auto-toc">
-<li><p><a class="reference internal" href="#paragraphs" id="toc-entry-6"><span class="sectnum">2.1</span> Paragraphs</a></p>
+<li><p><a class="reference internal" href="#paragraphs" id="toc-entry-6"><span class="sectnum">2.1 </span>Paragraphs</a></p>
<ul class="auto-toc">
-<li><p><a class="reference internal" href="#inline-markup" id="toc-entry-7"><span class="sectnum">2.1.1</span> Inline Markup</a></p></li>
+<li><p><a class="reference internal" href="#inline-markup" id="toc-entry-7"><span class="sectnum">2.1.1 </span>Inline Markup</a></p></li>
</ul>
</li>
-<li><p><a class="reference internal" href="#bullet-lists" id="toc-entry-8"><span class="sectnum">2.2</span> Bullet Lists</a></p></li>
-<li><p><a class="reference internal" href="#enumerated-lists" id="toc-entry-9"><span class="sectnum">2.3</span> Enumerated Lists</a></p></li>
-<li><p><a class="reference internal" href="#definition-lists" id="toc-entry-10"><span class="sectnum">2.4</span> Definition Lists</a></p></li>
-<li><p><a class="reference internal" href="#field-lists" id="toc-entry-11"><span class="sectnum">2.5</span> Field Lists</a></p></li>
-<li><p><a class="reference internal" href="#option-lists" id="toc-entry-12"><span class="sectnum">2.6</span> Option Lists</a></p></li>
-<li><p><a class="reference internal" href="#literal-blocks" id="toc-entry-13"><span class="sectnum">2.7</span> Literal Blocks</a></p></li>
-<li><p><a class="reference internal" href="#line-blocks" id="toc-entry-14"><span class="sectnum">2.8</span> Line Blocks</a></p></li>
-<li><p><a class="reference internal" href="#block-quotes" id="toc-entry-15"><span class="sectnum">2.9</span> Block Quotes</a></p></li>
-<li><p><a class="reference internal" href="#doctest-blocks" id="toc-entry-16"><span class="sectnum">2.10</span> Doctest Blocks</a></p></li>
-<li><p><a class="reference internal" href="#footnotes" id="toc-entry-17"><span class="sectnum">2.11</span> Footnotes</a></p></li>
-<li><p><a class="reference internal" href="#citations" id="toc-entry-18"><span class="sectnum">2.12</span> Citations</a></p></li>
-<li><p><a class="reference internal" href="#targets" id="toc-entry-19"><span class="sectnum">2.13</span> Targets</a></p>
+<li><p><a class="reference internal" href="#bullet-lists" id="toc-entry-8"><span class="sectnum">2.2 </span>Bullet Lists</a></p></li>
+<li><p><a class="reference internal" href="#enumerated-lists" id="toc-entry-9"><span class="sectnum">2.3 </span>Enumerated Lists</a></p></li>
+<li><p><a class="reference internal" href="#definition-lists" id="toc-entry-10"><span class="sectnum">2.4 </span>Definition Lists</a></p></li>
+<li><p><a class="reference internal" href="#field-lists" id="toc-entry-11"><span class="sectnum">2.5 </span>Field Lists</a></p></li>
+<li><p><a class="reference internal" href="#option-lists" id="toc-entry-12"><span class="sectnum">2.6 </span>Option Lists</a></p></li>
+<li><p><a class="reference internal" href="#literal-blocks" id="toc-entry-13"><span class="sectnum">2.7 </span>Literal Blocks</a></p></li>
+<li><p><a class="reference internal" href="#line-blocks" id="toc-entry-14"><span class="sectnum">2.8 </span>Line Blocks</a></p></li>
+<li><p><a class="reference internal" href="#block-quotes" id="toc-entry-15"><span class="sectnum">2.9 </span>Block Quotes</a></p></li>
+<li><p><a class="reference internal" href="#doctest-blocks" id="toc-entry-16"><span class="sectnum">2.10 </span>Doctest Blocks</a></p></li>
+<li><p><a class="reference internal" href="#footnotes" id="toc-entry-17"><span class="sectnum">2.11 </span>Footnotes</a></p></li>
+<li><p><a class="reference internal" href="#citations" id="toc-entry-18"><span class="sectnum">2.12 </span>Citations</a></p></li>
+<li><p><a class="reference internal" href="#targets" id="toc-entry-19"><span class="sectnum">2.13 </span>Targets</a></p>
<ul class="auto-toc">
-<li><p><a class="reference internal" href="#duplicate-target-names" id="toc-entry-20"><span class="sectnum">2.13.1</span> Duplicate Target Names</a></p></li>
-<li><p><a class="reference internal" href="#duplicate-target-names-1" id="toc-entry-21"><span class="sectnum">2.13.2</span> Duplicate Target Names</a></p></li>
+<li><p><a class="reference internal" href="#duplicate-target-names" id="toc-entry-20"><span class="sectnum">2.13.1 </span>Duplicate Target Names</a></p></li>
+<li><p><a class="reference internal" href="#duplicate-target-names-1" id="toc-entry-21"><span class="sectnum">2.13.2 </span>Duplicate Target Names</a></p></li>
</ul>
</li>
-<li><p><a class="reference internal" href="#directives" id="toc-entry-22"><span class="sectnum">2.14</span> Directives</a></p>
+<li><p><a class="reference internal" href="#directives" id="toc-entry-22"><span class="sectnum">2.14 </span>Directives</a></p>
<ul class="auto-toc">
-<li><p><a class="reference internal" href="#document-parts" id="toc-entry-23"><span class="sectnum">2.14.1</span> Document Parts</a></p></li>
-<li><p><a class="reference internal" href="#images-and-figures" id="toc-entry-24"><span class="sectnum">2.14.2</span> Images and Figures</a></p></li>
-<li><p><a class="reference internal" href="#tables" id="toc-entry-25"><span class="sectnum">2.14.3</span> Tables</a></p></li>
-<li><p><a class="reference internal" href="#admonitions" id="toc-entry-26"><span class="sectnum">2.14.4</span> Admonitions</a></p></li>
-<li><p><a class="reference internal" href="#topics-sidebars-and-rubrics" id="toc-entry-27"><span class="sectnum">2.14.5</span> Topics, Sidebars, and Rubrics</a></p></li>
-<li><p><a class="reference internal" href="#target-footnotes" id="toc-entry-28"><span class="sectnum">2.14.6</span> Target Footnotes</a></p></li>
-<li><p><a class="reference internal" href="#replacement-text" id="toc-entry-29"><span class="sectnum">2.14.7</span> Replacement Text</a></p></li>
-<li><p><a class="reference internal" href="#compound-paragraph" id="toc-entry-30"><span class="sectnum">2.14.8</span> Compound Paragraph</a></p></li>
-<li><p><a class="reference internal" href="#parsed-literal-blocks" id="toc-entry-31"><span class="sectnum">2.14.9</span> Parsed Literal Blocks</a></p></li>
-<li><p><a class="reference internal" href="#code" id="toc-entry-32"><span class="sectnum">2.14.10</span> Code</a></p></li>
-<li><p><a class="reference internal" href="#meta" id="toc-entry-33"><span class="sectnum">2.14.11</span> Meta</a></p></li>
+<li><p><a class="reference internal" href="#document-parts" id="toc-entry-23"><span class="sectnum">2.14.1 </span>Document Parts</a></p></li>
+<li><p><a class="reference internal" href="#images-and-figures" id="toc-entry-24"><span class="sectnum">2.14.2 </span>Images and Figures</a></p></li>
+<li><p><a class="reference internal" href="#tables" id="toc-entry-25"><span class="sectnum">2.14.3 </span>Tables</a></p></li>
+<li><p><a class="reference internal" href="#admonitions" id="toc-entry-26"><span class="sectnum">2.14.4 </span>Admonitions</a></p></li>
+<li><p><a class="reference internal" href="#topics-sidebars-and-rubrics" id="toc-entry-27"><span class="sectnum">2.14.5 </span>Topics, Sidebars, and Rubrics</a></p></li>
+<li><p><a class="reference internal" href="#target-footnotes" id="toc-entry-28"><span class="sectnum">2.14.6 </span>Target Footnotes</a></p></li>
+<li><p><a class="reference internal" href="#replacement-text" id="toc-entry-29"><span class="sectnum">2.14.7 </span>Replacement Text</a></p></li>
+<li><p><a class="reference internal" href="#compound-paragraph" id="toc-entry-30"><span class="sectnum">2.14.8 </span>Compound Paragraph</a></p></li>
+<li><p><a class="reference internal" href="#parsed-literal-blocks" id="toc-entry-31"><span class="sectnum">2.14.9 </span>Parsed Literal Blocks</a></p></li>
+<li><p><a class="reference internal" href="#code" id="toc-entry-32"><span class="sectnum">2.14.10 </span>Code</a></p></li>
+<li><p><a class="reference internal" href="#meta" id="toc-entry-33"><span class="sectnum">2.14.11 </span>Meta</a></p></li>
</ul>
</li>
-<li><p><a class="reference internal" href="#substitution-definitions" id="toc-entry-34"><span class="sectnum">2.15</span> Substitution Definitions</a></p></li>
-<li><p><a class="reference internal" href="#comments" id="toc-entry-35"><span class="sectnum">2.16</span> Comments</a></p></li>
-<li><p><a class="reference internal" href="#raw-text" id="toc-entry-36"><span class="sectnum">2.17</span> Raw text</a></p></li>
-<li><p><a class="reference internal" href="#container" id="toc-entry-37"><span class="sectnum">2.18</span> Container</a></p></li>
-<li><p><a class="reference internal" href="#colspanning-tables" id="toc-entry-38"><span class="sectnum">2.19</span> Colspanning tables</a></p></li>
-<li><p><a class="reference internal" href="#rowspanning-tables" id="toc-entry-39"><span class="sectnum">2.20</span> Rowspanning tables</a></p></li>
-<li><p><a class="reference internal" href="#complex-tables" id="toc-entry-40"><span class="sectnum">2.21</span> Complex tables</a></p></li>
-<li><p><a class="reference internal" href="#list-tables" id="toc-entry-41"><span class="sectnum">2.22</span> List Tables</a></p></li>
-<li><p><a class="reference internal" href="#custom-roles" id="toc-entry-42"><span class="sectnum">2.23</span> Custom Roles</a></p></li>
+<li><p><a class="reference internal" href="#substitution-definitions" id="toc-entry-34"><span class="sectnum">2.15 </span>Substitution Definitions</a></p></li>
+<li><p><a class="reference internal" href="#comments" id="toc-entry-35"><span class="sectnum">2.16 </span>Comments</a></p></li>
+<li><p><a class="reference internal" href="#raw-text" id="toc-entry-36"><span class="sectnum">2.17 </span>Raw text</a></p></li>
+<li><p><a class="reference internal" href="#container" id="toc-entry-37"><span class="sectnum">2.18 </span>Container</a></p></li>
+<li><p><a class="reference internal" href="#colspanning-tables" id="toc-entry-38"><span class="sectnum">2.19 </span>Colspanning tables</a></p></li>
+<li><p><a class="reference internal" href="#rowspanning-tables" id="toc-entry-39"><span class="sectnum">2.20 </span>Rowspanning tables</a></p></li>
+<li><p><a class="reference internal" href="#complex-tables" id="toc-entry-40"><span class="sectnum">2.21 </span>Complex tables</a></p></li>
+<li><p><a class="reference internal" href="#list-tables" id="toc-entry-41"><span class="sectnum">2.22 </span>List Tables</a></p></li>
+<li><p><a class="reference internal" href="#custom-roles" id="toc-entry-42"><span class="sectnum">2.23 </span>Custom Roles</a></p></li>
</ul>
</li>
-<li><p><a class="reference internal" href="#changes-to-the-html4css1-writer" id="toc-entry-43"><span class="sectnum">3</span> Changes to the <cite>html4css1</cite> Writer</a></p>
+<li><p><a class="reference internal" href="#changes-to-the-html4css1-writer" id="toc-entry-43"><span class="sectnum">3 </span>Changes to the <cite>html4css1</cite> Writer</a></p>
<ul class="auto-toc">
-<li><p><a class="reference internal" href="#field-list-rendering" id="toc-entry-44"><span class="sectnum">3.1</span> Field List Rendering</a></p></li>
-<li><p><a class="reference internal" href="#styling-with-class-arguments" id="toc-entry-45"><span class="sectnum">3.2</span> Styling with Class Arguments</a></p>
+<li><p><a class="reference internal" href="#field-list-rendering" id="toc-entry-44"><span class="sectnum">3.1 </span>Field List Rendering</a></p></li>
+<li><p><a class="reference internal" href="#styling-with-class-arguments" id="toc-entry-45"><span class="sectnum">3.2 </span>Styling with Class Arguments</a></p>
<ul class="auto-toc">
-<li><p><a class="reference internal" href="#description-lists" id="toc-entry-46"><span class="sectnum">3.2.1</span> Description Lists</a></p></li>
-<li><p><a class="reference internal" href="#details-disclosure-elements" id="toc-entry-47"><span class="sectnum">3.2.2</span> Details disclosure elements</a></p></li>
-<li><p><a class="reference internal" href="#field-list-variants" id="toc-entry-48"><span class="sectnum">3.2.3</span> Field List Variants</a></p></li>
-<li><p><a class="reference internal" href="#table-variants" id="toc-entry-49"><span class="sectnum">3.2.4</span> Table Variants</a></p></li>
-<li><p><a class="reference internal" href="#numbered-figures" id="toc-entry-50"><span class="sectnum">3.2.5</span> Numbered Figures</a></p></li>
+<li><p><a class="reference internal" href="#description-lists" id="toc-entry-46"><span class="sectnum">3.2.1 </span>Description Lists</a></p></li>
+<li><p><a class="reference internal" href="#details-disclosure-elements" id="toc-entry-47"><span class="sectnum">3.2.2 </span>Details disclosure elements</a></p></li>
+<li><p><a class="reference internal" href="#field-list-variants" id="toc-entry-48"><span class="sectnum">3.2.3 </span>Field List Variants</a></p></li>
+<li><p><a class="reference internal" href="#table-variants" id="toc-entry-49"><span class="sectnum">3.2.4 </span>Table Variants</a></p></li>
+<li><p><a class="reference internal" href="#numbered-figures" id="toc-entry-50"><span class="sectnum">3.2.5 </span>Numbered Figures</a></p></li>
</ul>
</li>
-<li><p><a class="reference internal" href="#text-level-semantics" id="toc-entry-51"><span class="sectnum">3.3</span> Text-Level Semantics</a></p></li>
-<li><p><a class="referen...
[truncated message content] |
|
From: <mi...@us...> - 2021-07-05 19:25:39
|
Revision: 8788
http://sourceforge.net/p/docutils/code/8788
Author: milde
Date: 2021-07-05 19:25:34 +0000 (Mon, 05 Jul 2021)
Log Message:
-----------
HTML5: add self-link after section headings (feature request #28).
The "section_self_link" setting triggers this behaviour. As it is
currently only implemented for HTML5, the setting is defined for this
writer only.
The self-link "invisible" by default. The provided stylesheet
"responsive.css" gives an example how it can be made visible when
hovering over the section heading.
Modified Paths:
--------------
trunk/docutils/docs/user/config.txt
trunk/docutils/docutils/writers/html5_polyglot/__init__.py
trunk/docutils/docutils/writers/html5_polyglot/responsive.css
trunk/docutils/docutils.conf
trunk/docutils/test/functional/expected/footnotes_html5.html
trunk/docutils/test/functional/expected/misc_rst_html5.html
trunk/docutils/test/functional/tests/footnotes_html5.py
trunk/docutils/test/functional/tests/misc_rst_html5.py
trunk/docutils/test/test_writers/test_html5_polyglot_parts.py
Modified: trunk/docutils/docs/user/config.txt
===================================================================
--- trunk/docutils/docs/user/config.txt 2021-07-05 19:25:20 UTC (rev 8787)
+++ trunk/docutils/docs/user/config.txt 2021-07-05 19:25:34 UTC (rev 8788)
@@ -1253,45 +1253,6 @@
Options: ``--xml-declaration``, ``--no-xml-declaration``.
-[html5 writer]
-~~~~~~~~~~~~~~
-
-The `HTML5 Writer`_ generates valid XML that is compatible with `HTML5`_.
-It shares all settings defined in the `[html writers]`_
-`configuration section`_.
-
-New in Docutils 0.13.
-
-__ https://www.w3.org/TR/html53/sections.html#the-h1-h2-h3-h4-h5-and-h6-elements
-.. _HTML5 Writer: html.html#html5-polyglot
-.. _HTML5: http://www.w3.org/TR/html5/
-
-
-Writer Specific Defaults
-""""""""""""""""""""""""
-
-`initial_header_level`_
- 2 (for "<h2>", cf. the `HTML5.3 Working Draft`__)
-
-`stylesheet_path <stylesheet_path [html writers]_>`__:
- "minimal.css, plain.css"
-
-embed_images
-""""""""""""
-
-Embed images in the output HTML file. If the image can be read from
-the local file system and its MIME type can be determined, it is
-base64_ encoded and included as a `data URI`_.
-
-Default: disabled (False).
-Options: ``--embed-images``, ``--link-images``.
-
-New in Docutils 0.17.
-
-.. _base64: https://en.wikipedia.org/wiki/Base64
-.. _data URI: https://en.wikipedia.org/wiki/Data_URI_scheme
-
-
[html4css1 writer]
~~~~~~~~~~~~~~~~~~
@@ -1338,6 +1299,58 @@
Default: 14 (i.e. 14 characters). Option: ``--option-limit``.
+[html5 writer]
+~~~~~~~~~~~~~~
+
+The `HTML5 Writer`_ generates valid XML that is compatible with `HTML5`_.
+It shares all settings defined in the `[html writers]`_
+`configuration section`_.
+
+New in Docutils 0.13.
+
+__ https://www.w3.org/TR/html53/sections.html#the-h1-h2-h3-h4-h5-and-h6-elements
+.. _HTML5 Writer: html.html#html5-polyglot
+.. _HTML5: http://www.w3.org/TR/html5/
+
+
+Writer Specific Defaults
+""""""""""""""""""""""""
+
+`initial_header_level`_
+ 2 (for "<h2>", cf. the `HTML5.3 Working Draft`__)
+
+`stylesheet_path <stylesheet_path [html writers]_>`__:
+ "minimal.css, plain.css"
+
+embed_images
+""""""""""""
+
+Embed images in the output HTML file. If the image can be read from
+the local file system and its MIME type can be determined, it is
+base64_ encoded and included as a `data URI`_.
+
+Default: disabled (False).
+Options: ``--embed-images``, ``--link-images``.
+
+New in Docutils 0.17.
+
+.. _base64: https://en.wikipedia.org/wiki/Base64
+.. _data URI: https://en.wikipedia.org/wiki/Data_URI_scheme
+
+
+section_self_link
+"""""""""""""""""
+
+Append an empty anchor element with a ``href`` to the section to
+section headings. See ``responsive.css`` for an example how this can be
+styled to show a symbol allowing users to copy the section's URL.
+
+Default: disabled (False).
+Options: ``--section-self-link``, ``--no-section-self-link``.
+
+New in Docutils 0.18.
+
+
[pep_html writer]
~~~~~~~~~~~~~~~~~
@@ -2036,22 +2049,6 @@
Default: False. Option: ``--dry-run``.
-.. _html_writer:
-.. _writer [buildhtml application]:
-
-writer
-~~~~~~
-
-`HTML writer`_ version. One of "html", "html4", "html5".
-
-Default: "html" (use Docutils' default HTML writer).
-Option: ``--writer``
-
-New in 0.17. Obsoletes the ``html_writer`` option.
-
-.. _HTML writer: html.html
-
-
ignore
~~~~~~
@@ -2088,13 +2085,22 @@
Default: show progress (None). Option: ``--silent``.
+.. _html_writer:
+.. _writer [buildhtml application]:
-[docfactory application]
-------------------------
+writer
+~~~~~~
-(To be completed.)
+`HTML writer`_ version. One of "html", "html4", "html5".
+Default: "html" (use Docutils' default HTML writer).
+Option: ``--writer``
+New in 0.17. Obsoletes the ``html_writer`` option.
+
+.. _HTML writer: html.html
+
+
Other Settings
==============
Modified: trunk/docutils/docutils/writers/html5_polyglot/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/html5_polyglot/__init__.py 2021-07-05 19:25:20 UTC (rev 8787)
+++ trunk/docutils/docutils/writers/html5_polyglot/__init__.py 2021-07-05 19:25:34 UTC (rev 8788)
@@ -90,10 +90,15 @@
['--embed-images'],
{'default': 0, 'action': 'store_true',
'validator': frontend.validate_boolean}),
- ('Link to images in the output HTML file. '
- 'This is the default.',
+ ('Link to images in the output HTML file. (default)',
['--link-images'],
{'dest': 'embed_images', 'action': 'store_false'}),
+ ('Append a self-link to section headings.',
+ ['--section-self-link'],
+ {'default': 0, 'action': 'store_true'}),
+ ('Do not append a self-link to section headings. (default)',
+ ['--no-section-self-link'],
+ {'dest': 'section_self_link', 'action': 'store_false'}),
))
config_section = 'html5 writer'
@@ -426,3 +431,15 @@
def depart_topic(self, node):
self.body.append('</%s>\n'%node.html_tagname)
del(node.html_tagname)
+
+ # append self-link
+ def section_title_tags(self, node):
+ start_tag, close_tag = super(HTMLTranslator,
+ self).section_title_tags(node)
+ ids = node.parent['ids']
+ if (ids and self.settings.section_self_link
+ and not isinstance(node.parent, nodes.document)):
+ self_link = ('<a class="self-link" title="link to this section"'
+ ' href="#%s"></a>' % ids[0])
+ close_tag = close_tag.replace('</h', self_link + '</h')
+ return start_tag, close_tag
Modified: trunk/docutils/docutils/writers/html5_polyglot/responsive.css
===================================================================
--- trunk/docutils/docutils/writers/html5_polyglot/responsive.css 2021-07-05 19:25:20 UTC (rev 8787)
+++ trunk/docutils/docutils/writers/html5_polyglot/responsive.css 2021-07-05 19:25:34 UTC (rev 8788)
@@ -280,6 +280,12 @@
content: " \2191"; /* ↑ UPWARDS ARROW */
color: grey;
}
+*:hover > a.self-link:after {
+ content: "\1F517"; /* LINK SYMBOL */
+ color: grey;
+ font-size: smaller;
+ margin-left: 0.2em;
+}
/* highlight the target of the current URL */
/* section:target > h2, section:target > h3, section:target > h4, */
/* section:target > h5, section:target > h6, */
Modified: trunk/docutils/docutils.conf
===================================================================
--- trunk/docutils/docutils.conf 2021-07-05 19:25:20 UTC (rev 8787)
+++ trunk/docutils/docutils.conf 2021-07-05 19:25:34 UTC (rev 8788)
@@ -15,6 +15,7 @@
[html5 writer]
stylesheet-dirs: docutils/writers/html5_polyglot/
stylesheet-path: minimal.css, responsive.css
+section-self-link: yes
# Prevent tools/buildhtml.py from processing certain text files.
[buildhtml application]
Modified: trunk/docutils/test/functional/expected/footnotes_html5.html
===================================================================
--- trunk/docutils/test/functional/expected/footnotes_html5.html 2021-07-05 19:25:20 UTC (rev 8787)
+++ trunk/docutils/test/functional/expected/footnotes_html5.html 2021-07-05 19:25:34 UTC (rev 8788)
@@ -51,7 +51,7 @@
nonexistent footnote:<a class="footnote-reference superscript" href="#footnote-6" id="footnote-reference-8" role="doc-noteref"><span class="fn-bracket">[</span>5<span class="fn-bracket">]</span></a>.</p>
</aside>
<section id="citations">
-<h2>Citations</h2>
+<h2>Citations<a class="self-link" title="link to this section" href="#citations"></a></h2>
<div role="list" class="citation-list">
<div class="citation" id="cit2002" role="doc-biblioentry">
<span class="label"><span class="fn-bracket">[</span>CIT2002<span class="fn-bracket">]</span></span>
Modified: trunk/docutils/test/functional/expected/misc_rst_html5.html
===================================================================
--- trunk/docutils/test/functional/expected/misc_rst_html5.html 2021-07-05 19:25:20 UTC (rev 8787)
+++ trunk/docutils/test/functional/expected/misc_rst_html5.html 2021-07-05 19:25:34 UTC (rev 8788)
@@ -57,32 +57,32 @@
</ul>
</nav>
<section id="section-heading-levels">
-<h2><a class="toc-backref" href="#contents" role="doc-backlink">Section heading levels</a></h2>
+<h2><a class="toc-backref" href="#contents" role="doc-backlink">Section heading levels</a><a class="self-link" title="link to this section" href="#section-heading-levels"></a></h2>
</section>
<section id="level-1">
-<h2><a class="toc-backref" href="#contents" role="doc-backlink">Level 1</a></h2>
+<h2><a class="toc-backref" href="#contents" role="doc-backlink">Level 1</a><a class="self-link" title="link to this section" href="#level-1"></a></h2>
<p>Nested sections</p>
<section id="level-2">
-<h3><a class="toc-backref" href="#contents" role="doc-backlink">Level 2</a></h3>
+<h3><a class="toc-backref" href="#contents" role="doc-backlink">Level 2</a><a class="self-link" title="link to this section" href="#level-2"></a></h3>
<p>reach at some level</p>
<section id="level-3">
-<h4><a class="toc-backref" href="#contents" role="doc-backlink">Level 3</a></h4>
+<h4><a class="toc-backref" href="#contents" role="doc-backlink">Level 3</a><a class="self-link" title="link to this section" href="#level-3"></a></h4>
<p>(depending on the document class and output format)</p>
<section id="level-4">
-<h5><a class="toc-backref" href="#contents" role="doc-backlink">level 4</a></h5>
+<h5><a class="toc-backref" href="#contents" role="doc-backlink">level 4</a><a class="self-link" title="link to this section" href="#level-4"></a></h5>
<p>a level</p>
<section id="level-5">
-<h6><a class="toc-backref" href="#contents" role="doc-backlink">level 5</a></h6>
+<h6><a class="toc-backref" href="#contents" role="doc-backlink">level 5</a><a class="self-link" title="link to this section" href="#level-5"></a></h6>
<p>that is not supported by the output format.</p>
<section id="level-6">
-<h6 aria-level="7"><a class="toc-backref" href="#contents" role="doc-backlink">level 6</a></h6>
+<h6 aria-level="7"><a class="toc-backref" href="#contents" role="doc-backlink">level 6</a><a class="self-link" title="link to this section" href="#level-6"></a></h6>
<p>Unsupported in LaTeX and HTML5
(HTML5 reserves the 1st level for the document title).</p>
<section id="level-7">
-<h6 aria-level="8"><a class="toc-backref" href="#contents" role="doc-backlink">level 7</a></h6>
+<h6 aria-level="8"><a class="toc-backref" href="#contents" role="doc-backlink">level 7</a><a class="self-link" title="link to this section" href="#level-7"></a></h6>
<p>Unsupported in HTML4.</p>
<section id="level-8">
-<h6 aria-level="9"><a class="toc-backref" href="#contents" role="doc-backlink">level 8</a></h6>
+<h6 aria-level="9"><a class="toc-backref" href="#contents" role="doc-backlink">level 8</a><a class="self-link" title="link to this section" href="#level-8"></a></h6>
<p>Unsupported in ODT.</p>
</section>
</section>
@@ -93,12 +93,12 @@
</section>
</section>
<section id="section-titles-with-inline-markup">
-<span id="references"></span><h2><a class="toc-backref" href="#contents" role="doc-backlink">Section titles with inline markup</a></h2>
+<span id="references"></span><h2><a class="toc-backref" href="#contents" role="doc-backlink">Section titles with inline markup</a><a class="self-link" title="link to this section" href="#section-titles-with-inline-markup"></a></h2>
<section id="emphasized-h2o-x-2-and-references">
-<h3><em>emphasized</em>, H<sub>2</sub>O, <span class="formula"><i>x</i><sup>2</sup></span>, and <a class="reference internal" href="#references">references</a></h3>
+<h3><em>emphasized</em>, H<sub>2</sub>O, <span class="formula"><i>x</i><sup>2</sup></span>, and <a class="reference internal" href="#references">references</a><a class="self-link" title="link to this section" href="#emphasized-h2o-x-2-and-references"></a></h3>
</section>
<section id="substitutions-fail">
-<h3><a class="toc-backref" href="#contents" role="doc-backlink">Substitutions work</a></h3>
+<h3><a class="toc-backref" href="#contents" role="doc-backlink">Substitutions work</a><a class="self-link" title="link to this section" href="#substitutions-fail"></a></h3>
<p>Note, that the “reference name” for this section is derived from the
content <em>before</em> substitution. This may be exploited to get intelligible
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>
@@ -105,7 +105,7 @@
</section>
</section>
<section id="embedded-images">
-<h2><a class="toc-backref" href="#contents" role="doc-backlink">Embedded Images</a></h2>
+<h2><a class="toc-backref" href="#contents" role="doc-backlink">Embedded Images</a><a class="self-link" title="link to this section" href="#embedded-images"></a></h2>
<p>The “embed” flag tells Docutils that it should
try to embed the image in the output document.</p>
<p>If the image can be read from the local file system, it is <a class="reference external" href="https://en.wikipedia.org/wiki/Base64">base64</a>
@@ -120,7 +120,7 @@
<p>Embedded inline image <img alt="inline-embedded" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAABGdBTUEAANkE3LLaAgAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAAZQTFRF////AAAAVcLTfgAAAAF0Uk5TAEDm2GYAAAA2SURBVHicYmBRYOAQYJCQYJC+wSBjAUL2fxjq6hgueTNM7AQh3g0MzAdAiP0BUBYAAAD//wMA4pkLDrFBDzUAAAAASUVORK5CYII=" style="height: 0.8em;" /> scaled to a height of 0.8 em.</p>
</section>
<section id="moving-images-video">
-<h2><a class="toc-backref" href="#contents" role="doc-backlink">Moving images (video)</a></h2>
+<h2><a class="toc-backref" href="#contents" role="doc-backlink">Moving images (video)</a><a class="self-link" title="link to this section" href="#moving-images-video"></a></h2>
<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>
Modified: trunk/docutils/test/functional/tests/footnotes_html5.py
===================================================================
--- trunk/docutils/test/functional/tests/footnotes_html5.py 2021-07-05 19:25:20 UTC (rev 8787)
+++ trunk/docutils/test/functional/tests/footnotes_html5.py 2021-07-05 19:25:34 UTC (rev 8788)
@@ -14,3 +14,4 @@
settings_overrides['stylesheet_dirs'] = ('.', 'functional/input/data')
settings_overrides['stylesheet_path'] = 'minimal.css,responsive.css'
settings_overrides['footnote_references'] = 'superscript'
+settings_overrides['section_self_link'] = True
Modified: trunk/docutils/test/functional/tests/misc_rst_html5.py
===================================================================
--- trunk/docutils/test/functional/tests/misc_rst_html5.py 2021-07-05 19:25:20 UTC (rev 8787)
+++ trunk/docutils/test/functional/tests/misc_rst_html5.py 2021-07-05 19:25:34 UTC (rev 8788)
@@ -15,4 +15,4 @@
settings_overrides['smart_quotes'] = 'yes'
settings_overrides['embed_images'] = 'yes'
settings_overrides['toc_backlinks'] = 'top'
-
+settings_overrides['section_self_link'] = True
Modified: trunk/docutils/test/test_writers/test_html5_polyglot_parts.py
===================================================================
--- trunk/docutils/test/test_writers/test_html5_polyglot_parts.py 2021-07-05 19:25:20 UTC (rev 8787)
+++ trunk/docutils/test/test_writers/test_html5_polyglot_parts.py 2021-07-05 19:25:34 UTC (rev 8788)
@@ -25,6 +25,9 @@
"""Test case for HTML5 writer via the publish_parts interface."""
writer_name = 'html5'
+ settings_default_overrides = HtmlWriterPublishPartsTestCase.settings_default_overrides.copy()
+ settings_default_overrides['section_self_link'] = True
+
standard_content_type_template = ('<meta charset="%s"/>\n')
standard_generator_template = ('<meta name="generator"'
' content="Docutils %s: http://docutils.sourceforge.net/" />\n')
@@ -146,10 +149,10 @@
"""\
{'fragment': '''<p>Some stuff</p>
<section id="section">
-<h2>Section</h2>
+<h2>Section<a class="self-link" title="link to this section" href="#section"></a></h2>
<p>Some more stuff</p>
<section id="another-section">
-<h3>Another Section</h3>
+<h3>Another Section<a class="self-link" title="link to this section" href="#another-section"></a></h3>
<p>And even more stuff</p>
</section>
</section>\\n''',
@@ -158,10 +161,10 @@
<p class="subtitle" id="subtitle">Subtitle</p>
<p>Some stuff</p>
<section id="section">
-<h2>Section</h2>
+<h2>Section<a class="self-link" title="link to this section" href="#section"></a></h2>
<p>Some more stuff</p>
<section id="another-section">
-<h3>Another Section</h3>
+<h3>Another Section<a class="self-link" title="link to this section" href="#another-section"></a></h3>
<p>And even more stuff</p>
</section>
</section>
@@ -285,15 +288,15 @@
""",
"""\
{'fragment': '''<section id="title">
-<h2>Title</h2>
+<h2>Title<a class="self-link" title="link to this section" href="#title"></a></h2>
<section id="not-a-subtitle">
-<h3>Not A Subtitle</h3>
+<h3>Not A Subtitle<a class="self-link" title="link to this section" href="#not-a-subtitle"></a></h3>
<p>Some stuff</p>
<section id="section">
-<h4>Section</h4>
+<h4>Section<a class="self-link" title="link to this section" href="#section"></a></h4>
<p>Some more stuff</p>
<section id="another-section">
-<h5>Another Section</h5>
+<h5>Another Section<a class="self-link" title="link to this section" href="#another-section"></a></h5>
<p>And even more stuff</p>
</section>
</section>
@@ -301,15 +304,15 @@
</section>\\n''',
'html_body': '''<main>
<section id="title">
-<h2>Title</h2>
+<h2>Title<a class="self-link" title="link to this section" href="#title"></a></h2>
<section id="not-a-subtitle">
-<h3>Not A Subtitle</h3>
+<h3>Not A Subtitle<a class="self-link" title="link to this section" href="#not-a-subtitle"></a></h3>
<p>Some stuff</p>
<section id="section">
-<h4>Section</h4>
+<h4>Section<a class="self-link" title="link to this section" href="#section"></a></h4>
<p>Some more stuff</p>
<section id="another-section">
-<h5>Another Section</h5>
+<h5>Another Section<a class="self-link" title="link to this section" href="#another-section"></a></h5>
<p>And even more stuff</p>
</section>
</section>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2021-07-12 21:22:08
|
Revision: 8793
http://sourceforge.net/p/docutils/code/8793
Author: milde
Date: 2021-07-12 21:22:04 +0000 (Mon, 12 Jul 2021)
Log Message:
-----------
Major rework of math2html converter.
Fork from elyxer (https://github.com/alexfernandez/elyxer).
Remove code that is not requried for math conversion.
Fix/update LaTeX/Unicode character translation, use common codebase
with MathML.
Support more commands.
Modified Paths:
--------------
trunk/docutils/docs/ref/rst/mathematics.txt
trunk/docutils/docutils/utils/math/math2html.py
trunk/docutils/docutils/writers/html5_polyglot/math.css
trunk/docutils/test/functional/expected/math_output_html.html
trunk/docutils/test/functional/expected/standalone_rst_html4css1.html
trunk/docutils/test/functional/expected/standalone_rst_html5.html
Modified: trunk/docutils/docs/ref/rst/mathematics.txt
===================================================================
--- trunk/docutils/docs/ref/rst/mathematics.txt 2021-07-07 11:52:58 UTC (rev 8792)
+++ trunk/docutils/docs/ref/rst/mathematics.txt 2021-07-12 21:22:04 UTC (rev 8793)
@@ -369,7 +369,7 @@
mathematical symbol (for other output formats, results are mixed):
.. math::
- \boldsymbol{abs(x)\pm\alpha \approx 3\Gamma \quad \forall x\in\mathbb{R}}
+ \boldsymbol{\cos(x)\pm\alpha \approx 3\Gamma \quad \forall x\in\mathbb{R}}
Miscellaneous symbols
Modified: trunk/docutils/docutils/utils/math/math2html.py
===================================================================
--- trunk/docutils/docutils/utils/math/math2html.py 2021-07-07 11:52:58 UTC (rev 8792)
+++ trunk/docutils/docutils/utils/math/math2html.py 2021-07-12 21:22:04 UTC (rev 8793)
@@ -3,7 +3,7 @@
# math2html: convert LaTeX equations to HTML output.
#
-# Copyright (C) 2009-2011 Alex Fernández
+# Copyright (C) 2009-2011 Alex Fernández, 2021 Günter Milde
#
# Released under the terms of the `2-Clause BSD license'_, in short:
# Copying and distribution of this file, with or without modification,
@@ -16,17 +16,14 @@
# Based on eLyXer: convert LyX source files to HTML output.
# http://alexfernandez.github.io/elyxer/
-# --end--
-# Alex 20101110
-# eLyXer standalone formula conversion to HTML.
+# Versions:
+# 1.2.5 2015-02-26 eLyXer standalone formula conversion to HTML.
+# 1.3 2021-06-02 Removed code for conversion of LyX files not
+# required for LaTeX math.
+# Support for more math commands from the AMS "math-guide".
-import codecs
-import datetime
-import gettext
-import io
import os.path
import sys
-import unicodedata
if sys.version_info >= (3, 0):
from urllib.parse import quote_plus
@@ -33,13 +30,16 @@
else:
from urllib import quote_plus
+from docutils.utils.math import tex2unichar
if sys.version_info >= (3, 0):
unicode = str #noqa
basestring = str # noqa
- file = io.IOBase # noqa
+__version__ = u'1.3 (2021-06-02)'
+
+
class Trace(object):
"A tracing class"
@@ -88,507 +88,239 @@
show = classmethod(show)
-class BibStylesConfig(object):
- "Configuration class from elyxer.config file"
-
- abbrvnat = {
- u'@article': u'$authors. $title. <i>$journal</i>,{ {$volume:}$pages,} $month $year.{ doi: $doi.}{ URL <a href="$url">$url</a>.}{ $note.}',
- u'cite': u'$surname($year)',
- u'default': u'$authors. <i>$title</i>. $publisher, $year.{ URL <a href="$url">$url</a>.}{ $note.}',
- }
-
- alpha = {
- u'@article': u'$authors. $title.{ <i>$journal</i>{, {$volume}{($number)}}{: $pages}{, $year}.}{ <a href="$url">$url</a>.}{ <a href="$filename">$filename</a>.}{ $note.}',
- u'cite': u'$Sur$YY',
- u'default': u'$authors. $title.{ <i>$journal</i>,} $year.{ <a href="$url">$url</a>.}{ <a href="$filename">$filename</a>.}{ $note.}',
- }
-
- authordate2 = {
- u'@article': u'$authors. $year. $title. <i>$journal</i>, <b>$volume</b>($number), $pages.{ URL <a href="$url">$url</a>.}{ $note.}',
- u'@book': u'$authors. $year. <i>$title</i>. $publisher.{ URL <a href="$url">$url</a>.}{ $note.}',
- u'cite': u'$surname, $year',
- u'default': u'$authors. $year. <i>$title</i>. $publisher.{ URL <a href="$url">$url</a>.}{ $note.}',
- }
-
- default = {
- u'@article': u'$authors: “$title”, <i>$journal</i>,{ pp. $pages,} $year.{ URL <a href="$url">$url</a>.}{ $note.}',
- u'@book': u'{$authors: }<i>$title</i>{ ($editor, ed.)}.{{ $publisher,} $year.}{ URL <a href="$url">$url</a>.}{ $note.}',
- u'@booklet': u'$authors: <i>$title</i>.{{ $publisher,} $year.}{ URL <a href="$url">$url</a>.}{ $note.}',
- u'@conference': u'$authors: “$title”, <i>$journal</i>,{ pp. $pages,} $year.{ URL <a href="$url">$url</a>.}{ $note.}',
- u'@inbook': u'$authors: <i>$title</i>.{{ $publisher,} $year.}{ URL <a href="$url">$url</a>.}{ $note.}',
- u'@incollection': u'$authors: <i>$title</i>{ in <i>$booktitle</i>{ ($editor, ed.)}}.{{ $publisher,} $year.}{ URL <a href="$url">$url</a>.}{ $note.}',
- u'@inproceedings': u'$authors: “$title”, <i>$booktitle</i>,{ pp. $pages,} $year.{ URL <a href="$url">$url</a>.}{ $note.}',
- u'@manual': u'$authors: <i>$title</i>.{{ $publisher,} $year.}{ URL <a href="$url">$url</a>.}{ $note.}',
- u'@mastersthesis': u'$authors: <i>$title</i>.{{ $publisher,} $year.}{ URL <a href="$url">$url</a>.}{ $note.}',
- u'@misc': u'$authors: <i>$title</i>.{{ $publisher,}{ $howpublished,} $year.}{ URL <a href="$url">$url</a>.}{ $note.}',
- u'@phdthesis': u'$authors: <i>$title</i>.{{ $publisher,} $year.}{ URL <a href="$url">$url</a>.}{ $note.}',
- u'@proceedings': u'$authors: “$title”, <i>$journal</i>,{ pp. $pages,} $year.{ URL <a href="$url">$url</a>.}{ $note.}',
- u'@techreport': u'$authors: <i>$title</i>, $year.{ URL <a href="$url">$url</a>.}{ $note.}',
- u'@unpublished': u'$authors: “$title”, <i>$journal</i>, $year.{ URL <a href="$url">$url</a>.}{ $note.}',
- u'cite': u'$index',
- u'default': u'$authors: <i>$title</i>.{{ $publisher,} $year.}{ URL <a href="$url">$url</a>.}{ $note.}',
- }
-
- defaulttags = {
- u'YY': u'??', u'authors': u'', u'surname': u'',
- }
-
- ieeetr = {
- u'@article': u'$authors, “$title”, <i>$journal</i>, vol. $volume, no. $number, pp. $pages, $year.{ URL <a href="$url">$url</a>.}{ $note.}',
- u'@book': u'$authors, <i>$title</i>. $publisher, $year.{ URL <a href="$url">$url</a>.}{ $note.}',
- u'cite': u'$index',
- u'default': u'$authors, “$title”. $year.{ URL <a href="$url">$url</a>.}{ $note.}',
- }
-
- plain = {
- u'@article': u'$authors. $title.{ <i>$journal</i>{, {$volume}{($number)}}{:$pages}{, $year}.}{ URL <a href="$url">$url</a>.}{ $note.}',
- u'@book': u'$authors. <i>$title</i>. $publisher,{ $month} $year.{ URL <a href="$url">$url</a>.}{ $note.}',
- u'@incollection': u'$authors. $title.{ In <i>$booktitle</i> {($editor, ed.)}.} $publisher,{ $month} $year.{ URL <a href="$url">$url</a>.}{ $note.}',
- u'@inproceedings': u'$authors. $title. { <i>$booktitle</i>{, {$volume}{($number)}}{:$pages}{, $year}.}{ URL <a href="$url">$url</a>.}{ $note.}',
- u'cite': u'$index',
- u'default': u'{$authors. }$title.{{ $publisher,} $year.}{ URL <a href="$url">$url</a>.}{ $note.}',
- }
-
- vancouver = {
- u'@article': u'$authors. $title. <i>$journal</i>, $year{;{<b>$volume</b>}{($number)}{:$pages}}.{ URL: <a href="$url">$url</a>.}{ $note.}',
- u'@book': u'$authors. $title. {$publisher, }$year.{ URL: <a href="$url">$url</a>.}{ $note.}',
- u'cite': u'$index',
- u'default': u'$authors. $title; {$publisher, }$year.{ $howpublished.}{ URL: <a href="$url">$url</a>.}{ $note.}',
- }
-
-class BibTeXConfig(object):
- "Configuration class from elyxer.config file"
-
- replaced = {
- u'--': u'—', u'..': u'.',
- }
-
class ContainerConfig(object):
"Configuration class from elyxer.config file"
- endings = {
- u'Align': u'\\end_layout', u'BarredText': u'\\bar',
- u'BoldText': u'\\series', u'Cell': u'</cell',
- u'ChangeDeleted': u'\\change_unchanged',
- u'ChangeInserted': u'\\change_unchanged', u'ColorText': u'\\color',
- u'EmphaticText': u'\\emph', u'Hfill': u'\\hfill', u'Inset': u'\\end_inset',
- u'Layout': u'\\end_layout', u'LyXFooter': u'\\end_document',
- u'LyXHeader': u'\\end_header', u'Row': u'</row', u'ShapedText': u'\\shape',
- u'SizeText': u'\\size', u'StrikeOut': u'\\strikeout',
- u'TextFamily': u'\\family', u'VersalitasText': u'\\noun',
- }
-
extracttext = {
- u'allowed': [u'StringContainer', u'Constant', u'FormulaConstant',],
- u'cloned': [u'',],
- u'extracted': [u'PlainLayout', u'TaggedText', u'Align', u'Caption', u'TextFamily', u'EmphaticText', u'VersalitasText', u'BarredText', u'SizeText', u'ColorText', u'LangLine', u'Formula', u'Bracket', u'RawText', u'BibTag', u'FormulaNumber', u'AlphaCommand', u'EmptyCommand', u'OneParamFunction', u'SymbolFunction', u'TextFunction', u'FontFunction', u'CombiningFunction', u'DecoratingFunction', u'FormulaSymbol', u'BracketCommand', u'TeXCode',],
+ u'allowed': [u'FormulaConstant',],
+ u'extracted': [
+ u'Formula',
+ u'Bracket',
+ u'RawText',
+ u'FormulaNumber',
+ u'AlphaCommand',
+ u'EmptyCommand',
+ u'OneParamFunction',
+ u'SymbolFunction', u'TextFunction',
+ u'FontFunction', u'CombiningFunction',
+ u'DecoratingFunction',
+ u'FormulaSymbol',
+ u'BracketCommand',
+ ],
}
- startendings = {
- u'\\begin_deeper': u'\\end_deeper', u'\\begin_inset': u'\\end_inset',
- u'\\begin_layout': u'\\end_layout',
- }
- starts = {
- u'': u'StringContainer', u'#LyX': u'BlackBox', u'</lyxtabular': u'BlackBox',
- u'<cell': u'Cell', u'<column': u'Column', u'<row': u'Row',
- u'\\align': u'Align', u'\\bar': u'BarredText',
- u'\\bar default': u'BlackBox', u'\\bar no': u'BlackBox',
- u'\\begin_body': u'BlackBox', u'\\begin_deeper': u'DeeperList',
- u'\\begin_document': u'BlackBox', u'\\begin_header': u'LyXHeader',
- u'\\begin_inset Argument': u'ShortTitle',
- u'\\begin_inset Box': u'BoxInset', u'\\begin_inset Branch': u'Branch',
- u'\\begin_inset Caption': u'Caption',
- u'\\begin_inset CommandInset bibitem': u'BiblioEntry',
- u'\\begin_inset CommandInset bibtex': u'BibTeX',
- u'\\begin_inset CommandInset citation': u'BiblioCitation',
- u'\\begin_inset CommandInset href': u'URL',
- u'\\begin_inset CommandInset include': u'IncludeInset',
- u'\\begin_inset CommandInset index_print': u'PrintIndex',
- u'\\begin_inset CommandInset label': u'Label',
- u'\\begin_inset CommandInset line': u'LineInset',
- u'\\begin_inset CommandInset nomencl_print': u'PrintNomenclature',
- u'\\begin_inset CommandInset nomenclature': u'NomenclatureEntry',
- u'\\begin_inset CommandInset ref': u'Reference',
- u'\\begin_inset CommandInset toc': u'TableOfContents',
- u'\\begin_inset ERT': u'ERT', u'\\begin_inset Flex': u'FlexInset',
- u'\\begin_inset Flex Chunkref': u'NewfangledChunkRef',
- u'\\begin_inset Flex Marginnote': u'SideNote',
- u'\\begin_inset Flex Sidenote': u'SideNote',
- u'\\begin_inset Flex URL': u'FlexURL', u'\\begin_inset Float': u'Float',
- u'\\begin_inset FloatList': u'ListOf', u'\\begin_inset Foot': u'Footnote',
- u'\\begin_inset Formula': u'Formula',
- u'\\begin_inset FormulaMacro': u'FormulaMacro',
- u'\\begin_inset Graphics': u'Image',
- u'\\begin_inset Index': u'IndexReference',
- u'\\begin_inset Info': u'InfoInset',
- u'\\begin_inset LatexCommand bibitem': u'BiblioEntry',
- u'\\begin_inset LatexCommand bibtex': u'BibTeX',
- u'\\begin_inset LatexCommand cite': u'BiblioCitation',
- u'\\begin_inset LatexCommand citealt': u'BiblioCitation',
- u'\\begin_inset LatexCommand citep': u'BiblioCitation',
- u'\\begin_inset LatexCommand citet': u'BiblioCitation',
- u'\\begin_inset LatexCommand htmlurl': u'URL',
- u'\\begin_inset LatexCommand index': u'IndexReference',
- u'\\begin_inset LatexCommand label': u'Label',
- u'\\begin_inset LatexCommand nomenclature': u'NomenclatureEntry',
- u'\\begin_inset LatexCommand prettyref': u'Reference',
- u'\\begin_inset LatexCommand printindex': u'PrintIndex',
- u'\\begin_inset LatexCommand printnomenclature': u'PrintNomenclature',
- u'\\begin_inset LatexCommand ref': u'Reference',
- u'\\begin_inset LatexCommand tableofcontents': u'TableOfContents',
- u'\\begin_inset LatexCommand url': u'URL',
- u'\\begin_inset LatexCommand vref': u'Reference',
- u'\\begin_inset Marginal': u'SideNote',
- u'\\begin_inset Newline': u'NewlineInset',
- u'\\begin_inset Newpage': u'NewPageInset', u'\\begin_inset Note': u'Note',
- u'\\begin_inset OptArg': u'ShortTitle',
- u'\\begin_inset Phantom': u'PhantomText',
- u'\\begin_inset Quotes': u'QuoteContainer',
- u'\\begin_inset Tabular': u'Table', u'\\begin_inset Text': u'InsetText',
- u'\\begin_inset VSpace': u'VerticalSpace', u'\\begin_inset Wrap': u'Wrap',
- u'\\begin_inset listings': u'Listing',
- u'\\begin_inset script': u'ScriptInset', u'\\begin_inset space': u'Space',
- u'\\begin_layout': u'Layout', u'\\begin_layout Abstract': u'Abstract',
- u'\\begin_layout Author': u'Author',
- u'\\begin_layout Bibliography': u'Bibliography',
- u'\\begin_layout Chunk': u'NewfangledChunk',
- u'\\begin_layout Description': u'Description',
- u'\\begin_layout Enumerate': u'ListItem',
- u'\\begin_layout Itemize': u'ListItem', u'\\begin_layout List': u'List',
- u'\\begin_layout LyX-Code': u'LyXCode',
- u'\\begin_layout Plain': u'PlainLayout',
- u'\\begin_layout Standard': u'StandardLayout',
- u'\\begin_layout Title': u'Title', u'\\begin_preamble': u'LyXPreamble',
- u'\\change_deleted': u'ChangeDeleted',
- u'\\change_inserted': u'ChangeInserted',
- u'\\change_unchanged': u'BlackBox', u'\\color': u'ColorText',
- u'\\color inherit': u'BlackBox', u'\\color none': u'BlackBox',
- u'\\emph default': u'BlackBox', u'\\emph off': u'BlackBox',
- u'\\emph on': u'EmphaticText', u'\\emph toggle': u'EmphaticText',
- u'\\end_body': u'LyXFooter', u'\\family': u'TextFamily',
- u'\\family default': u'BlackBox', u'\\family roman': u'BlackBox',
- u'\\hfill': u'Hfill', u'\\labelwidthstring': u'BlackBox',
- u'\\lang': u'LangLine', u'\\length': u'InsetLength',
- u'\\lyxformat': u'LyXFormat', u'\\lyxline': u'LyXLine',
- u'\\newline': u'Newline', u'\\newpage': u'NewPage',
- u'\\noindent': u'BlackBox', u'\\noun default': u'BlackBox',
- u'\\noun off': u'BlackBox', u'\\noun on': u'VersalitasText',
- u'\\paragraph_spacing': u'BlackBox', u'\\series bold': u'BoldText',
- u'\\series default': u'BlackBox', u'\\series medium': u'BlackBox',
- u'\\shape': u'ShapedText', u'\\shape default': u'BlackBox',
- u'\\shape up': u'BlackBox', u'\\size': u'SizeText',
- u'\\size normal': u'BlackBox', u'\\start_of_appendix': u'StartAppendix',
- u'\\strikeout default': u'BlackBox', u'\\strikeout on': u'StrikeOut',
- }
-
- string = {
- u'startcommand': u'\\',
- }
-
- table = {
- u'headers': [u'<lyxtabular', u'<features',],
- }
-
class EscapeConfig(object):
"Configuration class from elyxer.config file"
chars = {
- u'\n': u'', u' -- ': u' — ', u' --- ': u' — ', u'\'': u'’', u'`': u'‘',
+ u'\n': u'',
+ u"'": u'’',
+ u'`': u'‘',
}
- commands = {
- u'\\InsetSpace \\space{}': u' ', u'\\InsetSpace \\thinspace{}': u' ',
- u'\\InsetSpace ~': u' ', u'\\SpecialChar \\-': u'',
- u'\\SpecialChar \\@.': u'.', u'\\SpecialChar \\ldots{}': u'…',
- u'\\SpecialChar \\menuseparator': u' ▷ ',
- u'\\SpecialChar \\nobreakdash-': u'-', u'\\SpecialChar \\slash{}': u'/',
- u'\\SpecialChar \\textcompwordmark{}': u'', u'\\backslash': u'\\',
- }
-
entities = {
- u'&': u'&', u'<': u'<', u'>': u'>',
+ u'&': u'&',
+ u'<': u'<',
+ u'>': u'>',
}
- html = {
- u'/>': u'>',
- }
- iso885915 = {
- u' ': u' ', u' ': u' ', u' ': u' ',
- }
-
- nonunicode = {
- u' ': u' ',
- }
-
class FormulaConfig(object):
"Configuration class from elyxer.config file"
alphacommands = {
- u'\\AA': u'Å', u'\\AE': u'Æ',
- u'\\AmS': u'<span class="versalitas">AmS</span>', u'\\Angstroem': u'Å',
- u'\\DH': u'Ð', u'\\Koppa': u'Ϟ', u'\\L': u'Ł', u'\\Micro': u'µ', u'\\O': u'Ø',
- u'\\OE': u'Œ', u'\\Sampi': u'Ϡ', u'\\Stigma': u'Ϛ', u'\\TH': u'Þ',
- u'\\aa': u'å', u'\\ae': u'æ', u'\\alpha': u'α', u'\\beta': u'β',
- u'\\delta': u'δ', u'\\dh': u'ð', u'\\digamma': u'ϝ', u'\\epsilon': u'ϵ',
- u'\\eta': u'η', u'\\eth': u'ð', u'\\gamma': u'γ', u'\\i': u'ı',
- u'\\imath': u'ı', u'\\iota': u'ι', u'\\j': u'ȷ', u'\\jmath': u'ȷ',
- u'\\kappa': u'κ', u'\\koppa': u'ϟ', u'\\l': u'ł', u'\\lambda': u'λ',
- u'\\mu': u'μ', u'\\nu': u'ν', u'\\o': u'ø', u'\\oe': u'œ', u'\\omega': u'ω',
- u'\\phi': u'φ', u'\\pi': u'π', u'\\psi': u'ψ', u'\\rho': u'ρ',
- u'\\sampi': u'ϡ', u'\\sigma': u'σ', u'\\ss': u'ß', u'\\stigma': u'ϛ',
- u'\\tau': u'τ', u'\\tcohm': u'Ω', u'\\textcrh': u'ħ', u'\\th': u'þ',
- u'\\theta': u'θ', u'\\upsilon': u'υ', u'\\varDelta': u'∆',
- u'\\varGamma': u'Γ', u'\\varLambda': u'Λ', u'\\varOmega': u'Ω',
- u'\\varPhi': u'Φ', u'\\varPi': u'Π', u'\\varPsi': u'Ψ', u'\\varSigma': u'Σ',
- u'\\varTheta': u'Θ', u'\\varUpsilon': u'Υ', u'\\varXi': u'Ξ',
- u'\\varbeta': u'ϐ', u'\\varepsilon': u'ε', u'\\varkappa': u'ϰ',
- u'\\varphi': u'φ', u'\\varpi': u'ϖ', u'\\varrho': u'ϱ', u'\\varsigma': u'ς',
- u'\\vartheta': u'ϑ', u'\\xi': u'ξ', u'\\zeta': u'ζ',
+ '\\AmS': u'<span class="textsc">AmS</span>',
+ '\\AA': u'Å',
+ '\\AE': u'Æ',
+ '\\DH': u'Ð',
+ '\\L': u'Ł',
+ '\\O': u'Ø',
+ '\\OE': u'Œ',
+ '\\TH': u'Þ',
+ '\\aa': u'å',
+ '\\ae': u'æ',
+ '\\dh': u'ð',
+ '\\i': u'ı',
+ '\\j': u'ȷ',
+ '\\l': u'ł',
+ '\\o': u'ø',
+ '\\oe': u'œ',
+ '\\ss': u'ß',
+ '\\th': u'þ',
}
+ for key, value in tex2unichar.mathalpha.items():
+ alphacommands['\\'+key] = value
array = {
- u'begin': u'\\begin', u'cellseparator': u'&', u'end': u'\\end',
+ u'begin': u'\\begin',
+ u'cellseparator': u'&',
+ u'end': u'\\end',
u'rowseparator': u'\\\\',
}
- bigbrackets = {
- u'(': [u'⎛', u'⎜', u'⎝',], u')': [u'⎞', u'⎟', u'⎠',], u'[': [u'⎡', u'⎢', u'⎣',],
- u']': [u'⎤', u'⎥', u'⎦',], u'{': [u'⎧', u'⎪', u'⎨', u'⎩',], u'|': [u'|',],
- u'}': [u'⎫', u'⎪', u'⎬', u'⎭',], u'∥': [u'∥',],
- }
+ bigbrackets = {u'(': [u'⎛', u'⎜', u'⎝',],
+ u')': [u'⎞', u'⎟', u'⎠',],
+ u'[': [u'⎡', u'⎢', u'⎣',],
+ u']': [u'⎤', u'⎥', u'⎦',],
+ u'{': [u'⎧', u'⎪', u'⎨', u'⎩',],
+ u'}': [u'⎫', u'⎪', u'⎬', u'⎭',],
+ # TODO: 2-row brackets with ⎰⎱ (\lmoustache \rmoustache)
+ u'|': [u'|',],
+ u'∥': [u'∥',],
+ }
- bigsymbols = {
- u'∑': [u'⎲', u'⎳',], u'∫': [u'⌠', u'⌡',],
- }
+ bigsymbols = {u'∑': [u'⎲', u'⎳',], # ⎲ ⌠ ┌
+ u'∫': [u'⌠', u'⌡',], # ⎳ ⎮ │
+ u'√': [u'┌', u'⎷',], # ⌡ ⎷
+ }
bracketcommands = {
u'\\left': u'span class="symbol"',
u'\\left.': u'<span class="leftdot"></span>',
- u'\\middle': u'span class="symbol"', u'\\right': u'span class="symbol"',
+ u'\\middle': u'span class="symbol"',
+ u'\\right': u'span class="symbol"',
u'\\right.': u'<span class="rightdot"></span>',
}
combiningfunctions = {
- u'\\"': u'̈', u'\\\'': u'́', u'\\^': u'̂', u'\\`': u'̀', u'\\acute': u'́',
- u'\\bar': u'̄', u'\\breve': u'̆', u'\\c': u'̧', u'\\check': u'̌',
- u'\\dddot': u'⃛', u'\\ddot': u'̈', u'\\dot': u'̇', u'\\grave': u'̀',
- u'\\hat': u'̂', u'\\mathring': u'̊', u'\\overleftarrow': u'⃖',
- u'\\overrightarrow': u'⃗', u'\\r': u'̊', u'\\s': u'̩',
- u'\\textcircled': u'⃝', u'\\textsubring': u'̥', u'\\tilde': u'̃',
- u'\\v': u'̌', u'\\vec': u'⃗', u'\\~': u'̃',
+ u"\\'": u'́',
+ u'\\"': u'̈',
+ u'\\^': u'̂',
+ u'\\`': u'̀',
+ u'\\~': u'̃',
+ u'\\c': u'̧',
+ u'\\r': u'̊',
+ u'\\s': u'̩',
+ u'\\textcircled': u'⃝',
+ u'\\textsubring': u'̥',
+ u'\\v': u'̌',
}
+ for key, value in tex2unichar.mathaccent.items():
+ combiningfunctions['\\'+key] = value
commands = {
- u'\\ ': u' ', u'\\!': u'', u'\\#': u'#', u'\\$': u'$', u'\\%': u'%',
- u'\\&': u'&', u'\\,': u' ', u'\\:': u' ', u'\\;': u' ', u'\\AC': u'∿',
- u'\\APLcomment': u'⍝', u'\\APLdownarrowbox': u'⍗', u'\\APLinput': u'⍞',
- u'\\APLinv': u'⌹', u'\\APLleftarrowbox': u'⍇', u'\\APLlog': u'⍟',
- u'\\APLrightarrowbox': u'⍈', u'\\APLuparrowbox': u'⍐', u'\\Bbbk': u'𝕜',
- u'\\Box': u'□', u'\\Bumpeq': u'≎', u'\\CIRCLE': u'●', u'\\Cap': u'⋒',
- u'\\CapitalDifferentialD': u'ⅅ', u'\\CheckedBox': u'☑', u'\\Circle': u'○',
- u'\\Coloneqq': u'⩴', u'\\ComplexI': u'ⅈ', u'\\ComplexJ': u'ⅉ',
- u'\\Corresponds': u'≙', u'\\Cup': u'⋓', u'\\Delta': u'Δ', u'\\Diamond': u'◇',
- u'\\Diamondblack': u'◆', u'\\Diamonddot': u'⟐', u'\\DifferentialD': u'ⅆ',
- u'\\Downarrow': u'⇓', u'\\EUR': u'€', u'\\Euler': u'ℇ',
- u'\\ExponetialE': u'ⅇ', u'\\Finv': u'Ⅎ', u'\\Game': u'⅁', u'\\Gamma': u'Γ',
- u'\\Im': u'ℑ', u'\\Join': u'⨝', u'\\LEFTCIRCLE': u'◖', u'\\LEFTcircle': u'◐',
- u'\\LHD': u'◀', u'\\Lambda': u'Λ', u'\\Lbag': u'⟅', u'\\Leftarrow': u'⇐',
- u'\\Lleftarrow': u'⇚', u'\\Longleftarrow': u'⟸',
- u'\\Longleftrightarrow': u'⟺', u'\\Longrightarrow': u'⟹', u'\\Lparen': u'⦅',
- u'\\Lsh': u'↰', u'\\Mapsfrom': u'⇐|', u'\\Mapsto': u'|⇒', u'\\Omega': u'Ω',
- u'\\P': u'¶', u'\\Phi': u'Φ', u'\\Pi': u'Π', u'\\Pr': u'Pr', u'\\Psi': u'Ψ',
- u'\\Qoppa': u'Ϙ', u'\\RHD': u'▶', u'\\RIGHTCIRCLE': u'◗',
- u'\\RIGHTcircle': u'◑', u'\\Rbag': u'⟆', u'\\Re': u'ℜ', u'\\Rparen': u'⦆',
- u'\\Rrightarrow': u'⇛', u'\\Rsh': u'↱', u'\\S': u'§', u'\\Sigma': u'Σ',
- u'\\Square': u'☐', u'\\Subset': u'⋐', u'\\Sun': u'☉', u'\\Supset': u'⋑',
- u'\\Theta': u'Θ', u'\\Uparrow': u'⇑', u'\\Updownarrow': u'⇕',
- u'\\Upsilon': u'Υ', u'\\Vdash': u'⊩', u'\\Vert': u'∥', u'\\Vvdash': u'⊪',
- u'\\XBox': u'☒', u'\\Xi': u'Ξ', u'\\Yup': u'⅄', u'\\\\': u'<br/>',
- u'\\_': u'_', u'\\aleph': u'ℵ', u'\\amalg': u'∐', u'\\anchor': u'⚓',
- u'\\angle': u'∠', u'\\aquarius': u'♒', u'\\arccos': u'arccos',
- u'\\arcsin': u'arcsin', u'\\arctan': u'arctan', u'\\arg': u'arg',
- u'\\aries': u'♈', u'\\arrowbullet': u'➢', u'\\ast': u'∗', u'\\asymp': u'≍',
- u'\\backepsilon': u'∍', u'\\backprime': u'‵', u'\\backsimeq': u'⋍',
- u'\\backslash': u'\\', u'\\ballotx': u'✗', u'\\barwedge': u'⊼',
- u'\\because': u'∵', u'\\beth': u'ℶ', u'\\between': u'≬', u'\\bigcap': u'∩',
- u'\\bigcirc': u'○', u'\\bigcup': u'∪', u'\\bigodot': u'⊙',
- u'\\bigoplus': u'⊕', u'\\bigotimes': u'⊗', u'\\bigsqcup': u'⊔',
- u'\\bigstar': u'★', u'\\bigtriangledown': u'▽', u'\\bigtriangleup': u'△',
- u'\\biguplus': u'⊎', u'\\bigvee': u'∨', u'\\bigwedge': u'∧',
- u'\\biohazard': u'☣', u'\\blacklozenge': u'⧫', u'\\blacksmiley': u'☻',
- u'\\blacksquare': u'■', u'\\blacktriangle': u'▲',
- u'\\blacktriangledown': u'▼', u'\\blacktriangleleft': u'◂',
- u'\\blacktriangleright': u'▶', u'\\blacktriangleup': u'▴', u'\\bot': u'⊥',
- u'\\bowtie': u'⋈', u'\\box': u'▫', u'\\boxast': u'⧆', u'\\boxbar': u'◫',
- u'\\boxbox': u'⧈', u'\\boxbslash': u'⧅', u'\\boxcircle': u'⧇',
- u'\\boxdot': u'⊡', u'\\boxminus': u'⊟', u'\\boxplus': u'⊞',
- u'\\boxslash': u'⧄', u'\\boxtimes': u'⊠', u'\\bullet': u'•',
- u'\\bumpeq': u'≏', u'\\cancer': u'♋', u'\\cap': u'∩', u'\\capricornus': u'♑',
- u'\\cat': u'⁀', u'\\cdot': u'⋅', u'\\cdots': u'⋯', u'\\cent': u'¢',
- u'\\centerdot': u'∙', u'\\checkmark': u'✓', u'\\chi': u'χ', u'\\circ': u'∘',
- u'\\circeq': u'≗', u'\\circlearrowleft': u'↺', u'\\circlearrowright': u'↻',
- u'\\circledR': u'®', u'\\circledast': u'⊛', u'\\circledbslash': u'⦸',
- u'\\circledcirc': u'⊚', u'\\circleddash': u'⊝', u'\\circledgtr': u'⧁',
- u'\\circledless': u'⧀', u'\\clubsuit': u'♣', u'\\colon': u': ', u'\\coloneqq': u'≔',
- u'\\complement': u'∁', u'\\cong': u'≅', u'\\coprod': u'∐',
- u'\\copyright': u'©', u'\\cos': u'cos', u'\\cosh': u'cosh', u'\\cot': u'cot',
- u'\\coth': u'coth', u'\\csc': u'csc', u'\\cup': u'∪', u'\\curlyvee': u'⋎',
- u'\\curlywedge': u'⋏', u'\\curvearrowleft': u'↶',
- u'\\curvearrowright': u'↷', u'\\dag': u'†', u'\\dagger': u'†',
- u'\\daleth': u'ℸ', u'\\dashleftarrow': u'⇠', u'\\dashv': u'⊣',
- u'\\ddag': u'‡', u'\\ddagger': u'‡', u'\\ddots': u'⋱', u'\\deg': u'deg',
- u'\\det': u'det', u'\\diagdown': u'╲', u'\\diagup': u'╱',
- u'\\diameter': u'⌀', u'\\diamond': u'◇', u'\\diamondsuit': u'♦',
- u'\\dim': u'dim', u'\\div': u'÷', u'\\divideontimes': u'⋇',
- u'\\dotdiv': u'∸', u'\\doteq': u'≐', u'\\doteqdot': u'≑', u'\\dotplus': u'∔',
- u'\\dots': u'…', u'\\doublebarwedge': u'⌆', u'\\downarrow': u'↓',
- u'\\downdownarrows': u'⇊', u'\\downharpoonleft': u'⇃',
- u'\\downharpoonright': u'⇂', u'\\dsub': u'⩤', u'\\earth': u'♁',
- u'\\eighthnote': u'♪', u'\\ell': u'ℓ', u'\\emptyset': u'∅',
- u'\\eqcirc': u'≖', u'\\eqcolon': u'≕', u'\\eqsim': u'≂', u'\\euro': u'€',
- u'\\exists': u'∃', u'\\exp': u'exp', u'\\fallingdotseq': u'≒',
- u'\\fcmp': u'⨾', u'\\female': u'♀', u'\\flat': u'♭', u'\\forall': u'∀',
- u'\\fourth': u'⁗', u'\\frown': u'⌢', u'\\frownie': u'☹', u'\\gcd': u'gcd',
- u'\\gemini': u'♊', u'\\geq)': u'≥', u'\\geqq': u'≧', u'\\geqslant': u'≥',
- u'\\gets': u'←', u'\\gg': u'≫', u'\\ggg': u'⋙', u'\\gimel': u'ℷ',
- u'\\gneqq': u'≩', u'\\gnsim': u'⋧', u'\\gtrdot': u'⋗', u'\\gtreqless': u'⋚',
- u'\\gtreqqless': u'⪌', u'\\gtrless': u'≷', u'\\gtrsim': u'≳',
- u'\\guillemotleft': u'«', u'\\guillemotright': u'»', u'\\hbar': u'ℏ',
- u'\\heartsuit': u'♥', u'\\hfill': u'<span class="hfill"> </span>',
- u'\\hom': u'hom', u'\\hookleftarrow': u'↩', u'\\hookrightarrow': u'↪',
- u'\\hslash': u'ℏ', u'\\idotsint': u'<span class="bigsymbol">∫⋯∫</span>',
- u'\\iiint': u'<span class="bigsymbol">∭</span>',
- u'\\iint': u'<span class="bigsymbol">∬</span>', u'\\imath': u'ı',
- u'\\inf': u'inf', u'\\infty': u'∞', u'\\intercal': u'⊺',
- u'\\interleave': u'⫴', u'\\invamp': u'⅋', u'\\invneg': u'⌐',
- u'\\jmath': u'ȷ', u'\\jupiter': u'♃', u'\\ker': u'ker', u'\\land': u'∧',
- u'\\landupint': u'<span class="bigsymbol">∱</span>', u'\\lang': u'⟪',
- u'\\langle': u'⟨', u'\\lblot': u'⦉', u'\\lbrace': u'{', u'\\lbrace)': u'{',
- u'\\lbrack': u'[', u'\\lceil': u'⌈', u'\\ldots': u'…', u'\\leadsto': u'⇝',
- u'\\leftarrow)': u'←', u'\\leftarrowtail': u'↢', u'\\leftarrowtobar': u'⇤',
- u'\\leftharpoondown': u'↽', u'\\leftharpoonup': u'↼',
- u'\\leftleftarrows': u'⇇', u'\\leftleftharpoons': u'⥢', u'\\leftmoon': u'☾',
- u'\\leftrightarrow': u'↔', u'\\leftrightarrows': u'⇆',
- u'\\leftrightharpoons': u'⇋', u'\\leftthreetimes': u'⋋', u'\\leo': u'♌',
- u'\\leq)': u'≤', u'\\leqq': u'≦', u'\\leqslant': u'≤', u'\\lessdot': u'⋖',
- u'\\lesseqgtr': u'⋛', u'\\lesseqqgtr': u'⪋', u'\\lessgtr': u'≶',
- u'\\lesssim': u'≲', u'\\lfloor': u'⌊', u'\\lg': u'lg', u'\\lgroup': u'⟮',
- u'\\lhd': u'⊲', u'\\libra': u'♎', u'\\lightning': u'↯', u'\\limg': u'⦇',
- u'\\liminf': u'liminf', u'\\limsup': u'limsup', u'\\ll': u'≪',
- u'\\llbracket': u'⟦', u'\\llcorner': u'⌞', u'\\lll': u'⋘', u'\\ln': u'ln',
- u'\\lneqq': u'≨', u'\\lnot': u'¬', u'\\lnsim': u'⋦', u'\\log': u'log',
- u'\\longleftarrow': u'⟵', u'\\longleftrightarrow': u'⟷',
- u'\\longmapsto': u'⟼', u'\\longrightarrow': u'⟶', u'\\looparrowleft': u'↫',
- u'\\looparrowright': u'↬', u'\\lor': u'∨', u'\\lozenge': u'◊',
- u'\\lrcorner': u'⌟', u'\\ltimes': u'⋉', u'\\lyxlock': u'', u'\\male': u'♂',
- u'\\maltese': u'✠', u'\\mapsfrom': u'↤', u'\\mapsto': u'↦',
- u'\\mathcircumflex': u'^', u'\\max': u'max', u'\\measuredangle': u'∡',
- u'\\medbullet': u'⚫', u'\\medcirc': u'⚪', u'\\mercury': u'☿', u'\\mho': u'℧',
- u'\\mid': u'∣', u'\\min': u'min', u'\\models': u'⊨', u'\\mp': u'∓',
- u'\\multimap': u'⊸', u'\\nLeftarrow': u'⇍', u'\\nLeftrightarrow': u'⇎',
- u'\\nRightarrow': u'⇏', u'\\nVDash': u'⊯', u'\\nabla': u'∇',
- u'\\napprox': u'≉', u'\\natural': u'♮', u'\\ncong': u'≇', u'\\nearrow': u'↗',
- u'\\neg': u'¬', u'\\neg)': u'¬', u'\\neptune': u'♆', u'\\nequiv': u'≢',
- u'\\newline': u'<br/>', u'\\nexists': u'∄', u'\\ngeqslant': u'≱',
- u'\\ngtr': u'≯', u'\\ngtrless': u'≹', u'\\ni': u'∋', u'\\ni)': u'∋',
- u'\\nleftarrow': u'↚', u'\\nleftrightarrow': u'↮', u'\\nleqslant': u'≰',
- u'\\nless': u'≮', u'\\nlessgtr': u'≸', u'\\nmid': u'∤', u'\\nolimits': u'',
- u'\\nonumber': u'', u'\\not': u'¬', u'\\not<': u'≮', u'\\not=': u'≠',
- u'\\not>': u'≯', u'\\notbackslash': u'⍀', u'\\notin': u'∉', u'\\notni': u'∌',
- u'\\notslash': u'⌿', u'\\nparallel': u'∦', u'\\nprec': u'⊀',
- u'\\nrightarrow': u'↛', u'\\nsim': u'≁', u'\\nsimeq': u'≄',
- u'\\nsqsubset': u'⊏̸', u'\\nsubseteq': u'⊈', u'\\nsucc': u'⊁',
- u'\\nsucccurlyeq': u'⋡', u'\\nsupset': u'⊅', u'\\nsupseteq': u'⊉',
- u'\\ntriangleleft': u'⋪', u'\\ntrianglelefteq': u'⋬',
...
[truncated message content] |
|
From: <mi...@us...> - 2021-07-12 21:22:28
|
Revision: 8794
http://sourceforge.net/p/docutils/code/8794
Author: milde
Date: 2021-07-12 21:22:20 +0000 (Mon, 12 Jul 2021)
Log Message:
-----------
math2html: support small symbols, refactor math accent handling.
math accents/combining characters:
- insert combining character after first character of argument
(mimic LaTeX behaviour).
- support non alphabetical base-character (\not{\in} and similar).
- use precomposed characters if possible (normalization)
Cleanup: update comments, remove not required code.
Modified Paths:
--------------
trunk/docutils/docs/ref/rst/mathematics.txt
trunk/docutils/docutils/utils/math/math2html.py
trunk/docutils/docutils/writers/html5_polyglot/math.css
trunk/docutils/test/functional/expected/math_output_html.html
Property Changed:
----------------
trunk/docutils/docutils/utils/math/math2html.py
Modified: trunk/docutils/docs/ref/rst/mathematics.txt
===================================================================
--- trunk/docutils/docs/ref/rst/mathematics.txt 2021-07-12 21:22:04 UTC (rev 8793)
+++ trunk/docutils/docs/ref/rst/mathematics.txt 2021-07-12 21:22:20 UTC (rev 8794)
@@ -989,7 +989,6 @@
\left.\vert \frac{b}{a}\right\Vert\ \bigl\vert b\Bigr\Vert\ \biggl\vert b\Biggr\Vert
\quad
-
Variable-sized operators:
Inline: `\sum\ \int\ \oint\ \smallint\ \prod\ \coprod\ \bigwedge\
Modified: trunk/docutils/docutils/utils/math/math2html.py
===================================================================
--- trunk/docutils/docutils/utils/math/math2html.py 2021-07-12 21:22:04 UTC (rev 8793)
+++ trunk/docutils/docutils/utils/math/math2html.py 2021-07-12 21:22:20 UTC (rev 8794)
@@ -24,6 +24,7 @@
import os.path
import sys
+import unicodedata
if sys.version_info >= (3, 0):
from urllib.parse import quote_plus
@@ -94,18 +95,21 @@
extracttext = {
u'allowed': [u'FormulaConstant',],
u'extracted': [
+ u'AlphaCommand',
+ u'Bracket',
+ u'BracketCommand',
+ u'CombiningFunction',
+ u'DecoratingFunction',
+ u'EmptyCommand',
+ u'FontFunction',
u'Formula',
- u'Bracket',
- u'RawText',
u'FormulaNumber',
- u'AlphaCommand',
- u'EmptyCommand',
+ u'FormulaSymbol',
u'OneParamFunction',
- u'SymbolFunction', u'TextFunction',
- u'FontFunction', u'CombiningFunction',
- u'DecoratingFunction',
- u'FormulaSymbol',
- u'BracketCommand',
+ u'RawText',
+ u'SpacedCommand',
+ u'SymbolFunction',
+ u'TextFunction',
],
}
@@ -231,6 +235,13 @@
'\\qquad': u' ',
'\\rVert': u'∥',
'\\rvert': u'∣',
+ '\\shortmid': u'<span class="smallsymbol">∣</span>',
+ '\\shortparallel': u'<span class="smallsymbol">∥</span>',
+ '\\nshortmid': u'<span class="smallsymbol">∤</span>',
+ '\\nshortparallel': u'<span class="smallsymbol">∦</span>',
+ '\\smallfrown': u'<span class="smallsymbol">⌢</span>',
+ '\\smallsmile': u'<span class="smallsymbol">⌣</span>',
+ '\\smallint': u'<span class="smallsymbol">∫</span>',
'\\textasciicircum': u'^',
'\\textasciitilde': u'~',
'\\textbackslash': u'\\',
@@ -471,12 +482,6 @@
# relations (put additional space before and after the symbol)
spacedcommands = {
- # precomposed characters for negated symbols
- '\\not=': u'≠',
- '\\not<': u'≮',
- '\\not>': u'≯',
- # '\\not\\in': u'∉',
- # '\\not\\equiv': u'≢', # TODO why doesn't this work?
# negated symbols without pre-composed Unicode character
'\\nleqq': u'\u2266\u0338', # ≦̸
'\\ngeqq': u'\u2267\u0338', # ≧̸
@@ -665,15 +670,18 @@
create = classmethod(create)
class ContainerExtractor(object):
- "A class to extract certain containers."
+ """A class to extract certain containers.
+ The config parameter is a map containing three lists:
+ allowed, copied and extracted.
+ Each of the three is a list of class names for containers.
+ Allowed containers are included as is into the result.
+ Cloned containers are cloned and placed into the result.
+ Extracted containers are looked into.
+ All other containers are silently ignored.
+ """
+
def __init__(self, config):
- "The config parameter is a map containing three lists: allowed, copied and extracted."
- "Each of the three is a list of class names for containers."
- "Allowed containers are included as is into the result."
- "Cloned containers are cloned and placed into the result."
- "Extracted containers are looked into."
- "All other containers are silently ignored."
self.allowed = config['allowed']
self.extracted = config['extracted']
@@ -718,10 +726,6 @@
def parseparameter(self, reader):
"Parse a parameter"
- if reader.currentline().strip().startswith('<'):
- key, value = self.parsexml(reader)
- self.parameters[key] = value
- return
split = reader.currentline().strip().split(' ', 1)
reader.nextline()
if len(split) == 0:
@@ -736,31 +740,6 @@
doublesplit = split[1].split('"')
self.parameters[key] = doublesplit[1]
- def parsexml(self, reader):
- "Parse a parameter in xml form: <param attr1=value...>"
- strip = reader.currentline().strip()
- reader.nextline()
- if not strip.endswith('>'):
- Trace.error('XML parameter ' + strip + ' should be <...>')
- split = strip[1:-1].split()
- if len(split) == 0:
- Trace.error('Empty XML parameter <>')
- return None, None
- key = split[0]
- del split[0]
- if len(split) == 0:
- return key, dict()
- attrs = dict()
- for attr in split:
- if not '=' in attr:
- Trace.error('Erroneous attribute for ' + key + ': ' + attr)
- attr += '="0"'
- parts = attr.split('=')
- attrkey = parts[0]
- value = parts[1].split('"')[1]
- attrs[attrkey] = value
- return key, attrs
-
def parseending(self, reader, process):
"Parse until the current ending is found"
if not self.ending:
@@ -868,18 +847,8 @@
reader.nextline()
return contents
-class InsetParser(BoundedParser):
- "Parses a LyX inset"
- def parse(self, reader):
- "Parse inset parameters into a dictionary"
- startcommand = ContainerConfig.string['startcommand']
- while reader.currentline() != '' and not reader.currentline().startswith(startcommand):
- self.parseparameter(reader)
- return BoundedParser.parse(self, reader)
-
-
class ContainerOutput(object):
"The generic HTML output for a container."
@@ -1409,9 +1378,7 @@
"Extract all text from allowed containers."
result = ''
constants = ContainerExtractor(ContainerConfig.extracttext).extract(self)
- for constant in constants:
- result += constant.string
- return result
+ return ''.join(constant.string for constant in constants)
def group(self, index, group, isingroup):
"Group some adjoining elements into a group"
@@ -2315,7 +2282,8 @@
def parsebit(self, pos):
"Place as contents the command translated and spaced."
- self.contents = [FormulaConstant(u' ' + self.translated + u' ')]
+ # pad with MEDIUM MATHEMATICAL SPACE
+ self.contents = [FormulaConstant(u'\u205f' + self.translated + u'\u205f')]
class AlphaCommand(EmptyCommand):
"""A command without paramters whose result is alphabetical."""
@@ -2701,7 +2669,6 @@
FormulaCommand.types += [BeginCommand]
-
class CombiningFunction(OneParamFunction):
commandmap = FormulaConfig.combiningfunctions
@@ -2708,27 +2675,37 @@
def parsebit(self, pos):
"Parse a combining function."
- self.type = 'alpha'
combining = self.translated
parameter = self.parsesingleparameter(pos)
if not parameter:
- Trace.error('Empty parameter for combining function ' + self.command)
- elif len(parameter.extracttext()) != 1:
- Trace.error('Applying combining function ' + self.command + ' to invalid string "' + parameter.extracttext() + '"')
- self.contents.append(Constant(combining))
+ Trace.error('Missing parameter for combining function ' + self.command)
+ return
+ # Trace.message('apply %s to %r'%(self.command, parameter.extracttext()))
+ # parameter.tree()
+ if not isinstance(parameter, FormulaConstant):
+ try:
+ extractor = ContainerExtractor(ContainerConfig.extracttext)
+ parameter = extractor.extract(parameter)[0]
+ except IndexError:
+ Trace.error('No base character found for "%s".' % self.command)
+ return
+ # Trace.message(' basechar: %r' % parameter.string)
+ # Insert combining character after the first character:
+ if parameter.string.startswith(u'\u205f'):
+ i = 2 # skip padding by SpacedCommand
+ else:
+ i = 1
+ parameter.string = parameter.string[:i] + combining + parameter.string[i:]
+ # Use pre-composed characters if possible: \not{=} -> ≠, say.
+ # TODO: use overset for mathematical accents.
+ parameter.string = unicodedata.normalize('NFC', parameter.string)
def parsesingleparameter(self, pos):
"Parse a parameter, or a single letter."
self.factory.clearskipped(pos)
if pos.finished():
- Trace.error('Error while parsing single parameter at ' + pos.identifier())
return None
- if self.factory.detecttype(Bracket, pos) \
- or self.factory.detecttype(FormulaCommand, pos):
- return self.parseparameter(pos)
- letter = FormulaConstant(pos.skipcurrent())
- self.add(letter)
- return letter
+ return self.parseparameter(pos)
class DecoratingFunction(OneParamFunction):
"A function that decorates some bit of text"
Property changes on: trunk/docutils/docutils/utils/math/math2html.py
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Modified: trunk/docutils/docutils/writers/html5_polyglot/math.css
===================================================================
--- trunk/docutils/docutils/writers/html5_polyglot/math.css 2021-07-12 21:22:04 UTC (rev 8793)
+++ trunk/docutils/docutils/writers/html5_polyglot/math.css 2021-07-12 21:22:20 UTC (rev 8794)
@@ -105,6 +105,9 @@
sub.denominator, sub.unit {
vertical-align: -20%;
}
+span.smallsymbol {
+ font-size: 75%;
+}
span.sqrt {
display: inline-block;
vertical-align: middle;
@@ -117,8 +120,8 @@
span.radical {
display: inline-block;
padding: 0ex;
- font-size: 150%;
- line-height: 97%;
+ font-size: 160%;
+ line-height: 100%;
vertical-align: top;
vertical-align: middle;
}
Modified: trunk/docutils/test/functional/expected/math_output_html.html
===================================================================
--- trunk/docutils/test/functional/expected/math_output_html.html 2021-07-12 21:22:04 UTC (rev 8793)
+++ trunk/docutils/test/functional/expected/math_output_html.html 2021-07-12 21:22:20 UTC (rev 8794)
@@ -68,7 +68,7 @@
directives:</p>
<p>The Schrödinger equation</p>
<div class="formula" id="eq-schrodinger">
-<i>i</i><i>ℏ</i><span class="fraction"><span class="ignored">(</span><span class="numerator">∂</span><span class="ignored">)/(</span><span class="denominator">∂<i>t</i></span><span class="ignored">)</span></span>Ψ = <i>Ĥ</i>Ψ,
+<i>i</i><i>ℏ</i><span class="fraction"><span class="ignored">(</span><span class="numerator">∂</span><span class="ignored">)/(</span><span class="denominator">∂<i>t</i></span><span class="ignored">)</span></span>Ψ = <i>Ĥ</i>Ψ,
</div>
<p>with the <em>wave function</em> <span class="formula">Ψ</span>, describes how the quantum state of a
physical system changes in time.</p>
@@ -81,12 +81,12 @@
<col width="33%" />
</colgroup>
<tbody valign="top">
-<tr><td><span class="formula"><i>á</i></span> <tt class="docutils literal">\acute{a}</tt></td>
-<td><span class="formula"><i>ṫ</i></span> <tt class="docutils literal">\dot{t}</tt></td>
+<tr><td><span class="formula"><i>á</i></span> <tt class="docutils literal">\acute{a}</tt></td>
+<td><span class="formula"><i>ṫ</i></span> <tt class="docutils literal">\dot{t}</tt></td>
<td><span class="formula"><i>γ̂</i></span> <tt class="docutils literal"><span class="pre">\hat{\gamma}</span></tt></td>
</tr>
-<tr><td><span class="formula"><i>à</i></span> <tt class="docutils literal">\grave{a}</tt></td>
-<td><span class="formula"><i>ẗ</i></span> <tt class="docutils literal">\ddot{t}</tt></td>
+<tr><td><span class="formula"><i>à</i></span> <tt class="docutils literal">\grave{a}</tt></td>
+<td><span class="formula"><i>ẗ</i></span> <tt class="docutils literal">\ddot{t}</tt></td>
<td><span class="formula"><i>α̃</i></span> <tt class="docutils literal"><span class="pre">\tilde{\alpha}</span></tt></td>
</tr>
<tr><td><span class="formula"><i>x̆</i></span> <tt class="docutils literal">\breve{x}</tt></td>
@@ -93,7 +93,7 @@
<td><span class="formula"><i>t⃛</i></span> <tt class="docutils literal">\dddot{t}</tt></td>
<td><span class="formula"><i>ı⃗</i></span> <tt class="docutils literal"><span class="pre">\vec{\imath}</span></tt></td>
</tr>
-<tr><td><span class="formula"><i>ǎ</i></span> <tt class="docutils literal">\check{a}</tt></td>
+<tr><td><span class="formula"><i>ǎ</i></span> <tt class="docutils literal">\check{a}</tt></td>
<td><span class="formula"><span class="bar"><i>a</i></span></span> <tt class="docutils literal">\bar{a}</tt></td>
<td><span class="formula"><i>R⃗</i></span> <tt class="docutils literal">\vec{R}</tt></td>
</tr>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2021-07-12 21:22:59
|
Revision: 8795
http://sourceforge.net/p/docutils/code/8795
Author: milde
Date: 2021-07-12 21:22:35 +0000 (Mon, 12 Jul 2021)
Log Message:
-----------
math2html: support decorations under base character.
Modified Paths:
--------------
trunk/docutils/docutils/utils/math/math2html.py
trunk/docutils/docutils/writers/html5_polyglot/math.css
trunk/docutils/test/functional/expected/math_output_html.html
Modified: trunk/docutils/docutils/utils/math/math2html.py
===================================================================
--- trunk/docutils/docutils/utils/math/math2html.py 2021-07-12 21:22:20 UTC (rev 8794)
+++ trunk/docutils/docutils/utils/math/math2html.py 2021-07-12 21:22:35 UTC (rev 8795)
@@ -99,7 +99,6 @@
u'Bracket',
u'BracketCommand',
u'CombiningFunction',
- u'DecoratingFunction',
u'EmptyCommand',
u'FontFunction',
u'Formula',
@@ -106,10 +105,12 @@
u'FormulaNumber',
u'FormulaSymbol',
u'OneParamFunction',
+ u'OversetFunction',
u'RawText',
u'SpacedCommand',
u'SymbolFunction',
u'TextFunction',
+ u'UndersetFunction',
],
}
@@ -306,15 +307,33 @@
cmddict.update(tex2unichar.space)
commands.update(('\\' + key, value) for key, value in cmddict.items())
- decoratedcommand = {
- }
+ oversetfunctions = {
+ # math accents (cf. combiningfunctions)
+ # '\\acute': u'´',
+ '\\bar': u'‒', # FIGURE DASH
+ # '\\breve': u'˘',
+ # '\\check': u'ˇ',
+ '\\dddot': u'<span class="smallsymbol">⋯</span>',
+ # '\\ddot': u'··', # ¨ too high
+ # '\\dot': u'·',
+ # '\\grave': u'`',
+ # '\\hat': u'^',
+ # '\\mathring': u'˚',
+ # '\\tilde': u'~',
+ '\\vec': u'<span class="smallsymbol">→</span>',
+ # embellishments
+ '\\overleftarrow': u'⟵',
+ '\\overleftrightarrow': u'⟷',
+ '\\overrightarrow': u'⟶',
+ '\\widehat': u'^',
+ '\\widetilde': u'~',
+ }
- decoratingfunctions = {u'\\overleftarrow': u'⟵',
- u'\\overrightarrow': u'⟶',
- u'\\overleftrightarrow': u'⟷',
- u'\\widehat': u'^',
- u'\\widetilde': u'~',
- }
+ undersetfunctions = {
+ '\\underleftarrow': u'⟵',
+ '\\underleftrightarrow': u'⟷',
+ '\\underrightarrow': u'⟶',
+ }
endings = {
u'bracket': u'}',
@@ -456,28 +475,30 @@
}
onefunctions = {
- '\\Big': u'span class="bigsymbol"',
- '\\Bigl': u'span class="bigsymbol"',
- '\\Bigr': u'span class="bigsymbol"',
- '\\Bigg': u'span class="hugesymbol"',
- '\\Biggl': u'span class="hugesymbol"',
- '\\Biggr': u'span class="hugesymbol"',
- '\\bar': u'span class="bar"', u'\\begin{array}': u'span class="arraydef"',
- '\\big': u'span class="symbol"', u'\\bigg': u'span class="largesymbol"',
- '\\bigl': u'span class="symbol"',
- '\\bigr': u'span class="symbol"',
- '\\biggl': u'span class="largesymbol"',
- '\\biggr': u'span class="largesymbol"',
- '\\centering': u'span class="align-center"',
- '\\ensuremath': u'span class="ensuremath"',
- '\\hphantom': u'span class="phantom"',
- '\\noindent': u'span class="noindent"',
- '\\overbrace': u'span class="overbrace"',
- '\\overline': u'span class="overline"',
- '\\phantom': u'span class="phantom"',
- '\\underbrace': u'span class="underbrace"',
- '\\underline': u'u',
- '\\vphantom': u'span class="phantom"',
+ '\\Big': 'span class="bigsymbol"',
+ '\\Bigl': 'span class="bigsymbol"',
+ '\\Bigr': 'span class="bigsymbol"',
+ '\\Bigg': 'span class="hugesymbol"',
+ '\\Biggl': 'span class="hugesymbol"',
+ '\\Biggr': 'span class="hugesymbol"',
+ # '\\bar': 'span class="bar"',
+ '\\begin{array}': 'span class="arraydef"',
+ '\\big': 'span class="symbol"',
+ '\\bigl': 'span class="symbol"',
+ '\\bigr': 'span class="symbol"',
+ '\\bigg': 'span class="largesymbol"',
+ '\\biggl': 'span class="largesymbol"',
+ '\\biggr': 'span class="largesymbol"',
+ '\\centering': 'span class="align-center"',
+ '\\ensuremath': 'span class="ensuremath"',
+ '\\hphantom': 'span class="phantom"',
+ '\\noindent': 'span class="noindent"',
+ '\\overbrace': 'span class="overbrace"',
+ '\\overline': 'span class="overline"',
+ '\\phantom': 'span class="phantom"',
+ '\\underbrace': 'span class="underbrace"',
+ '\\underline': 'u',
+ '\\vphantom': 'span class="phantom"',
}
# relations (put additional space before and after the symbol)
@@ -2697,7 +2718,6 @@
i = 1
parameter.string = parameter.string[:i] + combining + parameter.string[i:]
# Use pre-composed characters if possible: \not{=} -> ≠, say.
- # TODO: use overset for mathematical accents.
parameter.string = unicodedata.normalize('NFC', parameter.string)
def parsesingleparameter(self, pos):
@@ -2707,22 +2727,36 @@
return None
return self.parseparameter(pos)
-class DecoratingFunction(OneParamFunction):
- "A function that decorates some bit of text"
+class OversetFunction(OneParamFunction):
+ "A function that decorates some bit of text with an overset."
- commandmap = FormulaConfig.decoratingfunctions
+ commandmap = FormulaConfig.oversetfunctions
def parsebit(self, pos):
- "Parse a decorating function"
- self.type = 'alpha'
+ "Parse an overset-function"
symbol = self.translated
- self.symbol = TaggedBit().constant(symbol, 'span class="symbolover"')
+ self.symbol = TaggedBit().constant(symbol, 'sup')
self.parameter = self.parseparameter(pos)
- self.output = TaggedOutput().settag('span class="withsymbol"')
+ self.output = TaggedOutput().settag('span class="embellished"')
self.contents.insert(0, self.symbol)
- self.parameter.output = TaggedOutput().settag('span class="undersymbol"')
+ self.parameter.output = TaggedOutput().settag('span class="base"')
self.simplifyifpossible()
+class UndersetFunction(OneParamFunction):
+ "A function that decorates some bit of text with an underset."
+
+ commandmap = FormulaConfig.undersetfunctions
+
+ def parsebit(self, pos):
+ "Parse an underset-function"
+ symbol = self.translated
+ self.symbol = TaggedBit().constant(symbol, 'sub')
+ self.parameter = self.parseparameter(pos)
+ self.output = TaggedOutput().settag('span class="embellished"')
+ self.contents.insert(0, self.symbol)
+ self.parameter.output = TaggedOutput().settag('span class="base"')
+ self.simplifyifpossible()
+
class LimitCommand(EmptyCommand):
"A command which accepts limits above and below, in display mode."
@@ -2899,9 +2933,8 @@
command.contents = bracket.getcontents()
-FormulaCommand.types += [
- DecoratingFunction, CombiningFunction, LimitCommand, BracketCommand,
- ]
+FormulaCommand.types += [OversetFunction, UndersetFunction,
+ CombiningFunction, LimitCommand, BracketCommand]
FormulaProcessor.processors += [
LimitsProcessor(), BracketProcessor(),
Modified: trunk/docutils/docutils/writers/html5_polyglot/math.css
===================================================================
--- trunk/docutils/docutils/writers/html5_polyglot/math.css 2021-07-12 21:22:20 UTC (rev 8794)
+++ trunk/docutils/docutils/writers/html5_polyglot/math.css 2021-07-12 21:22:35 UTC (rev 8795)
@@ -25,7 +25,7 @@
/* Formulas */
.formula {
text-align: center;
- font-family: "Droid Serif", "DejaVu Serif", "STIX", serif;
+ font-family: "Droid Serif", "DejaVu Serif", STIX, serif;
margin: 1.2em 0;
line-height: 1.4;
}
@@ -179,27 +179,21 @@
sup.limit, sub.limit {
line-height: 100%;
}
-span.symbolover {
+span.embellished,
+span.embellished > .base {
display: inline-block;
- text-align: center;
- position: relative;
- float: right;
- right: 100%;
- bottom: 0.5em;
- width: 0px;
}
-span.withsymbol {
+span.embellished > sup,
+span.embellished > sub {
display: inline-block;
-}
-span.symbolunder {
- display: inline-block;
- text-align: center;
+ font-size: 100%;
position: relative;
- float: right;
- right: 80%;
- top: 0.3em;
+ bottom: 0.3em;
width: 0px;
}
+span.embellished > sub {
+ top: 0.4em;
+}
/* Environments */
span.array, span.bracketcases, span.binomial, span.environment {
Modified: trunk/docutils/test/functional/expected/math_output_html.html
===================================================================
--- trunk/docutils/test/functional/expected/math_output_html.html 2021-07-12 21:22:20 UTC (rev 8794)
+++ trunk/docutils/test/functional/expected/math_output_html.html 2021-07-12 21:22:35 UTC (rev 8795)
@@ -90,12 +90,12 @@
<td><span class="formula"><i>α̃</i></span> <tt class="docutils literal"><span class="pre">\tilde{\alpha}</span></tt></td>
</tr>
<tr><td><span class="formula"><i>x̆</i></span> <tt class="docutils literal">\breve{x}</tt></td>
-<td><span class="formula"><i>t⃛</i></span> <tt class="docutils literal">\dddot{t}</tt></td>
-<td><span class="formula"><i>ı⃗</i></span> <tt class="docutils literal"><span class="pre">\vec{\imath}</span></tt></td>
+<td><span class="formula"><span class="embellished"><sup><span class="smallsymbol">⋯</span></sup><span class="base"><i>t</i></span></span></span> <tt class="docutils literal">\dddot{t}</tt></td>
+<td><span class="formula"><span class="embellished"><sup><span class="smallsymbol">→</span></sup><span class="base"><i>ı</i></span></span></span> <tt class="docutils literal"><span class="pre">\vec{\imath}</span></tt></td>
</tr>
<tr><td><span class="formula"><i>ǎ</i></span> <tt class="docutils literal">\check{a}</tt></td>
-<td><span class="formula"><span class="bar"><i>a</i></span></span> <tt class="docutils literal">\bar{a}</tt></td>
-<td><span class="formula"><i>R⃗</i></span> <tt class="docutils literal">\vec{R}</tt></td>
+<td><span class="formula"><span class="embellished"><sup>‒</sup><span class="base"><i>a</i></span></span></span> <tt class="docutils literal">\bar{a}</tt></td>
+<td><span class="formula"><span class="embellished"><sup><span class="smallsymbol">→</span></sup><span class="base"><i>R</i></span></span></span> <tt class="docutils literal">\vec{R}</tt></td>
</tr>
</tbody>
</table>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2021-07-12 21:23:11
|
Revision: 8796
http://sourceforge.net/p/docutils/code/8796
Author: milde
Date: 2021-07-12 21:23:07 +0000 (Mon, 12 Jul 2021)
Log Message:
-----------
math2html: Improve handling of big symbols.
Scale variable sized operators with CSS instead of constructing from pieces.
Fix Unicode translations for N-ary operators.
Scale stretch big delimiters instead of scaling.
Modified Paths:
--------------
trunk/docutils/docs/ref/rst/mathematics.txt
trunk/docutils/docutils/utils/math/math2html.py
trunk/docutils/docutils/writers/html5_polyglot/math.css
trunk/docutils/test/functional/expected/math_output_html.html
Modified: trunk/docutils/docs/ref/rst/mathematics.txt
===================================================================
--- trunk/docutils/docs/ref/rst/mathematics.txt 2021-07-12 21:22:35 UTC (rev 8795)
+++ trunk/docutils/docs/ref/rst/mathematics.txt 2021-07-12 21:23:07 UTC (rev 8796)
@@ -989,6 +989,7 @@
\left.\vert \frac{b}{a}\right\Vert\ \bigl\vert b\Bigr\Vert\ \biggl\vert b\Biggr\Vert
\quad
+
Variable-sized operators:
Inline: `\sum\ \int\ \oint\ \smallint\ \prod\ \coprod\ \bigwedge\
Modified: trunk/docutils/docutils/utils/math/math2html.py
===================================================================
--- trunk/docutils/docutils/utils/math/math2html.py 2021-07-12 21:22:35 UTC (rev 8795)
+++ trunk/docutils/docutils/utils/math/math2html.py 2021-07-12 21:23:07 UTC (rev 8796)
@@ -175,16 +175,16 @@
u'∥': [u'∥',],
}
- bigsymbols = {u'∑': [u'⎲', u'⎳',], # ⎲ ⌠ ┌
- u'∫': [u'⌠', u'⌡',], # ⎳ ⎮ │
- u'√': [u'┌', u'⎷',], # ⌡ ⎷
+ bigsymbols = {# u'∑': [u'⎲', u'⎳',], # ⎲ ⌠ ┌
+ # u'∫': [u'⌠', u'⌡',], # ⎳ ⎮ │
+ # u'√': [u'┌', u'⎷',], # ⌡ ⎷
}
bracketcommands = {
- u'\\left': u'span class="symbol"',
+ u'\\left': u'span class="bigdelimiter size2"',
u'\\left.': u'<span class="leftdot"></span>',
- u'\\middle': u'span class="symbol"',
- u'\\right': u'span class="symbol"',
+ u'\\middle': u'span class="bigdelimiter size2"',
+ u'\\right': u'span class="bigdelimiter size2"',
u'\\right.': u'<span class="rightdot"></span>',
}
@@ -206,6 +206,8 @@
commands = {
'\\\\': u'<br/>',
+ '\\\n': u' ', # escaped whitespace
+ '\\\t': u' ', # escaped whitespace
'\\colon': u': ',
'\\copyright': u'©',
'\\dotminus': u'∸',
@@ -382,7 +384,7 @@
u'\\addcontentsline': [u'{$p!}{$q!}{$r!}', u'f0{}', u'ignored',],
u'\\addtocontents': [u'{$p!}{$q!}', u'f0{}', u'ignored',],
u'\\backmatter': [u'', u'f0{}', u'ignored',],
- u'\\binom': [u'{$1}{$2}', u'f2{(}f0{f1{$1}f1{$2}}f2{)}', u'span class="binom"', u'span class="binomstack"', u'span class="bigsymbol"',],
+ u'\\binom': [u'{$1}{$2}', u'f2{(}f0{f1{$1}f1{$2}}f2{)}', u'span class="binom"', u'span class="binomstack"', u'span class="bigdelimiter size2"',],
u'\\boxed': [u'{$1}', u'f0{$1}', u'span class="boxed"',],
u'\\cfrac': [u'[$p!]{$1}{$2}', u'f0{f3{(}f1{$1}f3{)/(}f2{$2}f3{)}}', u'span class="fullfraction"', u'span class="numerator align-$p"', u'span class="denominator"', u'span class="ignored"',],
u'\\color': [u'{$p!}{$1}', u'f0{$1}', u'span style="color: $p;"',],
@@ -437,31 +439,30 @@
limitcommands = {
'\\biginterleave': u'⫼',
'\\inf': u'inf',
- '\\intop': u'∫', # large operator via pieces from bigsymbols
'\\lim': u'lim',
'\\max': u'max',
'\\min': u'min',
- '\\sum': u'∑', # large operator via pieces from bigsymbols
'\\sup': u'sup',
'\\ointop': u'<span class="bigoperator">∮</span>',
- '\\bigcap': u'<span class="bigoperator">∩</span>',
- '\\bigcup': u'<span class="bigoperator">∪</span>',
- '\\bigodot': u'<span class="bigoperator">⊙</span>',
- '\\bigoplus': u'<span class="bigoperator">⊕</span>',
- '\\bigotimes': u'<span class="bigoperator">⊗</span>',
+ '\\bigcap': u'<span class="bigoperator">⋂</span>',
+ '\\bigcup': u'<span class="bigoperator">⋃</span>',
+ '\\bigodot': u'<span class="bigoperator">⨀</span>',
+ '\\bigoplus': u'<span class="bigoperator">⨁</span>',
+ '\\bigotimes': u'<span class="bigoperator">⨂</span>',
'\\bigsqcap': u'<span class="bigoperator">⨅</span>',
- '\\bigsqcup': u'<span class="bigoperator">⊔</span>',
- '\\biguplus': u'<span class="bigoperator">⊎</span>',
- '\\bigvee': u'<span class="bigoperator">∨</span>',
- '\\bigwedge': u'<span class="bigoperator">∧</span>',
+ '\\bigsqcup': u'<span class="bigoperator">⨆</span>',
+ '\\biguplus': u'<span class="bigoperator">⨄</span>',
+ '\\bigvee': u'<span class="bigoperator">⋁</span>',
+ '\\bigwedge': u'<span class="bigoperator">⋀</span>',
'\\coprod': u'<span class="bigoperator">∐</span>',
+ '\\intop': u'<span class="bigoperator">∫</span>',
'\\prod': u'<span class="bigoperator">∏</span>',
+ '\\sum': u'<span class="bigoperator">∑</span>',
'\\varprod': u'<span class="bigoperator">⨉</span>',
'\\zcmp': u'⨟', '\\zhide': u'⧹', '\\zpipe': u'⨠', '\\zproject': u'⨡',
# integrals have limits in index position with LaTeX default settings
# TODO: move to commands?
- '\\int': u'∫',
- '\\smallint': u'∫',
+ '\\int': u'<span class="bigoperator">∫</span>',
'\\fint': u'<span class="bigoperator">⨏</span>',
'\\iiiint': u'<span class="bigoperator">⨌</span>',
'\\sqint': u'<span class="bigoperator">⨖</span>',
@@ -475,20 +476,20 @@
}
onefunctions = {
- '\\Big': 'span class="bigsymbol"',
- '\\Bigl': 'span class="bigsymbol"',
- '\\Bigr': 'span class="bigsymbol"',
- '\\Bigg': 'span class="hugesymbol"',
- '\\Biggl': 'span class="hugesymbol"',
- '\\Biggr': 'span class="hugesymbol"',
+ '\\big': 'span class="bigdelimiter size1"',
+ '\\bigl': 'span class="bigdelimiter size1"',
+ '\\bigr': 'span class="bigdelimiter size1"',
+ '\\Big': 'span class="bigdelimiter size2"',
+ '\\Bigl': 'span class="bigdelimiter size2"',
+ '\\Bigr': 'span class="bigdelimiter size2"',
+ '\\bigg': 'span class="bigdelimiter size3"',
+ '\\biggl': 'span class="bigdelimiter size3"',
+ '\\biggr': 'span class="bigdelimiter size3"',
+ '\\Bigg': 'span class="bigdelimiter size4"',
+ '\\Biggl': 'span class="bigdelimiter size4"',
+ '\\Biggr': 'span class="bigdelimiter size4"',
# '\\bar': 'span class="bar"',
'\\begin{array}': 'span class="arraydef"',
- '\\big': 'span class="symbol"',
- '\\bigl': 'span class="symbol"',
- '\\bigr': 'span class="symbol"',
- '\\bigg': 'span class="largesymbol"',
- '\\biggl': 'span class="largesymbol"',
- '\\biggr': 'span class="largesymbol"',
'\\centering': 'span class="align-center"',
'\\ensuremath': 'span class="ensuremath"',
'\\hphantom': 'span class="phantom"',
@@ -2489,7 +2490,7 @@
"Return the bracket as a single sign."
if self.original == '.':
return [TaggedBit().constant('', 'span class="emptydot"')]
- return [TaggedBit().constant(self.original, 'span class="symbol"')]
+ return [TaggedBit().constant(self.original, 'span class="bigdelimiter size2"')]
class FormulaEquation(CommandBit):
Modified: trunk/docutils/docutils/writers/html5_polyglot/math.css
===================================================================
--- trunk/docutils/docutils/writers/html5_polyglot/math.css 2021-07-12 21:22:35 UTC (rev 8795)
+++ trunk/docutils/docutils/writers/html5_polyglot/math.css 2021-07-12 21:23:07 UTC (rev 8796)
@@ -25,7 +25,8 @@
/* Formulas */
.formula {
text-align: center;
- font-family: "Droid Serif", "DejaVu Serif", STIX, serif;
+ font-family: "DejaVu Serif", STIX, serif;
+ /* "DejaVu Math TeX Gyre", (brace pieces don't fit) */
margin: 1.2em 0;
line-height: 1.4;
}
@@ -126,14 +127,6 @@
vertical-align: middle;
}
-/* div.formula span.sqrt span.radical:before { */
-/* writing-mode: vertical-lr; */
-/* text-orientation: upright; */
-/* content: "┌│⎷"; */
-/* } */
-/* or use "transform" property */
-/* https://developer.mozilla.org/en-US/docs/Web/CSS/transform */
-
span.root {
display: inline-block;
border-top: thin solid;
@@ -145,17 +138,33 @@
line-height: 125%;
font-size: 125%;
}
-/* TODO: use transform matrix to stretch fences */
-span.bigsymbol, div.formula span.bigoperator {
- line-height: 150%;
+div.formula .bigoperator,
+.displaystyle .bigoperator,
+.displaystyle .bigoperator {
+ line-height: 150%;
font-size: 150%;
}
-span.largesymbol {
- font-size: 175%;
+span.fraction .bigoperator,
+span.scriptstyle .bigoperator{
+ line-height: inherit;
+ font-size: inherit;
}
-span.hugesymbol {
- font-size: 200%;
+span.bigdelimiter {
+ display: inline-block;
+ vertical-align: text-bottom;
}
+span.bigdelimiter.size1 {
+ transform: scale(1, 1.2);
+}
+span.bigdelimiter.size2 {
+ transform: scale(1, 1.62);
+}
+span.bigdelimiter.size3 {
+ transform: scale(1, 2.05);
+}
+span.bigdelimiter.size4 {
+ transform: scale(1, 2.47);
+}
/* vertically stacked sub and superscript */
span.scripts {
display: inline-flex;
@@ -174,7 +183,7 @@
}
.limit {
display: table-row;
- line-height: 99%;
+/* line-height: 99%; */
}
sup.limit, sub.limit {
line-height: 100%;
@@ -211,9 +220,12 @@
span.arraycell, span.bracket, span.case, span.binomcell, span.environmentcell {
display: table-cell;
padding: 0ex 0.2ex;
- line-height: 99%;
+ line-height: 1; /* 99%; */
border: 0ex;
}
+.environment.align > .arrayrow > .arraycell.align-l {
+ padding-right: 2em;
+}
/*
* CSS file for LaTeX formulas, extra stuff:
* binomials, vertical braces, stackrel, fonts and colors.
Modified: trunk/docutils/test/functional/expected/math_output_html.html
===================================================================
--- trunk/docutils/test/functional/expected/math_output_html.html 2021-07-12 21:22:35 UTC (rev 8795)
+++ trunk/docutils/test/functional/expected/math_output_html.html 2021-07-12 21:23:07 UTC (rev 8796)
@@ -59,10 +59,10 @@
<p>More than one display math block can be put in one math directive.
For example, the following sum and integral with limits:</p>
<div class="formula">
-<span class="limits"><sup class="limit">1</sup><span class="limit">⌠</span><span class="limit">⌡</span><sub class="limit">0</sub></span><i>x</i><sup><i>n</i></sup><i>dx</i> = <span class="fraction"><span class="ignored">(</span><span class="numerator">1</span><span class="ignored">)/(</span><span class="denominator"><i>n</i> + 1</span><span class="ignored">)</span></span>
+<span class="limits"><sup class="limit">1</sup><span class="limit"><span class="bigoperator">∫</span></span><sub class="limit">0</sub></span><i>x</i><sup><i>n</i></sup><i>dx</i> = <span class="fraction"><span class="ignored">(</span><span class="numerator">1</span><span class="ignored">)/(</span><span class="denominator"><i>n</i> + 1</span><span class="ignored">)</span></span>
</div>
<div class="formula">
-<span class="limits"><sup class="limit"><i>m</i></sup><span class="limit">⎲</span><span class="limit">⎳</span><sub class="limit"><i>n</i> = 1</sub></span><i>n</i> = <span class="fraction"><span class="ignored">(</span><span class="numerator"><i>m</i>(<i>m</i> + 1)</span><span class="ignored">)/(</span><span class="denominator">2</span><span class="ignored">)</span></span>
+<span class="limits"><sup class="limit"><i>m</i></sup><span class="limit"><span class="bigoperator">∑</span></span><sub class="limit"><i>n</i> = 1</sub></span><i>n</i> = <span class="fraction"><span class="ignored">(</span><span class="numerator"><i>m</i>(<i>m</i> + 1)</span><span class="ignored">)/(</span><span class="denominator">2</span><span class="ignored">)</span></span>
</div>
<p>LaTeX-supported Unicode math symbols can be used in math roles and
directives:</p>
@@ -105,7 +105,7 @@
\widehat{xxx} -->
<p>Modulation Transfer Function:</p>
<div class="formula">
-<span class="text">MTF</span> = <span class="array"><span class="arrayrow"><span class="bracket align-left">|</span></span><span class="arrayrow"><span class="bracket align-left">|</span></span></span><span class="fraction"><span class="ignored">(</span><span class="numerator">ℱ{<i>s</i>(<i>x</i>)}</span><span class="ignored">)/(</span><span class="denominator">ℱ{<i>s</i>(<i>x</i>)}|<sub><i>ω</i><sub><i>x</i></sub> = 0</sub></span><span class="ignored">)</span></span><span class="array"><span class="arrayrow"><span class="bracket align-right">|</span></span><span class="arrayrow"><span class="bracket align-right">|</span></span></span> = <span class="mathrm"> abs</span><span class="array"><span class="arrayrow"><span class="bracket align-left">⎛</span></span><span class="arrayrow"><span class="bracket align-left">⎝</span></span></span><span class="fraction"><span class="ignored">(</span><span class="numerator"><span class="limits"><span class="limit">⌠</span><span class="limit">⌡</span></span><span class="scripts"><sup class="script">∞</sup><sub class="script"> − ∞</sub></span><i>s</i>(<i>x</i>)<span class="mathrm">e</span><sup><span class="mathrm">i</span><i>ω</i><sub><i>x</i></sub><i>x</i></sup><span class="mathrm">d</span><i>x</i></span><span class="ignored">)/(</span><span class="denominator"><span class="limits"><span class="limit">⌠</span><span class="limit">⌡</span></span><span class="scripts"><sup class="script">∞</sup><sub class="script"> − ∞</sub></span><i>s</i>(<i>x</i>)<span class="mathrm">d</span><i>x</i></span><span class="ignored">)</span></span><span class="array"><span class="arrayrow"><span class="bracket align-right">⎞</span></span><span class="arrayrow"><span class="bracket align-right">⎠</span></span></span>.
+<span class="text">MTF</span> = <span class="array"><span class="arrayrow"><span class="bracket align-left">|</span></span><span class="arrayrow"><span class="bracket align-left">|</span></span></span><span class="fraction"><span class="ignored">(</span><span class="numerator">ℱ{<i>s</i>(<i>x</i>)}</span><span class="ignored">)/(</span><span class="denominator">ℱ{<i>s</i>(<i>x</i>)}|<sub><i>ω</i><sub><i>x</i></sub> = 0</sub></span><span class="ignored">)</span></span><span class="array"><span class="arrayrow"><span class="bracket align-right">|</span></span><span class="arrayrow"><span class="bracket align-right">|</span></span></span> = <span class="mathrm"> abs</span><span class="array"><span class="arrayrow"><span class="bracket align-left">⎛</span></span><span class="arrayrow"><span class="bracket align-left">⎝</span></span></span><span class="fraction"><span class="ignored">(</span><span class="numerator"><span class="limits"><span class="limit"><span class="bigoperator">∫</span></span></span><span class="scripts"><sup class="script">∞</sup><sub class="script"> − ∞</sub></span><i>s</i>(<i>x</i>)<span class="mathrm">e</span><sup><span class="mathrm">i</span><i>ω</i><sub><i>x</i></sub><i>x</i></sup><span class="mathrm">d</span><i>x</i></span><span class="ignored">)/(</span><span class="denominator"><span class="limits"><span class="limit"><span class="bigoperator">∫</span></span></span><span class="scripts"><sup class="script">∞</sup><sub class="script"> − ∞</sub></span><i>s</i>(<i>x</i>)<span class="mathrm">d</span><i>x</i></span><span class="ignored">)</span></span><span class="array"><span class="arrayrow"><span class="bracket align-right">⎞</span></span><span class="arrayrow"><span class="bracket align-right">⎠</span></span></span>.
</div>
<p>Math split over two lines: If a double backslash is detected outside a
<tt class="docutils literal"><span class="pre">\begin{...}</span> <span class="pre">\end{...}</span></tt> pair, the math code is wrapped in an <a class="reference external" href="ftp://ftp.ams.org/ams/doc/amsmath/short-math-guide.pdf">AMSmath</a>
@@ -134,7 +134,7 @@
</span>
<span class="arraycell align-l">
- = <span class="limits"><span class="limit">⌠</span><span class="limit">⌡</span></span><i>s</i><sub><span class="mathrm">in</span></sub>(<i>x</i>’)<i>s</i><sub><i>δ</i></sub>(<i>x</i> − <i>x</i>’)<span class="mathrm">d</span><i>x</i>’
+ = <span class="limits"><span class="limit"><span class="bigoperator">∫</span></span></span><i>s</i><sub><span class="mathrm">in</span></sub>(<i>x</i>’)<i>s</i><sub><i>δ</i></sub>(<i>x</i> − <i>x</i>’)<span class="mathrm">d</span><i>x</i>’
</span>
</span>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2021-07-12 21:23:34
|
Revision: 8798
http://sourceforge.net/p/docutils/code/8798
Author: milde
Date: 2021-07-12 21:23:31 +0000 (Mon, 12 Jul 2021)
Log Message:
-----------
math2html: Prefer STIX fonts for formulas.
STIX is free, widely supported, and comprehensive.
(On the downside: it is considerably smaller than DejaVu:
no problem with Chromium/Chrome but in Firefox a larger font-size
might be advised.)
Work around bugs/problems in STIX:
"medium mathematical space" is too wide,
"vertical line" glyphs leave gaps when stacked,
upright integrals provide better alignment of limits.
Modified Paths:
--------------
trunk/docutils/docs/ref/rst/mathematics.txt
trunk/docutils/docutils/utils/math/math2html.py
trunk/docutils/docutils/writers/html5_polyglot/math.css
trunk/docutils/test/functional/expected/math_output_html.html
trunk/docutils/test/functional/expected/standalone_rst_html4css1.html
trunk/docutils/test/functional/expected/standalone_rst_html5.html
Modified: trunk/docutils/docs/ref/rst/mathematics.txt
===================================================================
--- trunk/docutils/docs/ref/rst/mathematics.txt 2021-07-12 21:23:19 UTC (rev 8797)
+++ trunk/docutils/docs/ref/rst/mathematics.txt 2021-07-12 21:23:31 UTC (rev 8798)
@@ -16,7 +16,6 @@
__ https://docutils.sourceforge.io/docs/ref/rst/directives.html#math
__ https://docutils.sourceforge.io/docs/ref/rst/roles.html#math
-
Inline formulas and displayed equations
=======================================
@@ -24,7 +23,7 @@
``:math:`\psi(r) = \exp(-2r)``` will produce :m:`\psi(r)=\exp(-2r)`.
Inside the backtics you can write anything you would write between dollar
signs in a LaTeX document. [#math-syntax]_
-
+
.. tip::
If you put ``.. default-role:: math`` at the top of your
@@ -992,15 +991,27 @@
Variable-sized operators:
-Inline: `\sum\ \int\ \oint\ \smallint\ \prod\ \coprod\ \bigwedge\
-\bigvee\ \bigcap\ \bigcup\ \biguplus\ \bigsqcup\ \bigodot\ \bigoplus\
-\bigotimes` and Display:
+Inline: `\sum\ \int\ \iint\ \iiint\ \iiiint\ \idotsint\ \oint\ \smallint\
+\prod\ \coprod\ \bigwedge\ \bigvee\ \bigcap\ \bigcup\ \biguplus\
+\bigsqcup\ \bigodot\ \bigoplus\ \bigotimes` and Display:
-.. math:: \sum\ \int\ \oint\ \smallint\ \prod\ \coprod\ \bigwedge
- \ \bigvee\ \bigcap\ \bigcup\ \biguplus\ \bigsqcup\ \bigodot
- \ \bigoplus\ \bigotimes
- \ \iiint\ \iiiint
+.. math:: \int\ \iint\ \iiint\ \iiiint\ \idotsint\ \oint\ \smallint\
+ \sum\ \prod\ \coprod\ \bigwedge\ \bigvee\ \bigcap\ \bigcup\
+ \biguplus\ \bigsqcup\ \bigodot\ \bigoplus\ \bigotimes
+.. math:: \int_1 f\ \intop_1 f\ \iint_1 f\ \smallint_1 f\ \sum_1 \
+ \prod_1 \ \bigwedge_1 \ \bigcap_1 \ \biguplus_1 \ \bigodot_1 \ \int^N
+ \ \intop^N \ \iiiint^N \ \oint^N \ \smallint^N \ \sum^N \ \coprod^N \
+ \bigvee^N \ \bigcup^N \ \bigsqcup^N \ \bigotimes^N \
+
+.. math:: \int_1^N \ \intop_1^N \ \iint_1^N \ \iiint_1^N \ \iiiint_1^N \
+ \idotsint_1^N \ \oint_1^N \ \smallint_1^N \ \sum_1^N \ \prod_1^N \
+ \coprod_1^N \ \bigwedge_1^N \ \bigvee_1^N \ \bigcap_1^N \ \bigcup_1^N
+ \ \biguplus_1^N \ \bigsqcup_1^N \ \bigodot_1^N \ \bigoplus_1^N \
+ \bigotimes_1^N \
+
+
+
Text
~~~~
Modified: trunk/docutils/docutils/utils/math/math2html.py
===================================================================
--- trunk/docutils/docutils/utils/math/math2html.py 2021-07-12 21:23:19 UTC (rev 8797)
+++ trunk/docutils/docutils/utils/math/math2html.py 2021-07-12 21:23:31 UTC (rev 8798)
@@ -171,15 +171,18 @@
u'{': [u'⎧', u'⎪', u'⎨', u'⎩',],
u'}': [u'⎫', u'⎪', u'⎬', u'⎭',],
# TODO: 2-row brackets with ⎰⎱ (\lmoustache \rmoustache)
- u'|': [u'|',],
- u'∥': [u'∥',],
+ u'|': [u'|',], # 007C VERTICAL LINE
+ # u'|': [u'⎮',], # 23AE INTEGRAL EXTENSION
+ # u'|': [u'⎪',], # 23AA CURLY BRACKET EXTENSION
+ u'‖': [u'‖'], # 2016 DOUBLE VERTICAL LINE
+ # u'∥': [u'∥'], # 2225 PARALLEL TO
}
bracketcommands = {
- u'\\left': u'span class="bigdelimiter size2"',
+ u'\\left': u'span class="stretchy"',
u'\\left.': u'<span class="leftdot"></span>',
- u'\\middle': u'span class="bigdelimiter size2"',
- u'\\right': u'span class="bigdelimiter size2"',
+ u'\\middle': u'span class="stretchy"',
+ u'\\right': u'span class="stretchy"',
u'\\right.': u'<span class="rightdot"></span>',
}
@@ -215,25 +218,16 @@
'\\euro': u'€',
'\\guillemotleft': u'«',
'\\guillemotright': u'»',
- '\\idotsint': u'<span class="bigoperator">∫⋯∫</span>',
- '\\iiiint': u'<span class="bigoperator">⨌</span>',
- '\\iiint': u'<span class="bigoperator">∭</span>',
- '\\iint': u'<span class="bigoperator">∬</span>',
- '\\lVert': u'∥',
+ '\\lVert': u'‖',
'\\Arrowvert': u'\u2016', # ‖
- '\\lvert': u'∣',
+ '\\lvert': u'|',
'\\newline': u'<br/>',
'\\nobreakspace': u' ',
'\\nolimits': u'',
'\\nonumber': u'',
- '\\oiiint': u'<span class="bigoperator">∰</span>',
- '\\oiint': u'<span class="bigoperator">∯</span>',
- '\\oint': u'<span class="bigoperator">∮</span>',
- '\\ointclockwise': u'<span class="bigoperator">∲</span>',
- '\\ointctrclockwise': u'<span class="bigoperator">∳</span>',
'\\qquad': u' ',
- '\\rVert': u'∥',
- '\\rvert': u'∣',
+ '\\rVert': u'‖',
+ '\\rvert': u'|',
'\\shortmid': u'<span class="smallsymbol">∣</span>',
'\\shortparallel': u'<span class="smallsymbol">∥</span>',
'\\nshortmid': u'<span class="smallsymbol">∤</span>',
@@ -240,7 +234,6 @@
'\\nshortparallel': u'<span class="smallsymbol">∦</span>',
'\\smallfrown': u'<span class="smallsymbol">⌢</span>',
'\\smallsmile': u'<span class="smallsymbol">⌣</span>',
- '\\smallint': u'<span class="smallsymbol">∫</span>',
'\\textasciicircum': u'^',
'\\textasciitilde': u'~',
'\\textbackslash': u'\\',
@@ -409,6 +402,7 @@
u'\\rule': [u'[$v!]{$w!}{$h!}', u'f0/', u'hr class="line" style="width: $w; height: $h;"',],
u'\\scriptscriptstyle': [u'{$1}', u'f0{$1}', u'span class="scriptscriptstyle"',],
u'\\scriptstyle': [u'{$1}', u'f0{$1}', u'span class="scriptstyle"',],
+ # TODO: increase √-size with argument (\frac in display mode, ...)
u'\\sqrt': [u'[$0]{$1}', u'f0{f1{$0}f2{√}f4{(}f3{$1}f4{)}}', u'span class="sqrt"', u'sup class="root"', u'span class="radical"', u'span class="root"', u'span class="ignored"',],
u'\\stackrel': [u'{$1}{$2}', u'f0{f1{$1}f2{$2}}', u'span class="stackrel"', u'span class="upstackrel"', u'span class="downstackrel"',],
u'\\tbinom': [u'{$1}{$2}', u'(f0{f1{f2{$1}}f1{f2{ }}f1{f2{$2}}})', u'span class="binomial"', u'span class="binomrow"', u'span class="binomcell"',],
@@ -439,7 +433,7 @@
'\\max': u'max',
'\\min': u'min',
'\\sup': u'sup',
- '\\ointop': u'<span class="bigoperator">∮</span>',
+ '\\ointop': u'<span class="bigoperator integral">∮</span>',
'\\bigcap': u'<span class="bigoperator">⋂</span>',
'\\bigcup': u'<span class="bigoperator">⋃</span>',
'\\bigodot': u'<span class="bigoperator">⨀</span>',
@@ -451,7 +445,7 @@
'\\bigvee': u'<span class="bigoperator">⋁</span>',
'\\bigwedge': u'<span class="bigoperator">⋀</span>',
'\\coprod': u'<span class="bigoperator">∐</span>',
- '\\intop': u'<span class="bigoperator">∫</span>',
+ '\\intop': u'<span class="bigoperator integral">∫</span>',
'\\prod': u'<span class="bigoperator">∏</span>',
'\\sum': u'<span class="bigoperator">∑</span>',
'\\varprod': u'<span class="bigoperator">⨉</span>',
@@ -458,16 +452,26 @@
'\\zcmp': u'⨟', '\\zhide': u'⧹', '\\zpipe': u'⨠', '\\zproject': u'⨡',
# integrals have limits in index position with LaTeX default settings
# TODO: move to commands?
- '\\int': u'<span class="bigoperator">∫</span>',
- '\\fint': u'<span class="bigoperator">⨏</span>',
- '\\sqint': u'<span class="bigoperator">⨖</span>',
- '\\varointclockwise': u'<span class="bigoperator">∲</span>',
+ '\\int': u'<span class="bigoperator integral">∫</span>',
+ '\\iint': u'<span class="bigoperator integral">∬</span>',
+ '\\iiint': u'<span class="bigoperator integral">∭</span>',
+ '\\iiiint': u'<span class="bigoperator integral">⨌</span>',
+ '\\fint': u'<span class="bigoperator integral">⨏</span>',
+ '\\idotsint': u'<span class="bigoperator integral">∫⋯∫</span>',
+ '\\oint': u'<span class="bigoperator integral">∮</span>',
+ '\\oiint': u'<span class="bigoperator integral">∯</span>',
+ '\\oiiint': u'<span class="bigoperator integral">∰</span>',
+ '\\ointclockwise': u'<span class="bigoperator integral">∲</span>',
+ '\\ointctrclockwise': u'<span class="bigoperator integral">∳</span>',
+ '\\smallint': u'<span class="smallsymbol integral">∫</span>',
+ '\\sqint': u'<span class="bigoperator integral">⨖</span>',
+ '\\varointclockwise': u'<span class="bigoperator integral">∲</span>',
}
modified = {
- u'\n': u'', u' ': u'', u'$': u'', u'&': u' ', u'\'': u'’', u'+': u' + ',
- u',': u', ', u'-': u' − ', u'/': u' ⁄ ', u':': u' : ', u'<': u' < ',
- u'=': u' = ', u'>': u' > ', u'@': u'', u'~': u'\u00a0',
+ u'\n': u'', u' ': u'', u'$': u'', u'&': u' ', u'\'': u'’', u'+': u'\u2009+\u2009',
+ u',': u',\u2009', u'-': u'\u2009−\u2009', u'/': u'\u2009⁄\u2009', u':': u' : ', u'<': u'\u2009<\u2009',
+ u'=': u'\u2009=\u2009', u'>': u'\u2009>\u2009', u'@': u'', u'~': u'\u00a0',
}
onefunctions = {
@@ -1954,7 +1958,7 @@
if bit.type == 'alpha':
self.italicize(bit, contents)
elif bit.type == 'font' and last and last.type == 'number':
- bit.contents.insert(0, FormulaConstant(u' '))
+ bit.contents.insert(0, FormulaConstant(u'\u2009'))
last = bit
def traverse(self, bit):
@@ -2299,8 +2303,10 @@
def parsebit(self, pos):
"Place as contents the command translated and spaced."
- # pad with MEDIUM MATHEMATICAL SPACE
- self.contents = [FormulaConstant(u'\u205f' + self.translated + u'\u205f')]
+ # pad with MEDIUM MATHEMATICAL SPACE (4/18 em): too wide in STIX fonts :(
+ # self.contents = [FormulaConstant(u'\u205f' + self.translated + u'\u205f')]
+ # pad with THIN SPACE (1/5 em)
+ self.contents = [FormulaConstant(u'\u2009' + self.translated + u'\u2009')]
class AlphaCommand(EmptyCommand):
"""A command without paramters whose result is alphabetical."""
@@ -2460,7 +2466,7 @@
"Return the bracket as a single sign."
if self.original == '.':
return [TaggedBit().constant('', 'span class="emptydot"')]
- return [TaggedBit().constant(self.original, 'span class="bigdelimiter size2"')]
+ return [TaggedBit().constant(self.original, 'span class="stretchy"')]
class FormulaEquation(CommandBit):
@@ -2683,8 +2689,8 @@
return
# Trace.message(' basechar: %r' % parameter.string)
# Insert combining character after the first character:
- if parameter.string.startswith(u'\u205f'):
- i = 2 # skip padding by SpacedCommand
+ if parameter.string.startswith(u'\u2009'):
+ i = 2 # skip padding by SpacedCommand and FormulaConfig.modified
else:
i = 1
parameter.string = parameter.string[:i] + combining + parameter.string[i:]
@@ -2793,7 +2799,7 @@
if self.checkscript(contents, index + 1):
superscript = self.getlimit(contents, index + 1)
else:
- superscript = TaggedBit().constant(u' ', 'sup class="limit"')
+ superscript = TaggedBit().constant(u'\u2009', 'sup class="limit"')
# fix order if source is x^i
if subscript.command == '^':
superscript, subscript = subscript, superscript
Modified: trunk/docutils/docutils/writers/html5_polyglot/math.css
===================================================================
--- trunk/docutils/docutils/writers/html5_polyglot/math.css 2021-07-12 21:23:19 UTC (rev 8797)
+++ trunk/docutils/docutils/writers/html5_polyglot/math.css 2021-07-12 21:23:31 UTC (rev 8798)
@@ -25,8 +25,6 @@
/* Formulas */
.formula {
text-align: center;
- font-family: "DejaVu Serif", STIX, serif;
- /* "DejaVu Math TeX Gyre", (brace pieces don't fit) */
margin: 1.2em 0;
line-height: 1.4;
}
@@ -97,7 +95,7 @@
padding: 0ex;
border-top: thin solid;
}
-math sub, math sup {
+.formula sub, .formula sup {
font-size: 80%;
}
sup.numerator, sup.unit {
@@ -108,6 +106,7 @@
}
span.smallsymbol {
font-size: 75%;
+ line-height: 75%;
}
span.sqrt {
display: inline-block;
@@ -121,7 +120,7 @@
span.radical {
display: inline-block;
padding: 0ex;
- font-size: 160%;
+ /* font-size: 160%; for DejaVu, not required with STIX */
line-height: 100%;
vertical-align: top;
vertical-align: middle;
@@ -133,41 +132,44 @@
padding: 0ex;
vertical-align: middle;
}
-span.symbol {
- line-height: 125%;
- font-size: 125%;
-}
div.formula .bigoperator,
.displaystyle .bigoperator,
.displaystyle .bigoperator {
- line-height: 150%;
+ line-height: 130%;
font-size: 150%;
+ padding-right: 0.2ex;
}
span.fraction .bigoperator,
span.scriptstyle .bigoperator {
line-height: inherit;
font-size: inherit;
+ padding-right: 0;
}
span.bigdelimiter {
display: inline-block;
- vertical-align: text-bottom;
}
span.bigdelimiter.size1 {
transform: scale(1, 1.2);
+ line-height: 1.2;
}
span.bigdelimiter.size2 {
transform: scale(1, 1.62);
+ line-height: 1.62%;
+
}
span.bigdelimiter.size3 {
transform: scale(1, 2.05);
+ line-height: 2.05%;
}
span.bigdelimiter.size4 {
transform: scale(1, 2.47);
+ line-height: 2.47%;
}
/* vertically stacked sub and superscript */
span.scripts {
display: inline-table;
vertical-align: middle;
+ padding-right: 0.2ex;
}
.script {
display: table-row;
@@ -221,10 +223,6 @@
.environment.align > .arrayrow > .arraycell.align-l {
padding-right: 2em;
}
-/*
-* CSS file for LaTeX formulas, extra stuff:
-* binomials, vertical braces, stackrel, fonts and colors.
-*/
/* Inline binomials */
span.binom {
@@ -267,6 +265,18 @@
}
/* Fonts */
+.formula {
+ font-family: STIX, "DejaVu Serif", "DejaVu Math TeX Gyre", serif;
+}
+span.radical, /* ensure correct size of square-root sign */
+span.integral { /* upright integral signs for better alignment of indices */
+ font-family: "STIXIntegralsUp", STIX;
+ /* font-size: 115%; match apparent size with DejaVu */
+}
+span.bracket {
+ /* some "STIX" and "DejaVu Math TeX Gyre" bracket pieces don't fit */
+ font-family: "DejaVu Serif", serif;
+}
span.mathsf, span.textsf {
font-style: normal;
font-family: sans-serif;
@@ -273,7 +283,7 @@
}
span.mathrm, span.textrm {
font-style: normal;
- font-family: serif;
+ font-family: STIX, "DejaVu Serif", "DejaVu Math TeX Gyre", serif;
}
span.mathtt, span.texttt {
font-style: normal;
Modified: trunk/docutils/test/functional/expected/math_output_html.html
===================================================================
--- trunk/docutils/test/functional/expected/math_output_html.html 2021-07-12 21:23:19 UTC (rev 8797)
+++ trunk/docutils/test/functional/expected/math_output_html.html 2021-07-12 21:23:31 UTC (rev 8798)
@@ -13,20 +13,20 @@
<h1 class="title">Mathematics</h1>
<p>Docutils supports inline math with the prefix or postfix <tt class="docutils literal">:math:</tt>
-role specificator, <span class="formula"><i>n</i>! + sin(<i>x</i><span class="scripts"><sup class="script">2</sup><sub class="script"><i>n</i></sub></span>)</span> and <span class="formula"><i>A</i><sub><span class="text">c</span></sub> = <span class="fraction"><span class="ignored">(</span><span class="numerator"><i>π</i></span><span class="ignored">)/(</span><span class="denominator">4</span><span class="ignored">)</span></span><i>d</i><sup>2</sup></span>, as well as displayed math via the
+role specificator, <span class="formula"><i>n</i>! + sin(<i>x</i><span class="scripts"><sup class="script">2</sup><sub class="script"><i>n</i></sub></span>)</span> and <span class="formula"><i>A</i><sub><span class="text">c</span></sub> = <span class="fraction"><span class="ignored">(</span><span class="numerator"><i>π</i></span><span class="ignored">)/(</span><span class="denominator">4</span><span class="ignored">)</span></span><i>d</i><sup>2</sup></span>, as well as displayed math via the
<cite>math</cite> directive:</p>
<div class="formula">
-<i>f</i>(<i>ϵ</i>) = <span class="fraction"><span class="ignored">(</span><span class="numerator">1</span><span class="ignored">)/(</span><span class="denominator">1 + exp<span class="array"><span class="arrayrow"><span class="bracket align-left">⎛</span></span><span class="arrayrow"><span class="bracket align-left">⎝</span></span></span><span class="fraction"><span class="ignored">(</span><span class="numerator"><i>ε</i></span><span class="ignored">)/(</span><span class="denominator"><i>k</i><sub><span class="text">B</span></sub><i>T</i></span><span class="ignored">)</span></span><span class="array"><span class="arrayrow"><span class="bracket align-right">⎞</span></span><span class="arrayrow"><span class="bracket align-right">⎠</span></span></span></span><span class="ignored">)</span></span>
+<i>f</i>(<i>ϵ</i>) = <span class="fraction"><span class="ignored">(</span><span class="numerator">1</span><span class="ignored">)/(</span><span class="denominator">1 + exp<span class="array"><span class="arrayrow"><span class="bracket align-left">⎛</span></span><span class="arrayrow"><span class="bracket align-left">⎝</span></span></span><span class="fraction"><span class="ignored">(</span><span class="numerator"><i>ε</i></span><span class="ignored">)/(</span><span class="denominator"><i>k</i><sub><span class="text">B</span></sub><i>T</i></span><span class="ignored">)</span></span><span class="array"><span class="arrayrow"><span class="bracket align-right">⎞</span></span><span class="arrayrow"><span class="bracket align-right">⎠</span></span></span></span><span class="ignored">)</span></span>
</div>
<p>Content may start on the first line of the directive, e.g.</p>
<div class="formula">
-<i>N</i> = <span class="fraction"><span class="ignored">(</span><span class="numerator"><span class="text">number of apples</span></span><span class="ignored">)/(</span><span class="denominator">7</span><span class="ignored">)</span></span>
+<i>N</i> = <span class="fraction"><span class="ignored">(</span><span class="numerator"><span class="text">number of apples</span></span><span class="ignored">)/(</span><span class="denominator">7</span><span class="ignored">)</span></span>
</div>
<p>Equations can be labeled with a reference name using the <tt class="docutils literal">:name:</tt> option.
See <a class="reference internal" href="#eq-m">eq:M</a> and <a class="reference internal" href="#eq-schrodinger">eq:schrödinger</a> below.</p>
<p>The determinant of the matrix</p>
<div class="formula" id="eq-m">
-<b>M</b> = <span class="array"><span class="arrayrow"><span class="bracket align-left">⎛</span></span><span class="arrayrow"><span class="bracket align-left">⎜</span></span><span class="arrayrow"><span class="bracket align-left">⎝</span></span></span><span class="array"><span class="arrayrow">
+<b>M</b> = <span class="array"><span class="arrayrow"><span class="bracket align-left">⎛</span></span><span class="arrayrow"><span class="bracket align-left">⎜</span></span><span class="arrayrow"><span class="bracket align-left">⎝</span></span></span><span class="array"><span class="arrayrow">
<span class="arraycell align-c">
<i>a</i>
</span>
@@ -55,20 +55,20 @@
</span>
</span><span class="array"><span class="arrayrow"><span class="bracket align-right">⎞</span></span><span class="arrayrow"><span class="bracket align-right">⎟</span></span><span class="arrayrow"><span class="bracket align-right">⎠</span></span></span>
</div>
-<p>is <span class="formula">|<b>M</b>| = <i>ad</i> − <i>bc</i></span>.</p>
+<p>is <span class="formula">|<b>M</b>| = <i>ad</i> − <i>bc</i></span>.</p>
<p>More than one display math block can be put in one math directive.
For example, the following sum and integral with limits:</p>
<div class="formula">
-<span class="limits"><sup class="limit">1</sup><span class="limit"><span class="bigoperator">∫</span></span><sub class="limit">0</sub></span><i>x</i><sup><i>n</i></sup><i>dx</i> = <span class="fraction"><span class="ignored">(</span><span class="numerator">1</span><span class="ignored">)/(</span><span class="denominator"><i>n</i> + 1</span><span class="ignored">)</span></span>
+<span class="limits"><sup class="limit">1</sup><span class="limit"><span class="bigoperator integral">∫</span></span><sub class="limit">0</sub></span><i>x</i><sup><i>n</i></sup><i>dx</i> = <span class="fraction"><span class="ignored">(</span><span class="numerator">1</span><span class="ignored">)/(</span><span class="denominator"><i>n</i> + 1</span><span class="ignored">)</span></span>
</div>
<div class="formula">
-<span class="limits"><sup class="limit"><i>m</i></sup><span class="limit"><span class="bigoperator">∑</span></span><sub class="limit"><i>n</i> = 1</sub></span><i>n</i> = <span class="fraction"><span class="ignored">(</span><span class="numerator"><i>m</i>(<i>m</i> + 1)</span><span class="ignored">)/(</span><span class="denominator">2</span><span class="ignored">)</span></span>
+<span class="limits"><sup class="limit"><i>m</i></sup><span class="limit"><span class="bigoperator">∑</span></span><sub class="limit"><i>n</i> = 1</sub></span><i>n</i> = <span class="fraction"><span class="ignored">(</span><span class="numerator"><i>m</i>(<i>m</i> + 1)</span><span class="ignored">)/(</span><span class="denominator">2</span><span class="ignored">)</span></span>
</div>
<p>LaTeX-supported Unicode math symbols can be used in math roles and
directives:</p>
<p>The Schrödinger equation</p>
<div class="formula" id="eq-schrodinger">
-<i>i</i><i>ℏ</i><span class="fraction"><span class="ignored">(</span><span class="numerator">∂</span><span class="ignored">)/(</span><span class="denominator">∂<i>t</i></span><span class="ignored">)</span></span>Ψ = <i>Ĥ</i>Ψ,
+<i>i</i><i>ℏ</i><span class="fraction"><span class="ignored">(</span><span class="numerator">∂</span><span class="ignored">)/(</span><span class="denominator">∂<i>t</i></span><span class="ignored">)</span></span>Ψ = <i>Ĥ</i>Ψ,
</div>
<p>with the <em>wave function</em> <span class="formula">Ψ</span>, describes how the quantum state of a
physical system changes in time.</p>
@@ -105,7 +105,7 @@
\widehat{xxx} -->
<p>Modulation Transfer Function:</p>
<div class="formula">
-<span class="text">MTF</span> = <span class="array"><span class="arrayrow"><span class="bracket align-left">|</span></span><span class="arrayrow"><span class="bracket align-left">|</span></span></span><span class="fraction"><span class="ignored">(</span><span class="numerator">ℱ{<i>s</i>(<i>x</i>)}</span><span class="ignored">)/(</span><span class="denominator">ℱ{<i>s</i>(<i>x</i>)}|<sub><i>ω</i><sub><i>x</i></sub> = 0</sub></span><span class="ignored">)</span></span><span class="array"><span class="arrayrow"><span class="bracket align-right">|</span></span><span class="arrayrow"><span class="bracket align-right">|</span></span></span> = <span class="mathrm"> abs</span><span class="array"><span class="arrayrow"><span class="bracket align-left">⎛</span></span><span class="arrayrow"><span class="bracket align-left">⎝</span></span></span><span class="fraction"><span class="ignored">(</span><span class="numerator"><span class="limits"><span class="limit"><span class="bigoperator">∫</span></span></span><span class="scripts"><sup class="script">∞</sup><sub class="script"> − ∞</sub></span><i>s</i>(<i>x</i>)<span class="mathrm">e</span><sup><span class="mathrm">i</span><i>ω</i><sub><i>x</i></sub><i>x</i></sup><span class="mathrm">d</span><i>x</i></span><span class="ignored">)/(</span><span class="denominator"><span class="limits"><span class="limit"><span class="bigoperator">∫</span></span></span><span class="scripts"><sup class="script">∞</sup><sub class="script"> − ∞</sub></span><i>s</i>(<i>x</i>)<span class="mathrm">d</span><i>x</i></span><span class="ignored">)</span></span><span class="array"><span class="arrayrow"><span class="bracket align-right">⎞</span></span><span class="arrayrow"><span class="bracket align-right">⎠</span></span></span>.
+<span class="text">MTF</span> = <span class="array"><span class="arrayrow"><span class="bracket align-left">|</span></span><span class="arrayrow"><span class="bracket align-left">|</span></span></span><span class="fraction"><span class="ignored">(</span><span class="numerator">ℱ{<i>s</i>(<i>x</i>)}</span><span class="ignored">)/(</span><span class="denominator">ℱ{<i>s</i>(<i>x</i>)}|<sub><i>ω</i><sub><i>x</i></sub> = 0</sub></span><span class="ignored">)</span></span><span class="array"><span class="arrayrow"><span class="bracket align-right">|</span></span><span class="arrayrow"><span class="bracket align-right">|</span></span></span> = <span class="mathrm"> abs</span><span class="array"><span class="arrayrow"><span class="bracket align-left">⎛</span></span><span class="arrayrow"><span class="bracket align-left">⎝</span></span></span><span class="fraction"><span class="ignored">(</span><span class="numerator"><span class="limits"><span class="limit"><span class="bigoperator integral">∫</span></span></span><span class="scripts"><sup class="script">∞</sup><sub class="script"> − ∞</sub></span><i>s</i>(<i>x</i>)<span class="mathrm">e</span><sup><span class="mathrm">i</span><i>ω</i><sub><i>x</i></sub><i>x</i></sup><span class="mathrm">d</span><i>x</i></span><span class="ignored">)/(</span><span class="denominator"><span class="limits"><span class="limit"><span class="bigoperator integral">∫</span></span></span><span class="scripts"><sup class="script">∞</sup><sub class="script"> − ∞</sub></span><i>s</i>(<i>x</i>)<span class="mathrm">d</span><i>x</i></span><span class="ignored">)</span></span><span class="array"><span class="arrayrow"><span class="bracket align-right">⎞</span></span><span class="arrayrow"><span class="bracket align-right">⎠</span></span></span>.
</div>
<p>Math split over two lines: If a double backslash is detected outside a
<tt class="docutils literal"><span class="pre">\begin{...}</span> <span class="pre">\end{...}</span></tt> pair, the math code is wrapped in an <a class="reference external" href="ftp://ftp.ams.org/ams/doc/amsmath/short-math-guide.pdf">AMSmath</a>
@@ -116,7 +116,7 @@
<i>s</i><sub><span class="mathrm">out</span></sub>(<i>x</i>)
</span>
<span class="arraycell align-l">
- = <i>s</i><sub><span class="mathrm">in</span></sub>(<i>x</i>’)*<i>s</i><sub><i>δ</i></sub>(<i>x</i> − <i>x</i>’)
+ = <i>s</i><sub><span class="mathrm">in</span></sub>(<i>x</i>’)*<i>s</i><sub><i>δ</i></sub>(<i>x</i> − <i>x</i>’)
</span>
</span>
@@ -134,7 +134,7 @@
</span>
<span class="arraycell align-l">
- = <span class="limits"><span class="limit"><span class="bigoperator">∫</span></span></span><i>s</i><sub><span class="mathrm">in</span></sub>(<i>x</i>’)<i>s</i><sub><i>δ</i></sub>(<i>x</i> − <i>x</i>’)<span class="mathrm">d</span><i>x</i>’
+ = <span class="limits"><span class="limit"><span class="bigoperator integral">∫</span></span></span><i>s</i><sub><span class="mathrm">in</span></sub>(<i>x</i>’)<i>s</i><sub><i>δ</i></sub>(<i>x</i> − <i>x</i>’)<span class="mathrm">d</span><i>x</i>’
</span>
</span>
@@ -142,13 +142,13 @@
</div>
<p>Cases with the <a class="reference external" href="ftp://ftp.ams.org/ams/doc/amsmath/short-math-guide.pdf">AMSmath</a> <tt class="docutils literal">cases</tt> environment:</p>
<div class="formula">
-<span class="mathrm">sgn</span>(<i>x</i>) = <span class="array"><span class="arrayrow"><span class="bracket align-l">⎧</span></span><span class="arrayrow"><span class="bracket align-l">⎨</span></span><span class="arrayrow"><span class="bracket align-l">⎩</span></span></span><span class="bracketcases">
+<span class="mathrm">sgn</span>(<i>x</i>) = <span class="array"><span class="arrayrow"><span class="bracket align-l">⎧</span></span><span class="arrayrow"><span class="bracket align-l">⎨</span></span><span class="arrayrow"><span class="bracket align-l">⎩</span></span></span><span class="bracketcases">
<span class="arrayrow">
<span class="case align-l">
- − 1
+ − 1
</span>
<span class="case align-l">
-<i>x</i> < 0
+<i>x</i> < 0
</span>
</span>
@@ -166,7 +166,7 @@
1
</span>
<span class="case align-l">
-<i>x</i> > 0
+<i>x</i> > 0
</span>
</span>
Modified: trunk/docutils/test/functional/expected/standalone_rst_html4css1.html
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_html4css1.html 2021-07-12 21:23:19 UTC (rev 8797)
+++ trunk/docutils/test/functional/expected/standalone_rst_html4css1.html 2021-07-12 21:23:31 UTC (rev 8798)
@@ -998,7 +998,7 @@
Inline markup is supported, e.g. <em>emphasis</em>, <strong>strong</strong>, <tt class="docutils literal">literal
text</tt>, <span class="subscript">sub-</span> and <span class="superscript">super</span>scripts,
-inline formulas: <span class="formula"><i>A</i> = 2<i>π</i><i>r</i><sup>2</sup></span>,
+inline formulas: <span class="formula"><i>A</i> = 2<i>π</i><i>r</i><sup>2</sup></span>,
footnotes <a class="footnote-reference" href="#footnote-1" id="footnote-reference-9">[1]</a>, <span class="target" id="hyperlink-targets">hyperlink targets</span>, and <a class="reference external" href="http://www.python.org/">references</a>.
</pre>
</div>
@@ -1025,7 +1025,7 @@
or as base for special code roles, e.g. the LaTeX code in the next
paragraph.</p>
<p>Docutils uses LaTeX syntax for math directives and roles:
-<code class="tex">\alpha = f(x)</code> prints <span class="formula"><i>α</i> = <i>f</i>(<i>x</i>)</span>.</p>
+<code class="tex">\alpha = f(x)</code> prints <span class="formula"><i>α</i> = <i>f</i>(<i>x</i>)</span>.</p>
<p>The <tt class="docutils literal">:code:</tt> option of the <ci...
[truncated message content] |
|
From: <mi...@us...> - 2021-07-12 21:23:50
|
Revision: 8799
http://sourceforge.net/p/docutils/code/8799
Author: milde
Date: 2021-07-12 21:23:47 +0000 (Mon, 12 Jul 2021)
Log Message:
-----------
Math: fix some LaTeX character mappings.
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/RELEASE-NOTES.txt
trunk/docutils/docs/ref/rst/mathematics.txt
trunk/docutils/docutils/utils/math/latex2mathml.py
trunk/docutils/docutils/utils/math/math2html.py
trunk/docutils/docutils/utils/math/tex2unichar.py
trunk/docutils/docutils/writers/html5_polyglot/math.css
trunk/docutils/test/functional/expected/math_output_html.html
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2021-07-12 21:23:31 UTC (rev 8798)
+++ trunk/docutils/HISTORY.txt 2021-07-12 21:23:47 UTC (rev 8799)
@@ -40,13 +40,21 @@
- `Meta` directive class (moved from html.py) inserts `meta`
(instead of `pending`) nodes.
-* docutils/tools/math/math2html;
+* docutils/tools/math/math2html.py,
+ docutils/tools/math/tex2unicode.py,
+ docutils/writers/html5/math.css
- - Fix bug #244 Wrong subscript/superscript order with
- ``--math-output=HTML``.
+ - Fork from elyxer and remove code that is not requried
+ for math conversion.
+ - Scale variable sized operators and big delimiters with CSS
+ - Support more commands, fix mapping fo commands to Unicode characters
+ (cf. `LaTeX syntax for mathematics`_).
+ - Fix bug #244 Wrong subscript/superscript order.
- Don't use <tt> element (deprecated in HTML5).
- - Support commands ``\Bbbk`` and ``operatorname``.
+ - Use STIX fonts if available.
+ .. _LaTeX syntax for mathematics: docs/ref/rst/mathematics.html
+
* docutils/utils/__init__.py
- Removed ``unique_combinations`` (obsoleted by ``itertools.combinations``).
@@ -62,7 +70,7 @@
they are present also without CSS and when copying text.
Adapt ``minimal.css``.
- - Use semantic tags <aside> for footnote text, topics, admonitions,
+ - Use semantic tags <aside> for footnote text, topics, admonitions,
and system-messages and <nav> for the table of contents. Use <div>
for citations.
@@ -72,12 +80,12 @@
- Use "aria-level" attribute instead of invalid tags <h7>, <h8>, ...
for headings of deeply nested sections.
-
+
- Do not set classes "compound-first", "compound-middle", or
"compound-last" to elements nested in a compound.
Use class value "backrefs" instead of "fn-backref" for a span of
back-references.
-
+
- Move space character between section number and heading into
"sectnum" span.
Modified: trunk/docutils/RELEASE-NOTES.txt
===================================================================
--- trunk/docutils/RELEASE-NOTES.txt 2021-07-12 21:23:31 UTC (rev 8798)
+++ trunk/docutils/RELEASE-NOTES.txt 2021-07-12 21:23:47 UTC (rev 8799)
@@ -40,6 +40,11 @@
we store the null-escaped text in Text nodes since 0.16 so there is no
additional information in the rawsource.
+* Move math format conversion from docutils/utils/math (called from
+ docutils/writers/_html_base.py) to a transform__.
+
+ __ docs/ref/transforms.html
+
* The default HTML writer "html" with frontend ``rst2html.py`` may change
from "html4css1" to "html5".
@@ -93,10 +98,16 @@
Items of a definition list with class argument "details" are
converted to `details disclosure elements`_.
-
+
Move space character between section number and heading into
"sectnum" span.
+ math-output: html
+ Support more commands, fix mapping fo commands to Unicode characters.
+ Scale variable sized operators and big delimiters with CSS.
+ Don't use <tt> element (deprecated in HTML5).
+ Use STIX fonts if available.
+
LaTeX:
`legacy_class_functions`_ setting default changed to "False":
admonitions are now environments.
@@ -115,6 +126,12 @@
* Removed attribute: ``HTMLTranslator.topic_classes``
(check node.parent.classes instead).
+* docutils/utils/math/math2html.py,
+ docutils/utils/math/latex2mathml.py
+
+ Major refactoring and fixes/additions
+ (cf. `LaTeX syntax for mathematics`_).
+
* Various bugfixes and improvements (see HISTORY_).
__ docs/ref/doctree.html#meta
@@ -124,6 +141,7 @@
.. _auto_id_prefix: docs/user/config.html#auto-id-prefix
.. _details disclosure elements:
https://www.w3.org/TR/html52/interactive-elements.html#the-details-element
+.. _LaTeX syntax for mathematics: docs/ref/rst/mathematics.html
Release 0.17.1 (2021-04-16)
Modified: trunk/docutils/docs/ref/rst/mathematics.txt
===================================================================
--- trunk/docutils/docs/ref/rst/mathematics.txt 2021-07-12 21:23:31 UTC (rev 8798)
+++ trunk/docutils/docs/ref/rst/mathematics.txt 2021-07-12 21:23:47 UTC (rev 8799)
@@ -83,7 +83,9 @@
.. [#math-syntax] The supported LaTeX commands include AMS extensions
- (see, e.g., the `Short Math Guide`_).
+ (see, e.g., the `Short Math Guide`_). Some of the shown symbols
+ require the "amssymb" `LaTeX package`_ (or another package providing
+ the AMS symbol macros) when exported with the "latex" writer.
The support is limited to a subset of *LaTeX math* by the conversion
required for many output formats. For HTML, the `math_output`_
@@ -98,6 +100,8 @@
http://mirrors.ctan.org/info/short-math-guide/short-math-guide.pdf
.. _math_output:
https://docutils.sourceforge.io/docs/user/config.html#math-output
+.. _LaTeX package:
+ ../../user/latex.html#latex-document-classes-and-packages
Mathematical symbols
@@ -215,8 +219,8 @@
.. TODO: fix spacing before unary minus (see also cases example below).
-Vertical Arrows
-~~~~~~~~~~~~~~~
+Extensible vertical arrows
+--------------------------
.. class:: colwidths-auto
=============================== ======================================
@@ -225,6 +229,7 @@
`\updownarrow` ``\updownarrow`` `\Updownarrow` ``\Updownarrow``
=============================== ======================================
+
Functions (named operators)
---------------------------
.. class:: colwidths-auto
@@ -269,14 +274,14 @@
========== ============ ========== ============ ========== ============ ============== ===============
`\Gamma` ``\Gamma`` `\alpha` ``\alpha`` `\mu` ``\mu`` `\omega` ``\omega``
`\Delta` ``\Delta`` `\beta` ``\beta`` `\nu` ``\nu`` `\digamma` ``\digamma``
- `\Lambda` ``\Lambda`` `\gamma` ``\gamma`` `\xi` ``\xi`` `\backepsilon` ``\backepsilon``
- `\Phi` ``\Phi`` `\delta` ``\delta`` `\pi` ``\pi`` `\varepsilon` ``\varepsilon``
- `\Pi` ``\Pi`` `\epsilon` ``\epsilon`` `\rho` ``\rho`` `\varkappa` ``\varkappa``
- `\Psi` ``\Psi`` `\zeta` ``\zeta`` `\sigma` ``\sigma`` `\varphi` ``\varphi``
- `\Sigma` ``\Sigma`` `\eta` ``\eta`` `\tau` ``\tau`` `\varpi` ``\varpi``
- `\Theta` ``\Theta`` `\theta` ``\theta`` `\upsilon` ``\upsilon`` `\varrho` ``\varrho``
- `\Upsilon` ``\Upsilon`` `\iota` ``\iota`` `\phi` ``\phi`` `\varsigma` ``\varsigma``
- `\Xi` ``\Xi`` `\kappa` ``\kappa`` `\chi` ``\chi`` `\vartheta` ``\vartheta``
+ `\Lambda` ``\Lambda`` `\gamma` ``\gamma`` `\xi` ``\xi`` `\varepsilon` ``\varepsilon``
+ `\Phi` ``\Phi`` `\delta` ``\delta`` `\pi` ``\pi`` `\varkappa` ``\varkappa``
+ `\Pi` ``\Pi`` `\epsilon` ``\epsilon`` `\rho` ``\rho`` `\varphi` ``\varphi``
+ `\Psi` ``\Psi`` `\zeta` ``\zeta`` `\sigma` ``\sigma`` `\varpi` ``\varpi``
+ `\Sigma` ``\Sigma`` `\eta` ``\eta`` `\tau` ``\tau`` `\varrho` ``\varrho``
+ `\Theta` ``\Theta`` `\theta` ``\theta`` `\upsilon` ``\upsilon`` `\varsigma` ``\varsigma``
+ `\Upsilon` ``\Upsilon`` `\iota` ``\iota`` `\phi` ``\phi`` `\vartheta` ``\vartheta``
+ `\Xi` ``\Xi`` `\kappa` ``\kappa`` `\chi` ``\chi``
`\Omega` ``\Omega`` `\lambda` ``\lambda`` `\psi` ``\psi``
========== ============ ========== ============ ========== ============ ============== ===============
@@ -447,13 +452,8 @@
`\upuparrows` ``\upuparrows`` `\downdownarrows` ``\downdownarrows``
====================== ======================== ===================== =======================
-
-
-
-
Synonyms: `\gets` ``\gets``, `\to` ``\to``, `\restriction` ``\restriction``.
-
Comparison
~~~~~~~~~~
@@ -626,19 +626,19 @@
.. class:: colwidths-auto
====================== ======== ===================== ==================
- :m:`3\qquad |` ``3\qquad |`` = 2em
- :m:`3\quad |` ``3\quad |`` = 1em
- :m:`3~|` ``3~|`` ``3\nobreakspace |``
- :m:`3\ |` ``3\ |`` escaped space
- :m:`3\;|` ``3\;|`` ``3\thickspace |``
- :m:`3\:|` ``3\:|`` ``3\medspace |``
- :m:`3\,|` ``3\,|`` ``3\thinspace |``
- :m:`3 |` ``3 |`` regular space [#]_
- :m:`3\!|` ``3\!|`` ``3\negthinspace |``
- :m:`3\negmedspace |` ``3\negmedspace |``
- :m:`3\negthickspace |` ``3\negthickspace |``
- `3\hspace{1ex}|` ``3\hspace{1ex}|`` custom length
- `3\mspace{20mu}|` ``3\mspace{20mu}|`` custom length [#]_
+ :m:`3\qquad 4` ``3\qquad 4`` = 2em
+ :m:`3\quad 4` ``3\quad 4`` = 1em
+ :m:`3~4` ``3~4`` ``3\nobreakspace 4``
+ :m:`3\ 4` ``3\ 4`` escaped space
+ :m:`3\;4` ``3\;4`` ``3\thickspace 4``
+ :m:`3\:4` ``3\:4`` ``3\medspace 4``
+ :m:`3\,4` ``3\,4`` ``3\thinspace 4``
+ :m:`3 4` ``3 4`` regular space [#]_
+ :m:`3\!4` ``3\!4`` ``3\negthinspace 4``
+ :m:`3\negmedspace 4` ``3\negmedspace 4``
+ :m:`3\negthickspace 4` ``3\negthickspace 4``
+ `3\hspace{1ex}4` ``3\hspace{1ex}4`` custom length
+ `3\mspace{20mu}4` ``3\mspace{20mu}4`` custom length [#]_
====================== ======== ===================== ==================
.. [#] Whitespace characters are ignored in LaTeX math mode.
@@ -962,36 +962,34 @@
\left.\{b\right \} \ \bigl\{b\Bigr \} \ \biggl\{b\Biggr \}
\quad
\left.\langle b\right\rangle\ \bigl\langle b\Bigr\rangle\ \biggl\langle b\Biggr\rangle
+
+ \left.\lceil b\right\rceil\ \bigl\lceil b\Bigr\rceil\ \biggl\lceil b\Biggr\rceil
\quad
- \left.\lceil b\right\rceil\ \bigl\lceil b\Bigr\rceil\ \biggl\lceil b\Biggr\rceil
-
\left.\lfloor b\right\rfloor\ \bigl\lfloor b\Bigr\rfloor\ \biggl\lfloor b\Biggr\rfloor
\quad
+ \left.\lvert b\right\rvert\ \bigl\lvert b\Bigr\rvert\ \biggl\lvert b\Biggr\rvert
+ \quad
+ \left.\lVert b\right\rVert\ \bigl\lVert b\Bigr\rVert\ \biggl\lVert b\Biggr\rVert
+
\left.\lgroup b\right\rgroup\ \bigl\lgroup b\Bigr\rgroup\ \biggl\lgroup b\Biggr\rgroup
\quad
\left.\lmoustache b\right\rmoustache\ \bigl\lmoustache b\Bigr\rmoustache\ \biggl\lmoustache b\Biggr\rmoustache
\quad
- \left.\lvert b\right\rvert\ \bigl\lvert b\Bigr\rvert\ \biggl\lvert b\Biggr\rvert
- \quad
- \left.\lVert b\right\rVert\ \bigl\lVert b\Bigr\rVert\ \biggl\lVert b\Biggr\rVert
+ \left./b\right\backslash\ \bigl/b\Bigr\backslash\ \biggl/b\Biggr\backslash
\left.|b\right\|\ \bigl|b\Bigr\|\ \biggl|b\Biggr\|
\quad
- \left./b\right\backslash\ \bigl/b\Bigr\backslash\ \biggl/b\Biggr\backslash
+ \left.\vert b\right\Vert\ \bigl\vert b\Bigr\Vert\ \biggl\vert b\Biggr\Vert
\quad
- \left.(b\right)\ \bigl(b\Bigr)\ \biggl(b\Biggr)
+ \left.\arrowvert b\right\Arrowvert\ \bigl\arrowvert b\Bigr\Arrowvert\ \biggl\arrowvert b\Biggr\Arrowvert
\quad
- \left.\arrowvert b\right\Arrowvert\ \bigl\arrowvert b\Bigr\Arrowvert\ \biggl\arrowvert b\Biggr\Arrowvert
-
\left.\bracevert b\right\bracevert\ \bigl\bracevert b\Bigr\bracevert\ \biggl\bracevert b\Biggr\bracevert
\quad
- \left.\vert \frac{b}{a}\right\Vert\ \bigl\vert b\Bigr\Vert\ \biggl\vert b\Biggr\Vert
- \quad
Variable-sized operators:
-Inline: `\sum\ \int\ \iint\ \iiint\ \iiiint\ \idotsint\ \oint\ \smallint\
+Inline: `\sum\ \int\ \iint\ \iiint\ \iiiint\ \idotsint \oint\ \smallint\
\prod\ \coprod\ \bigwedge\ \bigvee\ \bigcap\ \bigcup\ \biguplus\
\bigsqcup\ \bigodot\ \bigoplus\ \bigotimes` and Display:
@@ -999,16 +997,16 @@
\sum\ \prod\ \coprod\ \bigwedge\ \bigvee\ \bigcap\ \bigcup\
\biguplus\ \bigsqcup\ \bigodot\ \bigoplus\ \bigotimes
-.. math:: \int_1 f\ \intop_1 f\ \iint_1 f\ \smallint_1 f\ \sum_1 \
- \prod_1 \ \bigwedge_1 \ \bigcap_1 \ \biguplus_1 \ \bigodot_1 \ \int^N
- \ \intop^N \ \iiiint^N \ \oint^N \ \smallint^N \ \sum^N \ \coprod^N \
- \bigvee^N \ \bigcup^N \ \bigsqcup^N \ \bigotimes^N \
+.. math:: \int_1 f\ \intop_1 f\ \iint_1 f\ \smallint_1 f\ \sum_1\
+ \prod_1\ \bigwedge_1\ \bigcap_1\ \biguplus_1\ \bigodot_1\ \int^N\
+ \intop^N\ \iiiint^N\ \oint^N\ \smallint^N\ \sum^N\ \coprod^N\
+ \bigvee^N\ \bigcup^N\ \bigsqcup^N\ \bigotimes^N
-.. math:: \int_1^N \ \intop_1^N \ \iint_1^N \ \iiint_1^N \ \iiiint_1^N \
- \idotsint_1^N \ \oint_1^N \ \smallint_1^N \ \sum_1^N \ \prod_1^N \
- \coprod_1^N \ \bigwedge_1^N \ \bigvee_1^N \ \bigcap_1^N \ \bigcup_1^N
- \ \biguplus_1^N \ \bigsqcup_1^N \ \bigodot_1^N \ \bigoplus_1^N \
- \bigotimes_1^N \
+.. math:: \int_1^N\ \intop_1^N\ \iint_1^N\ \iiint_1^N\ \iiiint_1^N\
+ \idotsint_1^N\ \oint_1^N\ \smallint_1^N\ \sum_1^N\ \prod_1^N\
+ \coprod_1^N\ \bigwedge_1^N\ \bigvee_1^N\ \bigcap_1^N\ \bigcup_1^N
+ \ \biguplus_1^N\ \bigsqcup_1^N\ \bigodot_1^N\ \bigoplus_1^N\
+ \bigotimes_1^N
Modified: trunk/docutils/docutils/utils/math/latex2mathml.py
===================================================================
--- trunk/docutils/docutils/utils/math/latex2mathml.py 2021-07-12 21:23:31 UTC (rev 8798)
+++ trunk/docutils/docutils/utils/math/latex2mathml.py 2021-07-12 21:23:47 UTC (rev 8799)
@@ -42,6 +42,8 @@
# identifiers -> <mi>
letters = tex2unichar.mathalpha
+letters['hbar'] = u'\u210F' # compatiblity mapping to ℏ (\hslash).
+# (ħ LATIN SMALL LETTER H WITH STROKE is upright)
# special case: Capital Greek letters: (upright in TeX style)
greek_capitals = {
@@ -131,6 +133,12 @@
'nlessgtr': u'\u2276\u0338', # txfonts
'nsubseteqq': u'\u2AC5\u0338', # ⫅̸
'nsupseteqq': u'\u2AC6\u0338', # ⫆̸
+ # compatibility definitions:
+ 'centerdot': u'\u2B1D', # BLACK VERY SMALL SQUARE | mathbin
+ 'varnothing': u'\u2300', # ⌀ DIAMETER SIGN | empty set
+ 'varpropto': u'\u221d', # ∝ PROPORTIONAL TO | sans serif
+ 'triangle': u'\u25B3', # WHITE UP-POINTING TRIANGLE | mathord
+ 'triangledown': u'\u25BD', # WHITE DOWN-POINTING TRIANGLE | mathord
# alias commands:
'dotsb': u'\u22ef', # ⋯ with binary operators/relations
'dotsc': u'\u2026', # … with commas
@@ -147,6 +155,7 @@
operators.update(tex2unichar.mathbin) # Binary symbols
operators.update(tex2unichar.mathrel) # Relation symbols, arrow symbols
operators.update(tex2unichar.mathord) # Miscellaneous symbols
+operators.update(tex2unichar.mathpunct) # Punctuation
operators.update(tex2unichar.mathop) # Variable-sized symbols
operators.update(stretchables)
@@ -177,9 +186,9 @@
# Depending on settings, integrals may also be in this category.
# (e.g. if "amsmath" is loaded with option "intlimits", see
# http://mirror.ctan.org/macros/latex/required/amsmath/amsldoc.pdf)
-# displaylimits.extend(('fint', 'iiiint', 'iiint', 'iint', 'int', 'oiint',
-# 'oint', 'ointctrclockwise', 'sqint',
-# 'varointclockwise',))
+# displaylimits.extend(('fint', 'idotsint', 'iiiint', 'iiint', 'iint',
+# 'int', 'oiint', 'oint', 'ointctrclockwise',
+# 'sqint', 'varointclockwise',))
# horizontal space -> <mspace>
@@ -912,6 +921,10 @@
if name == 'colon': # trailing punctuation, not binary relation
node = node.append(mo(':', form='postfix', lspace='0', rspace='0.28em'))
return node, string
+
+ if name == 'idotsint':
+ node = parse_latex_math(node, '\int\dotsi\int')
+ return node, string
if name in thick_operators:
node = node.append(mo(thick_operators[name], style='font-weight: bold'))
@@ -1107,8 +1120,6 @@
if name == 'end':
return end_environment(node, string)
-
-
raise SyntaxError(u'Unknown LaTeX command: ' + name)
# >>> handle_cmd('left', math(), '[a\\right]')
Modified: trunk/docutils/docutils/utils/math/math2html.py
===================================================================
--- trunk/docutils/docutils/utils/math/math2html.py 2021-07-12 21:23:31 UTC (rev 8798)
+++ trunk/docutils/docutils/utils/math/math2html.py 2021-07-12 21:23:47 UTC (rev 8799)
@@ -206,6 +206,7 @@
'\\\\': u'<br/>',
'\\\n': u' ', # escaped whitespace
'\\\t': u' ', # escaped whitespace
+ '\\centerdot': u'\u2B1D', # BLACK VERY SMALL SQUARE, mathbin
'\\colon': u': ',
'\\copyright': u'©',
'\\dotminus': u'∸',
@@ -218,6 +219,7 @@
'\\euro': u'€',
'\\guillemotleft': u'«',
'\\guillemotright': u'»',
+ '\\hbar': u'<i>\u0127</i>', # ħ LATIN SMALL LETTER H WITH STROKE
'\\lVert': u'‖',
'\\Arrowvert': u'\u2016', # ‖
'\\lvert': u'|',
@@ -228,12 +230,6 @@
'\\qquad': u' ',
'\\rVert': u'‖',
'\\rvert': u'|',
- '\\shortmid': u'<span class="smallsymbol">∣</span>',
- '\\shortparallel': u'<span class="smallsymbol">∥</span>',
- '\\nshortmid': u'<span class="smallsymbol">∤</span>',
- '\\nshortparallel': u'<span class="smallsymbol">∦</span>',
- '\\smallfrown': u'<span class="smallsymbol">⌢</span>',
- '\\smallsmile': u'<span class="smallsymbol">⌣</span>',
'\\textasciicircum': u'^',
'\\textasciitilde': u'~',
'\\textbackslash': u'\\',
@@ -256,8 +252,11 @@
'\\texttrademark': u'™',
'\\texttwosuperior': u'²',
'\\textvisiblespace': u' ',
- '\\thickapprox': u'<b>≈</b>',
- '\\thicksim': u'<b>∼</b>',
+ '\\thickspace': u'<span class="thickspace"> </span>', # 5/13 em
+ '\\;': u'<span class="thickspace"> </span>', # 5/13 em
+ '\\triangle': u'\u25B3', # WHITE UP-POINTING TRIANGLE, mathord
+ '\\triangledown': u'\u25BD', # WHITE DOWN-POINTING TRIANGLE, mathord
+ '\\varnothing': u'\u2300', # ⌀ DIAMETER SIGN
# functions
'\\Pr': u'Pr',
'\\arccos': u'arccos',
@@ -290,11 +289,12 @@
'\\tanh': u'tanh',
}
cmddict = {}
- cmddict.update(tex2unichar.mathbin)
+ cmddict.update(tex2unichar.mathbin) # TODO: spacing around binary operators
cmddict.update(tex2unichar.mathopen)
cmddict.update(tex2unichar.mathclose)
cmddict.update(tex2unichar.mathfence)
cmddict.update(tex2unichar.mathord)
+ cmddict.update(tex2unichar.mathpunct)
cmddict.update(tex2unichar.space)
commands.update(('\\' + key, value) for key, value in cmddict.items())
@@ -341,7 +341,6 @@
u'smallmatrix': [u'c', u'c',],
}
-
fontfunctions = {
u'\\boldsymbol': u'b', u'\\mathbb': u'span class="blackboard"',
u'\\mathbb{A}': u'𝔸', u'\\mathbb{B}': u'𝔹', u'\\mathbb{C}': u'ℂ',
@@ -351,19 +350,22 @@
u'\\mathbb{O}': u'𝕆', u'\\mathbb{P}': u'ℙ', u'\\mathbb{Q}': u'ℚ',
u'\\mathbb{R}': u'ℝ', u'\\mathbb{S}': u'𝕊', u'\\mathbb{T}': u'𝕋',
u'\\mathbb{W}': u'𝕎', u'\\mathbb{Z}': u'ℤ', u'\\mathbf': u'b',
- u'\\mathcal': u'span class="scriptfont"', u'\\mathcal{B}': u'ℬ',
- u'\\mathcal{E}': u'ℰ', u'\\mathcal{F}': u'ℱ', u'\\mathcal{H}': u'ℋ',
- u'\\mathcal{I}': u'ℐ', u'\\mathcal{L}': u'ℒ', u'\\mathcal{M}': u'ℳ',
- u'\\mathcal{R}': u'ℛ', u'\\mathfrak': u'span class="fraktur"',
+ u'\\mathcal': u'span class="scriptfont"',
+ u'\\mathcal{B}': u'ℬ', u'\\mathcal{E}': u'ℰ', u'\\mathcal{F}':
+ u'ℱ', u'\\mathcal{H}': u'ℋ', u'\\mathcal{I}': u'ℐ',
+ u'\\mathcal{L}': u'ℒ', u'\\mathcal{M}': u'ℳ', u'\\mathcal{R}': u'ℛ',
+ u'\\mathfrak': u'span class="fraktur"',
u'\\mathfrak{C}': u'ℭ', u'\\mathfrak{F}': u'𝔉', u'\\mathfrak{H}': u'ℌ',
u'\\mathfrak{I}': u'ℑ', u'\\mathfrak{R}': u'ℜ', u'\\mathfrak{Z}': u'ℨ',
- u'\\mathit': u'i', u'\\mathring{A}': u'Å', u'\\mathring{U}': u'Ů',
+ u'\\mathit': u'i',
+ u'\\mathring{A}': u'Å', u'\\mathring{U}': u'Ů',
u'\\mathring{a}': u'å', u'\\mathring{u}': u'ů', u'\\mathring{w}': u'ẘ',
- u'\\mathring{y}': u'ẙ', u'\\mathrm': u'span class="mathrm"',
- u'\\mathscr': u'span class="scriptfont"',
- u'\\mathscr{B}': u'ℬ', u'\\mathscr{E}': u'ℰ', u'\\mathscr{F}':
- u'ℱ', u'\\mathscr{H}': u'ℋ', u'\\mathscr{I}': u'ℐ',
- u'\\mathscr{L}': u'ℒ', u'\\mathscr{M}': u'ℳ', u'\\mathscr{R}': u'ℛ',
+ u'\\mathring{y}': u'ẙ',
+ u'\\mathrm': u'span class="mathrm"',
+ u'\\mathscr': u'span class="mathscr"',
+ u'\\mathscr{B}': u'ℬ', u'\\mathscr{E}': u'ℰ', u'\\mathscr{F}': u'ℱ',
+ u'\\mathscr{H}': u'ℋ', u'\\mathscr{I}': u'ℐ', u'\\mathscr{L}': u'ℒ',
+ u'\\mathscr{M}': u'ℳ', u'\\mathscr{R}': u'ℛ',
u'\\mathsf': u'span class="mathsf"',
u'\\mathtt': u'span class="mathtt"',
u'\\operatorname': u'span class="mathrm"',
@@ -510,13 +512,20 @@
'\\ngeqslant': u'\u2a7e\u0338', # ⩾̸
'\\nsubseteqq': u'\u2AC5\u0338', # ⫅̸
'\\nsupseteqq': u'\u2AC6\u0338', # ⫆̸
- '\\ngtrless': u'\u2277\u0338', # ≹
- '\\nlessgtr': u'\u2276\u0338', # ≸
'\\nsqsubset': u'\u2276\u228F', # ⊏̸
+ # modified glyphs
+ '\\shortmid': u'<span class="smallsymbol">∣</span>',
+ '\\shortparallel': u'<span class="smallsymbol">∥</span>',
+ '\\nshortmid': u'<span class="smallsymbol">∤</span>',
+ '\\nshortparallel': u'<span class="smallsymbol">∦</span>',
+ '\\smallfrown': u'<span class="smallsymbol">⌢</span>',
+ '\\smallsmile': u'<span class="smallsymbol">⌣</span>',
+ '\\thickapprox': u'<span class="boldsymbol">≈</span>',
+ '\\thicksim': u'<span class="boldsymbol">∼</span>',
+ '\\varpropto': u'<span class="mathsf">\u221d</span>', # ∝ PROPORTIONAL TO
}
for key, value in tex2unichar.mathrel.items():
spacedcommands['\\'+key] = value
-
starts = {
u'beginafter': u'}', u'beginbefore': u'\\begin{', u'bracket': u'{',
u'command': u'\\', u'comment': u'%', u'complex': u'\\[', u'simple': u'$',
@@ -530,14 +539,14 @@
textfunctions = {
u'\\mbox': u'span class="mbox"',
u'\\text': u'span class="text"',
- u'\\textbf': u'b',
- u'\\textit': u'i',
+ u'\\textbf': u'span class="textbf"',
+ u'\\textit': u'span class="textit"',
u'\\textnormal': u'span class="textnormal"',
u'\\textrm': u'span class="textrm"',
u'\\textsc': u'span class="textsc"',
u'\\textsf': u'span class="textsf"',
- u'\\textsl': u'i',
- u'\\texttt': u'tt',
+ u'\\textsl': u'span class="textsl"',
+ u'\\texttt': u'span class="texttt"',
u'\\textup': u'span class="normal"',
}
Modified: trunk/docutils/docutils/utils/math/tex2unichar.py
===================================================================
--- trunk/docutils/docutils/utils/math/tex2unichar.py 2021-07-12 21:23:31 UTC (rev 8798)
+++ trunk/docutils/docutils/utils/math/tex2unichar.py 2021-07-12 21:23:47 UTC (rev 8799)
@@ -19,10 +19,8 @@
'hat': u'\u0302', # ̂ COMBINING CIRCUMFLEX ACCENT
'mathring': u'\u030a', # ̊ COMBINING RING ABOVE
'not': u'\u0338', # ̸ COMBINING LONG SOLIDUS OVERLAY
- 'overleftarrow': u'\u20d6', # ⃖ COMBINING LEFT ARROW ABOVE
'overleftrightarrow': u'\u20e1', # ⃡ COMBINING LEFT RIGHT ARROW ABOVE
'overline': u'\u0305', # ̅ COMBINING OVERLINE
- 'overrightarrow': u'\u20d7', # ⃗ COMBINING RIGHT ARROW ABOVE
'tilde': u'\u0303', # ̃ COMBINING TILDE
'underbar': u'\u0331', # ̱ COMBINING MACRON BELOW
'underleftarrow': u'\u20ee', # ⃮ COMBINING LEFT ARROW BELOW
@@ -59,7 +57,6 @@
'eth': u'\xf0', # ð LATIN SMALL LETTER ETH
'gamma': u'\u03b3', # γ GREEK SMALL LETTER GAMMA
'gimel': u'\u2137', # ℷ GIMEL SYMBOL
- 'hbar': u'\u210f', # ℏ PLANCK CONSTANT OVER TWO PI
'hslash': u'\u210f', # ℏ PLANCK CONSTANT OVER TWO PI
'imath': u'\u0131', # ı LATIN SMALL LETTER DOTLESS I
'iota': u'\u03b9', # ι GREEK SMALL LETTER IOTA
@@ -113,9 +110,6 @@
'bigtriangleup': u'\u25b3', # △ WHITE UP-POINTING TRIANGLE
'bindnasrepma': u'\u214b', # ⅋ TURNED AMPERSAND
'blacklozenge': u'\u29eb', # ⧫ BLACK LOZENGE
- 'blacktriangleleft': u'\u25c0', # ◀ BLACK LEFT-POINTING TRIANGLE
- 'blacktriangleright': u'\u25b6', # ▶ BLACK RIGHT-POINTING TRIANGLE
- 'blacktriangleup': u'\u25b4', # ▴ BLACK UP-POINTING SMALL TRIANGLE
'boxast': u'\u29c6', # ⧆ SQUARED ASTERISK
'boxbar': u'\u25eb', # ◫ WHITE SQUARE WITH VERTICAL BISECTING LINE
'boxbox': u'\u29c8', # ⧈ SQUARED SQUARE
@@ -144,14 +138,15 @@
'diamond': u'\u22c4', # ⋄ DIAMOND OPERATOR
'div': u'\xf7', # ÷ DIVISION SIGN
'divideontimes': u'\u22c7', # ⋇ DIVISION TIMES
- 'dotdiv': u'\u2238', # ∸ DOT MINUS
'dotplus': u'\u2214', # ∔ DOT PLUS
'doublebarwedge': u'\u2a5e', # ⩞ LOGICAL AND WITH DOUBLE OVERBAR
+ 'gtrdot': u'\u22d7', # ⋗ GREATER-THAN WITH DOT
'intercal': u'\u22ba', # ⊺ INTERCALATE
'interleave': u'\u2af4', # ⫴ TRIPLE VERTICAL BAR BINARY RELATION
'invamp': u'\u214b', # ⅋ TURNED AMPERSAND
'land': u'\u2227', # ∧ LOGICAL AND
'leftthreetimes': u'\u22cb', # ⋋ LEFT SEMIDIRECT PRODUCT
+ 'lessdot': u'\u22d6', # ⋖ LESS-THAN WITH DOT
'lor': u'\u2228', # ∨ LOGICAL OR
'ltimes': u'\u22c9', # ⋉ LEFT NORMAL FACTOR SEMIDIRECT PRODUCT
'mp': u'\u2213', # ∓ MINUS-OR-PLUS SIGN
@@ -169,7 +164,6 @@
'smalltriangledown': u'\u25bf', # ▿ WHITE DOWN-POINTING SMALL TRIANGLE
'smalltriangleleft': u'\u25c3', # ◃ WHITE LEFT-POINTING SMALL TRIANGLE
'smalltriangleright': u'\u25b9', # ▹ WHITE RIGHT-POINTING SMALL TRIANGLE
- 'smalltriangleup': u'\u25b5', # ▵ WHITE UP-POINTING SMALL TRIANGLE
'sqcap': u'\u2293', # ⊓ SQUARE CAP
'sqcup': u'\u2294', # ⊔ SQUARE CUP
'sslash': u'\u2afd', # ⫽ DOUBLE SOLIDUS OPERATOR
@@ -176,13 +170,9 @@
'star': u'\u22c6', # ⋆ STAR OPERATOR
'talloblong': u'\u2afe', # ⫾ WHITE VERTICAL BAR
'times': u'\xd7', # × MULTIPLICATION SIGN
- 'triangle': u'\u25b3', # △ WHITE UP-POINTING TRIANGLE
- 'triangledown': u'\u25bd', # ▽ WHITE DOWN-POINTING TRIANGLE
- 'triangleleft': u'\u25c1', # ◁ WHITE LEFT-POINTING TRIANGLE
- 'triangleright': u'\u25b7', # ▷ WHITE RIGHT-POINTING TRIANGLE
+ 'triangleleft': u'\u25c3', # ◃ WHITE LEFT-POINTING SMALL TRIANGLE
+ 'triangleright': u'\u25b9', # ▹ WHITE RIGHT-POINTING SMALL TRIANGLE
'uplus': u'\u228e', # ⊎ MULTISET UNION
- 'varparallel': u'\u2afd', # ⫽ DOUBLE SOLIDUS OPERATOR
- 'vartriangle': u'\u25b3', # △ WHITE UP-POINTING TRIANGLE
'vee': u'\u2228', # ∨ LOGICAL OR
'veebar': u'\u22bb', # ⊻ XOR
'wedge': u'\u2227', # ∧ LOGICAL AND
@@ -305,18 +295,14 @@
'aquarius': u'\u2652', # ♒ AQUARIUS
'aries': u'\u2648', # ♈ ARIES
'arrowvert': u'\u23d0', # ⏐ VERTICAL LINE EXTENSION
- 'ast': u'*', # * ASTERISK
- 'backepsilon': u'\u03f6', # ϶ GREEK REVERSED LUNATE EPSILON SYMBOL
'backprime': u'\u2035', # ‵ REVERSED PRIME
'backslash': u'\\', # \ REVERSE SOLIDUS
- 'because': u'\u2235', # ∵ BECAUSE
'bigstar': u'\u2605', # ★ BLACK STAR
- 'binampersand': u'&', # & AMPERSAND
- 'blacklozenge': u'\u2b27', # ⬧ BLACK MEDIUM LOZENGE
'blacksmiley': u'\u263b', # ☻ BLACK SMILING FACE
'blacksquare': u'\u25fc', # ◼ BLACK MEDIUM SQUARE
- 'blacktriangle': u'\u25b2', # ▲ BLACK UP-POINTING TRIANGLE
- 'blacktriangledown': u'\u25bc', # ▼ BLACK DOWN-POINTING TRIANGLE
+ 'blacktriangle': u'\u25b4', # ▴ BLACK UP-POINTING SMALL TRIANGLE
+ 'blacktriangledown': u'\u25be', # ▾ BLACK DOWN-POINTING SMALL TRIANGLE
+ 'blacktriangleup': u'\u25b4', # ▴ BLACK UP-POINTING SMALL TRIANGLE
'bot': u'\u22a5', # ⊥ UP TACK
'boy': u'\u2642', # ♂ MALE SIGN
'bracevert': u'\u23aa', # ⎪ CURLY BRACKET EXTENSION
@@ -324,13 +310,9 @@
'capricornus': u'\u2651', # ♑ CAPRICORN
'cdots': u'\u22ef', # ⋯ MIDLINE HORIZONTAL ELLIPSIS
'cent': u'\xa2', # ¢ CENT SIGN
- 'centerdot': u'\u2b1d', # ⬝ BLACK VERY SMALL SQUARE
'checkmark': u'\u2713', # ✓ CHECK MARK
- 'circlearrowleft': u'\u21ba', # ↺ ANTICLOCKWISE OPEN CIRCLE ARROW
- 'circlearrowright': u'\u21bb', # ↻ CLOCKWISE OPEN CIRCLE ARROW
'circledR': u'\u24c7', # Ⓡ CIRCLED LATIN CAPITAL LETTER R
'circledS': u'\u24c8', # Ⓢ CIRCLED LATIN CAPITAL LETTER S
- 'circledcirc': u'\u25ce', # ◎ BULLSEYE
'clubsuit': u'\u2663', # ♣ BLACK CLUB SUIT
'complement': u'\u2201', # ∁ COMPLEMENT
'diagdown': u'\u27cd', # ⟍ MATHEMATICAL FALLING DIAGONAL
@@ -354,7 +336,6 @@
'jupiter': u'\u2643', # ♃ JUPITER
'ldots': u'\u2026', # … HORIZONTAL ELLIPSIS
'leftmoon': u'\u263e', # ☾ LAST QUARTER MOON
- 'leftturn': u'\u21ba', # ↺ ANTICLOCKWISE OPEN CIRCLE ARROW
'leo': u'\u264c', # ♌ LEO
'libra': u'\u264e', # ♎ LIBRA
'lmoustache': u'\u23b0', # ⎰ UPPER LEFT OR LOWER RIGHT CURLY BRACKET SECTION
@@ -383,7 +364,6 @@
'prime': u'\u2032', # ′ PRIME
'quarternote': u'\u2669', # ♩ QUARTER NOTE
'rightmoon': u'\u263d', # ☽ FIRST QUARTER MOON
- 'rightturn': u'\u21bb', # ↻ CLOCKWISE OPEN CIRCLE ARROW
'rmoustache': u'\u23b1', # ⎱ UPPER RIGHT OR LOWER LEFT CURLY BRACKET SECTION
'sagittarius': u'\u2650', # ♐ SAGITTARIUS
'saturn': u'\u2644', # ♄ SATURN
@@ -390,7 +370,6 @@
'scorpio': u'\u264f', # ♏ SCORPIUS
'second': u'\u2033', ...
[truncated message content] |
|
From: <mi...@us...> - 2021-07-12 21:24:01
|
Revision: 8800
http://sourceforge.net/p/docutils/code/8800
Author: milde
Date: 2021-07-12 21:23:58 +0000 (Mon, 12 Jul 2021)
Log Message:
-----------
math.css: tweak bigoperator size.
Modified Paths:
--------------
trunk/docutils/docs/ref/rst/mathematics.txt
trunk/docutils/docutils/writers/html5_polyglot/math.css
Modified: trunk/docutils/docs/ref/rst/mathematics.txt
===================================================================
--- trunk/docutils/docs/ref/rst/mathematics.txt 2021-07-12 21:23:47 UTC (rev 8799)
+++ trunk/docutils/docs/ref/rst/mathematics.txt 2021-07-12 21:23:58 UTC (rev 8800)
@@ -401,12 +401,12 @@
.. class:: colwidths-auto
=== ===== ======== =============== ======== ==========
-`.` ``.`` `!` ``!`` `?` ``?``
-`/` ``/`` `\colon` ``\colon`` [#]_ `\dotsb` ``\dotsb``
-`|` ``|`` `\cdots` ``\cdots`` `\dotsc` ``\dotsc``
-`'` ``'`` `\ddots` ``\ddots`` `\dotsi` ``\dotsi``
-`;` ``;`` `\ldots` ``\ldots`` `\dotsm` ``\dotsm``
-`:` ``:`` `\vdots` ``\vdots`` `\dotso` ``\dotso``
+`.` ``.`` `!` ``!`` `\vdots` ``\vdots``
+`/` ``/`` `?` ``?`` `\dotsb` ``\dotsb``
+`|` ``|`` `\colon` ``\colon`` [#]_ `\dotsc` ``\dotsc``
+`'` ``'`` `\cdots` ``\cdots`` `\dotsi` ``\dotsi``
+`;` ``;`` `\ddots` ``\ddots`` `\dotsm` ``\dotsm``
+`:` ``:`` `\ldots` ``\ldots`` `\dotso` ``\dotso``
=== ===== ======== =============== ======== ==========
.. [#] Punctuation (not ratio):
@@ -989,8 +989,8 @@
Variable-sized operators:
-Inline: `\sum\ \int\ \iint\ \iiint\ \iiiint\ \idotsint \oint\ \smallint\
-\prod\ \coprod\ \bigwedge\ \bigvee\ \bigcap\ \bigcup\ \biguplus\
+Inline: `\int\ \iint\ \iiint\ \iiiint\ \idotsint \oint\ \smallint\
+\sum\ \prod\ \coprod\ \bigwedge\ \bigvee\ \bigcap\ \bigcup\ \biguplus\
\bigsqcup\ \bigodot\ \bigoplus\ \bigotimes` and Display:
.. math:: \int\ \iint\ \iiint\ \iiiint\ \idotsint\ \oint\ \smallint\
Modified: trunk/docutils/docutils/writers/html5_polyglot/math.css
===================================================================
--- trunk/docutils/docutils/writers/html5_polyglot/math.css 2021-07-12 21:23:47 UTC (rev 8799)
+++ trunk/docutils/docutils/writers/html5_polyglot/math.css 2021-07-12 21:23:58 UTC (rev 8800)
@@ -82,16 +82,17 @@
}
span.formula .fraction,
.textfraction,
-.fraction .fraction,
span.smallmatrix {
font-size: 80%;
- line-height: 100%;
+ line-height: 1;
}
span.numerator {
display: block;
+ line-height: 1;
}
span.denominator {
display: block;
+ line-height: 1;
padding: 0ex;
border-top: thin solid;
}
@@ -138,8 +139,8 @@
div.formula .bigoperator,
.displaystyle .bigoperator,
.displaystyle .bigoperator {
- line-height: 130%;
- font-size: 150%;
+ line-height: 120%;
+ font-size: 140%;
padding-right: 0.2ex;
}
span.fraction .bigoperator,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2021-07-12 21:24:11
|
Revision: 8801
http://sourceforge.net/p/docutils/code/8801
Author: milde
Date: 2021-07-12 21:24:09 +0000 (Mon, 12 Jul 2021)
Log Message:
-----------
Small documentation fixes and additions.
Modified Paths:
--------------
trunk/docutils/COPYING.txt
trunk/docutils/FAQ.txt
trunk/docutils/HISTORY.txt
trunk/docutils/docs/dev/todo.txt
trunk/docutils/docs/index.txt
trunk/docutils/docs/ref/doctree.txt
trunk/docutils/docutils/transforms/references.py
Modified: trunk/docutils/COPYING.txt
===================================================================
--- trunk/docutils/COPYING.txt 2021-07-12 21:23:58 UTC (rev 8800)
+++ trunk/docutils/COPYING.txt 2021-07-12 21:24:09 UTC (rev 8801)
@@ -87,7 +87,7 @@
test/transforms/test_smartquotes.py
tools/docutils-cli.py
tools/rst2html5.py
-
+
Copyright © Günter Milde.
Released under the terms of the `2-Clause BSD license`_
(`local copy <licenses/BSD-2-Clause.txt>`__).
@@ -129,7 +129,7 @@
* tools/editors/emacs/rst.el
- copyright by Free Software Foundation, Inc.,
+ copyright by Free Software Foundation, Inc.,
released under the `GNU General Public License`_ version 3 or later
(`local copy`__).
Modified: trunk/docutils/FAQ.txt
===================================================================
--- trunk/docutils/FAQ.txt 2021-07-12 21:23:58 UTC (rev 8800)
+++ trunk/docutils/FAQ.txt 2021-07-12 21:24:09 UTC (rev 8801)
@@ -983,16 +983,16 @@
.. note:: For the html5 writer, `initial_header_level`_ defaults to
``2`` because this is what the `HTML5 standard`__ expects as
start value for headings nested in <section> elements.
-
+
.. Sectioning content elements are always considered subsections of
their nearest ancestor *sectioning root* [#]_ or their nearest
ancestor element of *sectioning content* [#]_, whichever is nearest,
[...]
-
+
.. [#] <blockquote>, <body>, <details>, <dialog>, <fieldset>,
<figure>, <td>
- .. [#] <article>, <aside>, <nav>, <section>
-
+ .. [#] <article>, <aside>, <nav>, <section>
+
I.e., a top-level <section> is a subsection of <body>.
__ https://www.w3.org/TR/html53/sections.html#headings-and-sections
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2021-07-12 21:23:58 UTC (rev 8800)
+++ trunk/docutils/HISTORY.txt 2021-07-12 21:24:09 UTC (rev 8801)
@@ -229,12 +229,15 @@
__ 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>,
- <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
+ <i>, <b>, <u>, <mark>, and <bdi> if a unique matching class value
+ is found in `inline`__ and `literal`__ elements.
+ Use <ins> and <del> if a unique matching class value
is found in `inline`, `literal`, or `container` elements.
Use <small> for generated code line numbers.
+ __ docs/ref/doctree.html#inline
+ __ docs/ref/doctree.html#literal
+
- Fix bug #398: properly close link tag to "schema.dcterms".
- Add a `viewport meta tag`__ to fix rendering in mobile browsers.
Modified: trunk/docutils/docs/dev/todo.txt
===================================================================
--- trunk/docutils/docs/dev/todo.txt 2021-07-12 21:23:58 UTC (rev 8800)
+++ trunk/docutils/docs/dev/todo.txt 2021-07-12 21:24:09 UTC (rev 8801)
@@ -579,10 +579,10 @@
.. figure:: image.png
:name: figure name
- Improve the mapping of "phrase references" to IDs/labels with
- Literal transcription (i.e. ü -> ue, ß -> ss, å -> aa) instead of just
- stripping the accents and other non-ASCII chars.
- Use http://pypi.python.org/pypi/Unidecode?
+ Improve the mapping of "phrase references" to IDs/labels with Literal
+ transcription (i.e. ü -> ue, ß -> ss, å -> aa) instead of just
+ stripping the accents and other non-ASCII chars. See also the feature
+ request `allow more characters when transforming "names" to "ids"`__.
A "table" directive has been implemented, supporting table titles.
@@ -589,6 +589,7 @@
Perhaps the name could derive from the title/caption?
.. _reference names: ../ref/rst/restructuredtext.html#reference-names
+ __ https://sourceforge.net/p/docutils/feature-requests/66/
* We need syntax for object references. Cf. `OpenOffice.org XML`_
"reference fields":
Modified: trunk/docutils/docs/index.txt
===================================================================
--- trunk/docutils/docs/index.txt 2021-07-12 21:23:58 UTC (rev 8800)
+++ trunk/docutils/docs/index.txt 2021-07-12 21:24:09 UTC (rev 8801)
@@ -138,7 +138,7 @@
* `reStructuredText Interpreted Text Roles <ref/rst/roles.html>`__
* `reStructuredText Standard Definition Files
<ref/rst/definitions.html>`_
-* `LaTeX syntax for mathematics <ref/rst/mathematics.html>`__
+* `LaTeX syntax for mathematics <ref/rst/mathematics.html>`__
(syntax used in "math" directive and role)
Prehistoric:
Modified: trunk/docutils/docs/ref/doctree.txt
===================================================================
--- trunk/docutils/docs/ref/doctree.txt 2021-07-12 21:23:58 UTC (rev 8800)
+++ trunk/docutils/docs/ref/doctree.txt 2021-07-12 21:24:09 UTC (rev 8801)
@@ -2449,8 +2449,8 @@
``footnote_reference``
======================
-The ``footnote_reference`` element represents a cross reference to a
-footnote_ in running text (a footnote mark).
+The ``footnote_reference`` element is an inline element representing a
+cross reference to a footnote_ (a footnote mark).
Details
@@ -2751,9 +2751,71 @@
``inline``
==========
-`To be completed`_.
+The ``inline`` element is a generic inline container.
+Details
+-------
+:Category:
+ `Inline Elements`_
+
+:Parents:
+ All elements employing the `%inline.elements;`_ parameter entities in
+ their content models may contain ``inline``.
+
+:Children:
+ ``inline`` elements may contain text data plus `inline elements`_.
+
+:Analogues:
+ ``inline`` is analogous to the HTML "span" element.
+
+:Processing:
+ Writers typically pass the classes_ attribute to the output document
+ and leave styling to the backend or a custom stylesheet_. They may
+ also process the classes_ attribute and convert the ``inline``
+ element to a specific element or render the content distinctly
+ for specific class values. Moreover, writers may ignore the classes
+ attribute and render the content as ordinary text.
+
+
+Content Model
+-------------
+
+.. parsed-literal::
+
+ `%text.model;`_
+
+:Attributes:
+ The ``inline`` element contains the `common attributes`_
+ (ids_, names_, dupnames_, source_, and classes_).
+
+
+Examples
+--------
+
+`Custom interpreted text roles`_ create ``inline`` elements (unless they
+are based on a `standard role`_).
+
+reStructuredText source fragment::
+
+ .. role:: custom
+
+ An example of using :custom:`interpreted text`
+
+Pseudo-XML_ fragment from simple parsing::
+
+
+ <paragraph>
+ An example of using
+ <inline classes="custom">
+ interpreted text
+
+.. _stylesheet: ../user/config.html#stylesheet
+.. _custom interpreted text roles:
+ rst/directives.html#custom-interpreted-text-roles
+.. _standard role: rst/roles.html
+
+
``label``
=========
Modified: trunk/docutils/docutils/transforms/references.py
===================================================================
--- trunk/docutils/docutils/transforms/references.py 2021-07-12 21:23:58 UTC (rev 8800)
+++ trunk/docutils/docutils/transforms/references.py 2021-07-12 21:24:09 UTC (rev 8801)
@@ -1,3 +1,4 @@
+# .. coding: utf-8
# $Id$
# Author: David Goodger <go...@py...>
# Copyright: This module has been placed in the public domain.
@@ -475,17 +476,17 @@
# Entries 1-4 and 6 below are from section 12.51 of
# The Chicago Manual of Style, 14th edition.
'*', # asterisk/star
- u'\u2020', # dagger †
- u'\u2021', # double dagger ‡
- u'\u00A7', # section mark §
- u'\u00B6', # paragraph mark (pilcrow) ¶
+ u'\u2020', # † † dagger
+ u'\u2021', # ‡ ‡ double dagger
+ u'\u00A7', # § § section mark
+ u'\u00B6', # ¶ ¶ paragraph mark (pilcrow)
# (parallels ['||'] in CMoS)
'#', # number sign
# The entries below were chosen arbitrarily.
- u'\u2660', # spade suit ♠
- u'\u2665', # heart suit ♥
- u'\u2666', # diamond suit ♦
- u'\u2663', # club suit ♣
+ u'\u2660', # ♠ ♠ spade suit
+ u'\u2665', # ♡ ♥ heart suit
+ u'\u2666', # ♢ ♦ diamond suit
+ u'\u2663', # ♣ ♣ club suit
]
def apply(self):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2021-07-13 21:52:25
|
Revision: 8802
http://sourceforge.net/p/docutils/code/8802
Author: milde
Date: 2021-07-13 21:52:22 +0000 (Tue, 13 Jul 2021)
Log Message:
-----------
Fix bug #421 Typo in r8766
Also add a test case.
Modified Paths:
--------------
trunk/docutils/docutils/nodes.py
trunk/docutils/test/test_nodes.py
Modified: trunk/docutils/docutils/nodes.py
===================================================================
--- trunk/docutils/docutils/nodes.py 2021-07-12 21:24:09 UTC (rev 8801)
+++ trunk/docutils/docutils/nodes.py 2021-07-13 21:52:22 UTC (rev 8802)
@@ -1972,7 +1972,7 @@
1995.
"""
- optional = (meta)
+ optional = ('meta',)
"""
Tuple containing node class names (as strings).
Modified: trunk/docutils/test/test_nodes.py
===================================================================
--- trunk/docutils/test/test_nodes.py 2021-07-12 21:24:09 UTC (rev 8801)
+++ trunk/docutils/test/test_nodes.py 2021-07-13 21:52:22 UTC (rev 8802)
@@ -733,7 +733,22 @@
['P:test-1'],
['P:2019-10-30']])
+class NodeVisitorTests(unittest.TestCase):
+ def setUp(self):
+ self.document = utils.new_document('test')
+ self.element = nodes.Element()
+ self.visitor = nodes.NodeVisitor(self.document)
+ def test_dispatch_visit_unknown(self):
+ # raise exception if no visit/depart methods are defined for node class
+ self.assertRaises(NotImplementedError,
+ self.visitor.dispatch_visit, self.element)
+
+ def test_dispatch_visit_optional(self):
+ # silently skip nodes of a calss in tuple nodes.NodeVisitor.optional
+ rv = self.visitor.dispatch_visit(nodes.meta())
+ self.assertIsNone(rv)
+
class MiscFunctionTests(unittest.TestCase):
names = [('a', 'a'), ('A', 'a'), ('A a A', 'a a a'),
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2021-07-19 13:43:06
|
Revision: 8804
http://sourceforge.net/p/docutils/code/8804
Author: milde
Date: 2021-07-19 13:43:02 +0000 (Mon, 19 Jul 2021)
Log Message:
-----------
Update SVG image samples and tests.
Modified Paths:
--------------
trunk/docutils/docs/user/rst/images/biohazard-scaling.svg
trunk/docutils/docs/user/rst/images/biohazard.svg
trunk/docutils/docs/user/rst/images/title-scaling.svg
trunk/docutils/docs/user/rst/images/title.svg
trunk/docutils/test/functional/expected/standalone_rst_html4css1.html
trunk/docutils/test/functional/input/data/svg_images.txt
Modified: trunk/docutils/docs/user/rst/images/biohazard-scaling.svg
===================================================================
--- trunk/docutils/docs/user/rst/images/biohazard-scaling.svg 2021-07-19 13:42:25 UTC (rev 8803)
+++ trunk/docutils/docs/user/rst/images/biohazard-scaling.svg 2021-07-19 13:43:02 UTC (rev 8804)
@@ -1,95 +1,5 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-
-<svg
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:cc="http://creativecommons.org/ns#"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- sodipodi:docname="biohazard-scaling.svg"
- inkscape:version="0.47 r22583"
- sodipodi:version="0.32"
- id="svg24159"
- viewBox="0 0 48 48"
- width="100%"
- height="100%"
- version="1.0">
- <title
- id="title2837">Biohazard</title>
- <metadata
- id="metadata7">
- <rdf:RDF>
- <cc:Work
- rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type
- rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- <dc:title>Biohazard</dc:title>
- <cc:license
- rdf:resource="http://creativecommons.org/licenses/publicdomain/" />
- <dc:description>Standalone biohazard symbol, with no border, background or descriptive text.</dc:description>
- <dc:creator>
- <cc:Agent>
- <dc:title>Silsor</dc:title>
- </cc:Agent>
- </dc:creator>
- <dc:identifier></dc:identifier>
- <dc:source></dc:source>
- <dc:relation>http://de.wikipedia.org/wiki/Datei:Biohazard_symbol.svg</dc:relation>
- <dc:publisher>
- <cc:Agent>
- <dc:title>Wikipedia</dc:title>
- </cc:Agent>
- </dc:publisher>
- <dc:contributor>
- <cc:Agent>
- <dc:title>Bastique, Andux, MarianSigler, GM</dc:title>
- </cc:Agent>
- </dc:contributor>
- </cc:Work>
- <cc:License
- rdf:about="http://creativecommons.org/licenses/publicdomain/">
- <cc:permits
- rdf:resource="http://creativecommons.org/ns#Reproduction" />
- <cc:permits
- rdf:resource="http://creativecommons.org/ns#Distribution" />
- <cc:permits
- rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
- </cc:License>
- </rdf:RDF>
- </metadata>
- <defs
- id="defs5">
- <inkscape:perspective
- sodipodi:type="inkscape:persp3d"
- inkscape:vp_x="0 : 178.13126 : 1"
- inkscape:vp_y="0 : 1000 : 0"
- inkscape:vp_z="376.4375 : 178.13126 : 1"
- inkscape:persp3d-origin="188.21875 : 118.75417 : 1"
- id="perspective2835" />
- </defs>
- <sodipodi:namedview
- inkscape:current-layer="svg24159"
- inkscape:window-y="33"
- inkscape:window-x="0"
- inkscape:cy="22.455418"
- inkscape:cx="22.152639"
- inkscape:zoom="8.9316693"
- inkscape:window-height="771"
- inkscape:window-width="993"
- inkscape:pageshadow="2"
- inkscape:pageopacity="0.0"
- borderopacity="1.0"
- bordercolor="#666666"
- pagecolor="#ffffff"
- id="base"
- showgrid="false"
- inkscape:window-maximized="0" />
- <path
- id="path7214"
- style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;display:inline"
- d="m 23.585163,1.377771 c -7.3e-5,1.1e-4 6.2e-5,0.0039 0,0.0039 0.0013,-3.54e-4 0.0026,-0.0032 0.0039,-0.0039 -4.78e-4,0 -0.0034,-2.3e-5 -0.0039,0 z m -0.293287,0.01173 c -0.0027,3.39e-4 -0.0051,0.0032 -0.0078,0.0039 0.01047,-6.47e-4 0.0208,-0.0032 0.0313,-0.0039 -0.0026,3.1e-5 -0.0053,-1.18e-4 -0.0078,0 -0.0057,2.6e-4 -0.01016,-6.94e-4 -0.01564,0 z m 1.4234,0.0078 c 0.02085,0.0016 0.04176,0.0023 0.06257,0.0039 -0.02047,-0.0016 -0.04204,-0.0032 -0.06257,-0.0039 z m 0.06257,0.0039 c 5.265987,0.418547 9.412454,4.8332343 9.412454,10.206258 0,5.470767 -4.303553,9.932781 -9.705743,10.210182 l 0,2.096004 c 1.474852,0.23317 2.604371,1.513993 2.604371,3.054059 0,0.376932 -0.06786,0.737393 -0.191614,1.071465 l 1.916125,1.106653 c 2.96118,-4.473042 8.935485,-5.932586 13.643543,-3.214395 4.696858,2.711739 6.431117,8.594706 4.062951,13.389373 3.25012,-6.325927 0.990037,-14.166586 -5.236079,-17.761246 -1.557783,-0.899383 -3.21756,-1.447302 -4.895883,-1.673666 0.642426,-1.566299 0.997159,-3.281384 0.997159,-5.079678 0,-7.1369497 -5.576639,-12.979536 -12.607284,-13.405009 z m -1.716682,0.0078 c -6.995507,0.462047 -12.536897,6.2854693 -12.536897,13.397187 0,1.7471 0.33392,3.416827 0.942418,4.946709 C 9.8382992,19.991498 8.2240722,20.533989 6.7115792,21.40722 0.52714555,24.977806 -1.7383295,32.735989 1.4168439,39.039434 -0.86121285,34.26773 0.88578585,28.463663 5.5423552,25.775186 10.280179,23.039814 16.295416,24.535893 19.236731,29.07561 l 1.849653,-1.06755 c -0.116245,-0.324958 -0.175968,-0.675422 -0.175968,-1.040177 0,-1.474684 1.033904,-2.7081 2.416653,-3.014963 l 0,-2.138998 c -5.354361,-0.327959 -9.604053,-4.769878 -9.604053,-10.206284 0,-5.3484377 4.106511,-9.745581 9.338141,-10.198436 z m 0.5983,12.857539 c -2.702513,0.06215 -5.1939,0.982199 -7.238239,2.479239 0.163319,0.241678 0.3388,0.475581 0.523995,0.699968 0.185211,0.224379 0.381018,0.43966 0.586572,0.64522 0.205552,0.205552 0.420838,0.401368 0.645233,0.586565 0.164974,0.136169 0.34173,0.258763 0.516174,0.383226 1.509041,-0.990801 3.316157,-1.571993 5.263466,-1.571993 1.947286,-8e-6 3.750506,0.581192 5.259545,1.571993 0.174446,-0.124463 0.351193,-0.247057 0.516176,-0.383226 0.22439,-0.185197 0.439673,-0.381013 0.645219,-0.586565 0.205567,-0.20556 0.401375,-0.420841 0.586578,-0.64522 0.185195,-0.224387 0.360669,-0.45829 0.523998,-0.699968 -2.118228,-1.551143 -4.716051,-2.479239 -7.531516,-2.479239 -0.06599,0 -0.133689,-7.88e-4 -0.199445,0 -0.0321,5.04e-4 -0.06572,-7.33e-4 -0.09775,0 z m -12.31791,11.277867 c -0.284223,2.610003 0.211199,5.323971 1.618924,7.76224 1.407734,2.438252 3.510158,4.228056 5.912592,5.286916 0.127648,-0.262284 0.242394,-0.532967 0.344121,-0.805556 0.101731,-0.272573 0.190676,-0.548209 0.265902,-0.828999 0.07525,-0.280797 0.139504,-0.565564 0.187704,-0.852481 0.03545,-0.210964 0.05374,-0.42411 0.07431,-0.637415 -1.612588,-0.811463 -3.018925,-2.087157 -3.992574,-3.773578 -0.973652,-1.686412 -1.374436,-3.539399 -1.270899,-5.341664 -0.194995,-0.08884 -0.390062,-0.179391 -0.590482,-0.254187 -0.272577,-0.10171 -0.548216,-0.190664 -0.829012,-0.265909 -0.280794,-0.07523 -0.565552,-0.135585 -0.852473,-0.183786 -0.286919,-0.04821 -0.577155,-0.08499 -0.868119,-0.105582 z m 25.316234,0.152498 c -0.290976,0.02064 -0.581196,0.05743 -0.868118,0.105592 -0.286924,0.04821 -0.571694,0.108551 -0.852489,0.183796 -0.28078,0.07523 -0.560331,0.164188 -0.832917,0.265916 -0.200416,0.07475 -0.391568,0.169238 -0.586562,0.258079 0.103529,1.802257 -0.297254,3.655268 -1.270904,5.341672 -0.973644,1.686405 -2.379987,2.958198 -3.992556,3.769663 0.02056,0.213296 0.03885,0.42645 0.07429,0.637406 0.0482,0.286925 0.108544,0.571684 0.183787,0.85249 0.07524,0.280789 0.164195,0.560349 0.265917,0.832913 0.10171,0.272598 0.21648,0.539357 0.344115,0.80165 2.402441,-1.05887 4.504863,-2.844756 5.91259,-5.283018 1.407749,-2.438268 1.907058,-5.156151 1.622843,-7.766155 z m -14.984836,3.300424 -1.861376,1.079286 c 2.393175,4.80097 0.67248,10.702448 -4.035564,13.420654 -4.684876,2.704807 -10.6285418,1.281437 -13.6044538,-3.140087 3.861645,5.950286 11.7584698,7.900842 17.9724108,4.31321 1.505271,-0.869071 2.775062,-1.989431 3.793133,-3.273026 1.038062,1.349323 2.351864,2.521178 3.918266,3.425539 6.220932,3.591652 14.127263,1.63317 17.98415,-4.332768 -2.970401,4.440658 -8.922715,5.877231 -13.616174,3.167461 -4.737818,-2.735388 -6.449511,-8.693465 -3.988659,-13.51059 L 26.29902,29.028617 c -0.565692,0.629844 -1.386768,1.028448 -2.299348,1.028448 -0.927577,0 -1.760299,-0.411791 -2.32672,-1.059736 z" />
+<?xml version="1.0" encoding="UTF-8"?>
+<svg version="1.0" viewBox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
+ <title>Biohazard</title>
+ <path d="m23.585 1.3778c-7.3e-5 1.1e-4 6.2e-5 0.0039 0 0.0039 0.0013-3.54e-4 0.0026-0.0032 0.0039-0.0039-4.78e-4 0-0.0034-2.3e-5 -0.0039 0zm-0.29329 0.01173c-0.0027 3.39e-4 -0.0051 0.0032-0.0078 0.0039 0.01047-6.47e-4 0.0208-0.0032 0.0313-0.0039-0.0026 3.1e-5 -0.0053-1.18e-4 -0.0078 0-0.0057 2.6e-4 -0.01016-6.94e-4 -0.01564 0zm1.4234 0.0078c0.02085 0.0016 0.04176 0.0023 0.06257 0.0039-0.02047-0.0016-0.04204-0.0032-0.06257-0.0039zm0.06257 0.0039c5.266 0.41855 9.4125 4.8332 9.4125 10.206 0 5.4708-4.3036 9.9328-9.7057 10.21v2.096c1.4749 0.23317 2.6044 1.514 2.6044 3.0541 0 0.37693-0.06786 0.73739-0.19161 1.0715l1.9161 1.1067c2.9612-4.473 8.9355-5.9326 13.644-3.2144 4.6969 2.7117 6.4311 8.5947 4.063 13.389 3.2501-6.3259 0.99004-14.167-5.2361-17.761-1.5578-0.89938-3.2176-1.4473-4.8959-1.6737 0.64243-1.5663 0.99716-3.2814 0.99716-5.0797 0-7.1369-5.5766-12.98-12.607-13.405zm-1.7167 0.0078c-6.9955 0.46205-12.537 6.2855-12.537 13.397 0 1.7471 0.33392 3.4168 0.94242 4.9467-1.6284 0.2386-3.2426 0.78109-4.7551 1.6543-6.1844 3.5706-8.4499 11.329-5.2947 17.632-2.2781-4.7717-0.53106-10.576 4.1255-13.264 4.7378-2.7354 10.753-1.2393 13.694 3.3004l1.8497-1.0676c-0.11624-0.32496-0.17597-0.67542-0.17597-1.0402 0-1.4747 1.0339-2.7081 2.4167-3.015v-2.139c-5.3544-0.32796-9.6041-4.7699-9.6041-10.206 0-5.3484 4.1065-9.7456 9.3381-10.198zm0.5983 12.858c-2.7025 0.06215-5.1939 0.9822-7.2382 2.4792 0.16332 0.24168 0.3388 0.47558 0.524 0.69997 0.18521 0.22438 0.38102 0.43966 0.58657 0.64522 0.20555 0.20555 0.42084 0.40137 0.64523 0.58656 0.16497 0.13617 0.34173 0.25876 0.51617 0.38323 1.509-0.9908 3.3162-1.572 5.2635-1.572 1.9473-8e-6 3.7505 0.58119 5.2595 1.572 0.17445-0.12446 0.35119-0.24706 0.51618-0.38323 0.22439-0.1852 0.43967-0.38101 0.64522-0.58656 0.20557-0.20556 0.40138-0.42084 0.58658-0.64522 0.1852-0.22439 0.36067-0.45829 0.524-0.69997-2.1182-1.5511-4.7161-2.4792-7.5315-2.4792-0.06599 0-0.13369-7.88e-4 -0.19944 0-0.0321 5.04e-4 -0.06572-7.33e-4 -0.09775 0zm-12.318 11.278c-0.28422 2.61 0.2112 5.324 1.6189 7.7622 1.4077 2.4383 3.5102 4.2281 5.9126 5.2869 0.12765-0.26228 0.24239-0.53297 0.34412-0.80556 0.10173-0.27257 0.19068-0.54821 0.2659-0.829 0.07525-0.2808 0.1395-0.56556 0.1877-0.85248 0.03545-0.21096 0.05374-0.42411 0.07431-0.63742-1.6126-0.81146-3.0189-2.0872-3.9926-3.7736-0.97365-1.6864-1.3744-3.5394-1.2709-5.3417-0.195-0.08884-0.39006-0.17939-0.59048-0.25419-0.27258-0.10171-0.54822-0.19066-0.82901-0.26591-0.28079-0.07523-0.56555-0.13558-0.85247-0.18379-0.28692-0.04821-0.57716-0.08499-0.86812-0.10558zm25.316 0.1525c-0.29098 0.02064-0.5812 0.05743-0.86812 0.10559-0.28692 0.04821-0.57169 0.10855-0.85249 0.1838-0.28078 0.07523-0.56033 0.16419-0.83292 0.26592-0.20042 0.07475-0.39157 0.16924-0.58656 0.25808 0.10353 1.8023-0.29725 3.6553-1.2709 5.3417-0.97364 1.6864-2.38 2.9582-3.9926 3.7697 0.02056 0.2133 0.03885 0.42645 0.07429 0.63741 0.0482 0.28692 0.10854 0.57168 0.18379 0.85249 0.07524 0.28079 0.1642 0.56035 0.26592 0.83291 0.10171 0.2726 0.21648 0.53936 0.34412 0.80165 2.4024-1.0589 4.5049-2.8448 5.9126-5.283 1.4077-2.4383 1.9071-5.1562 1.6228-7.7662zm-14.985 3.3004-1.8614 1.0793c2.3932 4.801 0.67248 10.702-4.0356 13.421-4.6849 2.7048-10.629 1.2814-13.604-3.1401 3.8616 5.9503 11.758 7.9008 17.972 4.3132 1.5053-0.86907 2.7751-1.9894 3.7931-3.273 1.0381 1.3493 2.3519 2.5212 3.9183 3.4255 6.2209 3.5917 14.127 1.6332 17.984-4.3328-2.9704 4.4407-8.9227 5.8772-13.616 3.1675-4.7378-2.7354-6.4495-8.6935-3.9887-13.511l-1.9357-1.1184c-0.56569 0.62984-1.3868 1.0284-2.2993 1.0284-0.92758 0-1.7603-0.41179-2.3267-1.0597z"/>
</svg>
Modified: trunk/docutils/docs/user/rst/images/biohazard.svg
===================================================================
--- trunk/docutils/docs/user/rst/images/biohazard.svg 2021-07-19 13:42:25 UTC (rev 8803)
+++ trunk/docutils/docs/user/rst/images/biohazard.svg 2021-07-19 13:43:02 UTC (rev 8804)
@@ -1,62 +1,5 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<svg
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:cc="http://creativecommons.org/ns#"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- version="1.0"
- width="48"
- height="48"
- id="svg24159">
- <title
- id="title2837">Biohazard</title>
- <metadata
- id="metadata7">
- <rdf:RDF>
- <cc:Work
- rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type
- rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- <dc:title>Biohazard</dc:title>
- <cc:license
- rdf:resource="http://creativecommons.org/licenses/publicdomain/" />
- <dc:description>Standalone biohazard symbol, with no border, background or descriptive text.</dc:description>
- <dc:creator>
- <cc:Agent>
- <dc:title>Silsor</dc:title>
- </cc:Agent>
- </dc:creator>
- <dc:identifier />
- <dc:source />
- <dc:relation>http://de.wikipedia.org/wiki/Datei:Biohazard_symbol.svg</dc:relation>
- <dc:publisher>
- <cc:Agent>
- <dc:title>Wikipedia</dc:title>
- </cc:Agent>
- </dc:publisher>
- <dc:contributor>
- <cc:Agent>
- <dc:title>Bastique, Andux, MarianSigler, GM</dc:title>
- </cc:Agent>
- </dc:contributor>
- </cc:Work>
- <cc:License
- rdf:about="http://creativecommons.org/licenses/publicdomain/">
- <cc:permits
- rdf:resource="http://creativecommons.org/ns#Reproduction" />
- <cc:permits
- rdf:resource="http://creativecommons.org/ns#Distribution" />
- <cc:permits
- rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
- </cc:License>
- </rdf:RDF>
- </metadata>
- <defs
- id="defs5" />
- <path
- d="m 23.585163,1.377771 c -7.3e-5,1.1e-4 6.2e-5,0.0039 0,0.0039 0.0013,-3.54e-4 0.0026,-0.0032 0.0039,-0.0039 -4.78e-4,0 -0.0034,-2.3e-5 -0.0039,0 z m -0.293287,0.01173 c -0.0027,3.39e-4 -0.0051,0.0032 -0.0078,0.0039 0.01047,-6.47e-4 0.0208,-0.0032 0.0313,-0.0039 -0.0026,3.1e-5 -0.0053,-1.18e-4 -0.0078,0 -0.0057,2.6e-4 -0.01016,-6.94e-4 -0.01564,0 z m 1.4234,0.0078 c 0.02085,0.0016 0.04176,0.0023 0.06257,0.0039 -0.02047,-0.0016 -0.04204,-0.0032 -0.06257,-0.0039 z m 0.06257,0.0039 c 5.265987,0.418547 9.412454,4.8332343 9.412454,10.206258 0,5.470767 -4.303553,9.932781 -9.705743,10.210182 l 0,2.096004 c 1.474852,0.23317 2.604371,1.513993 2.604371,3.054059 0,0.376932 -0.06786,0.737393 -0.191614,1.071465 l 1.916125,1.106653 c 2.96118,-4.473042 8.935485,-5.932586 13.643543,-3.214395 4.696858,2.711739 6.431117,8.594706 4.062951,13.389373 3.25012,-6.325927 0.990037,-14.166586 -5.236079,-17.761246 -1.557783,-0.899383 -3.21756,-1.447302 -4.895883,-1.673666 0.642426,-1.566299 0.997159,-3.281384 0.997159,-5.079678 0,-7.1369497 -5.576639,-12.979536 -12.607284,-13.405009 z m -1.716682,0.0078 c -6.995507,0.462047 -12.536897,6.2854693 -12.536897,13.397187 0,1.7471 0.33392,3.416827 0.942418,4.946709 C 9.8382992,19.991498 8.2240722,20.533989 6.7115792,21.40722 0.52714555,24.977806 -1.7383295,32.735989 1.4168439,39.039434 -0.86121285,34.26773 0.88578585,28.463663 5.5423552,25.775186 10.280179,23.039814 16.295416,24.535893 19.236731,29.07561 l 1.849653,-1.06755 c -0.116245,-0.324958 -0.175968,-0.675422 -0.175968,-1.040177 0,-1.474684 1.033904,-2.7081 2.416653,-3.014963 l 0,-2.138998 c -5.354361,-0.327959 -9.604053,-4.769878 -9.604053,-10.206284 0,-5.3484377 4.106511,-9.745581 9.338141,-10.198436 z m 0.5983,12.857539 c -2.702513,0.06215 -5.1939,0.982199 -7.238239,2.479239 0.163319,0.241678 0.3388,0.475581 0.523995,0.699968 0.185211,0.224379 0.381018,0.43966 0.586572,0.64522 0.205552,0.205552 0.420838,0.401368 0.645233,0.586565 0.164974,0.136169 0.34173,0.258763 0.516174,0.383226 1.509041,-0.990801 3.316157,-1.571993 5.263466,-1.571993 1.947286,-8e-6 3.750506,0.581192 5.259545,1.571993 0.174446,-0.124463 0.351193,-0.247057 0.516176,-0.383226 0.22439,-0.185197 0.439673,-0.381013 0.645219,-0.586565 0.205567,-0.20556 0.401375,-0.420841 0.586578,-0.64522 0.185195,-0.224387 0.360669,-0.45829 0.523998,-0.699968 -2.118228,-1.551143 -4.716051,-2.479239 -7.531516,-2.479239 -0.06599,0 -0.133689,-7.88e-4 -0.199445,0 -0.0321,5.04e-4 -0.06572,-7.33e-4 -0.09775,0 z m -12.31791,11.277867 c -0.284223,2.610003 0.211199,5.323971 1.618924,7.76224 1.407734,2.438252 3.510158,4.228056 5.912592,5.286916 0.127648,-0.262284 0.242394,-0.532967 0.344121,-0.805556 0.101731,-0.272573 0.190676,-0.548209 0.265902,-0.828999 0.07525,-0.280797 0.139504,-0.565564 0.187704,-0.852481 0.03545,-0.210964 0.05374,-0.42411 0.07431,-0.637415 -1.612588,-0.811463 -3.018925,-2.087157 -3.992574,-3.773578 -0.973652,-1.686412 -1.374436,-3.539399 -1.270899,-5.341664 -0.194995,-0.08884 -0.390062,-0.179391 -0.590482,-0.254187 -0.272577,-0.10171 -0.548216,-0.190664 -0.829012,-0.265909 -0.280794,-0.07523 -0.565552,-0.135585 -0.852473,-0.183786 -0.286919,-0.04821 -0.577155,-0.08499 -0.868119,-0.105582 z m 25.316234,0.152498 c -0.290976,0.02064 -0.581196,0.05743 -0.868118,0.105592 -0.286924,0.04821 -0.571694,0.108551 -0.852489,0.183796 -0.28078,0.07523 -0.560331,0.164188 -0.832917,0.265916 -0.200416,0.07475 -0.391568,0.169238 -0.586562,0.258079 0.103529,1.802257 -0.297254,3.655268 -1.270904,5.341672 -0.973644,1.686405 -2.379987,2.958198 -3.992556,3.769663 0.02056,0.213296 0.03885,0.42645 0.07429,0.637406 0.0482,0.286925 0.108544,0.571684 0.183787,0.85249 0.07524,0.280789 0.164195,0.560349 0.265917,0.832913 0.10171,0.272598 0.21648,0.539357 0.344115,0.80165 2.402441,-1.05887 4.504863,-2.844756 5.91259,-5.283018 1.407749,-2.438268 1.907058,-5.156151 1.622843,-7.766155 z m -14.984836,3.300424 -1.861376,1.079286 c 2.393175,4.80097 0.67248,10.702448 -4.035564,13.420654 -4.684876,2.704807 -10.6285418,1.281437 -13.6044538,-3.140087 3.861645,5.950286 11.7584698,7.900842 17.9724108,4.31321 1.505271,-0.869071 2.775062,-1.989431 3.793133,-3.273026 1.038062,1.349323 2.351864,2.521178 3.918266,3.425539 6.220932,3.591652 14.127263,1.63317 17.98415,-4.332768 -2.970401,4.440658 -8.922715,5.877231 -13.616174,3.167461 -4.737818,-2.735388 -6.449511,-8.693465 -3.988659,-13.51059 L 26.29902,29.028617 c -0.565692,0.629844 -1.386768,1.028448 -2.299348,1.028448 -0.927577,0 -1.760299,-0.411791 -2.32672,-1.059736 z"
- style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;display:inline"
- id="path7214" />
+<?xml version="1.0" encoding="UTF-8"?>
+<svg version="1.0" width="48" height="48" xmlns="http://www.w3.org/2000/svg">
+ <title>Biohazard</title>
+ <path d="m23.585 1.3778c-7.3e-5 1.1e-4 6.2e-5 0.0039 0 0.0039 0.0013-3.54e-4 0.0026-0.0032 0.0039-0.0039-4.78e-4 0-0.0034-2.3e-5 -0.0039 0zm-0.29329 0.01173c-0.0027 3.39e-4 -0.0051 0.0032-0.0078 0.0039 0.01047-6.47e-4 0.0208-0.0032 0.0313-0.0039-0.0026 3.1e-5 -0.0053-1.18e-4 -0.0078 0-0.0057 2.6e-4 -0.01016-6.94e-4 -0.01564 0zm1.4234 0.0078c0.02085 0.0016 0.04176 0.0023 0.06257 0.0039-0.02047-0.0016-0.04204-0.0032-0.06257-0.0039zm0.06257 0.0039c5.266 0.41855 9.4125 4.8332 9.4125 10.206 0 5.4708-4.3036 9.9328-9.7057 10.21v2.096c1.4749 0.23317 2.6044 1.514 2.6044 3.0541 0 0.37693-0.06786 0.73739-0.19161 1.0715l1.9161 1.1067c2.9612-4.473 8.9355-5.9326 13.644-3.2144 4.6969 2.7117 6.4311 8.5947 4.063 13.389 3.2501-6.3259 0.99004-14.167-5.2361-17.761-1.5578-0.89938-3.2176-1.4473-4.8959-1.6737 0.64243-1.5663 0.99716-3.2814 0.99716-5.0797 0-7.1369-5.5766-12.98-12.607-13.405zm-1.7167 0.0078c-6.9955 0.46205-12.537 6.2855-12.537 13.397 0 1.7471 0.33392 3.4168 0.94242 4.9467-1.6284 0.2386-3.2426 0.78109-4.7551 1.6543-6.1844 3.5706-8.4499 11.329-5.2947 17.632-2.2781-4.7717-0.53106-10.576 4.1255-13.264 4.7378-2.7354 10.753-1.2393 13.694 3.3004l1.8497-1.0676c-0.11624-0.32496-0.17597-0.67542-0.17597-1.0402 0-1.4747 1.0339-2.7081 2.4167-3.015v-2.139c-5.3544-0.32796-9.6041-4.7699-9.6041-10.206 0-5.3484 4.1065-9.7456 9.3381-10.198zm0.5983 12.858c-2.7025 0.06215-5.1939 0.9822-7.2382 2.4792 0.16332 0.24168 0.3388 0.47558 0.524 0.69997 0.18521 0.22438 0.38102 0.43966 0.58657 0.64522 0.20555 0.20555 0.42084 0.40137 0.64523 0.58656 0.16497 0.13617 0.34173 0.25876 0.51617 0.38323 1.509-0.9908 3.3162-1.572 5.2635-1.572 1.9473-8e-6 3.7505 0.58119 5.2595 1.572 0.17445-0.12446 0.35119-0.24706 0.51618-0.38323 0.22439-0.1852 0.43967-0.38101 0.64522-0.58656 0.20557-0.20556 0.40138-0.42084 0.58658-0.64522 0.1852-0.22439 0.36067-0.45829 0.524-0.69997-2.1182-1.5511-4.7161-2.4792-7.5315-2.4792-0.06599 0-0.13369-7.88e-4 -0.19944 0-0.0321 5.04e-4 -0.06572-7.33e-4 -0.09775 0zm-12.318 11.278c-0.28422 2.61 0.2112 5.324 1.6189 7.7622 1.4077 2.4383 3.5102 4.2281 5.9126 5.2869 0.12765-0.26228 0.24239-0.53297 0.34412-0.80556 0.10173-0.27257 0.19068-0.54821 0.2659-0.829 0.07525-0.2808 0.1395-0.56556 0.1877-0.85248 0.03545-0.21096 0.05374-0.42411 0.07431-0.63742-1.6126-0.81146-3.0189-2.0872-3.9926-3.7736-0.97365-1.6864-1.3744-3.5394-1.2709-5.3417-0.195-0.08884-0.39006-0.17939-0.59048-0.25419-0.27258-0.10171-0.54822-0.19066-0.82901-0.26591-0.28079-0.07523-0.56555-0.13558-0.85247-0.18379-0.28692-0.04821-0.57716-0.08499-0.86812-0.10558zm25.316 0.1525c-0.29098 0.02064-0.5812 0.05743-0.86812 0.10559-0.28692 0.04821-0.57169 0.10855-0.85249 0.1838-0.28078 0.07523-0.56033 0.16419-0.83292 0.26592-0.20042 0.07475-0.39157 0.16924-0.58656 0.25808 0.10353 1.8023-0.29725 3.6553-1.2709 5.3417-0.97364 1.6864-2.38 2.9582-3.9926 3.7697 0.02056 0.2133 0.03885 0.42645 0.07429 0.63741 0.0482 0.28692 0.10854 0.57168 0.18379 0.85249 0.07524 0.28079 0.1642 0.56035 0.26592 0.83291 0.10171 0.2726 0.21648 0.53936 0.34412 0.80165 2.4024-1.0589 4.5049-2.8448 5.9126-5.283 1.4077-2.4383 1.9071-5.1562 1.6228-7.7662zm-14.985 3.3004-1.8614 1.0793c2.3932 4.801 0.67248 10.702-4.0356 13.421-4.6849 2.7048-10.629 1.2814-13.604-3.1401 3.8616 5.9503 11.758 7.9008 17.972 4.3132 1.5053-0.86907 2.7751-1.9894 3.7931-3.273 1.0381 1.3493 2.3519 2.5212 3.9183 3.4255 6.2209 3.5917 14.127 1.6332 17.984-4.3328-2.9704 4.4407-8.9227 5.8772-13.616 3.1675-4.7378-2.7354-6.4495-8.6935-3.9887-13.511l-1.9357-1.1184c-0.56569 0.62984-1.3868 1.0284-2.2993 1.0284-0.92758 0-1.7603-0.41179-2.3267-1.0597z"/>
</svg>
Modified: trunk/docutils/docs/user/rst/images/title-scaling.svg
===================================================================
--- trunk/docutils/docs/user/rst/images/title-scaling.svg 2021-07-19 13:42:25 UTC (rev 8803)
+++ trunk/docutils/docs/user/rst/images/title-scaling.svg 2021-07-19 13:43:02 UTC (rev 8804)
@@ -1,43 +1,11 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<svg
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:cc="http://creativecommons.org/ns#"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- id="svg2"
- height="19.933594pt"
- width="214.26941pt"
- viewBox="0 0 285.69254 26.578126"
- version="1.1">
- <metadata
- id="metadata8">
- <rdf:RDF>
- <cc:Work
- rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type
- rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- <dc:title></dc:title>
- </cc:Work>
- </rdf:RDF>
- </metadata>
- <defs
- id="defs6" />
- <text
- style="font-style:italic;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:34.41720963px;line-height:0%;font-family:TeXGyrePagella;-inkscape-font-specification:'TeXGyrePagella Italic';text-align:start;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none"
- xml:space="preserve"
- id="text2818"
- transform="scale(0.95603363,1.0459883)"
- y="24.939034"
- x="-0.3865214"><tspan
- id="tspan2820"
- y="24.939034"
- x="-0.3865214"><tspan
- style="font-family:'Times New Roman';-inkscape-font-specification:'Times New Roman'"
- id="tspan2985">re</tspan><tspan
- style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:34.41720963px;line-height:100%;font-family:'Courier New';-inkscape-font-specification:'Courier New';text-align:start;writing-mode:lr-tb;text-anchor:start"
- id="tspan2822">Structured</tspan><tspan
- style="font-family:'Times New Roman';-inkscape-font-specification:'Times New Roman'"
- id="tspan2989">Text</tspan></tspan></text>
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="203pt" height="24pt" version="1.1"
+ viewBox="0 0 232 24" xmlns="http://www.w3.org/2000/svg">
+ <text x="-2.25" y="24" fill="#000000"
+ font-family="Times New Roman, Liberation Serif, FreeSerif, serif"
+ font-size="32px" font-style="italic" letter-spacing="0px"
+ stroke-width="1px" word-spacing="0px"><tspan
+ x="-2.25" y="24">re<tspan
+ font-family="Helvetica, Liberation Sans, FreeSans, sans-serif"
+ font-style="normal">Structured</tspan>Text</tspan></text>
</svg>
Modified: trunk/docutils/docs/user/rst/images/title.svg
===================================================================
--- trunk/docutils/docs/user/rst/images/title.svg 2021-07-19 13:42:25 UTC (rev 8803)
+++ trunk/docutils/docs/user/rst/images/title.svg 2021-07-19 13:43:02 UTC (rev 8804)
@@ -1,43 +1,11 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<svg
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:cc="http://creativecommons.org/ns#"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- id="svg2"
- height="21.262499pt"
- width="228.4207pt"
- version="1.1">
- <metadata
- id="metadata8">
- <rdf:RDF>
- <cc:Work
- rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type
- rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- <dc:title></dc:title>
- </cc:Work>
- </rdf:RDF>
- </metadata>
- <defs
- id="defs6" />
- <text
- style="font-style:italic;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:36.711689px;line-height:0%;font-family:TeXGyrePagella;-inkscape-font-specification:'TeXGyrePagella Italic';text-align:start;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.0666666"
- xml:space="preserve"
- id="text2818"
- transform="scale(0.95603363,1.0459883)"
- y="26.601633"
- x="-0.41228947"><tspan
- style="stroke-width:1.0666666"
- id="tspan2820"
- y="26.601633"
- x="-0.41228947"><tspan
- style="font-family:'Times New Roman';-inkscape-font-specification:'Times New Roman';stroke-width:1.0666666"
- id="tspan2985">re</tspan><tspan
- style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:36.711689px;line-height:100%;font-family:'Courier New';-inkscape-font-specification:'Courier New';text-align:start;writing-mode:lr-tb;text-anchor:start;stroke-width:1.0666666"
- id="tspan2822">Structured</tspan><tspan
- style="font-family:'Times New Roman';-inkscape-font-specification:'Times New Roman';stroke-width:1.0666666"
- id="tspan2989">Text</tspan></tspan></text>
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="203pt" height="24pt" version="1.1"
+ xmlns="http://www.w3.org/2000/svg">
+ <text x="-2.25" y="24" fill="#000000"
+ font-family="Times New Roman, Liberation Serif, FreeSerif, serif"
+ font-size="32px" font-style="italic" letter-spacing="0px"
+ stroke-width="1px" word-spacing="0px"><tspan
+ x="-2.25" y="24">re<tspan
+ font-family="Helvetica, Liberation Sans, FreeSans, sans-serif"
+ font-style="normal">Structured</tspan>Text</tspan></text>
</svg>
Modified: trunk/docutils/test/functional/expected/standalone_rst_html4css1.html
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_html4css1.html 2021-07-19 13:42:25 UTC (rev 8803)
+++ trunk/docutils/test/functional/expected/standalone_rst_html4css1.html 2021-07-19 13:43:02 UTC (rev 8804)
@@ -1270,86 +1270,66 @@
<div class="section" id="svg-images">
<h2><a class="toc-backref" href="#toc-entry-43">2.24 SVG Images</a></h2>
<object class="align-left" data="../../../docs/user/rst/images/biohazard.svg" style="width: 48px; height: 48px;" type="image/svg+xml">../../../docs/user/rst/images/biohazard.svg</object>
-<p>Scalable vector graphics (SVG) images are the only standards-compliable way
-to include vector graphics in HTML documents. However, they are not
-supported by all backends/output formats. (E.g., LaTeX supports the
-PDF or Postscript formats for vector graphics instead.)</p>
-<p>Rendering behaviour varies, depending on</p>
-<ol class="loweralpha">
-<li><p class="first">The SVG image itself, e.g. fixed-size vs. scaling:</p>
-<pre class="literal-block">
-width="280" viewBox="0 0 280 27"
-height="27" width="100%"
- height="100%"
-</pre>
-</li>
-<li><p class="first">The method used to put the image in the document.</p>
-<p>For HTML, there are several alternatives including:</p>
-<ul class="simple">
-<li>using the HTML <tt class="docutils literal"><img></tt> tag (not for interactive/animated SVG),</li>
-<li>using the HTML <tt class="docutils literal"><object></tt> tag,</li>
-<li>including within SVG using the SVG <tt class="docutils literal"><image></tt> tag,...
[truncated message content] |
|
From: <mi...@us...> - 2021-08-10 14:13:37
|
Revision: 8805
http://sourceforge.net/p/docutils/code/8805
Author: milde
Date: 2021-08-10 14:13:35 +0000 (Tue, 10 Aug 2021)
Log Message:
-----------
MathML: fixes and additions.
Math accent commands more similar to their LaTeX behaviour.
Additions for HTML export.
Use boolean values for boolean node arguments.
Downcase node arguments before storing.
Use class argument "boldsymbol" for \boldsymbol content.
Alignment of multi line equations similar to AMS-LaTeX "align" environment.
Add space after bracket in "cases" environment, left-align columns.
Fix spacing before "unary" minus.
Modified Paths:
--------------
trunk/docutils/docs/ref/rst/mathematics.txt
trunk/docutils/docutils/utils/math/latex2mathml.py
trunk/docutils/docutils/writers/html5_polyglot/plain.css
trunk/docutils/docutils/writers/html5_polyglot/responsive.css
trunk/docutils/test/functional/expected/latex_memoir.tex
trunk/docutils/test/functional/expected/math_output_html.html
trunk/docutils/test/functional/expected/math_output_latex.html
trunk/docutils/test/functional/expected/math_output_mathjax.html
trunk/docutils/test/functional/expected/math_output_mathml.html
trunk/docutils/test/functional/expected/standalone_rst_latex.tex
trunk/docutils/test/functional/expected/standalone_rst_xetex.tex
trunk/docutils/test/functional/input/data/math.txt
Modified: trunk/docutils/docs/ref/rst/mathematics.txt
===================================================================
--- trunk/docutils/docs/ref/rst/mathematics.txt 2021-07-19 13:43:02 UTC (rev 8804)
+++ trunk/docutils/docs/ref/rst/mathematics.txt 2021-08-10 14:13:35 UTC (rev 8805)
@@ -70,8 +70,8 @@
.. math::
- a &= (x + y)^2 &\qquad b &= (x - y)^2 \\
- &= x^2 + 2xy + y^2 & &= x^2 - 2xy + y^2
+ a &= (x + y)^2 & b &= (x - y)^2 \\
+ &= x^2 + 2xy + y^2 & &= x^2 - 2xy + y^2
LaTeX output will wrap it in an ``align*`` environment.
The result is:
@@ -134,12 +134,12 @@
.. class:: colwidths-auto
========================== ============================ =========================== =============================
- `\widetilde{abi}` ``\widetilde{abi}`` `\widehat{abi}` ``\widehat{abi}``
- `\overline{abi}` ``\overline{abi}`` `\underline{abi}` ``\underline{abi}``
- `\overbrace{abi}` ``\overbrace{abi}`` `\underbrace{abi}` ``\underbrace{abi}``
- `\overleftarrow{abi}` ``\overleftarrow{abi}`` `\underleftarrow{abi}` ``\underleftarrow{abi}``
- `\overrightarrow{abi}` ``\overrightarrow{abi}`` `\underrightarrow{abi}` ``\underrightarrow{abi}``
- `\overleftrightarrow{abi}` ``\overleftrightarrow{abi}`` `\underleftrightarrow{abi}` ``\underleftrightarrow{abi}``
+ `\widetilde{gbi}` ``\widetilde{gbi}`` `\widehat{gbi}` ``\widehat{gbi}``
+ `\overline{gbi}` ``\overline{gbi}`` `\underline{gbi}` ``\underline{gbi}``
+ `\overbrace{gbi}` ``\overbrace{gbi}`` `\underbrace{gbi}` ``\underbrace{gbi}``
+ `\overleftarrow{gbi}` ``\overleftarrow{gbi}`` `\underleftarrow{gbi}` ``\underleftarrow{gbi}``
+ `\overrightarrow{gbi}` ``\overrightarrow{gbi}`` `\underrightarrow{gbi}` ``\underrightarrow{gbi}``
+ `\overleftrightarrow{gbi}` ``\overleftrightarrow{gbi}`` `\underleftrightarrow{gbi}` ``\underleftrightarrow{gbi}``
========================== ============================ =========================== =============================
@@ -577,8 +577,9 @@
In addition to the standard `accents and embellishments`_, other symbols
can be placed above or below a base symbol with the ``\overset`` and
-``\underset`` commands. For example, writing ``\overset{*}{X}`` becomes
-`\overset{*}{X}` and ``\underset{+}{M}`` becomes `\underset{+}{M}`.
+``\underset`` commands. The symbol is set in "scriptstyle" (smaller font
+size). For example, writing ``\overset{*}{X}`` becomes `\overset{*}{X}`
+and ``\underset{+}{M}`` becomes `\underset{+}{M}`.
Matrices
@@ -613,8 +614,8 @@
For piecewise function definitions there is a ``cases`` environment:
.. math:: \mathrm{sgn}(x) = \begin{cases}
- \, -1 & x<0\\
- \,\phantom{-}1 & x>0
+ -1 & x<0\\
+ \phantom{-}1 & x>0
\end{cases}
Spacing commands
@@ -908,6 +909,8 @@
:mathsf: `\mathsf{abs(x) \pm \alpha \approx 3 \Gamma \quad \forall x \in R}`
:mathbb: `\mathbb{abs(x) \pm \alpha \approx 3 \Gamma \quad \forall x \in R}`
:mathbf: `\mathbf{abs(x) \pm \alpha \approx 3 \Gamma \quad \forall x \in R}`
+:mathcal: `\mathcal{abs(x) \pm \alpha \approx 3 \Gamma \quad \forall x \in R}`
+:mathscr: `\mathscr{abs(x) \pm \alpha \approx 3 \Gamma \quad \forall x \in R}`
Unicode supports the following blackboard-bold characters:
`\mathbb{a \ldots z A \ldots Z 0 \ldots 9
@@ -932,7 +935,8 @@
~~~~~~~~~~~~~~~~~~
Accents should be nearer to the base (in MathML Firefox 78, it's vice versa!):
-`\bar a \overline a, \bar l \overline l, \bar i \overline i`.
+`\bar a \overline a, \bar l \overline l, \bar i \overline i`,
+`\vec{r}` `\overrightarrow{r}`.
Sub- and superscript may be given in any order:
`x_i^j = x^j_i` and `\int_0^1 = \int^1_0`.
@@ -950,9 +954,80 @@
Big delimiters and symbols
~~~~~~~~~~~~~~~~~~~~~~~~~~
+Compare automatic sizing with fixed sizes:
+.. math: \left( \frac{\frac1x}{\frac{1}{n}}\right) &= \Biggl(\text{Bigg}\Biggr)\\
+
+
+.. math::
+ \left( 3 \right)
+ \left( f(x) \right)
+ \left( \bar x \right)
+ \left( \overline x \right)
+ \left( n_i \right) &= () \\
+ \left( \underline x \right) &= \bigl(\text{big}\bigr)\\
+ \left( 3^2 \right)
+ \left( \sqrt{3} \right)
+ \left( \sqrt{3^2} \right)
+ \left( \sum \right)
+ \left( \bigotimes \right)
+ \left( \prod \right) &= \Bigl(\text{Big}\Bigr)\\
+ \left( \frac{3 }{2} \right)
+ \left( \frac{3^2}{2^4} \right)
+ \binom{3 }{2}
+ \begin{pmatrix} a & b \\ c & d \end{pmatrix}
+ \left( \frac{1}{\sqrt 2} \right)
+ \left( \int \right)
+ \left( \int_0 \right)
+ \left( \int^1 \right)
+ \left( \int_0^1 \right) &= \biggl(\text{bigg}\biggr)\\
+ \left( \frac{\sqrt 2}{2} \right)
+ \left( \sum_0 \right)
+ \left( \sum^1 \right)
+ \left( \sum_0^1 \right)
+ \left( \frac{\frac1x}{\frac{1}{n}}\right) &= \Biggl(\text{Bigg}\Biggr)\\
+ \left( \intop_0 \right)
+ \left( \intop^1 \right)
+ \left( \intop_0^1 \right)
+
+And in text:
+
+:`()`: `\left(3 \right)
+ \left( f(x) \right)
+ \left( \bar x \right)
+ \left( \overline x \right)
+ \left( n_i \right)
+ \left( \sum \right)
+ \left( \sum_0 \right)
+ \left( \prod \right)`
+
+
+:`\bigl(\text{big}\bigr)`: `\left(\underline x \right)
+ \left( 3^2 \right)
+ \binom{3}{2}
+ \left(\begin{smallmatrix} a & b \\
+ c & d \end{smallmatrix} \right)
+ \left( \bigotimes \right)`
+
+:`\Bigl(\text{Big}\Bigr)`: `\left(\sqrt{3} \right)
+ \left( \sqrt{3^2} \right)
+ \left( \frac{3}{2} \right)
+ \left( \frac{3^2}{2^4} \right)
+ \left( \frac{\sqrt 2}{2} \right)
+ \left( \int \right)
+ \left( \int_0 \right)
+ \left( \int^1 \right)
+ \left( \int_0^1 \right)
+ \left( \sum^1 \right)
+ \left( \sum_0^1 \right)
+ \left( \frac{\frac1x}{\frac{1}{n}}\right)`
+
+
+
+
+
Test ``\left``, ``\right``, and the \bigl/\bigr, … size commands
-with extensible delimiters.
+with all extensible delimiters.
.. math::
\left.(b\right)\ \bigl(b\Bigr)\ \biggl(b\Biggr)
@@ -967,9 +1042,11 @@
\quad
\left.\lfloor b\right\rfloor\ \bigl\lfloor b\Bigr\rfloor\ \biggl\lfloor b\Biggr\rfloor
\quad
- \left.\lvert b\right\rvert\ \bigl\lvert b\Bigr\rvert\ \biggl\lvert b\Biggr\rvert
+ \left.\lvert b\right\rvert\ \bigl\lvert b\Bigr\rvert\
+ \biggl\lvert b\Biggr\rvert
\quad
- \left.\lVert b\right\rVert\ \bigl\lVert b\Bigr\rVert\ \biggl\lVert b\Biggr\rVert
+ \left.\lVert b\right\rVert\ \bigl\lVert b\Bigr\rVert\
+ \biggl\lVert b\Biggr\rVert
\left.\lgroup b\right\rgroup\ \bigl\lgroup b\Bigr\rgroup\ \biggl\lgroup b\Biggr\rgroup
\quad
@@ -985,6 +1062,7 @@
\quad
\left.\bracevert b\right\bracevert\ \bigl\bracevert b\Bigr\bracevert\ \biggl\bracevert b\Biggr\bracevert
\quad
+ \left.\vert b\right\Vert\ \bigl\vert b\Bigr\Vert\ \biggl\vert b\Biggr\Vert
Variable-sized operators:
Modified: trunk/docutils/docutils/utils/math/latex2mathml.py
===================================================================
--- trunk/docutils/docutils/utils/math/latex2mathml.py 2021-07-19 13:43:02 UTC (rev 8804)
+++ trunk/docutils/docutils/utils/math/latex2mathml.py 2021-08-10 14:13:35 UTC (rev 8805)
@@ -24,6 +24,7 @@
# >>> from latex2mathml import *
import collections
+import copy
import re
import sys
import unicodedata
@@ -79,18 +80,18 @@
# math font selection -> <mi mathvariant=...> or <mstyle mathvariant=...>
math_alphabets = {# 'cmdname': 'mathvariant value' # package
'boldsymbol': 'bold',
- 'mathbb': 'double-struck', # amssymb
- 'mathbf': 'bold',
- 'mathcal': 'script',
- 'mathfrak': 'fraktur', # amssymb
- 'mathit': 'italic',
- 'mathrm': 'normal',
- 'mathscr': 'script', # mathrsfs
- 'mathsf': 'sans-serif',
- 'mathtt': 'monospace',
- 'mathbfit': 'bold-italic', # isomath
- 'mathsfit': 'sans-serif-italic', # isomath
- 'mathsfbfit': 'sans-serif-bold-italic', # isomath
+ 'mathbf': 'bold',
+ 'mathit': 'italic',
+ 'mathtt': 'monospace',
+ 'mathrm': 'normal',
+ 'mathsf': 'sans-serif',
+ 'mathcal': 'script',
+ 'mathbfit': 'bold-italic', # isomath
+ 'mathbb': 'double-struck', # amssymb
+ 'mathfrak': 'fraktur', # amssymb
+ 'mathsfit': 'sans-serif-italic', # isomath
+ 'mathsfbfit': 'sans-serif-bold-italic', # isomath
+ 'mathscr': 'script', # mathrsfs
# unsupported: bold-fraktur
# bold-script
# bold-sans-serif
@@ -178,8 +179,8 @@
}
# Operators and functions with limits above/below in display formulas
-# and in index position inline (movablelimits="true")
-displaylimits = ('bigcap', 'bigcup', 'bigodot', 'bigoplus', 'bigotimes',
+# and in index position inline (movablelimits=True)
+movablelimits = ('bigcap', 'bigcup', 'bigodot', 'bigoplus', 'bigotimes',
'bigsqcup', 'biguplus', 'bigvee', 'bigwedge',
'coprod', 'intop', 'ointop', 'prod', 'sum',
'lim', 'max', 'min', 'sup', 'inf')
@@ -186,11 +187,10 @@
# Depending on settings, integrals may also be in this category.
# (e.g. if "amsmath" is loaded with option "intlimits", see
# http://mirror.ctan.org/macros/latex/required/amsmath/amsldoc.pdf)
-# displaylimits.extend(('fint', 'idotsint', 'iiiint', 'iiint', 'iint',
-# 'int', 'oiint', 'oint', 'ointctrclockwise',
-# 'sqint', 'varointclockwise',))
+# movablelimits.extend(('fint', 'iiiint', 'iiint', 'iint', 'int', 'oiint',
+# 'oint', 'ointctrclockwise', 'sqint',
+# 'varointclockwise',))
-
# horizontal space -> <mspace>
spaces = {'qquad': '2em', # two \quad
@@ -208,38 +208,39 @@
'!': '-0.1667em', # negthinspace
}
-# accents -> <mover accent="true"> # TODO: stretchy="false"
-# TeX spacing combining
-accents = {'acute': u'´', # u'\u0301',
- 'bar': u'ˉ', # u'\u0304',
- 'breve': u'˘', # u'\u0306',
- 'check': u'ˇ', # u'\u030C',
- 'dot': u'˙', # u'\u0307',
- 'ddot': u'¨', # u'\u0308',
- 'dddot': u'\u20DB', # '…' too wide
+# accents -> <mover stretchy="false">
+accents = {# TeX: (spacing, combining)
+ 'acute': (u'´', u'\u0301'),
+ 'bar': (u'ˉ', u'\u0304'),
+ 'breve': (u'˘', u'\u0306'),
+ 'check': (u'ˇ', u'\u030C'),
+ 'dot': (u'˙', u'\u0307'),
+ 'ddot': (u'¨', u'\u0308'),
+ 'dddot': (u'⋯', u'\u20DB'),
+ 'grave': (u'`', u'\u0300'),
+ 'hat': (u'ˆ', u'\u0302'),
+ 'mathring': (u'˚', u'\u030A'),
+ 'tilde': (u'˜', u'\u0303'), # tilde ~ or small tilde ˜?
+ 'vec': (u'→', u'\u20d7'), # → too heavy, accents="false"
# TODO: ddddot
- 'grave': u'`', # u'\u0300',
- 'hat': u'ˆ', # u'\u0302',
- 'mathring': u'˚', # u'\u030A',
- 'tilde': u'˜', # u'\u0303',
}
-# limits etc. -> <mover accent="false"> or <munder>
-over = {# 'ddot': u'..',
- # 'dddot': u'…', # too wide if accent="true"
- 'overbrace': u'\u23DE', # TOP CURLY BRACKET
- 'overleftarrow': u'\u2190',
- 'overleftrightarrow': u'\u2194',
- 'overline': u'¯',
- 'overrightarrow': u'\u2192',
- 'vec': u'\u2192', # → too heavy if accent="true"
- 'widehat': u'^',
- 'widetilde': u'~'}
-under = {'underbrace': u'\u23DF',
- 'underleftarrow': u'\u2190',
- 'underleftrightarrow': u'\u2194',
- 'underline': u'_',
- 'underrightarrow': u'\u2192'}
+# limits etc. -> <mover> or <munder>
+over = {# TeX: (char, offset-correction/em)
+ 'overbrace': (u'\u23DE', -0.2), # DejaVu Math -0.6
+ 'overleftarrow': (u'\u2190', -0.2),
+ 'overleftrightarrow': (u'\u2194', -0.2),
+ 'overline': (u'_', -0.2), # \u2012' FIGURE DASH does not stretch
+ 'overrightarrow': (u'\u2192', -0.2),
+ 'widehat': (u'^', -0.5),
+ 'widetilde': (u'~', -0.3),
+ }
+under = {'underbrace': (u'\u23DF', 0.1), # DejaVu Math -0.7
+ 'underleftarrow': (u'\u2190', -0.2),
+ 'underleftrightarrow': (u'\u2194', -0.2),
+ 'underline': (u'_', -0.8),
+ 'underrightarrow': (u'\u2192', -0.2),
+ }
# Character translations
# ----------------------
@@ -258,8 +259,9 @@
u'π': u'\u213C', # ℼ
}
-
-matrices = {'matrix': ('', ''),
+# Matrix environments
+matrices = {# name: fences
+ 'matrix': ('', ''),
'smallmatrix': ('', ''), # smaller, see begin_environment()!
'pmatrix': ('(', ')'),
'bmatrix': ('[', ']'),
@@ -270,16 +272,16 @@
}
layout_styles = {
- 'displaystyle': {'displaystyle': 'true', 'scriptlevel': '0'},
- 'textstyle': {'displaystyle': 'false', 'scriptlevel': '0'},
- 'scriptstyle': {'displaystyle': 'false', 'scriptlevel': '1'},
- 'scriptscriptstyle': {'displaystyle': 'false', 'scriptlevel': '2'},
+ 'displaystyle': {'displaystyle': True, 'scriptlevel': 0},
+ 'textstyle': {'displaystyle': False, 'scriptlevel': 0},
+ 'scriptstyle': {'displaystyle': False, 'scriptlevel': 1},
+ 'scriptscriptstyle': {'displaystyle': False, 'scriptlevel': 2},
}
# See also https://www.w3.org/TR/MathML3/chapter3.html#presm.scriptlevel
fractions = {# name: style_attrs, frac_attrs
'frac': ({}, {}),
- 'cfrac': ({'displaystyle': 'true', 'scriptlevel': '0',
+ 'cfrac': ({'displaystyle': True, 'scriptlevel': 0,
'CLASS': 'cfrac'}, {}), # in LaTeX with padding
'dfrac': (layout_styles['displaystyle'], {}),
'tfrac': (layout_styles['textstyle'], {}),
@@ -288,18 +290,20 @@
'tbinom': (layout_styles['textstyle'], {'linethickness': 0}),
}
-delimiter_sizes = {'left': '',
- 'right': '',
- 'bigl': '1.2em',
- 'bigr': '1.2em',
- 'Bigl': '1.623em',
- 'Bigr': '1.623em',
- 'biggl': '2.047em',
- 'biggr': '2.047em',
- 'Biggl': '2.470em',
- 'Biggr': '2.470em',
- }
+delimiter_sizes = ['', '1.2em', '1.623em', '2.047em', '2.470em']
+bigdelimiters = {'left': 0,
+ 'right': 0,
+ 'bigl': 1,
+ 'bigr': 1,
+ 'Bigl': 2,
+ 'Bigr': 2,
+ 'biggl': 3,
+ 'biggr': 3,
+ 'Biggl': 4,
+ 'Biggr': 4,
+ }
+
# MathML element classes
# ----------------------
@@ -318,13 +322,18 @@
ord('&'): u'&',
0x2061: u'⁡',
}
+ _boolstrings = {True: 'true', False: 'false'}
+ """String representation of boolean MathML attribute values."""
+ html_tagname = 'span'
+ """Tag name for HTML representation."""
+
def __init__(self, *children, **attributes):
"""Set up node with `children` and `attributes`.
- Attributes are downcased: Use CLASS to get "class" in XML
+ Attributes are downcased: Use CLASS to set "class" value.
>>> math(mn(3), CLASS='test')
- math(mn(3), CLASS='test')
+ math(mn(3), class='test')
>>> math(CLASS='test').toprettyxml()
'<math class="test">\n</math>'
@@ -336,7 +345,9 @@
# sort attributes for predictable functional tests
# as self.attributes.update(attributes) does not keep order in Python < 3.6
for key in sorted(attributes.keys()):
- self.attributes[key] = attributes[key]
+ # Use .lower() to allow argument `CLASS` for attribute `class`
+ # (Python keyword). MathML uses only lowercase attributes.
+ self.attributes[key.lower()] = attributes[key]
def __repr__(self):
content = [repr(item) for item in getattr(self, 'children', [])]
@@ -344,8 +355,9 @@
content.append(repr(self.data))
if isinstance(self, MathSchema) and self.switch:
content.append('switch=True')
- if hasattr(self, 'attributes'):
- content += ["%s='%s'"%(k, v) for k, v in self.attributes.items()]
+ content += ["%s=%r"%(k, v) for k, v in self.attributes.items()
+ if v is not None]
+
return self.__class__.__name__ + '(%s)' % ', '.join(content)
def __len__(self):
@@ -401,9 +413,9 @@
+ ['</%s>' % self.__class__.__name__])
def xml_starttag(self):
- # Use k.lower() to allow argument `CLASS` for attribute `class`
- # (Python keyword). MathML uses only lowercase attributes.
- attrs = ['%s="%s"'%(k.lower(), v) for k, v in self.attributes.items()]
+ attrs = ['%s="%s"' % (k, str(v).replace('True', 'true').replace('False', 'false'))
+ for k, v in self.attributes.items()
+ if v is not None]
return '<%s>' % ' '.join([self.__class__.__name__] + attrs)
def _xml_body(self, level=0):
@@ -421,11 +433,11 @@
# '<math>\n <mn>2</mn>\n</math>'
# >>> len(n2)
# 1
-# >>> eq3 = math(id='eq3')
+# >>> eq3 = math(id='eq3', display='block')
# >>> eq3
-# math(id='eq3')
+# math(display='block', id='eq3')
# >>> eq3.toprettyxml()
-# '<math id="eq3">\n</math>'
+# '<math display="block" id="eq3">\n</math>'
# >>> len(eq3)
# 0
# >>> math(CLASS='bold').xml_starttag()
@@ -433,9 +445,10 @@
class mtable(math): pass
-# >>> mtable(displaystyle='true')
-# mtable(displaystyle='true')
-# >>> math(mtable(displaystyle='true')).toprettyxml()
+# >>> mt = mtable(displaystyle=True)
+# >>> mt
+# mtable(displaystyle=True)
+# >>> math(mt).toprettyxml()
# '<math>\n <mtable displaystyle="true">\n </mtable>\n</math>'
class mrow(math):
@@ -449,7 +462,7 @@
"""
parent = self.parent
if isinstance(parent, MathRowSchema) and parent.nchildren == 1:
- parent.nchildren = None
+ parent.nchildren = len(parent.children)
parent.children = self.children
for child in self.children:
child.parent = parent
@@ -462,8 +475,8 @@
return self.children[0]
return super(mrow, self).close()
-# >>> mrow(displaystyle='false')
-# mrow(displaystyle='false')
+# >>> mrow(displaystyle=False)
+# mrow(displaystyle=False)
# The elements <msqrt>, <mstyle>, <merror>, <mpadded>, <mphantom>, <menclose>,
# <mtd>, <mscarry>, and <math> treat their contents as a single inferred mrow
@@ -470,17 +483,24 @@
# formed from all their children.
class MathRowSchema(math):
"""Base class for elements treating content as a single inferred mrow."""
+
class mtr(MathRowSchema): pass
+
class mtd(MathRowSchema): pass
+
+class menclose(MathRowSchema):
+ nchildren = 1 # \boxed expects one argument or a group
+
class mphantom(MathRowSchema):
nchildren = 1 # \phantom expects one argument or a group
-class mstyle(MathRowSchema):
- nchildren = 1 # \mathrm, ... expect one argument or a group
+
class msqrt(MathRowSchema):
nchildren = 1 # \sqrt expects one argument or a group
-class menclose(MathRowSchema):
- nchildren = 1 # \boxed expects one argument or a group
+class mstyle(MathRowSchema):
+ nchildren = 1 # \mathrm, ... expect one argument or a group
+
+
class MathToken(math):
"""Token Element: contains textual data instead of children.
@@ -495,10 +515,10 @@
def _xml_body(self, level=0):
return [unicode(self.data).translate(self.xml_entities)]
+class mtext(MathToken): pass
class mi(MathToken): pass
+class mo(MathToken): pass
class mn(MathToken): pass
-class mo(MathToken): pass
-class mtext(MathToken): pass
# >>> mo(u'<')
# mo('<')
@@ -519,13 +539,12 @@
math.__init__(self, *children, **kwargs)
def append(self, child):
- new_current = super(MathSchema, self).append(child)
+ current_node = super(MathSchema, self).append(child)
# normalize order if full
if self.switch and self.full():
self.children[-1], self.children[-2] = self.children[-2], self.children[-1]
- # self.children.reverse()
self.switch = False
- return new_current
+ return current_node
class msub(MathSchema): pass
class msup(MathSchema): pass
@@ -532,31 +551,32 @@
class msubsup(MathSchema):
nchildren = 3
-class munder(MathSchema): pass
-class mover(MathSchema): pass
-class munderover(MathSchema):
- nchildren = 3
+# >>> msub(mi('x'), mo('-'))
+# msub(mi('x'), mo('-'))
+# >>> msubsup(mi('base'), mi('sub'), mi('super'))
+# msubsup(mi('base'), mi('sub'), mi('super'))
+# >>> msubsup(mi('base'), mi('super'), mi('sub'), switch=True)
+# msubsup(mi('base'), mi('sub'), mi('super'))
-# >>> munder(mi('lim'), mo('-'), accent='false')
-# munder(mi('lim'), mo('-'), accent='false')
-# >>> mu = munder(mo('-'), accent='false', switch=True)
+class munder(msub): pass
+class mover(msup): pass
+
+# >>> munder(mi('lim'), mo('-'), accent=False)
+# munder(mi('lim'), mo('-'), accent=False)
+# >>> mu = munder(mo('-'), accent=False, switch=True)
# >>> mu
-# munder(mo('-'), switch=True, accent='false')
+# munder(mo('-'), switch=True, accent=False)
# >>> mu.append(mi('lim'))
# >>> mu
-# munder(mi('lim'), mo('-'), accent='false')
+# munder(mi('lim'), mo('-'), accent=False)
# >>> mu.append(mi('lim'))
# Traceback (most recent call last):
-# SyntaxError: Node munder(mi('lim'), mo('-'), accent='false') already full!
-# >>> munder(mo('-'), mi('lim'), accent='false', switch=True).toprettyxml()
+# SyntaxError: Node munder(mi('lim'), mo('-'), accent=False) already full!
+# >>> munder(mo('-'), mi('lim'), accent=False, switch=True).toprettyxml()
# '<munder accent="false">\n <mi>lim</mi>\n <mo>-</mo>\n</munder>'
-# >>> msub(mi('x'), mo('-'))
-# msub(mi('x'), mo('-'))
-# >>> msubsup(mi('base'), mi('sub'), mi('super'))
-# msubsup(mi('base'), mi('sub'), mi('super'))
-# >>> msubsup(mi('base'), mi('super'), mi('sub'), switch=True)
-# msubsup(mi('base'), mi('sub'), mi('super'))
+class munderover(msubsup): pass
+
class mroot(MathSchema):
nchildren = 2
@@ -798,11 +818,16 @@
node = node.append(mn(c+number))
elif c in anomalous_chars:
# characters with a special meaning in LaTeX math mode
- node = node.append(mo(anomalous_chars[c]))
- # TODO: fix spacing before "unary" minus.
- # set form='prefix' if preceded by "(", "{", ...?
+ # fix spacing before "unary" minus.
+ attributes = {}
+ if c == '-' and node.children:
+ previous_node = node.children[-1]
+ if (getattr(previous_node, 'data', '-') in '([='
+ or previous_node.get('class') == 'mathopen'):
+ attributes['form'] = 'prefix'
+ node = node.append(mo(anomalous_chars[c], **attributes))
elif c in "/()[]|":
- node = node.append(mo(c, stretchy='false'))
+ node = node.append(mo(c, stretchy=False))
elif c in "+*=<>,.!?';@":
node = node.append(mo(c))
else:
@@ -824,7 +849,7 @@
# >>> parse_latex_math(math(), '\\sqrt[3]{2 + 3}')
# math(mroot(mrow(mn('2'), mo('+'), mn('3')), mn('3')))
# >>> parse_latex_math(math(), '\max_x') # function takes limits
-# math(munder(mo('max', movablelimits='true'), mi('x')))
+# math(munder(mo('max', movablelimits=True), mi('x')))
# >>> parse_latex_math(math(), 'x^j_i') # ensure correct order: base, sub, sup
# math(msubsup(mi('x'), mi('i'), mi('j')))
# >>> parse_latex_math(math(), '\int^j_i') # ensure correct order
@@ -863,7 +888,7 @@
node = node.append(new_node)
return node, string
- if (name in functions):
+ if name in functions:
# use <mi> followed by invisible function applicator character
# (see https://www.w3.org/TR/MathML3/chapter3.html#presm.mi)
if name == 'operatorname':
@@ -877,7 +902,7 @@
if name == 'varliminf': # \underline\lim
new_node = munder(new_node, mo(u'_'))
elif name == 'varlimsup': # \overline\lim
- new_node = mover(new_node, mo(u'¯'), accent='false')
+ new_node = mover(new_node, mo(u'¯'), accent=False)
elif name == 'varprojlim': # \underleftarrow\lim
new_node = munder(new_node, mo(u'\u2190'))
elif name == 'varinjlim': # \underrightarrow\lim
@@ -892,7 +917,7 @@
if name in math_alphabets:
if name == 'boldsymbol':
- attributes = {'style': 'font-weight: bold'}
+ attributes = {'class': 'boldsymbol'}
else:
attributes = {'mathvariant': math_alphabets[name]}
if name == 'mathscr':
@@ -921,7 +946,7 @@
if name == 'colon': # trailing punctuation, not binary relation
node = node.append(mo(':', form='postfix', lspace='0', rspace='0.28em'))
return node, string
-
+
if name == 'idotsint':
node = parse_latex_math(node, '\int\dotsi\int')
return node, string
@@ -935,15 +960,17 @@
return node, string
if name in operators:
- if name in displaylimits and string and string[0] in ' _^':
- node = node.append(mo(operators[name], movablelimits = 'true'))
- else:
- node = node.append(mo(operators[name]))
+ attributes = {}
+ if name in movablelimits and string and string[0] in ' _^':
+ attributes['movablelimits'] = True
+ elif name in ('lvert', 'lVert'):
+ attributes['class'] = 'mathopen'
+ node = node.append(mo(operators[name], **attributes))
return node, string
- if name in delimiter_sizes:
+ if name in bigdelimiters:
delimiter_attributes = {}
- size = delimiter_sizes[name]
+ size = delimiter_sizes[bigdelimiters[name]]
delimiter, string = tex_token_or_group(string)
if delimiter not in '()[]/|.':
try:
@@ -954,7 +981,7 @@
if size:
...
[truncated message content] |
|
From: <mi...@us...> - 2021-08-10 14:14:16
|
Revision: 8806
http://sourceforge.net/p/docutils/code/8806
Author: milde
Date: 2021-08-10 14:14:13 +0000 (Tue, 10 Aug 2021)
Log Message:
-----------
LaTeX writer: Refactor computation of table column widths.
Prepare for fixes (cf. bug #422).
Update documentation.
No change to the output.
Modified Paths:
--------------
trunk/docutils/docs/ref/rst/directives.txt
trunk/docutils/docs/user/config.txt
trunk/docutils/docs/user/latex.txt
trunk/docutils/docutils/writers/latex2e/__init__.py
Modified: trunk/docutils/docs/ref/rst/directives.txt
===================================================================
--- trunk/docutils/docs/ref/rst/directives.txt 2021-08-10 14:13:35 UTC (rev 8805)
+++ trunk/docutils/docs/ref/rst/directives.txt 2021-08-10 14:14:13 UTC (rev 8806)
@@ -777,12 +777,13 @@
``widths`` : "auto", "grid", or a list of integers
A comma- or space-separated list of column widths.
- The default is the width of the input columns (in characters).
+ Defaults to the widths of the input columns in characters.
- The special values "auto" or "grid" may be used by writers to decide
- whether to delegate the determination of column widths to the backend
- (LaTeX, the HTML browser, ...).
- See also the `table_style`_ configuration option.
+ The special value "auto" directs writers to delegate the
+ determination of column widths to the backend (LaTeX, the HTML
+ browser, ...), if possible. "grid" forces the default behaviour
+ (overwriting a `table_style`_ configuration setting value
+ "colwidths-auto").
``width`` : `length`_ or `percentage`_
Forces the width of the table to the specified length or percentage
@@ -856,9 +857,9 @@
A comma- or space-separated list of relative column widths. The
default is equal-width columns (100%/#columns).
- The special value "auto" may be used by writers to decide
- whether to delegate the determination of column widths to the backend
- (LaTeX, the HTML browser, ...).
+ The special value "auto" directs writers to delegate the
+ determination of column widths to the backend (LaTeX, the HTML
+ browser, ...), if possible.
``width`` : `length`_ or `percentage`_
Forces the width of the table to the specified length or percentage
Modified: trunk/docutils/docs/user/config.txt
===================================================================
--- trunk/docutils/docs/user/config.txt 2021-08-10 14:13:35 UTC (rev 8805)
+++ trunk/docutils/docs/user/config.txt 2021-08-10 14:14:13 UTC (rev 8806)
@@ -1205,11 +1205,6 @@
align-left, align-center, align-right
Align the tables
- colwidths-auto
- Delegate the determination of table column widths to the backend
- (leave out the ``<colgroup>`` column specification).
- See also the "widths" option of the `table directive`_.
-
The HTML5 stylesheets also define:
booktabs
@@ -1219,6 +1214,13 @@
Place the table caption below the table
(New in 0.17).
+In addition, the HTML writers support:
+
+ colwidths-auto
+ Delegate the determination of table column widths to the backend
+ (leave out the ``<colgroup>`` column specification).
+ Overridden by the "widths" option of the `table directive`_.
+
Default: "". Option: ``--table-style``.
.. _table directive: ../ref/rst/directives.html#table
@@ -1746,8 +1748,10 @@
standard
Borders around all cells.
+
booktabs
A line above and below the table and one after the head.
+
borderless
No borders.
@@ -1755,9 +1759,8 @@
Align tables.
colwidths-auto, colwidths-given
- Default value for column width determination by
- LaTeX or Docutils.
- Override with the `table directive`_'s :widths: option.
+ Column width determination by LaTeX or Docutils (default).
+ Overridden by the `table directive`_'s :widths: option.
.. warning::
Modified: trunk/docutils/docs/user/latex.txt
===================================================================
--- trunk/docutils/docs/user/latex.txt 2021-08-10 14:13:35 UTC (rev 8805)
+++ trunk/docutils/docs/user/latex.txt 2021-08-10 14:14:13 UTC (rev 8806)
@@ -2082,7 +2082,7 @@
*tablewidth* is set relative to this value. If someone produces documents
with line length of 132 this will lead to suboptimal results.
- You may use the `:width:` option to manually set the table column widths.
+ You may use the `:widths:` option to manually set the table column widths.
* Table: multicol cells are always left aligned.
Modified: trunk/docutils/docutils/writers/latex2e/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/latex2e/__init__.py 2021-08-10 14:13:35 UTC (rev 8805)
+++ trunk/docutils/docutils/writers/latex2e/__init__.py 2021-08-10 14:14:13 UTC (rev 8806)
@@ -6,6 +6,8 @@
"""LaTeX2e document tree Writer."""
+from __future__ import division
+
__docformat__ = 'reStructuredText'
# code contributions from several people included, thanks to all.
@@ -517,6 +519,10 @@
PreambleCmds.table = r"""\usepackage{longtable,ltcaption,array}
\setlength{\extrarowheight}{2pt}
\newlength{\DUtablewidth} % internal use in tables"""
+# if booktabs:
+# \newcommand{\DUcolumnwidth}[1]{\dimexpr #1\DUtablewidth-2\tabcolsep\relax}
+# else:
+# \newcommand{\DUcolumnwidth}[1]{\dimexpr #1\DUtablewidth-2\tabcolsep-\arrayrulewidth\relax}
PreambleCmds.textcomp = r"""\usepackage{textcomp} % text symbol macros"""
# TODO? Options [force,almostfull] prevent spurious error messages,
@@ -829,13 +835,10 @@
def __init__(self, translator, latex_type):
self._translator = translator
self._latex_type = latex_type
- self._open = False
- # miscellaneous attributes
- self._attrs = {}
- self._col_width = []
+
+ self.close()
+ self._colwidths = []
self._rowspan = []
- self.stubs = []
- self.colwidths_auto = False
self._in_thead = 0
def open(self):
@@ -844,6 +847,7 @@
self.caption = []
self._attrs = {}
self._in_head = False # maybe context with search
+
def close(self):
self._open = False
self._col_specs = None
@@ -857,12 +861,9 @@
def set_table_style(self, table_style, classes):
borders = [cls.replace('nolines', 'borderless')
- for cls in table_style+classes
+ for cls in ['standard'] + table_style + classes
if cls in ('standard', 'booktabs', 'borderless', 'nolines')]
- try:
- self.borders = borders[-1]
- except IndexError:
- self.borders = 'standard'
+ self.borders = borders[-1]
self.colwidths_auto = (('colwidths-auto' in classes
and 'colwidths-given' not in table_style)
or ('colwidths-auto' in table_style
@@ -876,6 +877,7 @@
def set(self, attr, value):
self._attrs[attr] = value
+
def get(self, attr):
if attr in self._attrs:
return self._attrs[attr]
@@ -930,35 +932,31 @@
ABC DEF
=== ===
- usually gets to narrow, therefore we add 1 (fiddlefactor).
+ usually gets too narrow, therefore we add 1 (fiddlefactor).
"""
bar = self.get_vertical_bar()
self._rowspan= [0] * len(self._col_specs)
- self._col_width = []
if self.colwidths_auto:
- latex_table_spec = (bar+'l')*len(self._col_specs)
- return latex_table_spec+bar
- width = 80
- total_width = 0.0
- # first see if we get too wide.
- for node in self._col_specs:
- colwidth = float(node['colwidth']+1) / width
- total_width += colwidth
- # donot make it full linewidth
- factor = 0.93
- if total_width > 1.0:
- factor /= total_width
- latex_table_spec = ''
- for node in self._col_specs:
- colwidth = factor * float(node['colwidth']+1) / width
- self._col_width.append(colwidth+0.005)
- latex_table_spec += '%sp{%.3f\\DUtablewidth}' % (bar, colwidth+0.005)
- return latex_table_spec+bar
+ self._colwidths = []
+ latex_colspecs = ['l'] * len(self._col_specs)
+ else:
+ width = 80 # assumed standard line length
+ # first see if we get too wide.
+ total_width = sum(node['colwidth']+1 for node in self._col_specs)
+ # do not make it full linewidth
+ factor = 0.93
+ if total_width > 80:
+ factor *= width / total_width
+ self._colwidths = [(factor * float(node['colwidth']+1)/width)
+ + 0.005 for node in self._col_specs]
+ latex_colspecs = ['p{%.3f\\DUtablewidth}' % colwidth
+ for colwidth in self._colwidths]
+ return bar + bar.join(latex_colspecs) + bar
def get_column_width(self):
"""Return columnwidth for current cell (not multicell)."""
try:
- return '%.2f\\DUtablewidth' % self._col_width[self._cell_in_row]
+ return '%.2f\\DUtablewidth' % self._colwidths[self._cell_in_row]
except IndexError:
return '*'
@@ -966,8 +964,8 @@
"""Return sum of columnwidths for multicell."""
try:
mc_width = sum([width
- for width in ([self._col_width[start + co]
- for co in range (len_)])])
+ for width in ([self._colwidths[start + co]
+ for co in range(len_)])])
return 'p{%.2f\\DUtablewidth}' % mc_width
except IndexError:
return 'l'
@@ -1170,10 +1168,6 @@
self.settings.graphicx_option)
# footnotes: TODO: implement LaTeX footnotes
self.docutils_footnotes = settings.docutils_footnotes
- # @@ table_style: list of values from fixed set: warn?
- # for s in self.settings.table_style:
- # if s not in Writer.table_style_values:
- # self.warn('Ignoring value "%s" in "table-style" setting.' %s)
# Output collection stacks
# ~~~~~~~~~~~~~~~~~~~~~~~~
@@ -2956,7 +2950,7 @@
content = self.out
self.pop_output_collector()
try:
- width = self.to_latex_length(node.attributes['width'])
+ width = self.to_latex_length(node['width'])
except KeyError:
width = r'\linewidth'
if isinstance(node.parent, nodes.compound):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2021-08-10 14:14:29
|
Revision: 8807
http://sourceforge.net/p/docutils/code/8807
Author: milde
Date: 2021-08-10 14:14:24 +0000 (Tue, 10 Aug 2021)
Log Message:
-----------
LaTeX writer: Simpler LaTeX code.
Modified Paths:
--------------
trunk/docutils/docutils/writers/latex2e/__init__.py
trunk/docutils/test/functional/expected/latex_cornercases.tex
trunk/docutils/test/functional/expected/latex_memoir.tex
trunk/docutils/test/functional/expected/standalone_rst_latex.tex
trunk/docutils/test/functional/expected/standalone_rst_xetex.tex
trunk/docutils/test/test_writers/test_latex2e.py
Modified: trunk/docutils/docutils/writers/latex2e/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/latex2e/__init__.py 2021-08-10 14:14:13 UTC (rev 8806)
+++ trunk/docutils/docutils/writers/latex2e/__init__.py 2021-08-10 14:14:24 UTC (rev 8807)
@@ -835,7 +835,7 @@
def __init__(self, translator, latex_type):
self._translator = translator
self._latex_type = latex_type
-
+
self.close()
self._colwidths = []
self._rowspan = []
@@ -1002,8 +1002,8 @@
a.append('\\endfirsthead\n')
else:
a.append('\\endhead\n')
- a.append(r'\multicolumn{%d}{c}' % len(self._col_specs) +
- r'{\hfill ... continued on next page} \\')
+ a.append(r'\multicolumn{%d}{r}' % len(self._col_specs) +
+ r'{... continued on next page} \\')
a.append('\n\\endfoot\n\\endlastfoot\n')
# for longtable one could add firsthead, foot and lastfoot
self._in_thead -= 1
Modified: trunk/docutils/test/functional/expected/latex_cornercases.tex
===================================================================
--- trunk/docutils/test/functional/expected/latex_cornercases.tex 2021-08-10 14:14:13 UTC (rev 8806)
+++ trunk/docutils/test/functional/expected/latex_cornercases.tex 2021-08-10 14:14:24 UTC (rev 8807)
@@ -296,7 +296,7 @@
& \textbf{Description} \\
\hline
\endhead
-\multicolumn{2}{c}{\hfill ... continued on next page} \\
+\multicolumn{2}{r}{... continued on next page} \\
\endfoot
\endlastfoot
\multicolumn{2}{|l|}{multicollumn cell} \\
Modified: trunk/docutils/test/functional/expected/latex_memoir.tex
===================================================================
--- trunk/docutils/test/functional/expected/latex_memoir.tex 2021-08-10 14:14:13 UTC (rev 8806)
+++ trunk/docutils/test/functional/expected/latex_memoir.tex 2021-08-10 14:14:24 UTC (rev 8807)
@@ -988,7 +988,7 @@
} \\
\hline
\endhead
-\multicolumn{2}{c}{\hfill ... continued on next page} \\
+\multicolumn{2}{r}{... continued on next page} \\
\endfoot
\endlastfoot
@@ -1025,7 +1025,7 @@
} \\
\hline
\endhead
-\multicolumn{2}{c}{\hfill ... continued on next page} \\
+\multicolumn{2}{r}{... continued on next page} \\
\endfoot
\endlastfoot
@@ -1062,7 +1062,7 @@
} \\
\hline
\endhead
-\multicolumn{2}{c}{\hfill ... continued on next page} \\
+\multicolumn{2}{r}{... continued on next page} \\
\endfoot
\endlastfoot
@@ -1092,7 +1092,7 @@
\textbf{A} & \textbf{B} & \textbf{A or B} \\
\hline
\endhead
-\multicolumn{3}{c}{\hfill ... continued on next page} \\
+\multicolumn{3}{r}{... continued on next page} \\
\endfoot
\endlastfoot
False & False & False \\
@@ -1577,7 +1577,7 @@
} \\
\hline
\endhead
-\multicolumn{3}{c}{\hfill ... continued on next page} \\
+\multicolumn{3}{r}{... continued on next page} \\
\endfoot
\endlastfoot
@@ -1645,7 +1645,7 @@
} \\
\hline
\endhead
-\multicolumn{3}{c}{\hfill ... continued on next page} \\
+\multicolumn{3}{r}{... continued on next page} \\
\endfoot
\endlastfoot
@@ -1705,7 +1705,7 @@
} \\
\hline
\endhead
-\multicolumn{3}{c}{\hfill ... continued on next page} \\
+\multicolumn{3}{r}{... continued on next page} \\
\endfoot
\endlastfoot
\textbf{%
Modified: trunk/docutils/test/functional/expected/standalone_rst_latex.tex
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_latex.tex 2021-08-10 14:14:13 UTC (rev 8806)
+++ trunk/docutils/test/functional/expected/standalone_rst_latex.tex 2021-08-10 14:14:24 UTC (rev 8807)
@@ -989,7 +989,7 @@
} \\
\hline
\endhead
-\multicolumn{2}{c}{\hfill ... continued on next page} \\
+\multicolumn{2}{r}{... continued on next page} \\
\endfoot
\endlastfoot
@@ -1026,7 +1026,7 @@
} \\
\hline
\endhead
-\multicolumn{2}{c}{\hfill ... continued on next page} \\
+\multicolumn{2}{r}{... continued on next page} \\
\endfoot
\endlastfoot
@@ -1063,7 +1063,7 @@
} \\
\hline
\endhead
-\multicolumn{2}{c}{\hfill ... continued on next page} \\
+\multicolumn{2}{r}{... continued on next page} \\
\endfoot
\endlastfoot
@@ -1093,7 +1093,7 @@
\textbf{A} & \textbf{B} & \textbf{A or B} \\
\hline
\endhead
-\multicolumn{3}{c}{\hfill ... continued on next page} \\
+\multicolumn{3}{r}{... continued on next page} \\
\endfoot
\endlastfoot
False & False & False \\
@@ -1599,7 +1599,7 @@
} \\
\hline
\endhead
-\multicolumn{3}{c}{\hfill ... continued on next page} \\
+\multicolumn{3}{r}{... continued on next page} \\
\endfoot
\endlastfoot
@@ -1667,7 +1667,7 @@
} \\
\hline
\endhead
-\multicolumn{3}{c}{\hfill ... continued on next page} \\
+\multicolumn{3}{r}{... continued on next page} \\
\endfoot
\endlastfoot
@@ -1727,7 +1727,7 @@
} \\
\hline
\endhead
-\multicolumn{3}{c}{\hfill ... continued on next page} \\
+\multicolumn{3}{r}{... continued on next page} \\
\endfoot
\endlastfoot
\textbf{%
Modified: trunk/docutils/test/functional/expected/standalone_rst_xetex.tex
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_xetex.tex 2021-08-10 14:14:13 UTC (rev 8806)
+++ trunk/docutils/test/functional/expected/standalone_rst_xetex.tex 2021-08-10 14:14:24 UTC (rev 8807)
@@ -857,7 +857,7 @@
} \\
\hline
\endhead
-\multicolumn{2}{c}{\hfill ... continued on next page} \\
+\multicolumn{2}{r}{... continued on next page} \\
\endfoot
\endlastfoot
@@ -894,7 +894,7 @@
} \\
\hline
\endhead
-\multicolumn{2}{c}{\hfill ... continued on next page} \\
+\multicolumn{2}{r}{... continued on next page} \\
\endfoot
\endlastfoot
@@ -931,7 +931,7 @@
} \\
\hline
\endhead
-\multicolumn{2}{c}{\hfill ... continued on next page} \\
+\multicolumn{2}{r}{... continued on next page} \\
\endfoot
\endlastfoot
@@ -961,7 +961,7 @@
\textbf{A} & \textbf{B} & \textbf{A or B} \\
\hline
\endhead
-\multicolumn{3}{c}{\hfill ... continued on next page} \\
+\multicolumn{3}{r}{... continued on next page} \\
\endfoot
\endlastfoot
False & False & False \\
@@ -1471,7 +1471,7 @@
} \\
\hline
\endhead
-\multicolumn{3}{c}{\hfill ... continued on next page} \\
+\multicolumn{3}{r}{... continued on next page} \\
\endfoot
\endlastfoot
@@ -1539,7 +1539,7 @@
} \\
\hline
\endhead
-\multicolumn{3}{c}{\hfill ... continued on next page} \\
+\multicolumn{3}{r}{... continued on next page} \\
\endfoot
\endlastfoot
@@ -1599,7 +1599,7 @@
} \\
\hline
\endhead
-\multicolumn{3}{c}{\hfill ... continued on next page} \\
+\multicolumn{3}{r}{... continued on next page} \\
\endfoot
\endlastfoot
\textbf{%
Modified: trunk/docutils/test/test_writers/test_latex2e.py
===================================================================
--- trunk/docutils/test/test_writers/test_latex2e.py 2021-08-10 14:14:13 UTC (rev 8806)
+++ trunk/docutils/test/test_writers/test_latex2e.py 2021-08-10 14:14:24 UTC (rev 8807)
@@ -854,7 +854,7 @@
} & \\
\hline
\endhead
-\multicolumn{2}{c}{\hfill ... continued on next page} \\
+\multicolumn{2}{r}{... continued on next page} \\
\endfoot
\endlastfoot
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2021-08-11 14:34:59
|
Revision: 8809
http://sourceforge.net/p/docutils/code/8809
Author: milde
Date: 2021-08-11 14:34:57 +0000 (Wed, 11 Aug 2021)
Log Message:
-----------
Small documentation update.
Modified Paths:
--------------
trunk/docutils/RELEASE-NOTES.txt
trunk/docutils/docs/ref/rst/directives.txt
Modified: trunk/docutils/RELEASE-NOTES.txt
===================================================================
--- trunk/docutils/RELEASE-NOTES.txt 2021-08-10 14:14:33 UTC (rev 8808)
+++ trunk/docutils/RELEASE-NOTES.txt 2021-08-11 14:34:57 UTC (rev 8809)
@@ -27,14 +27,16 @@
``[role="doc-noteref"]`` instead of ``.footnote-reference``
(see minimal.css for examples).
- - Do not write a <colgroup> specifying relative column widths with the
- deprecated ``<col width="...">``.
+ - Do not specify relative column widths with the
+ deprecated ``<colgroup><col width="...">...``.
- The `html5` writer will default to ``:widths: auto`` and
- use ``style="width: ...%"`` if the "widths" option specifies
- explicite table column widths. Set ``:widths: grid`` to keep
- the current table default widths.
+ The `html5` writer will default to ``:widths: auto`` and use
+ ``style="width: ..%"`` if the `"widths" option`__ sets explicite table
+ column widths. Use ``:widths: grid`` to keep the current default
+ column widths.
+ __ docs/ref/rst/directives.html#table
+
- Move attribution behind the blockquote to comply with the
`"living standard"`__?
(HTML5__ allows <cite> elements inside a blockquote, cf. Example 16.)
Modified: trunk/docutils/docs/ref/rst/directives.txt
===================================================================
--- trunk/docutils/docs/ref/rst/directives.txt 2021-08-10 14:14:33 UTC (rev 8808)
+++ trunk/docutils/docs/ref/rst/directives.txt 2021-08-11 14:34:57 UTC (rev 8809)
@@ -777,13 +777,12 @@
``widths`` : "auto", "grid", or a list of integers
A comma- or space-separated list of column widths.
- Defaults to the widths of the input columns in characters.
+ Default is "grid", the widths of the input columns in characters.
- The special value "auto" directs writers to delegate the
- determination of column widths to the backend (LaTeX, the HTML
- browser, ...), if possible. "grid" forces the default behaviour
- (overwriting a `table_style`_ configuration setting value
- "colwidths-auto").
+ The value "auto" directs writers to delegate the determination of
+ column widths to the backend (LaTeX, the HTML browser, ...), if possible.
+ The value "grid" overrules a `table_style`_ configuration setting
+ value "colwidths-auto".
``width`` : `length`_ or `percentage`_
Forces the width of the table to the specified length or percentage
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2021-09-07 21:02:52
|
Revision: 8820
http://sourceforge.net/p/docutils/code/8820
Author: milde
Date: 2021-09-07 21:02:50 +0000 (Tue, 07 Sep 2021)
Log Message:
-----------
Fix #423 Code blocks in sidebars cause LaTeX errors.
Do not use the "alltt" enviromnent in sidebars.
In admonitions and system-messages, "alltt" is used
unless the "legacy-class-functions" setting is True.
(Admonitions and system-messages are implemented as
environments since rev 8479.)
Thanks to Clement Pit-Claudel for reporting.
Revision Links:
--------------
http://sourceforge.net/p/docutils/code/8479
Modified Paths:
--------------
trunk/docutils/docutils/writers/latex2e/__init__.py
trunk/docutils/test/functional/expected/latex_literal_block.tex
trunk/docutils/test/functional/expected/latex_literal_block_fancyvrb.tex
trunk/docutils/test/functional/expected/latex_literal_block_listings.tex
trunk/docutils/test/functional/expected/latex_literal_block_verbatim.tex
trunk/docutils/test/functional/expected/latex_literal_block_verbatimtab.tex
trunk/docutils/test/functional/input/latex_literal_block.txt
Modified: trunk/docutils/docutils/writers/latex2e/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/latex2e/__init__.py 2021-08-23 15:57:34 UTC (rev 8819)
+++ trunk/docutils/docutils/writers/latex2e/__init__.py 2021-09-07 21:02:50 UTC (rev 8820)
@@ -2499,8 +2499,10 @@
# TODO: fails if normal text precedes the literal block.
# Check parent node instead?
_autowidth_table = _in_table and self.active_table.colwidths_auto
- _use_env = _plaintext and not isinstance(node.parent,
- (nodes.footnote, nodes.admonition, nodes.system_message))
+ _no_env_nodes = (nodes.footnote, nodes.sidebar)
+ if self.settings.legacy_class_functions:
+ _no_env_nodes += (nodes.admonition, nodes.system_message)
+ _use_env = _plaintext and not isinstance(node.parent, _no_env_nodes)
_use_listings = (literal_env == 'lstlisting') and _use_env
# Labels and classes:
Modified: trunk/docutils/test/functional/expected/latex_literal_block.tex
===================================================================
--- trunk/docutils/test/functional/expected/latex_literal_block.tex 2021-08-23 15:57:34 UTC (rev 8819)
+++ trunk/docutils/test/functional/expected/latex_literal_block.tex 2021-09-07 21:02:50 UTC (rev 8820)
@@ -6,6 +6,7 @@
\usepackage[utf8]{inputenc}
\usepackage{alltt}
\usepackage{amsmath}
+\usepackage{color}
\usepackage{graphicx}
\usepackage{longtable,ltcaption,array}
\setlength{\extrarowheight}{2pt}
@@ -106,12 +107,22 @@
A literal block in an admonition:
\begin{quote}
-\ttfamily\raggedright
-\textbackslash{}sin\textasciicircum{}2~x
+\begin{alltt}
+\textbackslash{}sin^2 x
+\end{alltt}
\end{quote}
\end{DUadmonition}
\end{DUclass}
+\DUsidebar{
+\DUtitle{Literal Block in a Sidebar}
+
+\begin{quote}
+\ttfamily\raggedright
+\textbackslash{}sin\textasciicircum{}2~x
+\end{quote}
+}
+
Parsed literal block with inline markup and leading whitespace:
\begin{quote}
Modified: trunk/docutils/test/functional/expected/latex_literal_block_fancyvrb.tex
===================================================================
--- trunk/docutils/test/functional/expected/latex_literal_block_fancyvrb.tex 2021-08-23 15:57:34 UTC (rev 8819)
+++ trunk/docutils/test/functional/expected/latex_literal_block_fancyvrb.tex 2021-09-07 21:02:50 UTC (rev 8820)
@@ -5,6 +5,7 @@
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
+\usepackage{color}
\usepackage{graphicx}
\usepackage{fancyvrb}
\usepackage{longtable,ltcaption,array}
@@ -106,12 +107,22 @@
A literal block in an admonition:
\begin{quote}
-\ttfamily\raggedright
-\textbackslash{}sin\textasciicircum{}2~x
+\begin{Verbatim}
+\sin^2 x
+\end{Verbatim}
\end{quote}
\end{DUadmonition}
\end{DUclass}
+\DUsidebar{
+\DUtitle{Literal Block in a Sidebar}
+
+\begin{quote}
+\ttfamily\raggedright
+\textbackslash{}sin\textasciicircum{}2~x
+\end{quote}
+}
+
Parsed literal block with inline markup and leading whitespace:
\begin{quote}
Modified: trunk/docutils/test/functional/expected/latex_literal_block_listings.tex
===================================================================
--- trunk/docutils/test/functional/expected/latex_literal_block_listings.tex 2021-08-23 15:57:34 UTC (rev 8819)
+++ trunk/docutils/test/functional/expected/latex_literal_block_listings.tex 2021-09-07 21:02:50 UTC (rev 8820)
@@ -5,6 +5,7 @@
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
+\usepackage{color}
\usepackage{graphicx}
\usepackage{listings}
\lstset{xleftmargin=\leftmargin}
@@ -110,12 +111,20 @@
A literal block in an admonition:
+\begin{lstlisting}
+\sin^2 x
+\end{lstlisting}
+\end{DUadmonition}
+\end{DUclass}
+
+\DUsidebar{
+\DUtitle{Literal Block in a Sidebar}
+
\begin{quote}
\ttfamily\raggedright
\textbackslash{}sin\textasciicircum{}2~x
\end{quote}
-\end{DUadmonition}
-\end{DUclass}
+}
Parsed literal block with inline markup and leading whitespace:
Modified: trunk/docutils/test/functional/expected/latex_literal_block_verbatim.tex
===================================================================
--- trunk/docutils/test/functional/expected/latex_literal_block_verbatim.tex 2021-08-23 15:57:34 UTC (rev 8819)
+++ trunk/docutils/test/functional/expected/latex_literal_block_verbatim.tex 2021-09-07 21:02:50 UTC (rev 8820)
@@ -5,6 +5,7 @@
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
+\usepackage{color}
\usepackage{graphicx}
\usepackage{longtable,ltcaption,array}
\setlength{\extrarowheight}{2pt}
@@ -105,12 +106,22 @@
A literal block in an admonition:
\begin{quote}
-\ttfamily\raggedright
-\textbackslash{}sin\textasciicircum{}2~x
+\begin{verbatim}
+\sin^2 x
+\end{verbatim}
\end{quote}
\end{DUadmonition}
\end{DUclass}
+\DUsidebar{
+\DUtitle{Literal Block in a Sidebar}
+
+\begin{quote}
+\ttfamily\raggedright
+\textbackslash{}sin\textasciicircum{}2~x
+\end{quote}
+}
+
Parsed literal block with inline markup and leading whitespace:
\begin{quote}
Modified: trunk/docutils/test/functional/expected/latex_literal_block_verbatimtab.tex
===================================================================
--- trunk/docutils/test/functional/expected/latex_literal_block_verbatimtab.tex 2021-08-23 15:57:34 UTC (rev 8819)
+++ trunk/docutils/test/functional/expected/latex_literal_block_verbatimtab.tex 2021-09-07 21:02:50 UTC (rev 8820)
@@ -5,6 +5,7 @@
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
+\usepackage{color}
\usepackage{graphicx}
\usepackage{moreverb}
\usepackage{longtable,ltcaption,array}
@@ -106,12 +107,22 @@
A literal block in an admonition:
\begin{quote}
-\ttfamily\raggedright
-\textbackslash{}sin\textasciicircum{}2~x
+\begin{verbatimtab}
+\sin^2 x
+\end{verbatimtab}
\end{quote}
\end{DUadmonition}
\end{DUclass}
+\DUsidebar{
+\DUtitle{Literal Block in a Sidebar}
+
+\begin{quote}
+\ttfamily\raggedright
+\textbackslash{}sin\textasciicircum{}2~x
+\end{quote}
+}
+
Parsed literal block with inline markup and leading whitespace:
\begin{quote}
Modified: trunk/docutils/test/functional/input/latex_literal_block.txt
===================================================================
--- trunk/docutils/test/functional/input/latex_literal_block.txt 2021-08-23 15:57:34 UTC (rev 8819)
+++ trunk/docutils/test/functional/input/latex_literal_block.txt 2021-09-07 21:02:50 UTC (rev 8820)
@@ -1,6 +1,6 @@
In LaTeX, literal blocks can be customized with the "literal-block-env"
setting. This test file exists to check if the LaTeX writer output compiles
-and looks as expected.
+and looks as expected.
Start with a plain literal block::
@@ -44,6 +44,12 @@
\sin^2 x
+.. sidebar:: Literal Block in a Sidebar
+
+ ::
+
+ \sin^2 x
+
.. role:: custom
.. role:: custom-role
@@ -69,10 +75,10 @@
:custom:`custom` :custom-role:`roles`, and explicit roles for
:title:`Docutils`' :emphasis:`standard` :strong:`inline` :literal:`markup`.
-.. [*] This footnote is referenced in a `parsed literal` block.
-
+.. [*] This footnote is referenced in a `parsed literal` block.
+
It contains a literal block::
-
+
\sin^2 x
.. [CIT2002] Sample Citation, 2017.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2021-09-11 11:17:47
|
Revision: 8821
http://sourceforge.net/p/docutils/code/8821
Author: milde
Date: 2021-09-11 11:17:44 +0000 (Sat, 11 Sep 2021)
Log Message:
-----------
Add "class" option to "raw" directive.
Classe values may already be specified via a preceding
"class" directive. This commit provides the concise alternative
known from other directives.
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/docs/ref/rst/directives.txt
trunk/docutils/docutils/parsers/rst/directives/misc.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2021-09-07 21:02:50 UTC (rev 8820)
+++ trunk/docutils/HISTORY.txt 2021-09-11 11:17:44 UTC (rev 8821)
@@ -40,6 +40,8 @@
- `Meta` directive class (moved from html.py) inserts `meta`
(instead of `pending`) nodes.
+ - Add `class` option to `Raw` directive.
+
* docutils/tools/math/math2html.py,
docutils/tools/math/tex2unicode.py,
docutils/writers/html5/math.css
Modified: trunk/docutils/docs/ref/rst/directives.txt
===================================================================
--- trunk/docutils/docs/ref/rst/directives.txt 2021-09-07 21:02:50 UTC (rev 8820)
+++ trunk/docutils/docs/ref/rst/directives.txt 2021-09-11 11:17:44 UTC (rev 8821)
@@ -1484,7 +1484,7 @@
:Directive Type: "raw"
:Doctree Element: raw_
:Directive Arguments: One or more, required (output format types).
-:Directive Options: Possible.
+:Directive Options: Possible (see below).
:Directive Content: Stored verbatim, uninterpreted. None (empty) if a
"file" or "url" option given.
:Configuration Setting: raw_enabled_
@@ -1554,6 +1554,9 @@
The text encoding of the external raw data (file or URL).
Defaults to the document's encoding (if specified).
+and the common option `:class:`_.
+
+
.. _"raw" role: roles.html#raw
Modified: trunk/docutils/docutils/parsers/rst/directives/misc.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/directives/misc.py 2021-09-07 21:02:50 UTC (rev 8820)
+++ trunk/docutils/docutils/parsers/rst/directives/misc.py 2021-09-11 11:17:44 UTC (rev 8821)
@@ -216,7 +216,8 @@
final_argument_whitespace = True
option_spec = {'file': directives.path,
'url': directives.uri,
- 'encoding': directives.encoding}
+ 'encoding': directives.encoding,
+ 'class': directives.class_option}
has_content = True
def run(self):
@@ -288,7 +289,8 @@
else:
# This will always fail because there is no content.
self.assert_has_content()
- raw_node = nodes.raw('', text, **attributes)
+ raw_node = nodes.raw('', text, classes=self.options.get('class', []),
+ **attributes)
(raw_node.source,
raw_node.line) = self.state_machine.get_source_and_line(self.lineno)
return [raw_node]
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2021-09-11 11:18:06
|
Revision: 8823
http://sourceforge.net/p/docutils/code/8823
Author: milde
Date: 2021-09-11 11:18:03 +0000 (Sat, 11 Sep 2021)
Log Message:
-----------
LaTeX writer: no newline before raw directives in compound blocks.
Based on patch 3 in patches #183 by Clement Pit-Claudel.
Modified Paths:
--------------
trunk/docutils/docutils/writers/latex2e/__init__.py
trunk/docutils/test/test_writers/test_latex2e.py
Modified: trunk/docutils/docutils/writers/latex2e/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/latex2e/__init__.py 2021-09-11 11:17:53 UTC (rev 8822)
+++ trunk/docutils/docutils/writers/latex2e/__init__.py 2021-09-11 11:18:03 UTC (rev 8823)
@@ -2713,7 +2713,8 @@
def visit_raw(self, node):
if not 'latex' in node.get('format', '').split():
raise nodes.SkipNode
- if not self.is_inline(node):
+ if not (self.is_inline(node)
+ or isinstance(node.parent, nodes.compound)):
self.out.append('\n')
self.visit_inline(node)
# append "as-is" skipping any LaTeX-encoding
Modified: trunk/docutils/test/test_writers/test_latex2e.py
===================================================================
--- trunk/docutils/test/test_writers/test_latex2e.py 2021-09-11 11:17:53 UTC (rev 8822)
+++ trunk/docutils/test/test_writers/test_latex2e.py 2021-09-11 11:18:03 UTC (rev 8823)
@@ -188,7 +188,7 @@
-------
Paragraph 2.
""",
-## # expected output
+# expected output
head_template.substitute(dict(parts,
requirements=parts['requirements'] + '\\setcounter{secnumdepth}{0}\n',
fallbacks=r"""
@@ -235,7 +235,7 @@
.. [3] 1. enumeration
""",
-## # expected output
+# expected output
head_template.substitute(dict(parts,
fallbacks=r"""
% numerical or symbol footnotes with hyperlinks and backlinks
@@ -276,7 +276,7 @@
first section
-------------
""",
-## # expected output
+# expected output
head_template.substitute(dict(parts,
requirements=parts['requirements'] + '\\setcounter{secnumdepth}{0}\n'
)) + r"""
@@ -302,7 +302,7 @@
first section
-------------
""",
-## # expected output
+# expected output
head_template.substitute(dict(parts,
requirements=parts['requirements'] + '\\setcounter{secnumdepth}{0}\n'
)) + r"""
@@ -328,7 +328,7 @@
first section
-------------
""",
-## # expected output
+# expected output
head_template.substitute(dict(parts,
requirements=parts['requirements'] + '\\setcounter{secnumdepth}{0}\n'
)) + r"""
@@ -356,7 +356,7 @@
first chapter
-------------
""",
-## # expected output
+# expected output
head_template.substitute(dict(parts,
head_prefix=r"""\documentclass[a4paper]{book}
""",
@@ -386,7 +386,7 @@
first section
-------------
""",
-## # expected output
+# expected output
head_template.substitute(dict(parts, requirements = parts['requirements'] +
r"""\setcounter{secnumdepth}{0}
""")) + r"""
@@ -411,7 +411,7 @@
first section
-------------
""",
-## # expected output
+# expected output
head_template.substitute(dict(parts,
requirements=parts['requirements'] + '\\setcounter{secnumdepth}{0}\n'
)) + r"""
@@ -434,7 +434,7 @@
.. [my_cite2006]
The underscore is mishandled.
""",
-## # expected output
+# expected output
head + r"""
Just a test citation \cite{my_cite2006}.
@@ -1009,6 +1009,40 @@
\end{document}
"""],
+[r""".. compound::
+
+ Compound paragraph
+
+ .. raw:: LaTeX
+
+ raw LaTeX block
+
+ compound paragraph continuation.
+""",
+head_template.substitute(
+ dict(parts,
+ fallbacks = r"""
+% class handling for environments (block-level elements)
+% \begin{DUclass}{spam} tries \DUCLASSspam and
+% \end{DUclass}{spam} tries \endDUCLASSspam
+\ifx\DUclass\undefined % poor man's "provideenvironment"
+ \newenvironment{DUclass}[1]%
+ {% "#1" does not work in end-part of environment.
+ \def\DocutilsClassFunctionName{DUCLASS#1}
+ \csname \DocutilsClassFunctionName \endcsname}%
+ {\csname end\DocutilsClassFunctionName \endcsname}%
+\fi
+"""
+ )
+) + r"""
+\begin{DUclass}{compound}
+Compound paragraph
+raw LaTeX block
+compound paragraph continuation.
+\end{DUclass}
+
+\end{document}
+"""],
]
totest['title_with_inline_markup'] = [
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2021-09-11 11:18:18
|
Revision: 8824
http://sourceforge.net/p/docutils/code/8824
Author: milde
Date: 2021-09-11 11:18:15 +0000 (Sat, 11 Sep 2021)
Log Message:
-----------
LaTeX writer: code cleanup and small fixes.
Fix newlines after/before ids_to_labels() (cf. patch #183).
Refactor/revise ToC writing.
Don't write `\phantomsection`, if a local ToC is skipped.
Functional test for "--use-docutils-toc" in XeTeX writer test).
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/docutils/writers/latex2e/__init__.py
trunk/docutils/test/functional/expected/latex_memoir.tex
trunk/docutils/test/functional/expected/standalone_rst_latex.tex
trunk/docutils/test/functional/expected/standalone_rst_xetex.tex
trunk/docutils/test/functional/tests/standalone_rst_xetex.py
trunk/docutils/test/test_writers/test_latex2e.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2021-09-11 11:18:03 UTC (rev 8823)
+++ trunk/docutils/HISTORY.txt 2021-09-11 11:18:15 UTC (rev 8824)
@@ -109,7 +109,11 @@
- Apply patch #181 "Fix tocdepth when chapter/part in use" by
John Thorvald Wodder II.
+
+ - Fix newlines after/before ids_to_labels() (cf. patch #183).
+ - Refactor/revise ToC writing.
+
* docutils/writers/latex2e/docutils.sty
- Fix excessive padding above sidebar titles.
Modified: trunk/docutils/docutils/writers/latex2e/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/latex2e/__init__.py 2021-09-11 11:18:03 UTC (rev 8823)
+++ trunk/docutils/docutils/writers/latex2e/__init__.py 2021-09-11 11:18:15 UTC (rev 8824)
@@ -1519,9 +1519,8 @@
If `set_anchor` is True, an anchor is set with \\phantomsection.
If `protect` is True, the \\label cmd is made robust.
"""
- labels = ['\\label{%s}' % id for id in node['ids']]
- if protect:
- labels = ['\\protect'+label for label in labels]
+ prefix = '\\protect' if protect else ''
+ labels = [prefix + '\\label{%s}' % id for id in node['ids']]
if set_anchor and labels:
labels.insert(0, '\\phantomsection')
return labels
@@ -1597,13 +1596,12 @@
break
else:
return ''
+ if isinstance(child, (nodes.container, nodes.compound)):
+ return self.term_postfix(child)
if isinstance(child, (nodes.image)):
return '\\leavevmode\n' # Images get an additional newline.
- if isinstance(child, (nodes.container, nodes.compound)):
- return self.term_postfix(child)
- if not isinstance(child,
- (nodes.paragraph, nodes.math_block)):
- return r'\leavevmode'
+ if not isinstance(child, (nodes.paragraph, nodes.math_block)):
+ return '\\leavevmode'
return ''
# Visitor methods
@@ -2064,7 +2062,7 @@
else:
self.context.append('')
- # if line ends with '{', mask line break to prevent spurious whitespace
+ # if line ends with '{', mask line break
if (not self.active_table.colwidths_auto
and self.out[-1].endswith("{")
and node.astext()):
@@ -2228,8 +2226,8 @@
(node['ids'][0], backref, self.encode(num)))
if node['ids'] == node['names']:
self.out += self.ids_to_labels(node)
- # mask newline to prevent spurious whitespace if paragraph follows:
- if node[1:] and isinstance(node[1], nodes.paragraph):
+ # prevent spurious whitespace if footnote starts with paragraph:
+ if len(node) > 1 and isinstance(node[1], nodes.paragraph):
self.out.append('%')
# TODO: "real" LaTeX \footnote{}s (see visit_footnotes_reference())
@@ -2496,9 +2494,9 @@
_use_listings = (literal_env == 'lstlisting') and _use_env
# Labels and classes:
+ self.duclass_open(node)
if node['ids']:
- self.out += ['\n'] + self.ids_to_labels(node)
- self.duclass_open(node)
+ self.out += self.ids_to_labels(node) + ['\n']
# Highlight code?
if (not _plaintext
and 'code' in node['classes']
@@ -3082,7 +3080,7 @@
if (level > len(self.d_class.sections)
and not self.settings.legacy_class_functions):
self.context[-1] += '\\end{DUclass}\n'
- # MAYBE postfix paragraph and subparagraph with \leavemode to
+ # MAYBE postfix paragraph and subparagraph with \leavevmode to
# ensure floats stay in the section and text starts on a new line.
def depart_title(self, node):
@@ -3090,76 +3088,88 @@
if isinstance(node.parent, (nodes.table, nodes.document)):
self.pop_output_collector()
- def minitoc(self, node, title, depth):
- """Generate a local table of contents with LaTeX package minitoc"""
- section_name = self.d_class.section(self.section_level)
- # name-prefix for current section level
- minitoc_names = {'part': 'part', 'chapter': 'mini'}
- if 'chapter' not in self.d_class.sections:
- minitoc_names['section'] = 'sect'
- try:
- minitoc_name = minitoc_names[section_name]
- except KeyError: # minitoc only supports part- and toplevel
- self.warn('Skipping local ToC at %s level.\n' % section_name +
- ' Feature not supported with option "use-latex-toc"',
- base_node=node)
+ def visit_contents(self, node):
+ """Write the table of contents.
+
+ Called from visit_topic() for "contents" topics.
+ """
+ # requirements/setup for local ToC with package "minitoc",
+ if self.use_latex_toc and 'local' in node['classes']:
+ section_name = self.d_class.section(self.section_level)
+ # minitoc only supports "part" and toplevel sections
+ minitoc_names = {'part': 'part',
+ 'chapter': 'mini',
+ 'section': 'sect'}
+ if 'chapter' in self.d_class.sections:
+ del(minitoc_names['section'])
+ try:
+ mtc_name = minitoc_names[section_name]
+ except KeyError:
+ self.warn('Skipping local ToC at "%s" level.\n'
+ ' Feature not supported with option "use-latex-toc"'
+ % section_name, base_node=node)
+ raise nodes.SkipNode
+
+ # labels and PDF bookmark (sidebar entry)
+ self.out.append('\n') # start new paragraph
+ if node['names']: # don't add labels for auto-ids
+ self.out += self.ids_to_labels(node) + ['\n']
+ if (isinstance(node.next_node(), nodes.title)
+ and 'local' not in node['classes']
+ and self.settings.documentclass != 'memoir'):
+ self.out.append('\\pdfbookmark[%d]{%s}{%s}\n' %
+ (self.section_level+1,
+ node.next_node().astext(),
+ node.get('ids', ['contents'])[0]
+ ))
+
+ # Docutils generated contents list (no page numbers)
+ if not self.use_latex_toc:
+ # set flag for visit_bullet_list()
+ self.is_toc_list = True
return
- # Requirements/Setup
- self.requirements['minitoc'] = PreambleCmds.minitoc
- self.requirements['minitoc-'+minitoc_name] = (r'\do%stoc' %
- minitoc_name)
- # depth: (Docutils defaults to unlimited depth)
+
+ # ToC by LaTeX
+ depth = node.get('depth', 0)
maxdepth = len(self.d_class.sections)
- self.requirements['minitoc-%s-depth' % minitoc_name] = (
- r'\mtcsetdepth{%stoc}{%d}' % (minitoc_name, maxdepth))
- # Process 'depth' argument (!Docutils stores a relative depth while
- # minitoc expects an absolute depth!):
- offset = {'sect': 1, 'mini': 0, 'part': 0}
- if 'chapter' in self.d_class.sections:
- offset['part'] = -1
- if depth:
- self.out.append('\\setcounter{%stocdepth}{%d}' %
- (minitoc_name, depth + offset[minitoc_name]))
- # title:
- self.out.append('\\mtcsettitle{%stoc}{%s}\n' % (minitoc_name, title))
- # the toc-generating command:
- self.out.append('\\%stoc\n' % minitoc_name)
+ if isinstance(node.next_node(), nodes.title):
+ title = self.encode(node[0].astext())
+ else:
+ title = ''
+ if 'local' in node['classes']:
+ # use the "minitoc" package
+ self.requirements['minitoc'] = PreambleCmds.minitoc
+ self.requirements['minitoc-'+mtc_name] = r'\do%stoc'%mtc_name
+ self.requirements['minitoc-%s-depth' % mtc_name] = (
+ r'\mtcsetdepth{%stoc}{%d}' % (mtc_name, maxdepth))
+ # "depth" option: Docutils stores a relative depth while
+ # minitoc expects an absolute depth!:
+ offset = {'sect': 1, 'mini': 0, 'part': 0}
+ if 'chapter' in self.d_class.sections:
+ offset['part'] = -1
+ if depth:
+ self.out.append('\\setcounter{%stocdepth}{%d}' %
+ (mtc_name, depth + offset[mtc_name]))
+ # title:
+ self.out.append('\\mtcsettitle{%stoc}{%s}\n' % (mtc_name, title))
+ # the toc-generating command:
+ self.out.append('\\%stoc\n' % mtc_name)
+ else:
+ if depth:
+ self.out.append('\\setcounter{tocdepth}{%d}\n'
+ % self.d_class.latex_section_depth(depth))
+ if title != 'Contents':
+ self.out.append('\\renewcommand{\\contentsname}{%s}\n' % title)
+ self.out.append('\\tableofcontents\n')
+ self.has_latex_toc = True
+ # ignore rest of node content
+ raise nodes.SkipNode
def visit_topic(self, node):
# Topic nodes can be generic topic, abstract, dedication, or ToC.
# table of contents:
if 'contents' in node['classes']:
- self.out.append('\n')
- self.out += self.ids_to_labels(node)
- # add contents to PDF bookmarks sidebar
- if (isinstance(node.next_node(), nodes.title)
- and self.settings.documentclass != 'memoir'):
- self.out.append('\n\\pdfbookmark[%d]{%s}{%s}' %
- (self.section_level+1,
- node.next_node().astext(),
- node.get('ids', ['contents'])[0]
- ))
- if self.use_latex_toc:
- title = ''
- if isinstance(node.next_node(), nodes.title):
- title = self.encode(node.pop(0).astext())
- depth = node.get('depth', 0)
- if 'local' in node['classes']:
- self.minitoc(node, title, depth)
- return
- if depth:
- self.out.append('\n\\setcounter{tocdepth}{%d}\n'
- % self.d_class.latex_section_depth(depth))
- if title != 'Contents':
- self.out.append('\n\\renewcommand{\\contentsname}{%s}'
- % title)
- self.out.append('\n\\tableofcontents\n')
- self.has_latex_toc = True
- # ignore rest of node content
- raise nodes.SkipNode
- else: # Docutils generated contents list
- # set flag for visit_bullet_list() and visit_title()
- self.is_toc_list = True
+ self.visit_contents(node)
elif ('abstract' in node['classes'] and
self.settings.use_latex_abstract):
self.push_output_collector(self.abstract)
Modified: trunk/docutils/test/functional/expected/latex_memoir.tex
===================================================================
--- trunk/docutils/test/functional/expected/latex_memoir.tex 2021-09-11 11:18:03 UTC (rev 8823)
+++ trunk/docutils/test/functional/expected/latex_memoir.tex 2021-09-11 11:18:15 UTC (rev 8824)
@@ -804,7 +804,6 @@
\label{directives}%
}
-\phantomsection\label{contents}
These are just a sample of the many reStructuredText Directives. For
others, please see \href{https://docutils.sourceforge.io/docs/ref/rst/directives.html}{reStructuredText Directives}\DUfootnotemark{footnote-reference-18}{footnote-10}{9}.
Modified: trunk/docutils/test/functional/expected/standalone_rst_latex.tex
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_latex.tex 2021-09-11 11:18:03 UTC (rev 8823)
+++ trunk/docutils/test/functional/expected/standalone_rst_latex.tex 2021-09-11 11:18:15 UTC (rev 8824)
@@ -805,7 +805,6 @@
\label{directives}%
}
-\phantomsection\label{contents}
These are just a sample of the many reStructuredText Directives. For
others, please see \href{https://docutils.sourceforge.io/docs/ref/rst/directives.html}{reStructuredText Directives}\DUfootnotemark{footnote-reference-18}{footnote-10}{9}.
Modified: trunk/docutils/test/functional/expected/standalone_rst_xetex.tex
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_xetex.tex 2021-09-11 11:18:03 UTC (rev 8823)
+++ trunk/docutils/test/functional/expected/standalone_rst_xetex.tex 2021-09-11 11:18:15 UTC (rev 8824)
@@ -142,10 +142,132 @@
\phantomsection\label{table-of-contents}
\pdfbookmark[1]{Table of Contents}{table-of-contents}
-\renewcommand{\contentsname}{Table of Contents}
-\tableofcontents
+\DUtitle{Table of Contents}
+\begin{DUclass}{auto-toc}
+\begin{list}{}{}
+\item \hyperref[structural-elements]{1 Structural Elements}
+
+\begin{DUclass}{auto-toc}
+\begin{list}{}{}
+\item \hyperref[section-title]{1.1 Section Title}
+
+\item \hyperref[empty-section]{1.2 Empty Section}
+
+\item \hyperref[transitions]{1.3 Transitions}
+\end{list}
+\end{DUclass}
+
+\item \hyperref[body-elements]{2 Body Elements}
+
+\begin{DUclass}{auto-toc}
+\begin{list}{}{}
+\item \hyperref[paragraphs]{2.1 Paragraphs}
+
+\begin{DUclass}{auto-toc}
+\begin{list}{}{}
+\item \hyperref[inline-markup]{2.1.1 Inline Markup}
+\end{list}
+\end{DUclass}
+
+\item \hyperref[bullet-lists]{2.2 Bullet Lists}
+
+\item \hyperref[enumerated-lists]{2.3 Enumerated Lists}
+
+\item \hyperref[definition-lists]{2.4 Definition Lists}
+
+\item \hyperref[field-lists]{2.5 Field Lists}
+
+\item \hyperref[option-lists]{2.6 Option Lists}
+
+\item \hyperref[literal-blocks]{2.7 Literal Blocks}
+
+\item \hyperref[line-blocks]{2.8 Line Blocks}
+
+\item \hyperref[block-quotes]{2.9 Block Quotes}
+
+\item \hyperref[doctest-blocks]{2.10 Doctest Blocks}
+
+\item \hyperref[footnotes]{2.11 Footnotes}
+
+\item \hyperref[citations]{2.12 Citations}
+
+\item \hyperref[targets]{2.13 Targets}
+
+\begin{DUclass}{auto-toc}
+\begin{list}{}{}
+\item \hyperref[duplicate-target-names]{2.13.1 Duplicate Target Names}
+
+\item \hyperref[duplicate-target-names-1]{2.13.2 Duplicate Target Names}
+\end{list}
+\end{DUclass}
+
+\item \hyperref[directives]{2.14 Directives}
+
+\begin{DUclass}{auto-toc}
+\begin{list}{}{}
+\item \hyperref[document-parts]{2.14.1 Document Parts}
+
+\item \hyperref[images-and-figures]{2.14.2 Images and Figures}
+
+\item \hyperref[tables]{2.14.3 Tables}
+
+\item \hyperref[admonitions]{2.14.4 Admonitions}
+
+\item \hyperref[topics-sidebars-and-rubrics]{2.14.5 Topics, Sidebars, and Rubrics}
+
+\item \hyperref[target-footnotes]{2.14.6 Target Footnotes}
+
+\item \hyperref[replacement-text]{2.14.7 Replacement Text}
+
+\item \hyperref[compound-paragraph]{2.14.8 Compound Paragraph}
+
+\item \hyperref[parsed-literal-blocks]{2.14.9 Parsed Literal Blocks}
+
+\item \hyperref[code]{2.14.10 Code}
+
+\item \hyperref[meta]{2.14.11 Meta}
+\end{list}
+\end{DUclass}
+
+\item \hyperref[substitution-definitions]{2.15 Substitution Definitions}
+
+\item \hyperref[comments]{2.16 Comments}
+
+\item \hyperref[raw-text]{2.17 Raw text}
+
+\item \hyperref[container]{2.18 Container}
+
+\item \hyperref[colspanning-tables]{2.19 Colspanning tables}
+
+\item \hyperref[rowspanning-tables]{2.20 Rowspanning tables}
+
+\item \hyperref[list-tables]{2.21 List Tables}
+
+\item \hyperref[custom-roles]{2.22 Custom Roles}
+
+\item \hyperref[mathematics]{2.23 Mathematics}
+\end{list}
+\end{DUclass}
+
+\item \hyperref[tests-for-the-latex-writer]{3 Tests for the LaTeX writer}
+
+\begin{DUclass}{auto-toc}
+\begin{list}{}{}
+\item \hyperref[custom-roles-in-latex]{3.1 Custom Roles in LaTeX}
+
+\item \hyperref[class-handling]{3.2 class handling}
+\end{list}
+\end{DUclass}
+
+\item \hyperref[tests-for-the-xetex-writer]{4 Tests for the XeTeX writer}
+
+\item \hyperref[error-handling]{5 Error Handling}
+\end{list}
+\end{DUclass}
+
+
\section{1 Structural Elements%
\label{structural-elements}%
}
@@ -674,6 +796,33 @@
}
\phantomsection\label{contents}
+
+\begin{DUclass}{auto-toc}
+\begin{list}{}{}
+\item \hyperref[document-parts]{2.14.1 Document Parts}
+
+\item \hyperref[images-and-figures]{2.14.2 Images and Figures}
+
+\item \hyperref[tables]{2.14.3 Tables}
+
+\item \hyperref[admonitions]{2.14.4 Admonitions}
+
+\item \hyperref[topics-sidebars-and-rubrics]{2.14.5 Topics, Sidebars, and Rubrics}
+
+\item \hyperref[target-footnotes]{2.14.6 Target Footnotes}
+
+\item \hyperref[replacement-text]{2.14.7 Replacement Text}
+
+\item \hyperref[compound-paragraph]{2.14.8 Compound Paragraph}
+
+\item \hyperref[parsed-literal-blocks]{2.14.9 Parsed Literal Blocks}
+
+\item \hyperref[code]{2.14.10 Code}
+
+\item \hyperref[meta]{2.14.11 Meta}
+\end{list}
+\end{DUclass}
+
These are just a sample of the many reStructuredText Directives. For
others, please see \href{https://docutils.sourceforge.io/docs/ref/rst/directives.html}{reStructuredText Directives}\DUfootnotemark{footnote-reference-19}{footnote-11}{10}.
Modified: trunk/docutils/test/functional/tests/standalone_rst_xetex.py
===================================================================
--- trunk/docutils/test/functional/tests/standalone_rst_xetex.py 2021-09-11 11:18:03 UTC (rev 8823)
+++ trunk/docutils/test/functional/tests/standalone_rst_xetex.py 2021-09-11 11:18:15 UTC (rev 8824)
@@ -13,3 +13,5 @@
settings_overrides['smart_quotes'] = True
# use docutils.sty and up-to-date class functions:
settings_overrides['stylesheet'] = 'docutils'
+# Test the ToC generation by Docutils:
+settings_overrides['use_latex_toc'] = False
Modified: trunk/docutils/test/test_writers/test_latex2e.py
===================================================================
--- trunk/docutils/test/test_writers/test_latex2e.py 2021-09-11 11:18:03 UTC (rev 8823)
+++ trunk/docutils/test/test_writers/test_latex2e.py 2021-09-11 11:18:15 UTC (rev 8824)
@@ -198,6 +198,7 @@
""")) + r"""
\phantomsection\label{table-of-contents}
\pdfbookmark[1]{Table of Contents}{table-of-contents}
+
\DUtitle{Table of Contents}
\begin{list}{}{}
@@ -335,7 +336,6 @@
\phantomsection\label{contents}
\pdfbookmark[1]{Contents}{contents}
\setcounter{tocdepth}{1}
-
\tableofcontents
@@ -365,7 +365,6 @@
\phantomsection\label{contents}
\pdfbookmark[1]{Contents}{contents}
\setcounter{tocdepth}{0}
-
\tableofcontents
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2021-09-11 11:18:32
|
Revision: 8825
http://sourceforge.net/p/docutils/code/8825
Author: milde
Date: 2021-09-11 11:18:27 +0000 (Sat, 11 Sep 2021)
Log Message:
-----------
LaTeXwriter: small fixes.
Don't add ``\phantomsection`` to labels in math-blocks.
New optional argument `newline` for LaTeXTranslator.ids_to_labels().
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/docutils/writers/latex2e/__init__.py
trunk/docutils/test/functional/expected/latex_memoir.tex
trunk/docutils/test/functional/expected/standalone_rst_latex.tex
trunk/docutils/test/functional/expected/standalone_rst_xetex.tex
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2021-09-11 11:18:15 UTC (rev 8824)
+++ trunk/docutils/HISTORY.txt 2021-09-11 11:18:27 UTC (rev 8825)
@@ -113,6 +113,8 @@
- Fix newlines after/before ids_to_labels() (cf. patch #183).
- Refactor/revise ToC writing.
+
+ - Don't add ``\phantomsection`` to labels in math-blocks.
* docutils/writers/latex2e/docutils.sty
Modified: trunk/docutils/docutils/writers/latex2e/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/latex2e/__init__.py 2021-09-11 11:18:15 UTC (rev 8824)
+++ trunk/docutils/docutils/writers/latex2e/__init__.py 2021-09-11 11:18:27 UTC (rev 8825)
@@ -1513,16 +1513,20 @@
self.out.append('%\n'.join(['\\raisebox{1em}{\\hypertarget{%s}{}}' %
id for id in node['ids']]))
- def ids_to_labels(self, node, set_anchor=True, protect=False):
+ def ids_to_labels(self, node, set_anchor=True, protect=False,
+ newline=False):
"""Return list of label definitions for all ids of `node`
If `set_anchor` is True, an anchor is set with \\phantomsection.
If `protect` is True, the \\label cmd is made robust.
+ If `newline` is True, a newline is added if there are labels.
"""
prefix = '\\protect' if protect else ''
labels = [prefix + '\\label{%s}' % id for id in node['ids']]
if set_anchor and labels:
labels.insert(0, '\\phantomsection')
+ if newline and labels:
+ labels.append('\n')
return labels
def set_align_from_classes(self, node):
@@ -2195,8 +2199,7 @@
self.out.append('\\begin{figure} %% align = "%s"\n' % alignment)
else:
self.out.append('\\begin{figure}\n')
- if node['ids']:
- self.out += self.ids_to_labels(node) + ['\n']
+ self.out += self.ids_to_labels(node, newline=True)
def depart_figure(self, node):
self.out.append('\\end{figure}\n')
@@ -2378,8 +2381,7 @@
self.out.extend(post)
def depart_image(self, node):
- if node['ids']:
- self.out += self.ids_to_labels(node) + ['\n']
+ self.out += self.ids_to_labels(node, newline=True)
def visit_inline(self, node): # <span>, i.e. custom roles
for cls in node['classes']:
@@ -2495,8 +2497,7 @@
# Labels and classes:
self.duclass_open(node)
- if node['ids']:
- self.out += self.ids_to_labels(node) + ['\n']
+ self.out += self.ids_to_labels(node, newline=True)
# Highlight code?
if (not _plaintext
and 'code' in node['classes']
@@ -2584,19 +2585,19 @@
self.visit_inline(node)
self.requirements['amsmath'] = r'\usepackage{amsmath}'
math_code = node.astext().translate(unichar2tex.uni2tex_table)
- if node['ids']:
- math_code = '\n'.join([math_code] + self.ids_to_labels(node))
if math_env == '$':
if self.alltt:
- wrapper = u'\\(%s\\)'
+ wrapper = ['\\(', '\\)']
else:
- wrapper = u'$%s$'
+ wrapper = ['$', '$']
else:
- wrapper = u'\n'.join(['%%',
- r'\begin{%s}' % math_env,
- '%s',
- r'\end{%s}' % math_env])
- self.out.append(wrapper % math_code)
+ labels = self.ids_to_labels(node, set_anchor=False, newline=True)
+ wrapper = ['%%\n\\begin{%s}\n' % math_env,
+ '\n',
+ ''.join(labels),
+ '\\end{%s}' % math_env]
+ wrapper.insert(1, math_code)
+ self.out.extend(wrapper)
self.depart_inline(node)
# Content already processed:
raise nodes.SkipNode
@@ -2690,8 +2691,7 @@
self.out.append('\n')
else:
self.out.append('\n')
- if node['ids']:
- self.out += self.ids_to_labels(node) + ['\n']
+ self.out += self.ids_to_labels(node, newline=True)
self.visit_inline(node)
def depart_paragraph(self, node):
@@ -2946,8 +2946,7 @@
self.active_table = self.table_stack.pop()
# Insert hyperlabel after (long)table, as
# other places (beginning, caption) result in LaTeX errors.
- if node['ids']:
- self.out += self.ids_to_labels(node, set_anchor=False) + ['\n']
+ self.out += self.ids_to_labels(node, set_anchor=False, newline=True)
self.duclass_close(node)
def visit_target(self, node):
@@ -3112,16 +3111,15 @@
# labels and PDF bookmark (sidebar entry)
self.out.append('\n') # start new paragraph
- if node['names']: # don't add labels for auto-ids
- self.out += self.ids_to_labels(node) + ['\n']
+ if node['names']: # don't add labels just for auto-ids
+ self.out += self.ids_to_labels(node, newline=True)
if (isinstance(node.next_node(), nodes.title)
and 'local' not in node['classes']
and self.settings.documentclass != 'memoir'):
self.out.append('\\pdfbookmark[%d]{%s}{%s}\n' %
(self.section_level+1,
- node.next_node().astext(),
- node.get('ids', ['contents'])[0]
- ))
+ node.next_node().astext(),
+ node.get('ids', ['contents'])[0]))
# Docutils generated contents list (no page numbers)
if not self.use_latex_toc:
Modified: trunk/docutils/test/functional/expected/latex_memoir.tex
===================================================================
--- trunk/docutils/test/functional/expected/latex_memoir.tex 2021-09-11 11:18:15 UTC (rev 8824)
+++ trunk/docutils/test/functional/expected/latex_memoir.tex 2021-09-11 11:18:27 UTC (rev 8825)
@@ -1815,7 +1815,6 @@
%
\begin{equation*}
\mathbf{M} = \left(\begin{matrix}a&b\\c&d\end{matrix}\right)
-\phantomsection
\label{eq-m}
\end{equation*}
is $|\mathbf{M}| = ad - bc$.
@@ -1836,7 +1835,6 @@
%
\begin{equation*}
i\hbar \frac{\partial }{\partial t}\Psi = \hat{H}\Psi ,
-\phantomsection
\label{eq-schrodinger}
\end{equation*}
with the \emph{wave function} $\Psi $, describes how the quantum state of a
Modified: trunk/docutils/test/functional/expected/standalone_rst_latex.tex
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_latex.tex 2021-09-11 11:18:15 UTC (rev 8824)
+++ trunk/docutils/test/functional/expected/standalone_rst_latex.tex 2021-09-11 11:18:27 UTC (rev 8825)
@@ -1837,7 +1837,6 @@
%
\begin{equation*}
\mathbf{M} = \left(\begin{matrix}a&b\\c&d\end{matrix}\right)
-\phantomsection
\label{eq-m}
\end{equation*}
is $|\mathbf{M}| = ad - bc$.
@@ -1858,7 +1857,6 @@
%
\begin{equation*}
i\hbar \frac{\partial }{\partial t}\Psi = \hat{H}\Psi ,
-\phantomsection
\label{eq-schrodinger}
\end{equation*}
with the \emph{wave function} $\Psi $, describes how the quantum state of a
Modified: trunk/docutils/test/functional/expected/standalone_rst_xetex.tex
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_xetex.tex 2021-09-11 11:18:15 UTC (rev 8824)
+++ trunk/docutils/test/functional/expected/standalone_rst_xetex.tex 2021-09-11 11:18:27 UTC (rev 8825)
@@ -1859,7 +1859,6 @@
%
\begin{equation*}
\mathbf{M} = \left(\begin{matrix}a&b\\c&d\end{matrix}\right)
-\phantomsection
\label{eq-m}
\end{equation*}
is $|\mathbf{M}| = ad - bc$.
@@ -1880,7 +1879,6 @@
%
\begin{equation*}
i\hbar \frac{\partial }{\partial t}\Psi = \hat{H}\Psi ,
-\phantomsection
\label{eq-schrodinger}
\end{equation*}
with the \emph{wave function} $\Psi $, describes how the quantum state of a
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2021-09-11 11:18:43
|
Revision: 8826
http://sourceforge.net/p/docutils/code/8826
Author: milde
Date: 2021-09-11 11:18:39 +0000 (Sat, 11 Sep 2021)
Log Message:
-----------
LaTeX writer: revise Docutils-generated table of contents
Improve spacing,
allow customization.
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/docutils/transforms/parts.py
trunk/docutils/docutils/writers/latex2e/__init__.py
trunk/docutils/test/functional/expected/standalone_rst_xetex.tex
trunk/docutils/test/test_writers/test_latex2e.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2021-09-11 11:18:27 UTC (rev 8825)
+++ trunk/docutils/HISTORY.txt 2021-09-11 11:18:39 UTC (rev 8826)
@@ -115,6 +115,9 @@
- Refactor/revise ToC writing.
- Don't add ``\phantomsection`` to labels in math-blocks.
+
+ - Improve spacing and allow customization of Docutils-generated table
+ of contents.
* docutils/writers/latex2e/docutils.sty
Modified: trunk/docutils/docutils/transforms/parts.py
===================================================================
--- trunk/docutils/docutils/transforms/parts.py 2021-09-11 11:18:27 UTC (rev 8825)
+++ trunk/docutils/docutils/transforms/parts.py 2021-09-11 11:18:39 UTC (rev 8826)
@@ -141,8 +141,8 @@
entries.append(item)
if entries:
contents = nodes.bullet_list('', *entries)
- if auto:
- contents['classes'].append('auto-toc')
+ if auto: # auto-numbered sections
+ contents['classes'].append('auto-toc') # auto-numbered sections
return contents
else:
return []
Modified: trunk/docutils/docutils/writers/latex2e/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/latex2e/__init__.py 2021-09-11 11:18:27 UTC (rev 8825)
+++ trunk/docutils/docutils/writers/latex2e/__init__.py 2021-09-11 11:18:39 UTC (rev 8826)
@@ -563,6 +563,15 @@
\fi
}"""
+PreambleCmds.toc_list = r"""
+\providecommand*{\DUCLASScontents}{%
+ \renewenvironment{itemize}%
+ {\begin{list}{}{\setlength{\partopsep}{0pt}
+ \setlength{\parsep}{0pt}}
+ }%
+ {\end{list}}%
+}"""
+
## PreambleCmds.caption = r"""% configure caption layout
## \usepackage{caption}
## \captionsetup{singlelinecheck=false}% no exceptions for one-liners"""
@@ -1098,7 +1107,6 @@
# -------------------
has_latex_toc = False # is there a toc in the doc? (needed by minitoc)
- is_toc_list = False # is the current bullet_list a ToC?
section_level = 0
# Flags to encode():
@@ -1685,16 +1693,10 @@
def visit_bullet_list(self, node):
self.duclass_open(node)
- if self.is_toc_list:
- self.out.append('\\begin{list}{}{}')
- else:
- self.out.append('\\begin{itemize}')
+ self.out.append('\\begin{itemize}')
def depart_bullet_list(self, node):
- if self.is_toc_list:
- self.out.append('\\end{list}\n')
- else:
- self.out.append('\\end{itemize}\n')
+ self.out.append('\\end{itemize}\n')
self.duclass_close(node)
def visit_superscript(self, node):
@@ -2909,8 +2911,6 @@
if self.active_table.is_open():
self.table_stack.append(self.active_table)
# nesting longtable does not work (e.g. 2007-04-18)
- # TODO: don't use a longtable or add \noindent before
- # the next paragraph, when in a "compound paragraph".
self.active_table = Table(self, 'tabular')
# A longtable moves before \paragraph and \subparagraph
# section titles if it immediately follows them:
@@ -2936,8 +2936,11 @@
width = self.to_latex_length(node['width'])
except KeyError:
width = r'\linewidth'
- if isinstance(node.parent, nodes.compound):
- self.out.append('\n')
+ # TODO: Don't use a longtable or add \noindent before
+ # the next paragraph, when in a "compound paragraph".
+ # Start a new line or a new paragraph?
+ # if (isinstance(node.parent, nodes.compound)
+ # and self._latex_type != 'longtable')?
self.out.append(self.active_table.get_opening(width))
self.out += content
self.out.append(self.active_table.get_closing() + '\n')
@@ -3123,8 +3126,8 @@
# Docutils generated contents list (no page numbers)
if not self.use_latex_toc:
- # set flag for visit_bullet_list()
- self.is_toc_list = True
+ self.fallbacks['toc-list'] = PreambleCmds.toc_list
+ self.duclass_open(node)
return
# ToC by LaTeX
@@ -3191,11 +3194,12 @@
self.visit_block_quote(node)
def depart_topic(self, node):
- self.is_toc_list = False
if ('abstract' in node['classes']
and self.settings.use_latex_abstract):
self.out.append('\\end{abstract}\n')
- elif not 'contents' in node['classes']:
+ elif 'contents' in node['classes']:
+ self.duclass_close(node)
+ else:
self.depart_block_quote(node)
if ('abstract' in node['classes'] or
'dedication' in node['classes']):
Modified: trunk/docutils/test/functional/expected/standalone_rst_xetex.tex
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_xetex.tex 2021-09-11 11:18:27 UTC (rev 8825)
+++ trunk/docutils/test/functional/expected/standalone_rst_xetex.tex 2021-09-11 11:18:39 UTC (rev 8826)
@@ -39,6 +39,14 @@
\DUprovidelength{\pdfpxdimen}{1bp}
+
+\providecommand*{\DUCLASScontents}{%
+ \renewenvironment{itemize}%
+ {\begin{list}{}{\setlength{\partopsep}{0pt}
+ \setlength{\parsep}{0pt}}
+ }%
+ {\end{list}}%
+}
% hyperlinks:
\ifthenelse{\isundefined{\hypersetup}}{
\usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref}
@@ -143,32 +151,34 @@
\phantomsection\label{table-of-contents}
\pdfbookmark[1]{Table of Contents}{table-of-contents}
+\begin{DUclass}{contents}
+
\DUtitle{Table of Contents}
\begin{DUclass}{auto-toc}
-\begin{list}{}{}
+\begin{itemize}
\item \hyperref[structural-elements]{1 Structural Elements}
\begin{DUclass}{auto-toc}
-\begin{list}{}{}
+\begin{itemize}
\item \hyperref[section-title]{1.1 Section Title}
\item \hyperref[empty-section]{1.2 Empty Section}
\item \hyperref[transitions]{1.3 Transitions}
-\end{list}
+\end{itemize}
\end{DUclass}
\item \hyperref[body-elements]{2 Body Elements}
\begin{DUclass}{auto-toc}
-\begin{list}{}{}
+\begin{itemize}
\item \hyperref[paragraphs]{2.1 Paragraphs}
\begin{DUclass}{auto-toc}
-\begin{list}{}{}
+\begin{itemize}
\item \hyperref[inline-markup]{2.1.1 Inline Markup}
-\end{list}
+\end{itemize}
\end{DUclass}
\item \hyperref[bullet-lists]{2.2 Bullet Lists}
@@ -196,17 +206,17 @@
\item \hyperref[targets]{2.13 Targets}
\begin{DUclass}{auto-toc}
-\begin{list}{}{}
+\begin{itemize}
\item \hyperref[duplicate-target-names]{2.13.1 Duplicate Target Names}
\item \hyperref[duplicate-target-names-1]{2.13.2 Duplicate Target Names}
-\end{list}
+\end{itemize}
\end{DUclass}
\item \hyperref[directives]{2.14 Directives}
\begin{DUclass}{auto-toc}
-\begin{list}{}{}
+\begin{itemize}
\item \hyperref[document-parts]{2.14.1 Document Parts}
\item \hyperref[images-and-figures]{2.14.2 Images and Figures}
@@ -228,7 +238,7 @@
\item \hyperref[code]{2.14.10 Code}
\item \hyperref[meta]{2.14.11 Meta}
-\end{list}
+\end{itemize}
\end{DUclass}
\item \hyperref[substitution-definitions]{2.15 Substitution Definitions}
@@ -248,24 +258,25 @@
\item \hyperref[custom-roles]{2.22 Custom Roles}
\item \hyperref[mathematics]{2.23 Mathematics}
-\end{list}
+\end{itemize}
\end{DUclass}
\item \hyperref[tests-for-the-latex-writer]{3 Tests for the LaTeX writer}
\begin{DUclass}{auto-toc}
-\begin{list}{}{}
+\begin{itemize}
\item \hyperref[custom-roles-in-latex]{3.1 Custom Roles in LaTeX}
\item \hyperref[class-handling]{3.2 class handling}
-\end{list}
+\end{itemize}
\end{DUclass}
\item \hyperref[tests-for-the-xetex-writer]{4 Tests for the XeTeX writer}
\item \hyperref[error-handling]{5 Error Handling}
-\end{list}
+\end{itemize}
\end{DUclass}
+\end{DUclass}
\section{1 Structural Elements%
@@ -797,8 +808,11 @@
\phantomsection\label{contents}
+\begin{DUclass}{contents}
+\begin{DUclass}{local}
+
\begin{DUclass}{auto-toc}
-\begin{list}{}{}
+\begin{itemize}
\item \hyperref[document-parts]{2.14.1 Document Parts}
\item \hyperref[images-and-figures]{2.14.2 Images and Figures}
@@ -820,8 +834,10 @@
\item \hyperref[code]{2.14.10 Code}
\item \hyperref[meta]{2.14.11 Meta}
-\end{list}
+\end{itemize}
\end{DUclass}
+\end{DUclass}
+\end{DUclass}
These are just a sample of the many reStructuredText Directives. For
others, please see \href{https://docutils.sourceforge.io/docs/ref/rst/directives.html}{reStructuredText Directives}\DUfootnotemark{footnote-reference-19}{footnote-11}{10}.
Modified: trunk/docutils/test/test_writers/test_latex2e.py
===================================================================
--- trunk/docutils/test/test_writers/test_latex2e.py 2021-09-11 11:18:27 UTC (rev 8825)
+++ trunk/docutils/test/test_writers/test_latex2e.py 2021-09-11 11:18:39 UTC (rev 8826)
@@ -192,22 +192,44 @@
head_template.substitute(dict(parts,
requirements=parts['requirements'] + '\\setcounter{secnumdepth}{0}\n',
fallbacks=r"""
+% class handling for environments (block-level elements)
+% \begin{DUclass}{spam} tries \DUCLASSspam and
+% \end{DUclass}{spam} tries \endDUCLASSspam
+\ifx\DUclass\undefined % poor man's "provideenvironment"
+ \newenvironment{DUclass}[1]%
+ {% "#1" does not work in end-part of environment.
+ \def\DocutilsClassFunctionName{DUCLASS#1}
+ \csname \DocutilsClassFunctionName \endcsname}%
+ {\csname end\DocutilsClassFunctionName \endcsname}%
+\fi
+
% title for topics, admonitions, unsupported section levels, and sidebar
\providecommand*{\DUtitle}[1]{%
\smallskip\noindent\textbf{#1}\smallskip}
+
+\providecommand*{\DUCLASScontents}{%
+ \renewenvironment{itemize}%
+ {\begin{list}{}{\setlength{\partopsep}{0pt}
+ \setlength{\parsep}{0pt}}
+ }%
+ {\end{list}}%
+}
""")) + r"""
\phantomsection\label{table-of-contents}
\pdfbookmark[1]{Table of Contents}{table-of-contents}
+\begin{DUclass}{contents}
+
\DUtitle{Table of Contents}
-\begin{list}{}{}
+\begin{itemize}
\item \hyperref[title-1]{Title 1}
-\begin{list}{}{}
+\begin{itemize}
\item \hyperref[title-2]{Title 2}
-\end{list}
-\end{list}
+\end{itemize}
+\end{itemize}
+\end{DUclass}
\section{Title 1%
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2021-09-20 13:03:19
|
Revision: 8829
http://sourceforge.net/p/docutils/code/8829
Author: milde
Date: 2021-09-20 13:03:17 +0000 (Mon, 20 Sep 2021)
Log Message:
-----------
Small documentation fixes.
Modified Paths:
--------------
trunk/docutils/RELEASE-NOTES.txt
trunk/docutils/docs/dev/todo.txt
trunk/docutils/docutils/writers/latex2e/__init__.py
Modified: trunk/docutils/RELEASE-NOTES.txt
===================================================================
--- trunk/docutils/RELEASE-NOTES.txt 2021-09-11 12:26:09 UTC (rev 8828)
+++ trunk/docutils/RELEASE-NOTES.txt 2021-09-20 13:03:17 UTC (rev 8829)
@@ -26,17 +26,17 @@
references. Since 0.18, you can use the CSS selector
``[role="doc-noteref"]`` instead of ``.footnote-reference``
(see minimal.css for examples).
-
+
- Do not specify relative column widths with the
deprecated ``<colgroup><col width="...">...``.
-
+
The `html5` writer will default to ``:widths: auto`` and use
``style="width: ..%"`` if the `"widths" option`__ sets explicite table
column widths. Use ``:widths: grid`` to keep the current default
column widths.
-
+
__ docs/ref/rst/directives.html#table
-
+
- Move attribution behind the blockquote to comply with the
`"living standard"`__?
(HTML5__ allows <cite> elements inside a blockquote, cf. Example 16.)
@@ -46,6 +46,13 @@
* `htm4css1` writer: Support the embed_images_ option.
+* `latex2e` writer:
+
+ - Change default of ``use_latex_citations`` to True.
+
+ - Remove ``--use-verbatim-when-possible`` option
+ (use ``--literal-block-env=verbatim``).
+
* Remove the "rawsource" attribute and argument from nodes.Text:
we store the null-escaped text in Text nodes since 0.16 so there is no
additional information in the rawsource.
Modified: trunk/docutils/docs/dev/todo.txt
===================================================================
--- trunk/docutils/docs/dev/todo.txt 2021-09-11 12:26:09 UTC (rev 8828)
+++ trunk/docutils/docs/dev/todo.txt 2021-09-20 13:03:17 UTC (rev 8829)
@@ -638,6 +638,7 @@
Make "meta" a generic directive and <meta> nodes standard nodes that
are kept in the doctree. Allow writers to ignore <meta> nodes.
+
Documentation
=============
Modified: trunk/docutils/docutils/writers/latex2e/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/latex2e/__init__.py 2021-09-11 12:26:09 UTC (rev 8828)
+++ trunk/docutils/docutils/writers/latex2e/__init__.py 2021-09-20 13:03:17 UTC (rev 8829)
@@ -180,8 +180,7 @@
'Default: "" (fall back to "alltt").',
['--literal-block-env'],
{'default': ''}),
- ('When possible, use "verbatim" for literal-blocks. '
- 'Compatibility alias for "--literal-block-env=verbatim".',
+ ('Deprecated alias for "--literal-block-env=verbatim".',
['--use-verbatim-when-possible'],
{'default': False, 'action': 'store_true',
'validator': frontend.validate_boolean}),
@@ -216,13 +215,13 @@
['--use-bibtex'],
{'default': ''}),
('Use legacy functions with class value list for '
- '\\DUtitle and \\DUadmonition (current default). ',
+ '\\DUtitle and \\DUadmonition.',
['--legacy-class-functions'],
{'default': False,
'action': 'store_true',
'validator': frontend.validate_boolean}),
('Use \\DUrole and "DUclass" wrappers for class values. '
- 'Place admonition content in an environment (future default).',
+ 'Place admonition content in an environment (default).',
['--new-class-functions'],
{'dest': 'legacy_class_functions',
'action': 'store_false',
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|