|
From: <mi...@us...> - 2015-03-26 13:38:54
|
Revision: 7855
http://sourceforge.net/p/docutils/code/7855
Author: milde
Date: 2015-03-26 13:38:51 +0000 (Thu, 26 Mar 2015)
Log Message:
-----------
HTML4 writer: Wrap literal blocks in a <span> to support sub- and superscript
(not allowed in <pre> but possible in parsed-literal).
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/docutils/writers/html4css1/__init__.py
trunk/docutils/docutils/writers/xhtml11/__init__.py
trunk/docutils/test/functional/expected/dangerous.html
trunk/docutils/test/functional/expected/standalone_rst_html4css1.html
trunk/docutils/test/functional/expected/standalone_rst_xhtml11.xhtml
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2015-03-23 08:18:25 UTC (rev 7854)
+++ trunk/docutils/HISTORY.txt 2015-03-26 13:38:51 UTC (rev 7855)
@@ -53,6 +53,8 @@
- Apply patch [ 119 ] by Anatoly Techtonik: use absolute paths for
``default_stylesheet_path`` and ``default_template_path``.
- Fix [ 266 ] creating labels/class values in description list items.
+ - Wrap literal blocks in a <span> to support sub- and superscript (not
+ allowed in <pre> but possible in parsed-literal).
* docutils/writers/latex2e/__init__.py
Modified: trunk/docutils/docutils/writers/html4css1/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/html4css1/__init__.py 2015-03-23 08:18:25 UTC (rev 7854)
+++ trunk/docutils/docutils/writers/html4css1/__init__.py 2015-03-26 13:38:51 UTC (rev 7855)
@@ -1180,8 +1180,10 @@
def visit_literal_block(self, node):
self.body.append(self.starttag(node, 'pre', CLASS='literal-block'))
+ self.body.append('<span>') # allow <sup> and <sub> (parsed-literal)
def depart_literal_block(self, node):
+ self.body.append('</span>') # allow <sup> and <sub> (parsed-literal)
self.body.append('\n</pre>\n')
def visit_math(self, node, math_env=''):
Modified: trunk/docutils/docutils/writers/xhtml11/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/xhtml11/__init__.py 2015-03-23 08:18:25 UTC (rev 7854)
+++ trunk/docutils/docutils/writers/xhtml11/__init__.py 2015-03-26 13:38:51 UTC (rev 7855)
@@ -118,6 +118,24 @@
self.body.append(self.starttag(node, 'ol', **atts))
+# <sup> and <sub> tags (possible with parsed-literal) are not allowed directly
+# in <pre> -- wrap in <span> ::
+
+ def visit_literal_block(self, node):
+ self.body.append(self.starttag(node, 'pre', '', CLASS='literal-block'))
+ if 'code' in node.get('classes', []):
+ self.body.append('<code>')
+ else:
+ self.body.append('<span>')
+
+ def depart_literal_block(self, node):
+ if 'code' in node.get('classes', []):
+ self.body.append('</code>')
+ else:
+ self.body.append('</span>')
+ self.body.append('</pre>\n')
+
+
# Meta tags: 'lang' attribute replaced by 'xml:lang' in XHTML 1.1
# HTML5/polyglott recommends using both
Modified: trunk/docutils/test/functional/expected/dangerous.html
===================================================================
--- trunk/docutils/test/functional/expected/dangerous.html 2015-03-23 08:18:25 UTC (rev 7854)
+++ trunk/docutils/test/functional/expected/dangerous.html 2015-03-26 13:38:51 UTC (rev 7855)
@@ -16,48 +16,48 @@
<p class="system-message-title">System Message: WARNING/2 (<tt class="docutils">functional/input/dangerous.txt</tt>, line 3)</p>
<p>"include" directive disabled.</p>
<pre class="literal-block">
-.. include:: /etc/passwd
+<span>.. include:: /etc/passwd</span>
</pre>
</div>
<div class="system-message">
<p class="system-message-title">System Message: WARNING/2 (<tt class="docutils">functional/input/dangerous.txt</tt>, line 4)</p>
<p>"raw" directive disabled.</p>
<pre class="literal-block">
-.. raw:: html
- :file: /etc/passwd
+<span>.. raw:: html
+ :file: /etc/passwd</span>
</pre>
</div>
<div class="system-message">
<p class="system-message-title">System Message: WARNING/2 (<tt class="docutils">functional/input/dangerous.txt</tt>, line 6)</p>
<p>"raw" directive disabled.</p>
<pre class="literal-block">
-.. raw:: html
- :url: file:///etc/passwd
+<span>.. raw:: html
+ :url: file:///etc/passwd</span>
</pre>
</div>
<div class="system-message">
<p class="system-message-title">System Message: WARNING/2 (<tt class="docutils">functional/input/dangerous.txt</tt>, line 8)</p>
<p>"raw" directive disabled.</p>
<pre class="literal-block">
-.. raw:: html
+<span>.. raw:: html
<script>
that does something really nasty
- </script>
+ </script></span>
</pre>
</div>
<div class="system-message">
<p class="system-message-title">System Message: WARNING/2 (<tt class="docutils">functional/input/dangerous.txt</tt>, line 13)</p>
<p>File and URL access deactivated; ignoring "csv-table" directive.</p>
<pre class="literal-block">
-.. csv-table:: :file: /etc/passwd
+<span>.. csv-table:: :file: /etc/passwd</span>
</pre>
</div>
<div class="system-message">
<p class="system-message-title">System Message: WARNING/2 (<tt class="docutils">functional/input/dangerous.txt</tt>, line 14)</p>
<p>File and URL access deactivated; ignoring "csv-table" directive.</p>
<pre class="literal-block">
-.. csv-table:: :url: file:///etc/passwd
+<span>.. csv-table:: :url: file:///etc/passwd</span>
</pre>
</div>
<div class="figure">
Modified: trunk/docutils/test/functional/expected/standalone_rst_html4css1.html
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_html4css1.html 2015-03-23 08:18:25 UTC (rev 7854)
+++ trunk/docutils/test/functional/expected/standalone_rst_html4css1.html 2015-03-26 13:38:51 UTC (rev 7855)
@@ -346,16 +346,16 @@
<p>Literal blocks are indicated with a double-colon ("::") at the end of
the preceding paragraph (over there <tt class="docutils literal"><span class="pre">--></span></tt>). They can be indented:</p>
<pre class="literal-block">
-if literal_block:
+<span>if literal_block:
text = 'is left as-is'
spaces_and_linebreaks = 'are preserved'
- markup_processing = None
+ markup_processing = None</span>
</pre>
<p>Or they can be quoted without indentation:</p>
<pre class="literal-block">
->> Great idea!
+<span>>> Great idea!
>
-> Why didn't I think of that?
+> Why didn't I think of that?</span>
</pre>
</div>
<div class="section" id="line-blocks">
@@ -775,7 +775,7 @@
<div class="compound">
<p class="compound-first">Compound 2, a literal block:</p>
<pre class="compound-middle literal-block">
-Compound 2, literal.
+<span>Compound 2, literal.</span>
</pre>
<p class="compound-last">Compound 2, this is a test.</p>
</div>
@@ -784,8 +784,8 @@
</div>
<div class="compound">
<pre class="compound-first literal-block">
-Compound 4.
-This one starts with a literal block.
+<span>Compound 4.
+This one starts with a literal block.</span>
</pre>
<p class="compound-last">Compound 4, a paragraph.</p>
</div>
@@ -832,13 +832,13 @@
<div class="section" id="parsed-literal-blocks">
<h3><a class="toc-backref" href="#id84">2.14.8 Parsed Literal Blocks</a></h3>
<pre class="literal-block">
-This is a parsed literal block.
+<span>This is a parsed literal block.
This line is indented. The next line is blank.
Inline markup is supported, e.g. <em>emphasis</em>, <strong>strong</strong>, <tt class="docutils literal">literal
text</tt>, <sub>sub-</sub> and <sup>super</sup>scripts,
inline formulas: <span class="formula"><i>A</i> = 2<i>π</i><i>r</i><sup>2</sup></span>,
-footnotes <a class="footnote-reference" href="#id8" id="id22">[1]</a>, <span class="target" id="hyperlink-targets">hyperlink targets</span>, and <a class="reference external" href="http://www.python.org/">references</a>.
+footnotes <a class="footnote-reference" href="#id8" id="id22">[1]</a>, <span class="target" id="hyperlink-targets">hyperlink targets</span>, and <a class="reference external" href="http://www.python.org/">references</a>.</span>
</pre>
</div>
<div class="section" id="code">
@@ -850,14 +850,14 @@
conversions in order to get identical results with/without installed
Pygments highlighter.)</p>
<pre class="code python literal-block">
-print 'This is Python code.'
+<span>print 'This is Python code.'</span>
</pre>
<p>The <tt class="docutils literal"><span class="pre">:number-lines:</span></tt> option (with optional start value) generates line
numbers:</p>
<pre class="code python literal-block">
-<span class="ln"> 8 </span># print integers from 0 to 9:
+<span><span class="ln"> 8 </span># print integers from 0 to 9:
<span class="ln"> 9 </span>for i in range(10):
-<span class="ln">10 </span> print i
+<span class="ln">10 </span> print i</span>
</pre>
<p>For inline code snippets, there is the <cite>code</cite> role, which can be used
directly (the code will not be parsed/tagged, as the language is not known)
@@ -868,8 +868,8 @@
<p>The <tt class="docutils literal">:code:</tt> option of the <cite>include</cite> directive sets the included content
as a code block, here the rst file <tt class="docutils literal">header_footer.txt</tt> with line numbers:</p>
<pre class="code rst literal-block">
-<span class="ln">1 </span>.. header:: Document header
-<span class="ln">2 </span>.. footer:: Document footer
+<span><span class="ln">1 </span>.. header:: Document header
+<span class="ln">2 </span>.. footer:: Document footer</span>
</pre>
</div>
</div>
@@ -1075,12 +1075,12 @@
<p>The following works in most browsers but does not validate
(<tt class="docutils literal"><style></tt> is only allowed in the document head):</p>
<pre class="literal-block">
-.. raw:: html
+<span>.. raw:: html
<style type="text/css"><!--
.green {color: green;}
.sc {font-variant: small-caps;}
- --></style>
+ --></style></span>
</pre>
<p><span class="green sc" lang="en-gb">British colourful text in small-caps</span>.</p>
</li>
@@ -1098,9 +1098,9 @@
<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"
+<span>width="280" viewBox="0 0 280 27"
height="27" width="100%"
- height="100%"
+ height="100%"</span>
</pre>
</li>
<li><p class="first">The method used to put the image in the document.</p>
Modified: trunk/docutils/test/functional/expected/standalone_rst_xhtml11.xhtml
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_xhtml11.xhtml 2015-03-23 08:18:25 UTC (rev 7854)
+++ trunk/docutils/test/functional/expected/standalone_rst_xhtml11.xhtml 2015-03-26 13:38:51 UTC (rev 7855)
@@ -351,14 +351,14 @@
<h2><a class="toc-backref" href="#id50"><span class="sectnum">2.7</span> Literal Blocks</a></h2>
<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:
+<pre class="literal-block"><span>if literal_block:
text = 'is left as-is'
spaces_and_linebreaks = 'are preserved'
- markup_processing = None</pre>
+ markup_processing = None</span></pre>
<p>Or they can be quoted without indentation:</p>
-<pre class="literal-block">>> Great idea!
+<pre class="literal-block"><span>>> Great idea!
>
-> Why didn't I think of that?</pre>
+> Why didn't I think of that?</span></pre>
</div>
<div class="section" id="line-blocks">
<h2><a class="toc-backref" href="#id51"><span class="sectnum">2.8</span> Line Blocks</a></h2>
@@ -756,15 +756,15 @@
<p>Another compound statement:</p>
<div class="compound">
<p class="compound-first">Compound 2, a literal block:</p>
-<pre class="compound-middle literal-block">Compound 2, literal.</pre>
+<pre class="compound-middle literal-block"><span>Compound 2, literal.</span></pre>
<p class="compound-last">Compound 2, this is a test.</p>
</div>
<div class="compound">
<p>Compound 3, only consisting of one paragraph.</p>
</div>
<div class="compound">
-<pre class="compound-first literal-block">Compound 4.
-This one starts with a literal block.</pre>
+<pre class="compound-first literal-block"><span>Compound 4.
+This one starts with a literal block.</span></pre>
<p class="compound-last">Compound 4, a paragraph.</p>
</div>
<p>Now something <em>really</em> perverted -- a nested compound block. This is
@@ -809,14 +809,14 @@
</div>
<div class="section" id="parsed-literal-blocks">
<h3><a class="toc-backref" href="#id95"><span class="sectnum">2.14.8</span> Parsed Literal Blocks</a></h3>
-<pre class="literal-block">This is a parsed literal block.
+<pre class="literal-block"><span>This is a parsed literal block.
This line is indented. The next line is blank.
Inline markup is supported, e.g. <em>emphasis</em>, <strong>strong</strong>, <span class="docutils literal">literal
text</span>, <sub>sub-</sub> and <sup>super</sup>scripts,
inline formulas: <math xmlns="http://www.w3.org/1998/Math/MathML">
<mrow><mi>A</mi><mo>=</mo><mn>2</mn><mi>π</mi><msup><mi>r</mi><mn>2</mn></msup></mrow></math>,
-footnotes <a class="footnote-reference" href="#id8" id="id22">[1]</a>, <span class="target" id="hyperlink-targets">hyperlink targets</span>, and <a class="reference external" href="http://www.python.org/">references</a>.</pre>
+footnotes <a class="footnote-reference" href="#id8" id="id22">[1]</a>, <span class="target" id="hyperlink-targets">hyperlink targets</span>, and <a class="reference external" href="http://www.python.org/">references</a>.</span></pre>
</div>
<div class="section" id="code">
<h3><a class="toc-backref" href="#id96"><span class="sectnum">2.14.9</span> Code</a></h3>
@@ -1046,12 +1046,12 @@
<li><p>A role with multiple class attributes, styled with raw directives:</p>
<p>The following works in most browsers but does not validate
(<span class="docutils literal"><style></span> is only allowed in the document head):</p>
-<pre class="literal-block">.. raw:: html
+<pre class="literal-block"><span>.. raw:: html
<style type="text/css"><!--
.green {color: green;}
.sc {font-variant: small-caps;}
- --></style></pre>
+ --></style></span></pre>
<p><span class="green sc" xml:lang="en-gb">British colourful text in small-caps</span>.</p>
</li>
</ul>
@@ -1066,9 +1066,9 @@
<p>Rendering behaviour varies, depending on</p>
<ol class="loweralpha">
<li><p>The SVG image itself, e.g. fixed-size vs. scaling:</p>
-<pre class="literal-block">width="280" viewBox="0 0 280 27"
+<pre class="literal-block"><span>width="280" viewBox="0 0 280 27"
height="27" width="100%"
- height="100%"</pre>
+ height="100%"</span></pre>
</li>
<li><p>The method used to put the image in the document.</p>
<p>For HTML, there are several alternatives including:</p>
@@ -1235,7 +1235,7 @@
<dd><p>of the field name width is possible with CSS instead
of the <cite>field-name-limit</cite> configuration setting, for
example:</p>
-<pre class="literal-block">dl.field-list > dd { margin-left: 6em; }</pre>
+<pre class="literal-block"><span>dl.field-list > dd { margin-left: 6em; }</span></pre>
</dd>
</dl>
<div class="section" id="styling-with-class-arguments">
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2015-03-30 14:41:09
|
Revision: 7856
http://sourceforge.net/p/docutils/code/7856
Author: milde
Date: 2015-03-30 14:41:00 +0000 (Mon, 30 Mar 2015)
Log Message:
-----------
Do not use <sup> and <sub> tags inside <pre> (parsed-literal blocks).
New approach: use <span class="subscript"> ... and CSS in literal blocks,
as <sup> and <sub> are explicitely forbidden in XHTML 1
http://www.w3.org/TR/xhtml1/#prohibitions
(but the validator does not check this)
Also: fix target in SVG image functional test.
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/docutils/writers/html4css1/__init__.py
trunk/docutils/docutils/writers/html4css1/html4css1.css
trunk/docutils/docutils/writers/xhtml11/__init__.py
trunk/docutils/docutils/writers/xhtml11/xhtml11.css
trunk/docutils/test/functional/expected/dangerous.html
trunk/docutils/test/functional/expected/standalone_rst_html4css1.html
trunk/docutils/test/functional/expected/standalone_rst_html_base.html
trunk/docutils/test/functional/expected/standalone_rst_xhtml11.xhtml
trunk/docutils/test/functional/input/data/svg_images.txt
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2015-03-26 13:38:51 UTC (rev 7855)
+++ trunk/docutils/HISTORY.txt 2015-03-30 14:41:00 UTC (rev 7856)
@@ -53,8 +53,7 @@
- Apply patch [ 119 ] by Anatoly Techtonik: use absolute paths for
``default_stylesheet_path`` and ``default_template_path``.
- Fix [ 266 ] creating labels/class values in description list items.
- - Wrap literal blocks in a <span> to support sub- and superscript (not
- allowed in <pre> but possible in parsed-literal).
+ - Do not use <sup> and <sub> tags inside <pre> (parsed-literal blocks).
* docutils/writers/latex2e/__init__.py
Modified: trunk/docutils/docutils/writers/html4css1/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/html4css1/__init__.py 2015-03-26 13:38:51 UTC (rev 7855)
+++ trunk/docutils/docutils/writers/html4css1/__init__.py 2015-03-30 14:41:00 UTC (rev 7856)
@@ -1180,10 +1180,8 @@
def visit_literal_block(self, node):
self.body.append(self.starttag(node, 'pre', CLASS='literal-block'))
- self.body.append('<span>') # allow <sup> and <sub> (parsed-literal)
def depart_literal_block(self, node):
- self.body.append('</span>') # allow <sup> and <sub> (parsed-literal)
self.body.append('\n</pre>\n')
def visit_math(self, node, math_env=''):
@@ -1493,10 +1491,18 @@
self.body.append('</strong>')
def visit_subscript(self, node):
- self.body.append(self.starttag(node, 'sub', ''))
+ # <sub> not allowed in <pre>
+ if isinstance(node.parent, nodes.literal_block):
+ self.body.append(self.starttag(node, 'span', '',
+ CLASS='subscript'))
+ else:
+ self.body.append(self.starttag(node, 'sub', ''))
def depart_subscript(self, node):
- self.body.append('</sub>')
+ if isinstance(node.parent, nodes.literal_block):
+ self.body.append('</span>')
+ else:
+ self.body.append('</sub>')
def visit_substitution_definition(self, node):
"""Internal only."""
@@ -1531,10 +1537,18 @@
del self.body[:]
def visit_superscript(self, node):
- self.body.append(self.starttag(node, 'sup', ''))
+ # <sup> not allowed in <pre>
+ if isinstance(node.parent, nodes.literal_block):
+ self.body.append(self.starttag(node, 'span', '',
+ CLASS='superscript'))
+ else:
+ self.body.append(self.starttag(node, 'sup', ''))
def depart_superscript(self, node):
- self.body.append('</sup>')
+ if isinstance(node.parent, nodes.literal_block):
+ self.body.append('</span>')
+ else:
+ self.body.append('</sup>')
def visit_system_message(self, node):
self.body.append(self.starttag(node, 'div', CLASS='system-message'))
Modified: trunk/docutils/docutils/writers/html4css1/html4css1.css
===================================================================
--- trunk/docutils/docutils/writers/html4css1/html4css1.css 2015-03-26 13:38:51 UTC (rev 7855)
+++ trunk/docutils/docutils/writers/html4css1/html4css1.css 2015-03-30 14:41:00 UTC (rev 7856)
@@ -28,6 +28,14 @@
.hidden {
display: none }
+.subscript {
+ vertical-align: sub;
+ font-size: smaller }
+
+.superscript {
+ vertical-align: super;
+ font-size: smaller }
+
a.toc-backref {
text-decoration: none ;
color: black }
Modified: trunk/docutils/docutils/writers/xhtml11/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/xhtml11/__init__.py 2015-03-26 13:38:51 UTC (rev 7855)
+++ trunk/docutils/docutils/writers/xhtml11/__init__.py 2015-03-30 14:41:00 UTC (rev 7856)
@@ -13,14 +13,13 @@
# .. _2-Clause BSD license: http://www.spdx.org/licenses/BSD-2-Clause
"""
-Strict HyperText Markup Language document tree Writer.
+Strict eXtensible HyperText Markup Language (XHTML) document Writer.
-This is a variant of Docutils' standard 'html4css1' writer.
+This is a variant of Docutils' `html-base` writer.
-GOAL:
- * The output conforms to the XHTML version 1.1 DTD.
- * It contains no hard-coded formatting information that would prevent
- layout design by cascading style sheets.
+* The output conforms to the XHTML version 1.1 DTD.
+* It contains no hard-coded formatting information that would prevent
+ configuration by cascading style sheets.
"""
__docformat__ = 'reStructuredText'
@@ -118,24 +117,37 @@
self.body.append(self.starttag(node, 'ol', **atts))
-# <sup> and <sub> tags (possible with parsed-literal) are not allowed directly
-# in <pre> -- wrap in <span> ::
+ # <sup> and <sub> tags (possible with parsed-literal) are not allowed
+ # in <pre> --- use <span> ::
- def visit_literal_block(self, node):
- self.body.append(self.starttag(node, 'pre', '', CLASS='literal-block'))
- if 'code' in node.get('classes', []):
- self.body.append('<code>')
+ def visit_subscript(self, node):
+ if isinstance(node.parent, nodes.literal_block):
+ self.body.append(self.starttag(node, 'span', '',
+ CLASS='subscript'))
else:
- self.body.append('<span>')
+ self.body.append(self.starttag(node, 'sub', ''))
- def depart_literal_block(self, node):
- if 'code' in node.get('classes', []):
- self.body.append('</code>')
+ def depart_subscript(self, node):
+ if isinstance(node.parent, nodes.literal_block):
+ self.body.append('</span>')
else:
+ self.body.append('</sub>')
+
+
+ def visit_superscript(self, node):
+ # <sup> not allowed in <pre>
+ if isinstance(node.parent, nodes.literal_block):
+ self.body.append(self.starttag(node, 'span', '',
+ CLASS='superscript'))
+ else:
+ self.body.append(self.starttag(node, 'sup', ''))
+
+ def depart_superscript(self, node):
+ if isinstance(node.parent, nodes.literal_block):
self.body.append('</span>')
- self.body.append('</pre>\n')
+ else:
+ self.body.append('</sup>')
-
# Meta tags: 'lang' attribute replaced by 'xml:lang' in XHTML 1.1
# HTML5/polyglott recommends using both
Modified: trunk/docutils/docutils/writers/xhtml11/xhtml11.css
===================================================================
--- trunk/docutils/docutils/writers/xhtml11/xhtml11.css 2015-03-26 13:38:51 UTC (rev 7855)
+++ trunk/docutils/docutils/writers/xhtml11/xhtml11.css 2015-03-30 14:41:00 UTC (rev 7856)
@@ -20,11 +20,11 @@
/* .. _validates: http://jigsaw.w3.org/css-validator/validator$link */
-/* Ordered List (Enumeration) */
-/* -------------------------- */
+/* Ordered List (Enumeration) */
+/* -------------------------- */
-/* XHTML 1.1 removed the "start" argument form ordered lists (It */
-/* resurfaces in HTML5). */
+/* XHTML 1.1 removes the "start" argument form ordered lists */
+/* (it resurfaces in HTML5). */
/* */
/* Use custom counters to replace the deprecated start attribute. Make */
/* sure the resulting list resembles the list-style 'outside' with a */
@@ -92,7 +92,17 @@
content: counters(item, ".") " ";
}
+/* <sup> and <sub> tags (possible with parsed-literal) are not allowed */
+/* in <pre> --- use <span> */
+.subscript {
+ vertical-align: sub;
+ font-size: smaller;
+}
+.superscript {
+ vertical-align: super;
+ font-size: smaller;
+}
/* Field Lists */
/* ----------- */
@@ -109,5 +119,5 @@
content: '';
display: block;
clear: left;
- vertical-align: baseline;
+ vertical-align: baseline;
}
Modified: trunk/docutils/test/functional/expected/dangerous.html
===================================================================
--- trunk/docutils/test/functional/expected/dangerous.html 2015-03-26 13:38:51 UTC (rev 7855)
+++ trunk/docutils/test/functional/expected/dangerous.html 2015-03-30 14:41:00 UTC (rev 7856)
@@ -16,48 +16,48 @@
<p class="system-message-title">System Message: WARNING/2 (<tt class="docutils">functional/input/dangerous.txt</tt>, line 3)</p>
<p>"include" directive disabled.</p>
<pre class="literal-block">
-<span>.. include:: /etc/passwd</span>
+.. include:: /etc/passwd
</pre>
</div>
<div class="system-message">
<p class="system-message-title">System Message: WARNING/2 (<tt class="docutils">functional/input/dangerous.txt</tt>, line 4)</p>
<p>"raw" directive disabled.</p>
<pre class="literal-block">
-<span>.. raw:: html
- :file: /etc/passwd</span>
+.. raw:: html
+ :file: /etc/passwd
</pre>
</div>
<div class="system-message">
<p class="system-message-title">System Message: WARNING/2 (<tt class="docutils">functional/input/dangerous.txt</tt>, line 6)</p>
<p>"raw" directive disabled.</p>
<pre class="literal-block">
-<span>.. raw:: html
- :url: file:///etc/passwd</span>
+.. raw:: html
+ :url: file:///etc/passwd
</pre>
</div>
<div class="system-message">
<p class="system-message-title">System Message: WARNING/2 (<tt class="docutils">functional/input/dangerous.txt</tt>, line 8)</p>
<p>"raw" directive disabled.</p>
<pre class="literal-block">
-<span>.. raw:: html
+.. raw:: html
<script>
that does something really nasty
- </script></span>
+ </script>
</pre>
</div>
<div class="system-message">
<p class="system-message-title">System Message: WARNING/2 (<tt class="docutils">functional/input/dangerous.txt</tt>, line 13)</p>
<p>File and URL access deactivated; ignoring "csv-table" directive.</p>
<pre class="literal-block">
-<span>.. csv-table:: :file: /etc/passwd</span>
+.. csv-table:: :file: /etc/passwd
</pre>
</div>
<div class="system-message">
<p class="system-message-title">System Message: WARNING/2 (<tt class="docutils">functional/input/dangerous.txt</tt>, line 14)</p>
<p>File and URL access deactivated; ignoring "csv-table" directive.</p>
<pre class="literal-block">
-<span>.. csv-table:: :url: file:///etc/passwd</span>
+.. csv-table:: :url: file:///etc/passwd
</pre>
</div>
<div class="figure">
Modified: trunk/docutils/test/functional/expected/standalone_rst_html4css1.html
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_html4css1.html 2015-03-26 13:38:51 UTC (rev 7855)
+++ trunk/docutils/test/functional/expected/standalone_rst_html4css1.html 2015-03-30 14:41:00 UTC (rev 7856)
@@ -346,16 +346,16 @@
<p>Literal blocks are indicated with a double-colon ("::") at the end of
the preceding paragraph (over there <tt class="docutils literal"><span class="pre">--></span></tt>). They can be indented:</p>
<pre class="literal-block">
-<span>if literal_block:
+if literal_block:
text = 'is left as-is'
spaces_and_linebreaks = 'are preserved'
- markup_processing = None</span>
+ markup_processing = None
</pre>
<p>Or they can be quoted without indentation:</p>
<pre class="literal-block">
-<span>>> Great idea!
+>> Great idea!
>
-> Why didn't I think of that?</span>
+> Why didn't I think of that?
</pre>
</div>
<div class="section" id="line-blocks">
@@ -775,7 +775,7 @@
<div class="compound">
<p class="compound-first">Compound 2, a literal block:</p>
<pre class="compound-middle literal-block">
-<span>Compound 2, literal.</span>
+Compound 2, literal.
</pre>
<p class="compound-last">Compound 2, this is a test.</p>
</div>
@@ -784,8 +784,8 @@
</div>
<div class="compound">
<pre class="compound-first literal-block">
-<span>Compound 4.
-This one starts with a literal block.</span>
+Compound 4.
+This one starts with a literal block.
</pre>
<p class="compound-last">Compound 4, a paragraph.</p>
</div>
@@ -832,13 +832,13 @@
<div class="section" id="parsed-literal-blocks">
<h3><a class="toc-backref" href="#id84">2.14.8 Parsed Literal Blocks</a></h3>
<pre class="literal-block">
-<span>This is a parsed literal block.
+This is a parsed literal block.
This line is indented. The next line is blank.
Inline markup is supported, e.g. <em>emphasis</em>, <strong>strong</strong>, <tt class="docutils literal">literal
-text</tt>, <sub>sub-</sub> and <sup>super</sup>scripts,
+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>,
-footnotes <a class="footnote-reference" href="#id8" id="id22">[1]</a>, <span class="target" id="hyperlink-targets">hyperlink targets</span>, and <a class="reference external" href="http://www.python.org/">references</a>.</span>
+footnotes <a class="footnote-reference" href="#id8" id="id22">[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>
<div class="section" id="code">
@@ -850,14 +850,14 @@
conversions in order to get identical results with/without installed
Pygments highlighter.)</p>
<pre class="code python literal-block">
-<span>print 'This is Python code.'</span>
+print 'This is Python code.'
</pre>
<p>The <tt class="docutils literal"><span class="pre">:number-lines:</span></tt> option (with optional start value) generates line
numbers:</p>
<pre class="code python literal-block">
-<span><span class="ln"> 8 </span># print integers from 0 to 9:
+<span class="ln"> 8 </span># print integers from 0 to 9:
<span class="ln"> 9 </span>for i in range(10):
-<span class="ln">10 </span> print i</span>
+<span class="ln">10 </span> print i
</pre>
<p>For inline code snippets, there is the <cite>code</cite> role, which can be used
directly (the code will not be parsed/tagged, as the language is not known)
@@ -868,8 +868,8 @@
<p>The <tt class="docutils literal">:code:</tt> option of the <cite>include</cite> directive sets the included content
as a code block, here the rst file <tt class="docutils literal">header_footer.txt</tt> with line numbers:</p>
<pre class="code rst literal-block">
-<span><span class="ln">1 </span>.. header:: Document header
-<span class="ln">2 </span>.. footer:: Document footer</span>
+<span class="ln">1 </span>.. header:: Document header
+<span class="ln">2 </span>.. footer:: Document footer
</pre>
</div>
</div>
@@ -1075,12 +1075,12 @@
<p>The following works in most browsers but does not validate
(<tt class="docutils literal"><style></tt> is only allowed in the document head):</p>
<pre class="literal-block">
-<span>.. raw:: html
+.. raw:: html
<style type="text/css"><!--
.green {color: green;}
.sc {font-variant: small-caps;}
- --></style></span>
+ --></style>
</pre>
<p><span class="green sc" lang="en-gb">British colourful text in small-caps</span>.</p>
</li>
@@ -1098,9 +1098,9 @@
<ol class="loweralpha">
<li><p class="first">The SVG image itself, e.g. fixed-size vs. scaling:</p>
<pre class="literal-block">
-<span>width="280" viewBox="0 0 280 27"
+width="280" viewBox="0 0 280 27"
height="27" width="100%"
- height="100%"</span>
+ height="100%"
</pre>
</li>
<li><p class="first">The method used to put the image in the document.</p>
@@ -1151,7 +1151,7 @@
<p>A scaling image 1 em high, right aligned:</p>
</li>
<li><p class="first">A scaling image 5 mm x 5 mm, centered, with hyperlink reference:</p>
-<a class="reference external image-reference" href="SVGImages_"><object class="align-center" data="../../../docs/user/rst/images/biohazard-scaling.svg" style="width: 5mm; height: 5mm;" type="image/svg+xml">../../../docs/user/rst/images/biohazard-scaling.svg</object></a>
+<a class="reference internal image-reference" href="#svg-images"><object class="align-center" data="../../../docs/user/rst/images/biohazard-scaling.svg" style="width: 5mm; height: 5mm;" type="image/svg+xml">../../../docs/user/rst/images/biohazard-scaling.svg</object></a>
</li>
<li><object class="first align-right" data="../../../docs/user/rst/images/biohazard.svg" style="width: 4cm; height: 2em;" type="image/svg+xml">
../../../docs/user/rst/images/biohazard.svg</object>
Modified: trunk/docutils/test/functional/expected/standalone_rst_html_base.html
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_html_base.html 2015-03-26 13:38:51 UTC (rev 7855)
+++ trunk/docutils/test/functional/expected/standalone_rst_html_base.html 2015-03-30 14:41:00 UTC (rev 7856)
@@ -1110,7 +1110,7 @@
<p>A scaling image 1 em high, right aligned:</p>
</li>
<li><p>A scaling image 5 mm x 5 mm, centered, with hyperlink reference:</p>
-<a class="reference external image-reference" href="SVGImages_"><img alt="../../../docs/user/rst/images/biohazard-scaling.svg" class="align-center" src="../../../docs/user/rst/images/biohazard-scaling.svg" style="width: 5mm; height: 5mm;" /></a>
+<a class="reference internal image-reference" href="#svg-images"><img alt="../../../docs/user/rst/images/biohazard-scaling.svg" class="align-center" src="../../../docs/user/rst/images/biohazard-scaling.svg" style="width: 5mm; height: 5mm;" /></a>
</li>
<li><img alt="../../../docs/user/rst/images/biohazard.svg" class="align-right" src="../../../docs/user/rst/images/biohazard.svg" style="width: 4cm; height: 2em;" />
<p>A fixed-size image in a 4 cm x 2 em box.</p>
Modified: trunk/docutils/test/functional/expected/standalone_rst_xhtml11.xhtml
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_xhtml11.xhtml 2015-03-26 13:38:51 UTC (rev 7855)
+++ trunk/docutils/test/functional/expected/standalone_rst_xhtml11.xhtml 2015-03-30 14:41:00 UTC (rev 7856)
@@ -351,14 +351,14 @@
<h2><a class="toc-backref" href="#id50"><span class="sectnum">2.7</span> Literal Blocks</a></h2>
<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"><span>if literal_block:
+<pre class="literal-block">if literal_block:
text = 'is left as-is'
spaces_and_linebreaks = 'are preserved'
- markup_processing = None</span></pre>
+ markup_processing = None</pre>
<p>Or they can be quoted without indentation:</p>
-<pre class="literal-block"><span>>> Great idea!
+<pre class="literal-block">>> Great idea!
>
-> Why didn't I think of that?</span></pre>
+> Why didn't I think of that?</pre>
</div>
<div class="section" id="line-blocks">
<h2><a class="toc-backref" href="#id51"><span class="sectnum">2.8</span> Line Blocks</a></h2>
@@ -756,15 +756,15 @@
<p>Another compound statement:</p>
<div class="compound">
<p class="compound-first">Compound 2, a literal block:</p>
-<pre class="compound-middle literal-block"><span>Compound 2, literal.</span></pre>
+<pre class="compound-middle literal-block">Compound 2, literal.</pre>
<p class="compound-last">Compound 2, this is a test.</p>
</div>
<div class="compound">
<p>Compound 3, only consisting of one paragraph.</p>
</div>
<div class="compound">
-<pre class="compound-first literal-block"><span>Compound 4.
-This one starts with a literal block.</span></pre>
+<pre class="compound-first literal-block">Compound 4.
+This one starts with a literal block.</pre>
<p class="compound-last">Compound 4, a paragraph.</p>
</div>
<p>Now something <em>really</em> perverted -- a nested compound block. This is
@@ -809,14 +809,14 @@
</div>
<div class="section" id="parsed-literal-blocks">
<h3><a class="toc-backref" href="#id95"><span class="sectnum">2.14.8</span> Parsed Literal Blocks</a></h3>
-<pre class="literal-block"><span>This is a parsed literal block.
+<pre class="literal-block">This is a parsed literal block.
This line is indented. The next line is blank.
Inline markup is supported, e.g. <em>emphasis</em>, <strong>strong</strong>, <span class="docutils literal">literal
-text</span>, <sub>sub-</sub> and <sup>super</sup>scripts,
+text</span>, <span class="subscript">sub-</span> and <span class="superscript">super</span>scripts,
inline formulas: <math xmlns="http://www.w3.org/1998/Math/MathML">
<mrow><mi>A</mi><mo>=</mo><mn>2</mn><mi>π</mi><msup><mi>r</mi><mn>2</mn></msup></mrow></math>,
-footnotes <a class="footnote-reference" href="#id8" id="id22">[1]</a>, <span class="target" id="hyperlink-targets">hyperlink targets</span>, and <a class="reference external" href="http://www.python.org/">references</a>.</span></pre>
+footnotes <a class="footnote-reference" href="#id8" id="id22">[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>
<div class="section" id="code">
<h3><a class="toc-backref" href="#id96"><span class="sectnum">2.14.9</span> Code</a></h3>
@@ -1046,12 +1046,12 @@
<li><p>A role with multiple class attributes, styled with raw directives:</p>
<p>The following works in most browsers but does not validate
(<span class="docutils literal"><style></span> is only allowed in the document head):</p>
-<pre class="literal-block"><span>.. raw:: html
+<pre class="literal-block">.. raw:: html
<style type="text/css"><!--
.green {color: green;}
.sc {font-variant: small-caps;}
- --></style></span></pre>
+ --></style></pre>
<p><span class="green sc" xml:lang="en-gb">British colourful text in small-caps</span>.</p>
</li>
</ul>
@@ -1066,9 +1066,9 @@
<p>Rendering behaviour varies, depending on</p>
<ol class="loweralpha">
<li><p>The SVG image itself, e.g. fixed-size vs. scaling:</p>
-<pre class="literal-block"><span>width="280" viewBox="0 0 280 27"
+<pre class="literal-block">width="280" viewBox="0 0 280 27"
height="27" width="100%"
- height="100%"</span></pre>
+ height="100%"</pre>
</li>
<li><p>The method used to put the image in the document.</p>
<p>For HTML, there are several alternatives including:</p>
@@ -1114,7 +1114,7 @@
<p>A scaling image 1 em high, right aligned:</p>
</li>
<li><p>A scaling image 5 mm x 5 mm, centered, with hyperlink reference:</p>
-<a class="reference external image-reference" href="SVGImages_"><img alt="../../../docs/user/rst/images/biohazard-scaling.svg" class="align-center" src="../../../docs/user/rst/images/biohazard-scaling.svg" style="width: 5mm; height: 5mm;" /></a>
+<a class="reference internal image-reference" href="#svg-images"><img alt="../../../docs/user/rst/images/biohazard-scaling.svg" class="align-center" src="../../../docs/user/rst/images/biohazard-scaling.svg" style="width: 5mm; height: 5mm;" /></a>
</li>
<li><img alt="../../../docs/user/rst/images/biohazard.svg" class="align-right" src="../../../docs/user/rst/images/biohazard.svg" style="width: 4cm; height: 2em;" />
<p>A fixed-size image in a 4 cm x 2 em box.</p>
@@ -1235,7 +1235,7 @@
<dd><p>of the field name width is possible with CSS instead
of the <cite>field-name-limit</cite> configuration setting, for
example:</p>
-<pre class="literal-block"><span>dl.field-list > dd { margin-left: 6em; }</span></pre>
+<pre class="literal-block">dl.field-list > dd { margin-left: 6em; }</pre>
</dd>
</dl>
<div class="section" id="styling-with-class-arguments">
Modified: trunk/docutils/test/functional/input/data/svg_images.txt
===================================================================
--- trunk/docutils/test/functional/input/data/svg_images.txt 2015-03-26 13:38:51 UTC (rev 7855)
+++ trunk/docutils/test/functional/input/data/svg_images.txt 2015-03-30 14:41:00 UTC (rev 7856)
@@ -85,7 +85,7 @@
* A scaling image 5 mm x 5 mm, centered, with hyperlink reference:
.. image:: ../../../docs/user/rst/images/biohazard-scaling.svg
- :target: SVG Images_
+ :target: `SVG Images`_
:width: 5 mm
:height: 5 mm
:align: center
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2015-03-30 20:53:42
|
Revision: 7857
http://sourceforge.net/p/docutils/code/7857
Author: milde
Date: 2015-03-30 20:53:39 +0000 (Mon, 30 Mar 2015)
Log Message:
-----------
Document HTML writers.
Modified Paths:
--------------
trunk/docutils/docs/user/tools.txt
trunk/docutils/docutils/writers/__init__.py
Added Paths:
-----------
trunk/docutils/docs/user/html.txt
Added: trunk/docutils/docs/user/html.txt
===================================================================
--- trunk/docutils/docs/user/html.txt (rev 0)
+++ trunk/docutils/docs/user/html.txt 2015-03-30 20:53:39 UTC (rev 7857)
@@ -0,0 +1,204 @@
+=====================
+Docutils HTML writers
+=====================
+
+.. note:: This document is a working draft. Naming of writers, aliases, and
+ front-ends may change before the release of Docutils 0.13.
+
+Overview
+--------
+
+Since version 0.13, Docutils comes with a family of HTML writers to support
+several `HTML variants`_.
+
+============ =========== ================= =============================
+alias alias name output format(s)
+============ =========== ================= =============================
+*html* [#]_ xhtml1 or html4css1_ `XHTML 1 Transitional`_
+ html4 [#]_
+.. pep_html_ `XHTML 1 Transitional`_
+
+*s5* s5_html_ `XHTML 1 Transitional`_
+
+.. html4trans_ [#]_ `XHTML 1 Transitional`_
+
+*html5* html-base html_base_ | HTML5_
+ | `XHTML 1 Transitional`_
+
+*xhtml* html4strict xhtml11_ | `XHTML 1.1`_
+ | HTML5_
+============ =========== ================= =============================
+
+For *emphazised* aliases exist ``rst2<alias>.py`` `front-end tools`_.
+
+.. [#] *html* will become an alias for html-base in a future release.
+
+.. [#] TODO: how to name the alias/frontend specific to the html4css1 writer
+ replacing "html":
+
+ :html4:
+
+ +1 short form of html4css1,
+ -1 writer produces XHTML 1, not HTML 4
+
+ :xhtml1:
+
+ +1 correct and short description of the output format.
+ -1 may be confused with xhtml11 or xhtml (aliases for the
+ "new" XHTML 1.1. writer inheriting from html-base).
+
+.. [#] in the sandbox
+
+.. _front-end tools: tools.html
+
+
+html4css1
+~~~~~~~~~
+
+:aliases: html4, html
+:front-ends: rst2html.py_, rst2html4.py
+:config: `[html4css1 writer]`_
+
+The HTML Writer module, ``docutils/writers/html4css1.py``, started
+as a proof-of-concept reference implementation. It is the first Docutils
+writer and was up to release 0.13 the only official HTML writer.
+
+The output conforms to the `XHTML 1 Transitional`_ specification.
+Correct rendering depends on a CSS_ style sheet. A reference style sheet,
+`html4css1.css`_, is provided with Docutils.
+
+Due to the closing of empty tags required in XML but not allowed in HTML 4,
+generated documents do not validate as `HTML 4.01 Transitional`_.
+However, they follow the `HTML Compatibility Guidelines`_ for proper
+rendering on most HTML user agents.
+
+To support the `Internet Explorer` (IE) (with a market share of about 90%
+at the time this writer was written), documents are tagged as "text/html"
+(instead of "application/xhtml+xml") and contain some hard-coded formatting
+hints. [#IE]_
+
+.. [#IE] Conformance to CSS 2.1 has been added in the IE 8 (2009), support
+ for XHTML in IE 9 (2011).
+
+.. _rst2html.py: tools.html#rst2html-py
+.. _[html4css1 writer]: config.html#html4css1-writer
+.. _html4css1.css: ../../docutils/writers/html4css1/html4css1.css
+
+--------------------------------------------------------------------------
+
+The following three HTML writers inherit from `html4css1`:
+
+pep_html
+""""""""
+
+:front-end: rstpep2html.py_
+:config: `[pep_html writer]`_
+
+This is a special writer for the generation of `Python Enhancement
+Proposals`_ (PEPs). It adds some PEP-Specific
+Options, a style sheet and template. The front-end uses also a specialized
+Reader.
+
+.. _rstpep2html.py: tools.html#rstpep2html-py
+.. _[pep_html writer]: config.html#pep-html-writer
+.. _Python Enhancement Proposals: https://www.python.org/dev/peps/
+
+s5_html
+"""""""
+
+:alias: s5
+:front-end: rst2s5.py_
+:config: `[s5_html writer]`_
+
+The `s5` writer produces XHTML output compatible with S5_, the “Simple
+Standards-based Slide Show System” by Eric Meyer. This allows one to create
+`Easy Slide Shows With reST & S5`_. A theme_ is required for proper
+rendering
+
+.. _rst2s5.py: tools.html#rst2s5-py
+.. _[s5_html writer]: config.html#s5-html-writer
+.. _Easy Slide Shows With reST & S5: slide-shows.html
+.. _S5: http://meyerweb.com/eric/tools/s5/
+.. _theme: tools.html#themes
+
+
+html4trans
+""""""""""
+
+:front-end: rst2html_trans.py_
+
+The `html4trans` writer (`sandbox/html4trans`_) removes the dependency on
+CSS browser support. The output conforms to `XHTML 1 Transitional`_ and
+contains enough formatting information to be viewed without a cascading
+style sheet by a lightweight html browser.
+
+.. _sandbox/html4trans: ../../../sandbox/html4trans
+.. _rst2html_trans.py: ../../../sandbox/html4trans/tools/rst2html_trans.py
+
+
+html_base
+~~~~~~~~~
+
+:aliases: html-base, html5
+:front-end: rst2html5.py_
+:config: `[html-base writer]`_
+
+The `html-base` writer produces `polyglot HTML`_ output (compatible with
+HTML5_ and `XHTML 1 Transitional`_). A CSS style sheet is required for
+proper rendering; a complete style sheet, html-base.css_, is provided by
+Docutils and used by default.
+
+.. _rst2html5.py: tools.html#rst2html5-py
+.. _[html-base writer]: config.html#html-base-writer
+.. _html-base.css: ../../docutils/writers/html_base/html-base.css
+
+
+xhtml11
+~~~~~~~
+:aliases: xhtml, html4strict
+:front-end: rst2xhtml.py_
+:config: `[xhtml11 writer]`_
+
+The `xhtml11` writer inherits from html_base_ and adds compatibility to
+`XHTML 1.1`_ (see `its source`__ for details)
+
+An additional style sheet adds support for a "start" value for enumerated
+lists via a CSS-counter.
+
+__ ../../docutils/writers/xhtml11/__init__.py
+.. _rst2xhtml.py: tools.html#rst2html5-py
+.. _[xhtml11 writer]: config.html#xhtml11-writer
+
+
+
+HTML variants
+-------------
+
+_`HTML5`
+ `HTML5, A vocabulary and associated APIs for HTML and XHTML`,
+ W3C Recommendation, 28 October 2014.
+ http://www.w3.org/TR/html5/
+
+_`XHTML 1.1`
+ `XHTML™ 1.1 - Module-based XHTML - Second Edition`,
+ W3C Recommendation, 23 November 2010.
+ http://www.w3.org/TR/xhtml11/
+
+_`XHTML 1 Transitional`
+ `Transitional version`_ of:
+ `XHTML™ 1.0 The Extensible HyperText Markup Language (Second
+ Edition)`, `A Reformulation of HTML 4 in XML 1.0`,
+ W3C Recommendation, 26 January 2000, revised 1 August 2002.
+ http://www.w3.org/TR/xhtml1/
+
+.. _transitional version:
+ http://www.w3.org/TR/xhtml1/#a_dtd_XHTML-1.0-Transitional
+
+_`HTML 4.01 Transitional`
+ Transitional version of:
+ `HTML 4.01 Specification`, W3C Recommendation 24 December 1999.
+ http://www.w3.org/TR/html4/
+
+.. _HTML Compatibility Guidelines: http://www.w3.org/TR/xhtml1/#guidelines
+.. _polyglot HTML: http://www.w3.org/TR/html-polyglot/
+.. _CSS: http://www.w3.org/TR/CSS/
Property changes on: trunk/docutils/docs/user/html.txt
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/docutils/docs/user/tools.txt
===================================================================
--- trunk/docutils/docs/user/tools.txt 2015-03-30 14:41:00 UTC (rev 7856)
+++ trunk/docutils/docs/user/tools.txt 2015-03-30 20:53:39 UTC (rev 7857)
@@ -101,11 +101,10 @@
:Reader: Standalone
:Parser: reStructuredText
-:Writer: html (html4css1; this will change to hmtl-base in future)
+:Writer: html (html4css1_; this will change to hmtl-base_ in future)
The ``rst2html.py`` front end reads standalone reStructuredText source
-files and produces `HTML 4.1`_ Transitional (or `XHTML 1.0 Transitional`_)
-output.
+files and produces `XHTML 1.0 Transitional`_ output.
A CSS stylesheet is required for proper rendering; a simple but
complete stylesheet is installed and used by default (see Stylesheets_
below).
@@ -138,8 +137,8 @@
`guide to writing HTML (CSS) stylesheets for Docutils`__.
__ ../howto/html-stylesheets.html
+.. _html4css1: html.html#html4css1
-
rst2xhtml.py
--------------
@@ -148,7 +147,7 @@
:Writer: xhtml (xhtml11)
The ``rst2xhtml11.py`` front end reads standalone reStructuredText
-source files and produces clean `XHTML 1.1`_ (or `HTML 4.1`_ Strict)
+source files and produces clean `XHTML 1.1`_
output. A CSS 2 stylesheet is required for proper rendering; a complete
stylesheet is installed and used by default.
@@ -157,14 +156,15 @@
:Reader: Standalone
:Parser: reStructuredText
-:Writer: html5 (html-base)
+:Writer: html5 (html-base_)
The ``rst2html5.py`` front end reads standalone reStructuredText source
files and produces simple `HTML 5`_ output (compatible to `XHTML 1.0
-Transitional`_ and `HTML 4.1`_ Transitional). A CSS 2 stylesheet is
-required for proper rendering; a complete stylesheet is installed and
-used by default.
+Transitional`_). A CSS 2 stylesheet is required for proper rendering; a
+complete stylesheet is installed and used by default.
+.. _html-base: html.html#html-base
+
rstpep2html.py
--------------
Modified: trunk/docutils/docutils/writers/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/__init__.py 2015-03-30 14:41:00 UTC (rev 7856)
+++ trunk/docutils/docutils/writers/__init__.py 2015-03-30 20:53:39 UTC (rev 7857)
@@ -121,17 +121,19 @@
_writer_aliases = {
'html': 'html4css1', # will change to html_base some day
+ 'html4': 'html4css1',
+ 'html5': 'html_base', # until a special HTML 5 writer is ready
+ 'html4strict': 'xhtml11',
'html-base': 'html_base',
- 'html5': 'html_base', # only until a special HTML 5 writer is ready
- 'xhtml': 'xhtml11',
- 'xhtml10': 'html4css1',
'latex': 'latex2e',
- 'xelatex': 'xetex',
'pprint': 'pseudoxml',
'pformat': 'pseudoxml',
'pdf': 'rlpdf',
- 'xml': 'docutils_xml',
- 's5': 's5_html'}
+ 's5': 's5_html',
+ 'xelatex': 'xetex',
+ 'xhtml': 'xhtml11',
+ 'xhtml10': 'html4css1',
+ 'xml': 'docutils_xml'}
def get_writer_class(writer_name):
"""Return the Writer class from the `writer_name` module."""
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2015-04-10 23:48:54
|
Revision: 7861
http://sourceforge.net/p/docutils/code/7861
Author: milde
Date: 2015-04-10 23:48:51 +0000 (Fri, 10 Apr 2015)
Log Message:
-----------
Support some external TeX math -> MathML converters.
Modified Paths:
--------------
trunk/docutils/docs/dev/todo.txt
trunk/docutils/docs/user/config.txt
trunk/docutils/docutils/writers/html_base/__init__.py
Added Paths:
-----------
trunk/docutils/docutils/utils/math/tex2mathml_extern.py
Modified: trunk/docutils/docs/dev/todo.txt
===================================================================
--- trunk/docutils/docs/dev/todo.txt 2015-04-02 15:47:56 UTC (rev 7860)
+++ trunk/docutils/docs/dev/todo.txt 2015-04-10 23:48:51 UTC (rev 7861)
@@ -1317,40 +1317,46 @@
Converters from LaTeX to MathML include
* latex_math_ (Python) by Jens Jørgen Mortensen in the Docutils sandbox
- * Blahtex_ (C++)
+
+ This is the base for Docutils latex2mathml_ module used by
+ default with ``--math-output=MathML``.
+
+ * blahtexml_ (C++), supported with ``--math-output=MathML blahtexml``.
+
+ Fast conversion, support for many symbols and environments, but
+ no "align" (or other equation-aligning) environment.
+
+ * LaTeXML_ (Perl), supported with ``--math-output=MathML latexml``.
+
+ Comprehensive macro support but very slow
+
+ * TtM_ (C), ``--math-output=MathML ttm``, support may be removed.
+
+ No "matrix", "align" and "cases" environments.
+
* MathToWeb_ (Java)
* TeX4ht_ (TeX based)
- * LaTeXML_ (Perl) with the command latexmlmath_, e.g.::
-
- latexmlmath --contentmathml=- $\vec{\alpha}$
-
* itex_ (also `used in Abiword`__)
- * TtM_ (C, non free, free binary for Linux) with an `online-trial page`__
* `Steve’s LATEX-to-MathML translator`_
('mini-language', javascript, Python)
- latex_math_ is the base for the current latex2mathml_ module used
- with ``--math-output=MathML``.
- * Write a new converter based on:
+ * Write a new converter? E.g. based on:
* a generic tokenizer (see e.g. a `latex-codec recipe`_,
`updated latex-codec`_, )
* the Unicode-Char <-> LaTeX mappings database unimathsymbols_
__ http://msevior.livejournal.com/26377.html
- __ http://hutchinson.belmont.ma.us/tth/mml/ttmmozform.html
.. _MathML: http://www.w3.org/TR/MathML2/
.. _latex_math: ../../../sandbox/jensj/latex_math/
.. _latex2mathml: ../../docutils/math/latex2mathml.py
- .. _Blahtex: http://gva.noekeon.org/blahtexml/
+ .. _blahtexml: http://gva.noekeon.org/blahtexml/
+ .. _LaTeXML: http://dlmf.nist.gov/LaTeXML/
+ .. _ttm: http://hutchinson.belmont.ma.us/tth/mml/
+ .. _TeX4ht: http://www.tug.org/applications/tex4ht/mn.html
.. _MathToWeb: http://www.mathtoweb.com/
- .. _TeX4ht: http://www.tug.org/applications/tex4ht/mn.html
- .. _LaTeXML: http://dlmf.nist.gov/LaTeXML/
- .. _latexmlmath:
- http://dlmf.nist.gov/LaTeXML/manual/commands/latexmlmath.html
.. _itex: http://golem.ph.utexas.edu/~distler/blog/itex2MMLcommands.html
- .. _ttm: http://hutchinson.belmont.ma.us/tth/mml/
.. _Steve’s LATEX-to-MathML translator:
http://www.gold-saucer.org/mathml/greasemonkey/dist/display-latex
.. _latex-codec recipe:
@@ -1367,19 +1373,19 @@
format math in standard HTML enhanced by CSS rules
(Overview__, `Examples and experiments`__).
- LaTeX-math to HTML/CSS converters include
+ The ``math-output=html`` option uses the converter from eLyXer_
+ (included with Docutils).
+ Alternatives: LaTeX-math to HTML/CSS converters include
+
* TtH_ (C)
* Hevea_ (Objective Caml)
- * eLyXer_ (Python)
- The ``math-output=html`` option uses the converter from eLyXer.
-
__ http://www.cs.tut.fi/~jkorpela/math/
__ http://www.zipcon.net/~swhite/docs/math/math.html
+ .. _elyxer: http://elyxer.nongnu.org/
.. _TtH: ttp://hutchinson.belmont.ma.us/tth/index.html
.. _Hevea: http://para.inria.fr/~maranget/hevea/
- .. _elyxer: http://elyxer.nongnu.org/
images
(PNG or SVG) like e.g. Wikipedia. (e.g. with dvisvgm_ or the
Modified: trunk/docutils/docs/user/config.txt
===================================================================
--- trunk/docutils/docs/user/config.txt 2015-04-02 15:47:56 UTC (rev 7860)
+++ trunk/docutils/docs/user/config.txt 2015-04-10 23:48:51 UTC (rev 7861)
@@ -977,6 +977,21 @@
Transitional. However, MathML-enabled browsers will render it
fine.
+ An external converter can be appended after whitespace:
+
+ * ``math-output: MathML blahtexml``
+
+ blahtexml_ (C++) Fast conversion, support for many symbols and
+ environments, but no "align" (or other equation-aligning) environment.
+
+ * ``--math-output=MathML latexml``.
+
+ LaTeXML_ (Perl) Comprehensive macro support but very slow
+
+ * ``--math-output=MathML ttm``, support may be removed.
+
+ No "matrix", "align" and "cases" environments.
+
:LaTeX:
Include literal LaTeX code.
@@ -991,6 +1006,9 @@
.. _MathJax: http://www.mathjax.org/
.. _MathPlayer: http://www.dessci.com/en/products/mathplayer/
.. _MathML: http://www.w3.org/TR/MathML/
+.. _blahtexml: http://gva.noekeon.org/blahtexml/
+.. _LaTeXML: http://dlmf.nist.gov/LaTeXML/
+.. _ttm: http://hutchinson.belmont.ma.us/tth/mml/
option_limit
~~~~~~~~~~~~
Added: trunk/docutils/docutils/utils/math/tex2mathml_extern.py
===================================================================
--- trunk/docutils/docutils/utils/math/tex2mathml_extern.py (rev 0)
+++ trunk/docutils/docutils/utils/math/tex2mathml_extern.py 2015-04-10 23:48:51 UTC (rev 7861)
@@ -0,0 +1,147 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# :Id: $Id$
+# :Copyright: © 2015 Günter Milde.
+# :License: Released under the terms of the `2-Clause BSD license`_, in short:
+#
+# Copying and distribution of this file, with or without modification,
+# are permitted in any medium without royalty provided the copyright
+# notice and this notice are preserved.
+# This file is offered as-is, without any warranty.
+#
+# .. _2-Clause BSD license: http://www.spdx.org/licenses/BSD-2-Clause
+
+# Wrappers for TeX->MathML conversion by external tools
+# =====================================================
+
+import subprocess
+
+document_template = r"""\documentclass{article}
+\usepackage{amsmath}
+\begin{document}
+%s
+\end{document}
+"""
+
+def latexml(math_code, reporter=None):
+ """Convert LaTeX math code to MathML with LaTeXML_
+
+ .. _LaTeXML: http://dlmf.nist.gov/LaTeXML/
+ """
+ p = subprocess.Popen(['latexml',
+ '-', # read from stdin
+ # '--preload=amsmath',
+ '--inputencoding=utf8',
+ ],
+ stdin=subprocess.PIPE,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+ close_fds=True)
+ p.stdin.write((document_template % math_code).encode('utf8'))
+ p.stdin.close()
+ latexml_code = p.stdout.read()
+ latexml_err = p.stderr.read().decode('utf8')
+ if reporter and latexml_err.find('Error') >= 0 or not latexml_code:
+ reporter.error(latexml_err)
+
+ post_p = subprocess.Popen(['latexmlpost',
+ '-',
+ '--nonumbersections',
+ '--format=xhtml',
+ # '--linelength=78', # experimental
+ '--'
+ ],
+ stdin=subprocess.PIPE,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+ close_fds=True)
+ post_p.stdin.write(latexml_code)
+ post_p.stdin.close()
+ result = post_p.stdout.read().decode('utf8')
+ post_p_err = post_p.stderr.read().decode('utf8')
+ if reporter and post_p_err.find('Error') >= 0 or not result:
+ reporter.error(post_p_err)
+
+ # extract MathML code:
+ start,end = result.find('<math'), result.find('</math>')+7
+ result = result[start:end]
+ if 'class="ltx_ERROR' in result:
+ raise SyntaxError(result)
+ return result
+
+def ttm(math_code, reporter=None):
+ """Convert LaTeX math code to MathML with TtM_
+
+ .. _TtM: http://hutchinson.belmont.ma.us/tth/mml/
+ """
+ p = subprocess.Popen(['ttm',
+ # '-i', # italic font for equations. Default roman.
+ '-u', # unicode character encoding. (Default iso-8859-1).
+ '-r', # output raw MathML (no preamble or postlude)
+ ],
+ stdin=subprocess.PIPE,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+ close_fds=True)
+ p.stdin.write((document_template % math_code).encode('utf8'))
+ p.stdin.close()
+ result = p.stdout.read()
+ err = p.stderr.read().decode('utf8')
+ if err.find('**** Unknown') >= 0:
+ msg = '\n'.join([line for line in err.splitlines()
+ if line.startswith('****')])
+ raise SyntaxError('\nMessage from external converter TtM:\n'+ msg)
+ if reporter and err.find('**** Error') >= 0 or not result:
+ reporter.error(err)
+ start,end = result.find('<math'), result.find('</math>')+7
+ result = result[start:end]
+ return result
+
+def blahtexml(math_code, inline=True, reporter=None):
+ """Convert LaTeX math code to MathML with blahtexml_
+
+ .. _blahtexml: http://gva.noekeon.org/blahtexml/
+ """
+ options = ['--mathml',
+ '--indented',
+ '--spacing', 'moderate',
+ '--mathml-encoding', 'raw',
+ '--other-encoding', 'raw',
+ '--doctype-xhtml+mathml',
+ '--annotate-TeX',
+ ]
+ if inline:
+ mathmode_arg = ''
+ else:
+ mathmode_arg = 'mode="display"'
+ options.append('--displaymath')
+
+ p = subprocess.Popen(['blahtexml']+options,
+ stdin=subprocess.PIPE,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+ close_fds=True)
+ p.stdin.write(math_code.encode('utf8'))
+ p.stdin.close()
+ result = p.stdout.read().decode('utf8')
+ err = p.stderr.read().decode('utf8')
+
+ print err
+ if result.find('<error>') >= 0:
+ raise SyntaxError('\nMessage from external converter blahtexml:\n'
+ +result[result.find('<message>')+9:result.find('</message>')])
+ if reporter and (err.find('**** Error') >= 0 or not result):
+ reporter.error(err)
+ start,end = result.find('<markup>')+9, result.find('</markup>')
+ result = ('<math xmlns="http://www.w3.org/1998/Math/MathML"%s>\n'
+ '%s</math>\n') % (mathmode_arg, result[start:end])
+ return result
+
+# self-test
+
+if __name__ == "__main__":
+ example = ur'\frac{\partial \sin^2(\alpha)}{\partial \vec r} \varpi \, \text{Grüße}'
+ # print latexml(example).encode('utf8')
+ # print ttm(example)#.encode('utf8')
+ print blahtexml(example).encode('utf8')
Property changes on: trunk/docutils/docutils/utils/math/tex2mathml_extern.py
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/docutils/docutils/writers/html_base/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/html_base/__init__.py 2015-04-02 15:47:56 UTC (rev 7860)
+++ trunk/docutils/docutils/writers/html_base/__init__.py 2015-04-10 23:48:51 UTC (rev 7861)
@@ -44,8 +44,8 @@
from docutils import frontend, nodes, utils, writers, languages, io
from docutils.utils.error_reporting import SafeString
from docutils.transforms import writer_aux
-from docutils.utils.math import unichar2tex, pick_math_environment, math2html
-from docutils.utils.math.latex2mathml import parse_latex_math
+from docutils.utils.math import (unichar2tex, pick_math_environment,
+ math2html, latex2mathml, tex2mathml_extern)
class Writer(writers.Writer):
@@ -132,8 +132,9 @@
'Defined styles: "borderless". Default: ""',
['--table-style'],
{'default': ''}),
- ('Math output format (one of "MathML", "HTML", "MathJax" '
- 'or "LaTeX") and options(s). Default: "HTML math.css"',
+ ('Math output format (one of "MathML", "HTML", "MathJax", '
+ 'or "LaTeX") and option(s). '
+ 'Default: "HTML math.css"',
['--math-output'],
{'default': 'HTML math.css'}),
('Prepend an XML declaration. (Thwarts HTML5 conformance.) '
@@ -1141,15 +1142,9 @@
def visit_math(self, node, math_env=''):
# If the method is called from visit_math_block(), math_env != ''.
- # As there is no native HTML math support, we provide alternatives:
- # LaTeX and MathJax math_output modes simply wrap the content,
- # HTML and MathML math_output modes also convert the math_code.
- if self.math_output not in ('mathml', 'html', 'mathjax', 'latex'):
- self.document.reporter.error(
- 'math-output format "%s" not supported '
- 'falling back to "latex"'% self.math_output)
- self.math_output = 'latex'
- #
+ # As there is no native HTML math support, we provide alternatives
+ # for the math-output: LaTeX and MathJax simply wrap the content,
+ # HTML and MathML also convert the math_code.
# HTML container
tags = {# math_output: (block, inline, class-arguments)
'mathml': ('div', '', ''),
@@ -1157,22 +1152,31 @@
'mathjax': ('div', 'span', 'math'),
'latex': ('pre', 'tt', 'math'),
}
+ if self.math_output not in tags:
+ self.document.reporter.error(
+ 'math-output format "%s" not supported '
+ 'falling back to "latex"'% self.math_output)
+ self.math_output = 'latex'
tag = tags[self.math_output][math_env == '']
clsarg = tags[self.math_output][2]
# LaTeX container
wrappers = {# math_mode: (inline, block)
- 'mathml': (None, None),
+ 'mathml': ('$%s$', u'\\begin{%s}\n%s\n\\end{%s}'),
'html': ('$%s$', u'\\begin{%s}\n%s\n\\end{%s}'),
'mathjax': ('\(%s\)', u'\\begin{%s}\n%s\n\\end{%s}'),
'latex': (None, None),
}
wrapper = wrappers[self.math_output][math_env != '']
+ if self.math_output == 'mathml' and (not self.math_output_options or
+ self.math_output_options[0] == 'blahtexml'):
+ wrapper = None
# get and wrap content
math_code = node.astext().translate(unichar2tex.uni2tex_table)
- if wrapper and math_env:
- math_code = wrapper % (math_env, math_code, math_env)
- elif wrapper:
- math_code = wrapper % math_code
+ if wrapper:
+ try: # wrapper with three "%s"
+ math_code = wrapper % (math_env, math_code, math_env)
+ except TypeError: # wrapper with one "%s"
+ math_code = wrapper % math_code
# settings and conversion
if self.math_output in ('latex', 'mathjax'):
math_code = self.encode(math_code)
@@ -1191,9 +1195,26 @@
elif self.math_output == 'mathml':
self.doctype = self.doctype_mathml
# self.content_type = self.content_type_mathml
+ converter = ' '.join(self.math_output_options).lower()
try:
- mathml_tree = parse_latex_math(math_code, inline=not(math_env))
- math_code = ''.join(mathml_tree.xml())
+ if converter == 'latexml':
+ math_code = tex2mathml_extern.latexml(math_code,
+ self.document.reporter)
+ elif converter == 'ttm':
+ math_code = tex2mathml_extern.ttm(math_code,
+ self.document.reporter)
+ elif converter == 'blahtexml':
+ math_code = tex2mathml_extern.blahtexml(math_code,
+ inline=not(math_env),
+ reporter=self.document.reporter)
+ elif not converter:
+ math_code = latex2mathml.tex2mathml(math_code,
+ inline=not(math_env))
+ else:
+ self.document.reporter.error('option "%s" not supported '
+ 'with math-output "MathML"')
+ except OSError:
+ raise OSError('is "latexmlmath" in your PATH?')
except SyntaxError, err:
err_node = self.document.reporter.error(err, base_node=node)
self.visit_system_message(err_node)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2015-04-12 09:57:12
|
Revision: 7864
http://sourceforge.net/p/docutils/code/7864
Author: milde
Date: 2015-04-12 09:57:05 +0000 (Sun, 12 Apr 2015)
Log Message:
-----------
Revert removal of obsolete `handle_io_errors` arg. Still used by Sphinx.
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/RELEASE-NOTES.txt
trunk/docutils/docutils/io.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2015-04-12 09:49:14 UTC (rev 7863)
+++ trunk/docutils/HISTORY.txt 2015-04-12 09:57:05 UTC (rev 7864)
@@ -16,10 +16,6 @@
Changes Since 0.12
==================
-* docutils/io.py
-
- - removed the `handle_io_errors` option from io.FileInput/Output.
-
* docutils/nodes.py
- Fix [ 253 ] Attribute key without value not allowed in XML.
Modified: trunk/docutils/RELEASE-NOTES.txt
===================================================================
--- trunk/docutils/RELEASE-NOTES.txt 2015-04-12 09:49:14 UTC (rev 7863)
+++ trunk/docutils/RELEASE-NOTES.txt 2015-04-12 09:57:05 UTC (rev 7864)
@@ -20,6 +20,8 @@
Future changes
==============
+* remove the `handle_io_errors` option from io.FileInput/Output.
+
* »Prune« the doctree (no change to the reST input syntax):
- "doctest" element -> literal block with "pycon" (python-console)
Modified: trunk/docutils/docutils/io.py
===================================================================
--- trunk/docutils/docutils/io.py 2015-04-12 09:49:14 UTC (rev 7863)
+++ trunk/docutils/docutils/io.py 2015-04-12 09:57:05 UTC (rev 7864)
@@ -204,7 +204,7 @@
"""
def __init__(self, source=None, source_path=None,
encoding=None, error_handler='strict',
- autoclose=True, mode='rU'):
+ autoclose=True, handle_io_errors=None, mode='rU'):
"""
:Parameters:
- `source`: either a file-like object (which is read directly), or
@@ -214,6 +214,7 @@
- `error_handler`: the encoding error handler to use.
- `autoclose`: close automatically after read (except when
`sys.stdin` is the source).
+ - `handle_io_errors`: ignored, deprecated, will be removed.
- `mode`: how the file is to be opened (see standard function
`open`). The default 'rU' provides universal newline support
for text files.
@@ -302,7 +303,7 @@
def __init__(self, destination=None, destination_path=None,
encoding=None, error_handler='strict', autoclose=True,
- mode=None):
+ handle_io_errors=None, mode=None):
"""
:Parameters:
- `destination`: either a file-like object (which is written
@@ -314,6 +315,7 @@
- `error_handler`: the encoding error handler to use.
- `autoclose`: close automatically after write (except when
`sys.stdout` or `sys.stderr` is the destination).
+ - `handle_io_errors`: ignored, deprecated, will be removed.
- `mode`: how the file is to be opened (see standard function
`open`). The default is 'w', providing universal newline
support for text files.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2015-04-12 10:06:45
|
Revision: 7865
http://sourceforge.net/p/docutils/code/7865
Author: milde
Date: 2015-04-12 10:06:43 +0000 (Sun, 12 Apr 2015)
Log Message:
-----------
Small HTML fixes and documentation updates.
Modified Paths:
--------------
trunk/docutils/docs/user/html.txt
trunk/docutils/docutils/utils/math/__init__.py
trunk/docutils/docutils/utils/math/latex2mathml.py
trunk/docutils/docutils/writers/html_base/html-base.css
trunk/docutils/docutils/writers/xhtml11/__init__.py
trunk/docutils/docutils/writers/xhtml11/xhtml11.css
Modified: trunk/docutils/docs/user/html.txt
===================================================================
--- trunk/docutils/docs/user/html.txt 2015-04-12 09:57:05 UTC (rev 7864)
+++ trunk/docutils/docs/user/html.txt 2015-04-12 10:06:43 UTC (rev 7865)
@@ -63,13 +63,28 @@
.. _front-end tools: tools.html
+html
+~~~~
+
+The writer name `html` is an alias pointing to the "recommended Docutils
+HTML writer". Its meaning may change with the development of HTML, browsers
+and the web.
+
+* Use `get_writer_by_name('html') or the ``rst2html.py`` front end, if you
+ want the output to be up-to-date automatically.
+
+* Use a more specific writer name or front end, if you depend on stability
+ of the generated HTML code, e.g. because you use a custom style sheet or
+ postprocessing that may break otherwise.
+
+
html_base
~~~~~~~~~
.. note:: The name `html_base` will change to a more appropriate one.
Candidates are `html_basic` (but beware of confusion with the
- `XHTML Basic`_ document type), `html_common`, or simply `html` (name
- currently used as alias by `html4css1`_). Suggestions welcome.
+ `XHTML Basic`_ document type) or `html_common`
+ Suggestions welcome.
:aliases: html-base, html5
@@ -130,9 +145,10 @@
html5
"""""
-The writer name `html5` is reserved for a HTML writer that makes use of the
-new features and objects defined in HTML5 (like <video>, <aside>, or
-<section>) that are not (yet) fit for use in `html-base`.
+The writer name `html5` is reserved for a HTML writer that makes use of new
+features and objects defined in HTML5 but not (yet) fit for use in
+`html-base` because of limited browser support (like <video>, <aside>, or
+<section>).
html4css1
Modified: trunk/docutils/docutils/utils/math/__init__.py
===================================================================
--- trunk/docutils/docutils/utils/math/__init__.py 2015-04-12 09:57:05 UTC (rev 7864)
+++ trunk/docutils/docutils/utils/math/__init__.py 2015-04-12 10:06:43 UTC (rev 7865)
@@ -17,8 +17,9 @@
:math2html: LaTeX math -> HTML conversion from eLyXer
:latex2mathml: LaTeX math -> presentational MathML
-:unichar2tex: Unicode character to LaTeX math translation table
-:tex2unichar: LaTeX math to Unicode character translation dictionaries
+:unichar2tex: Unicode character to LaTeX math translation table
+:tex2unichar: LaTeX math to Unicode character translation dictionaries
+:tex2mathml_extern: Wrapper for TeX -> MathML command line converters
"""
# helpers for Docutils math support
Modified: trunk/docutils/docutils/utils/math/latex2mathml.py
===================================================================
--- trunk/docutils/docutils/utils/math/latex2mathml.py 2015-04-12 09:57:05 UTC (rev 7864)
+++ trunk/docutils/docutils/utils/math/latex2mathml.py 2015-04-12 10:06:43 UTC (rev 7865)
@@ -558,3 +558,14 @@
raise SyntaxError(u'Unknown LaTeX command: ' + name)
return node, skip
+
+def tex2mathml(tex_math, inline=True):
+ """Return string with MathML code corresponding to `tex_math`.
+
+ `inline`=True is for inline math and `inline`=False for displayed math.
+ """
+
+ mathml_tree = parse_latex_math(tex_math, inline=inline)
+ return ''.join(mathml_tree.xml())
+
+
Modified: trunk/docutils/docutils/writers/html_base/html-base.css
===================================================================
--- trunk/docutils/docutils/writers/html_base/html-base.css 2015-04-12 09:57:05 UTC (rev 7864)
+++ trunk/docutils/docutils/writers/html_base/html-base.css 2015-04-12 10:06:43 UTC (rev 7865)
@@ -147,7 +147,8 @@
/* dl > dd p:last-child { margin-bottom: 0; } */
/* lists nested in definition lists */
-dd > ul, dd > ol { padding-left: 0pt; }
+/* :only-child is not part of CSS 2.1 (introduced in CSS 3) */
+dd > ul:only-child, dd > ol:only-child { padding-left: 1em; }
dt span.classifier { font-style: italic }
dt span.classifier:before {
@@ -458,7 +459,7 @@
/* can be styled in a custom stylesheet */
-/* Document Header & Footer */
+/* Document Header and Footer */
div.footer, div.header {
clear: both;
Modified: trunk/docutils/docutils/writers/xhtml11/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/xhtml11/__init__.py 2015-04-12 09:57:05 UTC (rev 7864)
+++ trunk/docutils/docutils/writers/xhtml11/__init__.py 2015-04-12 10:06:43 UTC (rev 7865)
@@ -16,10 +16,7 @@
Strict eXtensible HyperText Markup Language (XHTML) document Writer.
This is a variant of Docutils' `html-base` writer.
-
-* The output conforms to the XHTML version 1.1 DTD.
-* It contains no hard-coded formatting information that would prevent
- configuration by cascading style sheets.
+The output conforms to the XHTML version 1.1 DTD.
"""
__docformat__ = 'reStructuredText'
Modified: trunk/docutils/docutils/writers/xhtml11/xhtml11.css
===================================================================
--- trunk/docutils/docutils/writers/xhtml11/xhtml11.css 2015-04-12 09:57:05 UTC (rev 7864)
+++ trunk/docutils/docutils/writers/xhtml11/xhtml11.css 2015-04-12 10:06:43 UTC (rev 7865)
@@ -92,8 +92,8 @@
content: counters(item, ".") " ";
}
-/* <sup> and <sub> tags (possible with parsed-literal) are not allowed */
-/* in <pre> --- use <span> */
+/* "sup" and "sub" tags (possible with parsed-literal) are not allowed */
+/* in "pre" --- use "span" */
.subscript {
vertical-align: sub;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2015-04-13 18:59:21
|
Revision: 7866
http://sourceforge.net/p/docutils/code/7866
Author: milde
Date: 2015-04-13 18:59:13 +0000 (Mon, 13 Apr 2015)
Log Message:
-----------
XHTML does not allow "math" directly in "pre". Wrap in "span".
Modified Paths:
--------------
trunk/docutils/docs/user/html.txt
trunk/docutils/docutils/writers/html_base/__init__.py
trunk/docutils/docutils/writers/xhtml11/__init__.py
trunk/docutils/test/functional/expected/math_output_mathml.xhtml
trunk/docutils/test/functional/expected/standalone_rst_xhtml11.xhtml
trunk/docutils/test/functional/tests/math_output_mathml.py
Modified: trunk/docutils/docs/user/html.txt
===================================================================
--- trunk/docutils/docs/user/html.txt 2015-04-12 10:06:43 UTC (rev 7865)
+++ trunk/docutils/docs/user/html.txt 2015-04-13 18:59:13 UTC (rev 7866)
@@ -44,8 +44,7 @@
.. [#] `html` may become an alias for html-base in a future release.
-.. [#] TODO: how to name the alias/frontend specific to the html4css1 writer
- replacing "html":
+.. [#] TODO: how to name the alias/frontend pointing to html4css1?
:html4:
@@ -82,9 +81,13 @@
~~~~~~~~~
.. note:: The name `html_base` will change to a more appropriate one.
- Candidates are `html_basic` (but beware of confusion with the
- `XHTML Basic`_ document type) or `html_common`
- Suggestions welcome.
+ Candidates are
+
+ * `html_basic` (but beware of confusion with the `XHTML
+ Basic`_ document type),
+ * `html-generic`, `html-conservative`, or
+ * `html_common` (the greatest common denominator of (X)HTML variants
+ currently in use).
:aliases: html-base, html5
Modified: trunk/docutils/docutils/writers/html_base/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/html_base/__init__.py 2015-04-12 10:06:43 UTC (rev 7865)
+++ trunk/docutils/docutils/writers/html_base/__init__.py 2015-04-13 18:59:13 UTC (rev 7866)
@@ -1139,26 +1139,28 @@
self.body.append('</code>')
self.body.append('</pre>\n')
+ # Mathematics:
+ # As there is no native HTML math support, we provide alternatives
+ # for the math-output: LaTeX and MathJax simply wrap the content,
+ # HTML and MathML also convert the math_code.
+ # HTML container
+ math_tags = {# math_output: (block, inline, class-arguments)
+ 'mathml': ('div', '', ''),
+ 'html': ('div', 'span', 'formula'),
+ 'mathjax': ('div', 'span', 'math'),
+ 'latex': ('pre', 'tt', 'math'),
+ }
+
def visit_math(self, node, math_env=''):
# If the method is called from visit_math_block(), math_env != ''.
- # As there is no native HTML math support, we provide alternatives
- # for the math-output: LaTeX and MathJax simply wrap the content,
- # HTML and MathML also convert the math_code.
- # HTML container
- tags = {# math_output: (block, inline, class-arguments)
- 'mathml': ('div', '', ''),
- 'html': ('div', 'span', 'formula'),
- 'mathjax': ('div', 'span', 'math'),
- 'latex': ('pre', 'tt', 'math'),
- }
- if self.math_output not in tags:
+ if self.math_output not in self.math_tags:
self.document.reporter.error(
'math-output format "%s" not supported '
'falling back to "latex"'% self.math_output)
self.math_output = 'latex'
- tag = tags[self.math_output][math_env == '']
- clsarg = tags[self.math_output][2]
+ tag = self.math_tags[self.math_output][math_env == '']
+ clsarg = self.math_tags[self.math_output][2]
# LaTeX container
wrappers = {# math_mode: (inline, block)
'mathml': ('$%s$', u'\\begin{%s}\n%s\n\\end{%s}'),
Modified: trunk/docutils/docutils/writers/xhtml11/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/xhtml11/__init__.py 2015-04-12 10:06:43 UTC (rev 7865)
+++ trunk/docutils/docutils/writers/xhtml11/__init__.py 2015-04-13 18:59:13 UTC (rev 7866)
@@ -91,16 +91,17 @@
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN" '
'"http://www.w3.org/Math/DTD/mathml2/xhtml-math11-f.dtd">\n')
- # there is no attribute "lang" in XHTML 1.1
+# there is no attribute "lang" in XHTML 1.1
+
lang_attribute = 'xml:lang' # changed from 'lang' in XHTML 1.0
head_prefix_template = ('<html xmlns="http://www.w3.org/1999/xhtml"'
' xml:lang="%(lang)s">\n<head>\n')
- # enumerated lists
- # ----------------
- # The 'start' attribute does not conform to HTML4/XHTML1 Strict
- # (resurfaced in HTML5)
+# enumerated lists
+# ----------------
+# The 'start' attribute does not conform to HTML4/XHTML1 Strict
+# (resurfaced in HTML5)
def visit_enumerated_list(self, node):
atts = {}
@@ -114,8 +115,8 @@
self.body.append(self.starttag(node, 'ol', **atts))
- # <sup> and <sub> tags (possible with parsed-literal) are not allowed
- # in <pre> --- use <span> ::
+# <sup> and <sub> tags (possible with parsed-literal) are not allowed
+# in <pre> --- use <span> ::
def visit_subscript(self, node):
if isinstance(node.parent, nodes.literal_block):
@@ -145,9 +146,19 @@
else:
self.body.append('</sup>')
- # Meta tags: 'lang' attribute replaced by 'xml:lang' in XHTML 1.1
- # HTML5/polyglott recommends using both
+# Wrap inline MathML in <span>, as it is not allowed directly in a <pre> block
+# (possible with parsed-literal)::
+ math_tags = {# math_output: (block, inline, class-arguments)
+ 'mathml': ('div', 'span', ''),
+ 'html': ('div', 'span', 'formula'),
+ 'mathjax': ('div', 'span', 'math'),
+ 'latex': ('pre', 'tt', 'math'),
+ }
+
+# Meta tags: 'lang' attribute replaced by 'xml:lang' in XHTML 1.1
+# HTML5/polyglott recommends using both
+
def visit_meta(self, node):
if node.hasattr('lang'):
node['xml:lang'] = node['lang']
Modified: trunk/docutils/test/functional/expected/math_output_mathml.xhtml
===================================================================
--- trunk/docutils/test/functional/expected/math_output_mathml.xhtml 2015-04-12 10:06:43 UTC (rev 7865)
+++ trunk/docutils/test/functional/expected/math_output_mathml.xhtml 2015-04-13 18:59:13 UTC (rev 7866)
@@ -1,12 +1,10 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN" "http://www.w3.org/Math/DTD/mathml2/xhtml-math11-f.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
-<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.13: http://docutils.sourceforge.net/" />
<title>Mathematics</title>
<link rel="stylesheet" href="../input/data/html-base.css" type="text/css" />
-<link rel="stylesheet" href="../input/data/xhtml11.css" type="text/css" />
</head>
<body>
<div class="document" id="mathematics">
Modified: trunk/docutils/test/functional/expected/standalone_rst_xhtml11.xhtml
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_xhtml11.xhtml 2015-04-12 10:06:43 UTC (rev 7865)
+++ trunk/docutils/test/functional/expected/standalone_rst_xhtml11.xhtml 2015-04-13 18:59:13 UTC (rev 7866)
@@ -814,8 +814,8 @@
Inline markup is supported, e.g. <em>emphasis</em>, <strong>strong</strong>, <span class="docutils literal">literal
text</span>, <span class="subscript">sub-</span> and <span class="superscript">super</span>scripts,
-inline formulas: <math xmlns="http://www.w3.org/1998/Math/MathML">
-<mrow><mi>A</mi><mo>=</mo><mn>2</mn><mi>π</mi><msup><mi>r</mi><mn>2</mn></msup></mrow></math>,
+inline formulas: <span><math xmlns="http://www.w3.org/1998/Math/MathML">
+<mrow><mi>A</mi><mo>=</mo><mn>2</mn><mi>π</mi><msup><mi>r</mi><mn>2</mn></msup></mrow></math></span>,
footnotes <a class="footnote-reference" href="#id8" id="id22">[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>
<div class="section" id="code">
@@ -837,8 +837,8 @@
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 <math xmlns="http://www.w3.org/1998/Math/MathML">
-<mrow><mi>α</mi><mo>=</mo><mi>f</mi><mo>(</mo><mi>x</mi><mo>)</mo></mrow></math>.</p>
+<code class="tex">\alpha = f(x)</code> prints <span><math xmlns="http://www.w3.org/1998/Math/MathML">
+<mrow><mi>α</mi><mo>=</mo><mi>f</mi><mo>(</mo><mi>x</mi><mo>)</mo></mrow></math></span>.</p>
<p>The <span class="docutils literal">:code:</span> option of the <cite>include</cite> directive sets the included content
as a code block, here the rst file <span class="docutils literal">header_footer.txt</span> with line numbers:</p>
<pre class="code rst literal-block"><code><span class="ln">1 </span>.. header:: Document header
@@ -1468,10 +1468,10 @@
<h2><a class="toc-backref" href="#id86"><span class="sectnum">3.5</span> Maths</a></h2>
<p>The <span class="docutils literal"><span class="pre">html-output</span></span> setting defaults to »MathML«. If there is mathematical
content in <cite>MathML</cite> format, the document type is XHTML 1.1 plus MathML 2.0.</p>
-<p>The linear mapping <math xmlns="http://www.w3.org/1998/Math/MathML">
+<p>The linear mapping <span><math xmlns="http://www.w3.org/1998/Math/MathML">
<mrow><mi>f</mi><mo>:</mo><msup><mi>ℂ</mi>
<mrow><mi>N</mi></mrow></msup><mo>⟼</mo><msup><mi>ℂ</mi>
-<mrow><mi>N</mi></mrow></msup></mrow></math>
+<mrow><mi>N</mi></mrow></msup></mrow></math></span>
with</p>
<div>
<math xmlns="http://www.w3.org/1998/Math/MathML" mode="display">
@@ -1488,9 +1488,9 @@
<mrow><mi>n</mi><mi>k</mi></mrow>
<mrow><mi>N</mi></mrow></mfrac></mrow></msup></mtd></mtr></mtable></math>
</div>
-<p>for all <math xmlns="http://www.w3.org/1998/Math/MathML">
+<p>for all <span><math xmlns="http://www.w3.org/1998/Math/MathML">
<mrow><mi>a</mi><mo>∈</mo><msup><mi>ℂ</mi>
-<mrow><mi>N</mi></mrow></msup></mrow></math> is called discrete Fourier
+<mrow><mi>N</mi></mrow></msup></mrow></math></span> is called discrete Fourier
transformation (DFT).</p>
</div>
</div>
Modified: trunk/docutils/test/functional/tests/math_output_mathml.py
===================================================================
--- trunk/docutils/test/functional/tests/math_output_mathml.py 2015-04-12 10:06:43 UTC (rev 7865)
+++ trunk/docutils/test/functional/tests/math_output_mathml.py 2015-04-13 18:59:13 UTC (rev 7866)
@@ -5,7 +5,7 @@
# Keyword parameters passed to publish_file.
reader_name = "standalone"
parser_name = "rst"
-writer_name = "xhtml"
+writer_name = "html-base"
# Settings
settings_overrides['math_output'] = 'MathML'
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gi...@us...> - 2015-04-16 04:13:58
|
Revision: 7874
http://sourceforge.net/p/docutils/code/7874
Author: gitpull
Date: 2015-04-16 04:13:50 +0000 (Thu, 16 Apr 2015)
Log Message:
-----------
Add tox.ini support for testing multiple versions. Update release notes and docs for testing.
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/docs/dev/testing.txt
Added Paths:
-----------
trunk/docutils/tox.ini
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2015-04-16 03:13:26 UTC (rev 7873)
+++ trunk/docutils/HISTORY.txt 2015-04-16 04:13:50 UTC (rev 7874)
@@ -16,6 +16,13 @@
Changes Since 0.12
==================
+* tox.ini
+
+ - Test py26, py27, py33 and py34.
+
+ To use, install the ``tox`` package via pip or easy_install and use
+ tox from the project root directory.
+
* docutils/nodes.py
- Fix [ 253 ] Attribute key without value not allowed in XML.
Modified: trunk/docutils/docs/dev/testing.txt
===================================================================
--- trunk/docutils/docs/dev/testing.txt 2015-04-16 03:13:26 UTC (rev 7873)
+++ trunk/docutils/docs/dev/testing.txt 2015-04-16 04:13:50 UTC (rev 7874)
@@ -29,7 +29,35 @@
cd docutils/test
./alltests.py
+Testing Across Versions with tox
+================================
+To save time, you can use `tox`_ to test docutils on versions 2.6+. To
+install tox, you can use ``easy_install tox`` or ``pip install tox``.
+From shell::
+
+ cd docutils
+ tox
+
+If you need to install multiple versions of python, you can install
+`pyenv`_ (see `installing pyenv`_) and setup multiple python versions::
+
+ # assuming your system runs 2.7.x
+ $ pyenv install 2.6.9
+ $ pyenv install 3.3.6
+ $ pyenv install 3.4.3
+ $ pyenv global system 2.6.9 3.3.6 3.4.3
+ $ rm -rf ~/.pyenv/shims && pyenv rehash
+
+This will give you ``python2.6``, ``python2.7``, ``python3.3`` and
+``python3.4``. Along with that, ``pip2.6``, ``pip2.7`` and so on.
+
+Note: tox only supports python 2.6 and onward.
+
+.. _tox: https://tox.readthedocs.org/en/latest/
+.. _pyenv: https://github.com/yyuu/pyenv
+.. _installing pyenv: https://github.com/yyuu/pyenv#installation
+
Python Versions
===============
Added: trunk/docutils/tox.ini
===================================================================
--- trunk/docutils/tox.ini (rev 0)
+++ trunk/docutils/tox.ini 2015-04-16 04:13:50 UTC (rev 7874)
@@ -0,0 +1,5 @@
+[tox]
+envlist = py26, py27, py33, py34
+
+[testenv]
+commands = python test/alltests.py
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2015-04-20 10:57:48
|
Revision: 7883
http://sourceforge.net/p/docutils/code/7883
Author: milde
Date: 2015-04-20 10:57:46 +0000 (Mon, 20 Apr 2015)
Log Message:
-----------
Move development plan (single 2/3 source) from RELEASE-NOTES to todo list.
Modified Paths:
--------------
trunk/docutils/RELEASE-NOTES.txt
trunk/docutils/docs/dev/todo.txt
Modified: trunk/docutils/RELEASE-NOTES.txt
===================================================================
--- trunk/docutils/RELEASE-NOTES.txt 2015-04-20 10:55:19 UTC (rev 7882)
+++ trunk/docutils/RELEASE-NOTES.txt 2015-04-20 10:57:46 UTC (rev 7883)
@@ -22,6 +22,9 @@
* remove the `handle_io_errors` option from io.FileInput/Output.
+ .. used by Sphinx up to version 1.3.1,
+ see https://github.com/sphinx-doc/sphinx/issues/1834
+
* »Prune« the doctree (no change to the reST input syntax):
- "doctest" element -> literal block with "pycon" (python-console)
@@ -29,22 +32,16 @@
- special admonitions (note, hint, warning, ...) -> generic "admonition"
element with class attribute and auto-generated title.
-* Move to single source for Python 2 and Python 3, slowly.
- See `Porting Python 2 Code to Python 3`_ and
- `future: clean single-source support for Python 2/3`_
+* Drop support for python 2.4 after release 0.13.
- - Drop support for python 2.4 after release 0.12.
-.. _Porting Python 2 Code to Python 3: https://docs.python.org/3/howto/pyporting.html
-.. _future\: clean single-source support for Python 2/3: http://python-future.org
-
Changes Since 0.12
==================
* docutils/writers/
- New HTML writers generating `HTML 5`_ and `XHTML 1.1`_.
-
+
New stylesheet ``html-base.css`` for default layout using CSS 2.1.
* tools/
Modified: trunk/docutils/docs/dev/todo.txt
===================================================================
--- trunk/docutils/docs/dev/todo.txt 2015-04-20 10:55:19 UTC (rev 7882)
+++ trunk/docutils/docs/dev/todo.txt 2015-04-20 10:57:46 UTC (rev 7883)
@@ -71,6 +71,17 @@
General
=======
+* Move to single source for Python 2 and Python 3.
+ (Cf. `Porting Python 2 Code to Python 3`_ and
+ `clean single-source support for Python 2/3`_.)
+
+ - Gradually phase out support for Python 2.4 and 2.5 first.
+
+ .. _Porting Python 2 Code to Python 3:
+ https://docs.python.org/3/howto/pyporting.html
+ .. _clean single-source support for Python 2/3:
+ http://python-future.org
+
* Encoding of command line arguments can only be guessed:
* try UTF-8/strict first, then try the locale's encoding with
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2015-05-08 15:56:35
|
Revision: 7889
http://sourceforge.net/p/docutils/code/7889
Author: milde
Date: 2015-05-08 15:56:32 +0000 (Fri, 08 May 2015)
Log Message:
-----------
Documentation update.
Modified Paths:
--------------
trunk/docutils/COPYING.txt
trunk/docutils/docs/dev/distributing.txt
trunk/docutils/docs/dev/release.txt
trunk/docutils/docs/user/html.txt
trunk/docutils/docs/user/links.txt
Modified: trunk/docutils/COPYING.txt
===================================================================
--- trunk/docutils/COPYING.txt 2015-05-07 15:15:08 UTC (rev 7888)
+++ trunk/docutils/COPYING.txt 2015-05-08 15:56:32 UTC (rev 7889)
@@ -110,7 +110,7 @@
.. _eLyXer: http://www.nongnu.org/elyxer/
-* extras/roman.py, copyright by Mark Pilgrim, released under the
+* docutils/utils/roman.py, copyright by Mark Pilgrim, released under the
`Python 2.1.1 license`_ (`local copy`__).
__ licenses/python-2-1-1.txt
Modified: trunk/docutils/docs/dev/distributing.txt
===================================================================
--- trunk/docutils/docs/dev/distributing.txt 2015-05-07 15:15:08 UTC (rev 7888)
+++ trunk/docutils/docs/dev/distributing.txt 2015-05-08 15:56:32 UTC (rev 7889)
@@ -40,10 +40,6 @@
well as included source code files (with the "code" option to the include_
directive).
-* There is one file in the ``extras/`` directory of the Docutils
- distribution, ``roman.py``. It is automatically installed by the setup
- script (when calling "python setup.py install").
-
.. _Python Imaging Library: http://www.pythonware.com/products/pil/
.. _Pygments: http://pygments.org/
.. _code directives: ../ref/rst/directives.html#code
Modified: trunk/docutils/docs/dev/release.txt
===================================================================
--- trunk/docutils/docs/dev/release.txt 2015-05-07 15:15:08 UTC (rev 7888)
+++ trunk/docutils/docs/dev/release.txt 2015-05-08 15:56:32 UTC (rev 7889)
@@ -194,16 +194,25 @@
__ https://packaging.python.org/en/latest/distributing.html#pure-python-wheels
- + Eventually install the `wheel <https://pypi.python.org/pypi/wheel/>`__
- package::
+ + Eventually install the `pip <https://pypi.python.org/pypi/pip/>`__` and
+ `wheel <https://pypi.python.org/pypi/wheel/>`__ packages.
- pip install wheel
+ + Produce wheels:
+
+ For the default Python version:
- + Produce wheels for Python 2 and Python 3::
+ - From release at PyPI ::
- python2 setup.py bdist_wheel
- python3 setup.py bdist_wheel
+ pip wheel docutils
+ - From working directory's sub-directory "docutils" ::
+
+ pip wheel ./docutils/
+
+ Under Debian, the default Python version is 2.7 and the wheel is usable
+ for all 2.x versions supported by Docutils and
+ the command ``pip3 wheel docutils`` generates a wheel suitable for Py3k.
+
+ `Upload to PyPI`__
__ https://packaging.python.org/en/latest/distributing.html#upload-your-distributions
Modified: trunk/docutils/docs/user/html.txt
===================================================================
--- trunk/docutils/docs/user/html.txt 2015-05-07 15:15:08 UTC (rev 7888)
+++ trunk/docutils/docs/user/html.txt 2015-05-08 15:56:32 UTC (rev 7889)
@@ -15,98 +15,92 @@
and descendants).
-Overview
---------
+============= ============ ================= ==========================
+alias alias name output format(s)
+============= ============ ================= ==========================
+*html5* [#5]_ html_base_ | HTML5_
+ [#base]_ | `XHTML 1 Transitional`_
+
+*xhtml* html4strict xhtml11_ | `XHTML 1.1`_
+ | HTML5_
+
+*html* [#h]_ xhtml1 html4css1_ `XHTML 1 Transitional`_
+ html4
+
+.. pep_html_ `XHTML 1 Transitional`_
+
+*s5* s5_html_ `XHTML 1 Transitional`_
+
+============= ============ ================= ==========================
+
+For *emphasised* aliases exist ``rst2<alias>.py`` `front-end tools`_.
+
-========== =========== ================= =============================
-alias alias name output format(s)
-========== =========== ================= =============================
-*html5* html-base html_base_ | HTML5_
-[#]_ | `XHTML 1 Transitional`_
+.. html4trans_ `XHTML 1 Transitional`_
+ [#sandbox]_
+ .. [#sandbox] in the sandbox
-*xhtml* html4strict xhtml11_ | `XHTML 1.1`_
- | HTML5_
-
-*html* *xhtml1* or html4css1_ `XHTML 1 Transitional`_
-[#]_ *html4*
- [#]_
-.. pep_html_ `XHTML 1 Transitional`_
-
-*s5* s5_html_ `XHTML 1 Transitional`_
-
-.. html4trans_ [#]_ `XHTML 1 Transitional`_
-========== =========== ================= =============================
-
-For *emphazised* aliases exist ``rst2<alias>.py`` `front-end tools`_.
-
-.. [#] `html5` may become the name of an advanced HTML5 writer derived from
- html-base in a future release.
-
-.. [#] `html` may become an alias for html-base in a future release.
-
-.. [#] TODO: how to name the alias/frontend pointing to html4css1?
-
- :html4:
-
- +1 short form of html4css1,
- -1 writer produces XHTML 1, not HTML 4
-
- :xhtml1:
-
- +1 correct and short description of the output format.
- -1 may be confused with xhtml11 or xhtml (aliases for the
- "new" XHTML 1.1. writer inheriting from html-base).
-
-.. [#] in the sandbox
-
.. _front-end tools: tools.html
html
-~~~~
+----
-The writer name `html` is an alias pointing to the "recommended Docutils
-HTML writer". Its meaning may change with the development of HTML, browsers
-and the web.
+The writer alias `html` points to the "recommended Docutils HTML writer".
+Its meaning may change with the development of HTML, browsers, Docutils, and
+the web.
* Use `get_writer_by_name('html') or the ``rst2html.py`` front end, if you
want the output to be up-to-date automatically.
* Use a more specific writer name or front end, if you depend on stability
of the generated HTML code, e.g. because you use a custom style sheet or
- postprocessing that may break otherwise.
+ post-processing that may break otherwise.
html_base
-~~~~~~~~~
+---------
-.. note:: The name `html_base` will change to a more appropriate one.
- Candidates are
-
- * `html_basic` (but beware of confusion with the `XHTML
- Basic`_ document type),
- * `html-generic`, `html-conservative`, or
- * `html_common` (the greatest common denominator of (X)HTML variants
- currently in use).
-
-
-:aliases: html-base, html5
+:aliases: html-base [#base]_, html5 [#5]_
:front-end: rst2html5.py_
:config: `[html-base writer]`_
-The `html-base` writer is both, basis for more specialized HTML writers and
-working code generating clean and highly compatible documents.
+The `html-base` module is both, basis for other HTML writers and
+a writer generating simple, clean, and highly compatible documents.
-It generates modern `polyglot HTML`_ output (compatible with HTML5_
-and `XHTML 1 Transitional`_). Correct rendering depends on a CSS_ style
-sheet. An example style sheet, html-base.css_, is provided and used by
-default.
+It generates `polyglot HTML`_ output (compatible with HTML5_ and `XHTML 1
+Transitional`_). New features and elements will only be used if they are
+widely supported to make documents `viewable with any browser`_.
-New features and elements will only be used if they are widely supported to
-make documents `viewable with any browser`_. Leaving out hard-coded
+Correct rendering depends on a CSS_ style sheet. An example style sheet,
+html-base.css_, is provided and used by default. Leaving out hard-coded
formatting information from the HTML code allows adaption of the layout with
`custom style sheets`_.
+.. [#base] TODO: Find a better name for the basic html writer.
+
+ Suggestions:
+
+ html-plain
+ +1 simple, plain, unadorned.
+ html-simple
+ ±0 simple
+ html-vanilla
+ -0 too long
+ html-basic
+ -1 does not produce `XHTML Basic`_
+ html-lcd
+ `Lowest Common Denominator` -- supporting HTML 5, XHTML 1,
+ and older (HTML 4 + CSS2) browsers.
+
+ -1 cryptic
+ html-base
+ -1 not only base class but also for end-users
+
+.. [#5] `html5` may become the name for a specialised `html5 writer`_ in a
+ future release.
+
+
.. _rst2html5.py: tools.html#rst2html5-py
.. _[html-base writer]: config.html#html-base-writer
.. _html-base.css: ../../docutils/writers/html_base/html-base.css
@@ -115,7 +109,7 @@
xhtml11
-"""""""
+~~~~~~~
:aliases: xhtml, html4strict
:front-end: rst2xhtml.py_
:config: `[xhtml11 writer]`_
@@ -131,7 +125,7 @@
* Enumerated lists don't support the 'start' attribute.
The style sheet xhtml11.css_ adds support for a "start" value for
- enumerated lists via a CSS-counter.
+ enumerated lists via a CSS-counter. This allows also nested enumeration.
* ``<sup>`` and ``<sub>`` tags are not allowed in preformatted blocks
(``<pre>``) but possible in reStructuredText with the "parsed-literal"
@@ -145,8 +139,10 @@
.. _xhtml11.css: ../../docutils/writers/xhtml11/xhtml11.css
+.. _`html5 writer`:
+
html5
-"""""
+~~~~~
The writer name `html5` is reserved for a HTML writer that makes use of new
features and objects defined in HTML5 but not (yet) fit for use in
@@ -155,12 +151,24 @@
html4css1
-~~~~~~~~~
+---------
-:aliases: html4, html
+:aliases: html4 [#html4]_, html [#h]_
:front-ends: rst2html.py_, rst2html4.py
:config: `[html4css1 writer]`_
+.. [#h] `html` may become an alias for html-base in a future release.
+
+.. [#html4] TODO: How to name a specific alias/front-end pointing to html4css1?
+
+ html4
+ | +1 short form of html4css1,
+ | -1 writer produces XHTML 1, not HTML 4
+ xhtml1
+ | +1 correct and short description of the output format.
+ | -1 may be confused with xhtml11 or xhtml (aliases for the
+ "new" XHTML 1.1. writer inheriting from html-base).
+
The HTML Writer module, ``docutils/writers/html4css1.py``, started
as a proof-of-concept reference implementation. It is the first Docutils
writer and was up to release 0.13 the only official HTML writer.
@@ -191,14 +199,14 @@
The following three HTML writers inherit from `html4css1`:
pep_html
-""""""""
+~~~~~~~~
:front-end: rstpep2html.py_
:config: `[pep_html writer]`_
This is a special writer for the generation of `Python Enhancement
Proposals`_ (PEPs). It adds some PEP-Specific
-Options, a style sheet and template. The front-end uses also a specialized
+Options, a style sheet and template. The front-end uses also a specialised
reader.
.. _rstpep2html.py: tools.html#rstpep2html-py
@@ -206,7 +214,7 @@
.. _Python Enhancement Proposals: https://www.python.org/dev/peps/
s5_html
-"""""""
+~~~~~~~
:alias: s5
:front-end: rst2s5.py_
@@ -224,7 +232,7 @@
html4trans
-""""""""""
+~~~~~~~~~~
:front-end: rst2html_trans.py_
Modified: trunk/docutils/docs/user/links.txt
===================================================================
--- trunk/docutils/docs/user/links.txt 2015-05-07 15:15:08 UTC (rev 7888)
+++ trunk/docutils/docs/user/links.txt 2015-05-08 15:56:32 UTC (rev 7889)
@@ -79,7 +79,7 @@
.. _outliner: http://en.wikipedia.org/wiki/Outliner
__ http://leoeditor.com/tutorial-rst3.html
-* `NoTex <https://notex.ch>`_ is a browser based reStructuredText editor
+* `NoTex <https://notex.ch>`_ is a browser-based reStructuredText editor
with syntax highlighting and PDF/HTML export functionality using Sphinx.
* `rsted <https://github.com/anru/rsted>`_ is a "simple online editor for
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2015-05-11 15:39:01
|
Revision: 7893
http://sourceforge.net/p/docutils/code/7893
Author: milde
Date: 2015-05-11 15:38:58 +0000 (Mon, 11 May 2015)
Log Message:
-----------
Separate style sheets for required and optional layout rules.
Modified Paths:
--------------
trunk/docutils/docutils/writers/html_base/__init__.py
trunk/docutils/docutils/writers/xhtml11/__init__.py
trunk/docutils/test/functional/expected/math_output_mathml.xhtml
trunk/docutils/test/functional/expected/standalone_rst_html_base.html
trunk/docutils/test/functional/expected/standalone_rst_xhtml11.xhtml
trunk/docutils/test/functional/input/standalone_rst_html_base.txt
trunk/docutils/test/functional/input/standalone_rst_xhtml11.txt
Added Paths:
-----------
trunk/docutils/docutils/writers/html_base/minimal.css
trunk/docutils/docutils/writers/html_base/plain.css
trunk/docutils/test/functional/input/data/minimal.css
trunk/docutils/test/test_writers/test_html_base_misc.py
Removed Paths:
-------------
trunk/docutils/docutils/writers/html_base/html-base.css
trunk/docutils/test/functional/input/data/html-base.css
Modified: trunk/docutils/docutils/writers/html_base/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/html_base/__init__.py 2015-05-08 16:03:49 UTC (rev 7892)
+++ trunk/docutils/docutils/writers/html_base/__init__.py 2015-05-11 15:38:58 UTC (rev 7893)
@@ -22,7 +22,8 @@
The output conforms to the `HTML 5` specification as well as
to `XHTML 1.0 transitional`.
-The cascading style sheet "html-base.css" is required for proper viewing.
+The cascading style sheet "minimal.css" is required for proper viewing,
+the style sheet "plain.css" provides a better reading experience.
"""
__docformat__ = 'reStructuredText'
@@ -52,7 +53,7 @@
supported = ('html', 'html5', 'html4', 'xhtml', 'xhtml10')
"""Formats this writer supports."""
- default_stylesheets = ['html-base.css']
+ default_stylesheets = ['minimal.css','plain.css']
default_stylesheet_dirs = ['.', os.path.abspath(os.path.dirname(__file__))]
default_template = 'template.txt'
Deleted: trunk/docutils/docutils/writers/html_base/html-base.css
===================================================================
--- trunk/docutils/docutils/writers/html_base/html-base.css 2015-05-08 16:03:49 UTC (rev 7892)
+++ trunk/docutils/docutils/writers/html_base/html-base.css 2015-05-11 15:38:58 UTC (rev 7893)
@@ -1,510 +0,0 @@
-/* Basic style sheet for the HTML output of Docutils. */
-/* */
-/* :Author: Günter Milde, based on html4css1.css by David Goodger */
-/* :Id: $Id$ */
-/* :Copyright: © 2015 Günter Milde. */
-/* :License: Released under the terms of the `2-Clause BSD license`_, */
-/* in short: */
-/* */
-/* Copying and distribution of this file, with or without modification, */
-/* are permitted in any medium without royalty provided the copyright */
-/* notice and this notice are preserved. */
-/* */
-/* This file is offered as-is, without any warranty. */
-/* */
-/* .. _2-Clause BSD license: http://www.spdx.org/licenses/BSD-2-Clause */
-
-
-/* This stylesheet contains basic rules for the output of the */
-/* Docutils HTML writers. It validates_ as CSS2.1_ */
-/* */
-/* .. _CSS2.1: http://www.w3.org/TR/CSS2 */
-/* .. _validates: http://jigsaw.w3.org/css-validator/validator$link */
-
-
-/* Document Structure */
-/* ****************** */
-
-/* Document */
-
-body {
- padding: 0 5%;
- margin: 8px 0;
-}
-
-div.document {
- line-height:1.3;
- counter-reset: table;
- /* counter-reset: figure; */
- /* avoid long lines --> better reading */
- /* OTOH: lines should not be too short because of missing hyphenation, */
- max-width: 50em;
- margin: auto;
-}
-
-.align-left { text-align: left; }
-.align-right { text-align: right; }
-.align-center {
- clear: both;
- text-align: center;
-}
-
-/* Sections */
-
-h1.title, p.subtitle {
- text-align: center;
-}
-
-h1 + p.subtitle { font-size: 1.6em; }
-h1 + p.section-subtitle { font-size: 1.6em; }
-h2 + p.section-subtitle { font-size: 1.28em; }
-
-a.toc-backref {
- color: black;
- text-decoration: none;
-}
-
-/* Stop floating sidebars, images and figures at section level 1,2,3 */
-h1, h2, h3 { clear: both; }
-
-/* Transitions */
-
-hr.docutils {
- width: 80%;
- margin-top: 1em;
- margin-bottom: 1em;
- clear: both;
-}
-
-/* Paragraphs */
-/* ========== */
-
-/* vertical space (parskip) */
-p, ol, ul, dl,
-div.line-block,
-table{
- margin-top: 0.5em;
- margin-bottom: 0.5em;
-}
-h1, h2, h3, h4, h5, h6,
-dl > dd {
- margin-bottom: 0.5em;
-}
-
-/* titles */
-p.admonition-title,
-p.topic-title,
-p.sidebar-title,
-p.system-message-title {
- font-weight: bold;
-}
-
-p.subtitle,
-p.section-subtitle,
-p.sidebar-subtitle {
- font-weight: bold;
- margin-top: -0.5em;
-}
-
-
-/* Warnings, Errors */
-div.caution p.admonition-title,
-div.attention p.admonition-title,
-div.danger p.admonition-title,
-div.error p.admonition-title,
-div.warning p.admonition-title,
-div.system-messages h1,
-div.error,
-span.problematic,
-p.system-message-title {
- color: red;
-}
-
-/* Lists */
-/* ========== */
-
-/* compact and simple lists: no margin between items */
-dl.simple > dd, dl.compact > dd,
-.compact li, .compact ul, .compact ol
-.simple li, .simple ul, .simple ol,
-.simple > li p, .compact > li p {
- margin-top: 0;
- margin-bottom: 0;
-}
-
-/* Enumerated Lists */
-
-ol.arabic { list-style: decimal }
-ol.loweralpha { list-style: lower-alpha }
-ol.upperalpha { list-style: upper-alpha }
-ol.lowerroman { list-style: lower-roman }
-ol.upperroman { list-style: upper-roman }
-
-/* Definition Lists */
-
-dl > dd p:first-child { margin-top: 0; }
-/* :last-child is not part of CSS 2.1 (introduced in CSS 3) */
-/* dl > dd p:last-child { margin-bottom: 0; } */
-
-/* lists nested in definition lists */
-/* :only-child is not part of CSS 2.1 (introduced in CSS 3) */
-dd > ul:only-child, dd > ol:only-child { padding-left: 1em; }
-
-dt span.classifier { font-style: italic }
-dt span.classifier:before {
- font-style: normal;
- margin: 0.5em;
- content: ":";
-}
-
-/* Field Lists */
-
-/* bold field name, content starts on the same line */
-dl.field-list > dt,
-dl.option-list > dt,
-dl.docinfo > dt,
-dl.footnote > dt,
-dl.citation > dt,
-dl.description > dt {
- font-weight: bold;
- clear: left;
- float: left;
- margin: 0;
- padding: 0;
- padding-right: 0.5em;
-}
-/* Offset for field content (corresponds to the --field-name-limit option) */
-dl.field-list > dd,
-dl.option-list > dd,
-dl.docinfo > dd {
- margin-left: 9em; /* ca. 14 chars in the test examples */
-/* padding-left: 0.5em; */
-}
-/* start field-body on a new line after long field names */
-dl.field-list > dd > *:first-child,
-dl.option-list > dd > *:first-child,
-dl.docinfo > dd > *:first-child {
- display: inline-block;
- width: 100%;
- margin: 0;
-}
-/* field names followed by a colon */
-dl.field-list > dt:after,
-dl.docinfo > dt:after {
- content: ":";
-}
-
-/* example for custom field-name width */
-dl.field-list.narrow > dd {
- margin-left: 5em;
-}
-/* run-in: start field-body on same line after long field names */
-dl.field-list.run-in > dd p {
- display: block;
-}
-
-/* Bibliographic Fields */
-
-/* use special field-list dl.docinfo */
-
-pre.address {
- margin-bottom: 0;
- margin-top: 0;
- font: inherit;
-}
-dd.authors > p { margin: 0; }
-
-div.abstract p.topic-title {
- text-align: center;
-}
-
-div.dedication {
- margin: 2em 5em;
- text-align: center;
- font-style: italic;
-}
-div.dedication p.topic-title {
- font-style: normal;
-}
-
-/* Option Lists */
-
-dl.option-list {
- margin-left: 1em;
-}
-dl.option-list > dt {
- font-weight: normal;
-}
-span.option {
- white-space: nowrap;
-}
-
-/* Text Blocks */
-/* ============ */
-
-/* Line Blocks */
-
-div.line-block {
- display: block;
-}
-div.line-block div.line-block {
- margin-top: 0;
- margin-bottom: 0;
- margin-left: 1.5em;
-}
-
-/* Literal Blocks */
-
-pre.literal-block, pre.doctest-block,
-pre.math, pre.code {
- margin-left: 1.5em;
- margin-right: 1.5em
-}
-
-/* Block Quotes */
-
-blockquote,
-div.topic {
- margin-left: 1.5em;
- margin-right: 1.5em
-}
-blockquote > table,
-div.topic > table {
- margin-top: 0;
- margin-bottom: 0;
-}
-blockquote p.attribution,
-div.topic p.attribution {
- text-align: right;
- margin-left: 20%;
-}
-
-/* Tables */
-/* ====== */
-
-/* margins and borders for "normal" tables */
-table {
- border-collapse: collapse;
-}
-td, th {
- border-style: solid;
- border-color: silver;
- padding: 0 1ex;
-/* some borders missing at some magnifications
-/* in Firefox 31.5.0 and opera 10.63 */
- border-width: thin;
-}
-td > p:first-child, th > p:first-child {
- margin-top: 0;
-}
-td > p, th > p {
- margin-bottom: 0;
-}
-th {
- vertical-align: bottom;
-}
-
-table > caption {
- text-align: left;
- margin-bottom: 0.25em
-}
-
-table.borderless td, table.borderless th {
- border: 0;
- padding: 0;
- padding-right: 0.5em /* separate table cells */
-}
-
-/* "booktabs" style (no vertical lines) */
-table.booktabs {
- border: 0;
- border-top: 2px solid;
- border-bottom: 2px solid;
- border-collapse: collapse;
-}
-
-table.booktabs * {
- border: 0;
-}
-table.booktabs th {
- border-bottom: thin solid;
- text-align: left;
-}
-
-/* numbered tables (counter defined in div.document) */
-table.numbered > caption:before {
- counter-increment: table;
- content: "Table " counter(table) ": ";
- font-weight: bold;
-}
-
-/* Explicit Markup Blocks */
-/* ====================== */
-
-/* Footnotes and Citations */
-/* ----------------------- */
-
-/* line on the left */
-dl.footnote {
- padding-left: 1ex;
- border-left: solid;
- border-left-width: thin;
-}
-
-dl > dt.label {
- font-weight: normal;
-}
-dt.label > span.fn-backref {
- margin: 0.2em;
-}
-dt.label > span.fn-backref > a {
- font-style: italic;
-}
-
-/* Directives */
-/* ---------- */
-
-/* Admonitions */
-/* System Messages */
-
-div.admonition,
-div.system-message {
- margin: 2em;
- border: medium outset;
- padding-right: 1em;
- padding-left: 1em;
-}
-
-/* Body Elements */
-/* ~~~~~~~~~~~~~ */
-
-/* Image and Figure */
-
-img.align-left,
-.figure.align-left,
-object.align-left {
- clear: left;
- float: left;
- margin-right: 1em
-}
-img.align-right,
-.figure.align-right,
-object.align-right {
- clear: right;
- float: right;
- margin-left: 1em
-}
-img.align-center,
-.figure.align-center,
-object.align-center {
- display: block;
- margin-left: auto;
- margin-right: auto;
-}
-/* reset inner alignment in figures */
-div.align-right {
- text-align: inherit }
-
-/* Topic */
-
-div.topic { margin: 2em }
-
-/* Sidebar */
-
-/* in a layout with fixed margins, */
-/* the sidebar can be moved into the margin completely */
-div.sidebar {
- border: medium outset;
- padding-right: 1em;
- padding-left: 1em;
- width: 30%;
- max-width: 26em;
- float: right;
- clear: right;
- margin-left: 1em;
- margin-right: -5.5%;
- background-color: #ffffee ;
-}
-p.sidebar-title { font-size: larger; }
-
-/* Code */
-
-pre.code, code { background-color: #eeeeee }
-pre.code .ln { color: gray; } /* line numbers */
-/* basic highlighting: for a complete scheme, see */
-/* http://docutils.sourceforge.net/sandbox/stylesheets/ */
-pre.code .comment, code .comment { color: #5C6576 }
-pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
-pre.code .literal.string, code .literal.string { color: #0C5404 }
-pre.code .name.builtin, code .name.builtin { color: #352B84 }
-pre.code .deleted, code .deleted { background-color: #DEB0A1}
-pre.code .inserted, code .inserted { background-color: #A3D289}
-
-/* Math */
-/* styled separately (see math.css for math-output=HTML) */
-
-/* Rubric */
-
-p.rubric {
- font-weight: bold;
- font-size: larger;
- color: maroon;
-}
-
-/* Epigraph */
-/* Highlights */
-/* Pull-Quote */
-/* Compound Paragraph */
-/* Container */
-
-/* can be styled in a custom stylesheet */
-
-/* Document Header and Footer */
-
-div.footer, div.header {
- clear: both;
- font-size: smaller;
-}
-
-/* Contents */
-
-div.topic.contents {
- margin: 0; /* don't indent like a topic */
-}
-ul.auto-toc {
- list-style-type: none;
-}
-
-/* Inline Markup */
-/* ============= */
-
-/* Emphasis */
-/* em */
-/* Strong Emphasis */
-/* strong */
-/* Interpreted Text */
-/* span.interpreted */
-/* Title Reference */
-/* cite */
-/* Inline Literals */
-
-tt.literal, span.docutils.literal {
- font-family: monospace;
- /* possible values: normal, nowrap, pre, pre-wrap, pre-line */
- white-space: pre-wrap;
-}
-/* do not wraph a hyphens and similar: */
-.literal > span.pre { white-space: nowrap; }
-
-/* Hyperlink References */
-
-a { text-decoration: none; }
-
-/* External Targets */
-/* span.target.external */
-/* Internal Targets */
-/* span.target.internal */
-/* Footnote References */
-/* a.footnote-reference */
-/* Citation References */
-/* a.citation-reference */
Copied: trunk/docutils/docutils/writers/html_base/minimal.css (from rev 7885, trunk/docutils/docutils/writers/html_base/html-base.css)
===================================================================
--- trunk/docutils/docutils/writers/html_base/minimal.css (rev 0)
+++ trunk/docutils/docutils/writers/html_base/minimal.css 2015-05-11 15:38:58 UTC (rev 7893)
@@ -0,0 +1,240 @@
+/* Minimal style sheet for the HTML output of Docutils. */
+/* */
+/* :Author: Günter Milde, based on html4css1.css by David Goodger */
+/* :Id: $Id$ */
+/* :Copyright: © 2015 Günter Milde. */
+/* :License: Released under the terms of the `2-Clause BSD license`_, */
+/* in short: */
+/* */
+/* Copying and distribution of this file, with or without modification, */
+/* are permitted in any medium without royalty provided the copyright */
+/* notice and this notice are preserved. */
+/* */
+/* This file is offered as-is, without any warranty. */
+/* */
+/* .. _2-Clause BSD license: http://www.spdx.org/licenses/BSD-2-Clause */
+
+/* This CSS2.1_ stylesheet defines rules for Docutils elements without */
+/* HTML equivalent. It is required to make the document semantic visible. */
+/* */
+/* .. _CSS2.1: http://www.w3.org/TR/CSS2 */
+/* .. _validates: http://jigsaw.w3.org/css-validator/validator$link */
+
+/* Figure/table alignment */
+.align-left { text-align: left; }
+.align-right { text-align: right; }
+.align-center { clear: both; text-align: center;}
+
+/* titles */
+h1.title, p.subtitle {
+ text-align: center;
+}
+p.admonition-title,
+p.topic-title,
+p.sidebar-title,
+p.rubric,
+p.system-message-title {
+ font-weight: bold;
+}
+h1 + p.subtitle,
+h1 + p.section-subtitle {
+ font-size: 1.6em;
+}
+h2 + p.section-subtitle { font-size: 1.28em; }
+p.subtitle,
+p.section-subtitle,
+p.sidebar-subtitle {
+ font-weight: bold;
+ margin-top: -0.5em;
+}
+p.sidebar-title,
+p.rubric {
+ font-size: larger;
+}
+p.rubric { color: maroon; }
+a.toc-backref {
+ color: black;
+ text-decoration: none; }
+
+/* Warnings, Errors */
+div.caution p.admonition-title,
+div.attention p.admonition-title,
+div.danger p.admonition-title,
+div.error p.admonition-title,
+div.warning p.admonition-title,
+div.system-messages h1,
+div.error,
+span.problematic,
+p.system-message-title {
+ color: red;
+}
+
+/* inline literals */
+span.docutils.literal {
+ font-family: monospace;
+ white-space: pre-wrap;
+}
+/* do not wraph at hyphens and similar: */
+.literal > span.pre { white-space: nowrap; }
+
+/* Lists */
+
+/* compact and simple lists: no margin between items */
+.simple li, .compact li,
+.simple ul, .compact ul,
+.simple ol, .compact ol,
+.simple > li p, .compact > li p,
+dl.simple > dd, dl.compact > dd {
+ margin-top: 0;
+ margin-bottom: 0;
+}
+
+/* Table of Contents */
+div.topic.contents { margin: 0; }
+ul.auto-toc {
+ list-style-type: none;
+ padding-left: 1.5em; }
+
+/* Enumerated Lists */
+ol.arabic { list-style: decimal }
+ol.loweralpha { list-style: lower-alpha }
+ol.upperalpha { list-style: upper-alpha }
+ol.lowerroman { list-style: lower-roman }
+ol.upperroman { list-style: upper-roman }
+
+dt span.classifier { font-style: italic }
+dt span.classifier:before {
+ font-style: normal;
+ margin: 0.5em;
+ content: ":";
+}
+
+/* Field Lists and drivatives */
+/* bold field name, content starts on the same line */
+dl.field-list > dt,
+dl.option-list > dt,
+dl.docinfo > dt,
+dl.footnote > dt,
+dl.citation > dt {
+ font-weight: bold;
+ clear: left;
+ float: left;
+ margin: 0;
+ padding: 0;
+ padding-right: 0.5em;
+}
+/* Offset for field content (corresponds to the --field-name-limit option) */
+dl.field-list > dd,
+dl.option-list > dd,
+dl.docinfo > dd {
+ margin-left: 9em; /* ca. 14 chars in the test examples */
+}
+/* start field-body on a new line after long field names */
+dl.field-list > dd > *:first-child,
+dl.option-list > dd > *:first-child
+{
+ display: inline-block;
+ width: 100%;
+ margin: 0;
+}
+/* field names followed by a colon */
+dl.field-list > dt:after,
+dl.docinfo > dt:after {
+ content: ":";
+}
+
+/* Bibliographic Fields (docinfo) */
+pre.address { font: inherit; }
+dd.authors > p { margin: 0; }
+
+/* Option Lists */
+dl.option-list { margin-left: 40px; }
+dl.option-list > dt { font-weight: normal; }
+span.option { white-space: nowrap; }
+
+/* Footnotes and Citations */
+dl > dt.label { font-weight: normal; }
+dt.label > span.fn-backref { margin: 0.2em; }
+dt.label > span.fn-backref > a { font-style: italic; }
+
+/* Line Blocks */
+div.line-block { display: block; }
+div.line-block div.line-block {
+ margin-top: 0;
+ margin-bottom: 0;
+ margin-left: 40px;
+}
+
+/* Images and Figures */
+img.align-left,
+.figure.align-left,
+object.align-left {
+ display: block;
+ margin-right: auto;
+}
+img.align-center,
+.figure.align-center,
+object.align-center {
+ display: block;
+ margin-left: auto;
+ margin-right: auto;
+}
+img.align-right,
+.figure.align-right,
+object.align-right {
+ display: block;
+ margin-left: auto;
+}
+/* reset inner alignment in figures */
+div.align-right { text-align: inherit }
+
+/* Admonitions and System Messages */
+div.admonition,
+div.system-message,
+div.sidebar{
+ margin: 40px;
+ border: medium outset;
+ padding-right: 1em;
+ padding-left: 1em;
+}
+
+/* Sidebar */
+div.sidebar {
+ width: 30%;
+ max-width: 26em;
+ float: right;
+ clear: right;
+}
+
+/* Text Blocks */
+div.topic,
+pre.literal-block,
+pre.doctest-block,
+pre.math,
+pre.code {
+ margin-right: 40px;
+ margin-left: 40px;
+}
+pre.code .ln { color: gray; } /* line numbers */
+
+/* Tables */
+table { border-collapse: collapse; }
+td, th {
+ border-style: solid;
+ border-color: silver;
+ padding: 0 1ex;
+ border-width: thin;
+}
+td > p:first-child, th > p:first-child { margin-top: 0; }
+td > p, th > p { margin-bottom: 0; }
+
+table > caption {
+ text-align: left;
+ margin-bottom: 0.25em
+}
+
+table.borderless td, table.borderless th {
+ border: 0;
+ padding: 0;
+ padding-right: 0.5em /* separate table cells */
+}
Added: trunk/docutils/docutils/writers/html_base/plain.css
===================================================================
--- trunk/docutils/docutils/writers/html_base/plain.css (rev 0)
+++ trunk/docutils/docutils/writers/html_base/plain.css 2015-05-11 15:38:58 UTC (rev 7893)
@@ -0,0 +1,283 @@
+/* CSS31_ style sheet for the output of Docutils HTML writers. */
+/* Rules for easy reading and pre-defined style variants. */
+/* */
+/* :Author: Günter Milde, based on html4css1.css by David Goodger */
+/* :Id: $Id$ */
+/* :Copyright: © 2015 Günter Milde. */
+/* :License: Released under the terms of the `2-Clause BSD license`_, */
+/* in short: */
+/* */
+/* Copying and distribution of this file, with or without modification, */
+/* are permitted in any medium without royalty provided the copyright */
+/* notice and this notice are preserved. */
+/* */
+/* This file is offered as-is, without any warranty. */
+/* */
+/* .. _2-Clause BSD license: http://www.spdx.org/licenses/BSD-2-Clause */
+/* .. _CSS3: http://www.w3.org/TR/CSS3 */
+
+
+/* Document Structure */
+/* ****************** */
+
+/* "page layout" */
+body {
+ padding: 0 5%;
+ margin: 8px 0;
+}
+div.document {
+ line-height:1.3;
+ counter-reset: table;
+ /* counter-reset: figure; */
+ /* avoid long lines --> better reading */
+ /* OTOH: lines should not be too short because of missing hyphenation, */
+ max-width: 50em;
+ margin: auto;
+}
+
+/* Sections */
+
+/* Transitions */
+
+hr.docutils {
+ width: 80%;
+ margin-top: 1em;
+ margin-bottom: 1em;
+ clear: both;
+}
+
+/* Paragraphs */
+/* ========== */
+
+/* vertical space (parskip) */
+p, ol, ul, dl,
+div.line-block,
+table{
+ margin-top: 0.5em;
+ margin-bottom: 0.5em;
+}
+h1, h2, h3, h4, h5, h6,
+dl > dd {
+ margin-bottom: 0.5em;
+}
+
+/* Lists */
+/* ========== */
+
+/* Definition Lists */
+
+dl > dd p:first-child { margin-top: 0; }
+/* :last-child is not part of CSS 2.1 (introduced in CSS 3) */
+/* dl > dd p:last-child { margin-bottom: 0; } */
+
+/* lists nested in definition lists */
+/* :only-child is not part of CSS 2.1 (introduced in CSS 3) */
+dd > ul:only-child, dd > ol:only-child { padding-left: 1em; }
+
+/* Description Lists */
+/* styled like in most dictionaries, encyclopedias etc. */
+dl.description > dt {
+ font-weight: bold;
+ clear: left;
+ float: left;
+ margin: 0;
+ padding: 0;
+ padding-right: 0.5em;
+}
+
+/* Field Lists */
+
+/* example for custom field-name width */
+dl.field-list.narrow > dd {
+ margin-left: 5em;
+}
+/* run-in: start field-body on same line after long field names */
+dl.field-list.run-in > dd p {
+ display: block;
+}
+
+/* Bibliographic Fields */
+
+/* generally, bibliographic fields use special definition list dl.docinfo */
+/* but dedication and abstract are placed into "topic" divs */
+div.abstract p.topic-title {
+ text-align: center;
+}
+div.dedication {
+ margin: 2em 5em;
+ text-align: center;
+ font-style: italic;
+}
+div.dedication p.topic-title {
+ font-style: normal;
+}
+
+/* Citations */
+dl.citation dt.label {
+ font-weight: bold;
+}
+span.fn-backref {
+ font-weight: normal;
+}
+
+/* Text Blocks */
+/* ============ */
+
+/* Literal Blocks */
+pre.literal-block, pre.doctest-block,
+pre.math, pre.code {
+ margin-left: 1.5em;
+ margin-right: 1.5em
+}
+
+/* Block Quotes */
+
+blockquote,
+div.topic {
+ margin-left: 1.5em;
+ margin-right: 1.5em
+}
+blockquote > table,
+div.topic > table {
+ margin-top: 0;
+ margin-bottom: 0;
+}
+blockquote p.attribution,
+div.topic p.attribution {
+ text-align: right;
+ margin-left: 20%;
+}
+
+/* Tables */
+/* ====== */
+
+/* th { vertical-align: bottom; } */
+
+/* "booktabs" style (no vertical lines) */
+table.booktabs {
+ border: 0;
+ border-top: 2px solid;
+ border-bottom: 2px solid;
+ border-collapse: collapse;
+}
+table.booktabs * {
+ border: 0;
+}
+table.booktabs th {
+ border-bottom: thin solid;
+ text-align: left;
+}
+
+/* numbered tables (counter defined in div.document) */
+table.numbered > caption:before {
+ counter-increment: table;
+ content: "Table " counter(table) ": ";
+ font-weight: bold;
+}
+
+/* Explicit Markup Blocks */
+/* ====================== */
+
+/* Footnotes and Citations */
+/* ----------------------- */
+
+/* line on the left */
+dl.footnote {
+ padding-left: 1ex;
+ border-left: solid;
+ border-left-width: thin;
+}
+
+/* Directives */
+/* ---------- */
+
+/* Body Elements */
+/* ~~~~~~~~~~~~~ */
+
+/* Images and Figures */
+img.align-left,
+.figure.align-left,
+object.align-left {
+ clear: left;
+ float: left;
+ margin-right: 1em
+}
+img.align-right,
+.figure.align-right,
+object.align-right {
+ clear: right;
+ float: right;
+ margin-left: 1em
+}
+/* Stop floating sidebars, images and figures at section level 1,2,3 */
+h1, h2, h3 { clear: both; }
+
+/* Sidebar */
+
+/* Move into the margin. In a layout with fixed margins, */
+/* it can be moved into the margin completely. */
+div.sidebar {
+ width: 30%;
+ max-width: 26em;
+ margin-left: 1em;
+ margin-right: -5.5%;
+ background-color: #ffffee ;
+}
+
+/* Code */
+
+pre.code, code { background-color: #eeeeee }
+pre.code .ln { color: gray; } /* line numbers */
+/* basic highlighting: for a complete scheme, see */
+/* http://docutils.sourceforge.net/sandbox/stylesheets/ */
+pre.code .comment, code .comment { color: #5C6576 }
+pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
+pre.code .literal.string, code .literal.string { color: #0C5404 }
+pre.code .name.builtin, code .name.builtin { color: #352B84 }
+pre.code .deleted, code .deleted { background-color: #DEB0A1}
+pre.code .inserted, code .inserted { background-color: #A3D289}
+
+/* Math */
+/* styled separately (see math.css for math-output=HTML) */
+
+/* Epigraph */
+/* Highlights */
+/* Pull-Quote */
+/* Compound Paragraph */
+/* Container */
+
+/* can be styled in a custom stylesheet */
+
+/* Document Header and Footer */
+
+div.footer, div.header {
+ clear: both;
+ font-size: smaller;
+}
+
+/* Inline Markup */
+/* ============= */
+
+/* Emphasis */
+/* em */
+/* Strong Emphasis */
+/* strong */
+/* Interpreted Text */
+/* span.interpreted */
+/* Title Reference */
+/* cite */
+/* Inline Literals */
+/* possible values: normal, nowrap, pre, pre-wrap, pre-line */
+/* span.docutils.literal { white-space: pre-wrap; } */
+
+/* Hyperlink References */
+a { text-decoration: none; }
+
+/* External Targets */
+/* span.target.external */
+/* Internal Targets */
+/* span.target.internal */
+/* Footnote References */
+/* a.footnote-reference */
+/* Citation References */
+/* a.citation-reference */
Property changes on: trunk/docutils/docutils/writers/html_base/plain.css
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/docutils/docutils/writers/xhtml11/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/xhtml11/__init__.py 2015-05-08 16:03:49 UTC (rev 7892)
+++ trunk/docutils/docutils/writers/xhtml11/__init__.py 2015-05-11 15:38:58 UTC (rev 7893)
@@ -35,7 +35,7 @@
'xhtml', 'xhtml1', 'xhtml1strict', 'xhtml11')
"""Formats this writer supports."""
- default_stylesheets = ['html-base.css', 'xhtml11.css']
+ default_stylesheets = ['minimal.css', 'plain.css', 'xhtml11.css']
default_stylesheet_dirs = ['.',
os.path.abspath(os.path.dirname(__file__)),
os.path.abspath(os.path.join(
Modified: trunk/docutils/test/functional/expected/math_output_mathml.xhtml
===================================================================
--- trunk/docutils/test/functional/expected/math_output_mathml.xhtml 2015-05-08 16:03:49 UTC (rev 7892)
+++ trunk/docutils/test/functional/expected/math_output_mathml.xhtml 2015-05-11 15:38:58 UTC (rev 7893)
@@ -4,7 +4,8 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.13: http://docutils.sourceforge.net/" />
<title>Mathematics</title>
-<link rel="stylesheet" href="../input/data/html-base.css" type="text/css" />
+<link rel="stylesheet" href="../input/data/minimal.css" type="text/css" />
+<link rel="stylesheet" href="../input/data/plain.css" type="text/css" />
</head>
<body>
<div class="document" id="mathematics">
Modified: trunk/docutils/test/functional/expected/standalone_rst_html_base.html
=====================================...
[truncated message content] |
|
From: <mi...@us...> - 2015-05-27 12:11:52
|
Revision: 7895
http://sourceforge.net/p/docutils/code/7895
Author: milde
Date: 2015-05-27 12:11:49 +0000 (Wed, 27 May 2015)
Log Message:
-----------
Add link to "plain.css" to the test data.
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
Added Paths:
-----------
trunk/docutils/test/functional/input/data/plain.css
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2015-05-13 09:22:07 UTC (rev 7894)
+++ trunk/docutils/HISTORY.txt 2015-05-27 12:11:49 UTC (rev 7895)
@@ -39,7 +39,8 @@
- New HTML writer generating clean, polyglot_ markup conforming to
`HTML 5`_ and compatible with `XHTML 1.0`_ Transitional.
- New stylesheet ``html-base.css`` for default layout using CSS 2.1 rules.
+ CSS stylesheets ``minimal.css`` and ``plain.css`` with required and
+ recommended layout rules.
Also base for the xhtml11_ writer.
Added: trunk/docutils/test/functional/input/data/plain.css
===================================================================
--- trunk/docutils/test/functional/input/data/plain.css (rev 0)
+++ trunk/docutils/test/functional/input/data/plain.css 2015-05-27 12:11:49 UTC (rev 7895)
@@ -0,0 +1 @@
+link ../../../../docutils/writers/html_base/plain.css
\ No newline at end of file
Property changes on: trunk/docutils/test/functional/input/data/plain.css
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2015-05-29 11:48:22
|
Revision: 7897
http://sourceforge.net/p/docutils/code/7897
Author: milde
Date: 2015-05-29 11:48:20 +0000 (Fri, 29 May 2015)
Log Message:
-----------
Add name of generic bibliographic fields as a "classes" attribute value
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/docs/ref/rst/restructuredtext.txt
trunk/docutils/docutils/transforms/frontmatter.py
trunk/docutils/test/functional/expected/standalone_rst_html4css1.html
trunk/docutils/test/functional/expected/standalone_rst_html_base.html
trunk/docutils/test/functional/expected/standalone_rst_pseudoxml.txt
trunk/docutils/test/functional/expected/standalone_rst_xhtml11.xhtml
trunk/docutils/test/test_transforms/test_docinfo.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2015-05-29 10:04:23 UTC (rev 7896)
+++ trunk/docutils/HISTORY.txt 2015-05-29 11:48:20 UTC (rev 7897)
@@ -29,6 +29,11 @@
- Patch [ 120 ] tables accept option widths: list of relative widths, 'auto'
or 'grid'.
+* docutils/transforms/frontmatter.py
+
+ - Add name of generic bibliographic fields as a "classes" attribute value
+ (after conversion to a valid identifier form).
+
* docutils/utils/math/math2html.py
- Add ``\colon`` macro, fix spacing around colons. Fixes [ 246 ].
Modified: trunk/docutils/docs/ref/rst/restructuredtext.txt
===================================================================
--- trunk/docutils/docs/ref/rst/restructuredtext.txt 2015-05-29 10:04:23 UTC (rev 7896)
+++ trunk/docutils/docs/ref/rst/restructuredtext.txt 2015-05-29 11:48:20 UTC (rev 7897)
@@ -921,6 +921,8 @@
Unregistered/generic fields may contain one or more paragraphs or
arbitrary body elements.
+The field name is also used as a "classes"
+attribute value after being converted into a valid identifier form.
RCS Keywords
Modified: trunk/docutils/docutils/transforms/frontmatter.py
===================================================================
--- trunk/docutils/docutils/transforms/frontmatter.py 2015-05-29 10:04:23 UTC (rev 7896)
+++ trunk/docutils/docutils/transforms/frontmatter.py 2015-05-29 11:48:20 UTC (rev 7897)
@@ -403,7 +403,7 @@
for field in field_list:
try:
name = field[0][0].astext()
- normedname = nodes.fully_normalize_name(name)
+ normedname = nodes.make_id(name)
if not (len(field) == 2 and normedname in bibliofields
and self.check_empty_biblio_field(field, name)):
raise TransformError
@@ -433,6 +433,8 @@
and isinstance(field[-1][0], nodes.paragraph):
utils.clean_rcs_keywords(
field[-1][0], self.rcs_keyword_substitutions)
+ if normedname and normedname not in bibliofields:
+ field['classes'].append(normedname)
docinfo.append(field)
nodelist = []
if len(docinfo) != 0:
Modified: trunk/docutils/test/functional/expected/standalone_rst_html4css1.html
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_html4css1.html 2015-05-29 10:04:23 UTC (rev 7896)
+++ trunk/docutils/test/functional/expected/standalone_rst_html4css1.html 2015-05-29 11:48:20 UTC (rev 7897)
@@ -61,9 +61,9 @@
incorporate, collate, fold, staple, or mutilate it, or do
anything else to it that your or anyone else's heart
desires.</td></tr>
-<tr class="field"><th class="docinfo-name">field name:</th><td class="field-body">This is a "generic bibliographic field".</td>
+<tr class="field-name field"><th class="docinfo-name">field name:</th><td class="field-body">This is a "generic bibliographic field".</td>
</tr>
-<tr class="field"><th class="docinfo-name">field name "2":</th><td class="field-body"><p class="first">Generic bibliographic fields may contain multiple body elements.</p>
+<tr class="field-name-2 field"><th class="docinfo-name">field name "2":</th><td class="field-body"><p class="first">Generic bibliographic fields may contain multiple body elements.</p>
<p class="last">Like this.</p>
</td>
</tr>
Modified: trunk/docutils/test/functional/expected/standalone_rst_html_base.html
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_html_base.html 2015-05-29 10:04:23 UTC (rev 7896)
+++ trunk/docutils/test/functional/expected/standalone_rst_html_base.html 2015-05-29 11:48:20 UTC (rev 7897)
@@ -56,11 +56,11 @@
incorporate, collate, fold, staple, or mutilate it, or do
anything else to it that your or anyone else's heart
desires.</dd>
-<dt>field name</dt>
-<dd><p>This is a "generic bibliographic field".</p>
+<dt class="field-name">field name</dt>
+<dd class="field-name"><p>This is a "generic bibliographic field".</p>
</dd>
-<dt>field name "2"</dt>
-<dd><p>Generic bibliographic fields may contain multiple body elements.</p>
+<dt class="field-name-2">field name "2"</dt>
+<dd class="field-name-2"><p>Generic bibliographic fields may contain multiple body elements.</p>
<p>Like this.</p>
</dd>
</dl>
Modified: trunk/docutils/test/functional/expected/standalone_rst_pseudoxml.txt
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_pseudoxml.txt 2015-05-29 10:04:23 UTC (rev 7896)
+++ trunk/docutils/test/functional/expected/standalone_rst_pseudoxml.txt 2015-05-29 11:48:20 UTC (rev 7897)
@@ -48,13 +48,13 @@
incorporate, collate, fold, staple, or mutilate it, or do
anything else to it that your or anyone else's heart
desires.
- <field>
+ <field classes="field-name">
<field_name>
field name
<field_body>
<paragraph>
This is a "generic bibliographic field".
- <field>
+ <field classes="field-name-2">
<field_name>
field name "2"
<field_body>
Modified: trunk/docutils/test/functional/expected/standalone_rst_xhtml11.xhtml
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_xhtml11.xhtml 2015-05-29 10:04:23 UTC (rev 7896)
+++ trunk/docutils/test/functional/expected/standalone_rst_xhtml11.xhtml 2015-05-29 11:48:20 UTC (rev 7897)
@@ -57,11 +57,11 @@
incorporate, collate, fold, staple, or mutilate it, or do
anything else to it that your or anyone else's heart
desires.</dd>
-<dt>field name</dt>
-<dd><p>This is a "generic bibliographic field".</p>
+<dt class="field-name">field name</dt>
+<dd class="field-name"><p>This is a "generic bibliographic field".</p>
</dd>
-<dt>field name "2"</dt>
-<dd><p>Generic bibliographic fields may contain multiple body elements.</p>
+<dt class="field-name-2">field name "2"</dt>
+<dd class="field-name-2"><p>Generic bibliographic fields may contain multiple body elements.</p>
<p>Like this.</p>
</dd>
</dl>
Modified: trunk/docutils/test/test_transforms/test_docinfo.py
===================================================================
--- trunk/docutils/test/test_transforms/test_docinfo.py 2015-05-29 10:04:23 UTC (rev 7896)
+++ trunk/docutils/test/test_transforms/test_docinfo.py 2015-05-29 11:48:20 UTC (rev 7897)
@@ -44,7 +44,7 @@
1
<date>
2001-08-11
- <field>
+ <field classes="parameter-i">
<field_name>
Parameter i
<field_body>
@@ -97,7 +97,7 @@
There can only be one "Abstract" field.
<date>
2001-08-11
- <field>
+ <field classes="parameter-i">
<field_name>
Parameter i
<field_body>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2015-05-29 20:49:31
|
Revision: 7898
http://sourceforge.net/p/docutils/code/7898
Author: milde
Date: 2015-05-29 20:49:28 +0000 (Fri, 29 May 2015)
Log Message:
-----------
Really fix [ 159 ] Spurious table column alignment errors.
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/docutils/parsers/rst/tableparser.py
trunk/docutils/test/test_parsers/test_rst/test_tables.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2015-05-29 11:48:20 UTC (rev 7897)
+++ trunk/docutils/HISTORY.txt 2015-05-29 20:49:28 UTC (rev 7898)
@@ -29,6 +29,10 @@
- Patch [ 120 ] tables accept option widths: list of relative widths, 'auto'
or 'grid'.
+*docutils/parsers/rst/tableparser.py
+
+ - Really fix [ 159 ] Spurious table column alignment errors.
+
* docutils/transforms/frontmatter.py
- Add name of generic bibliographic fields as a "classes" attribute value
Modified: trunk/docutils/docutils/parsers/rst/tableparser.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/tableparser.py 2015-05-29 11:48:20 UTC (rev 7897)
+++ trunk/docutils/docutils/parsers/rst/tableparser.py 2015-05-29 20:49:28 UTC (rev 7898)
@@ -511,8 +511,8 @@
if i == lastcol and line[end:].strip():
text = line[start:].rstrip()
new_end = start + len(text)
- columns[i] = (start, new_end)
main_start, main_end = self.columns[-1]
+ columns[i] = (start, max(main_end, new_end))
if new_end > main_end:
self.columns[-1] = (main_start, new_end)
elif line[end:nextstart].strip():
Modified: trunk/docutils/test/test_parsers/test_rst/test_tables.py
===================================================================
--- trunk/docutils/test/test_parsers/test_rst/test_tables.py 2015-05-29 11:48:20 UTC (rev 7897)
+++ trunk/docutils/test/test_parsers/test_rst/test_tables.py 2015-05-29 20:49:28 UTC (rev 7898)
@@ -789,6 +789,56 @@
"""],
["""\
============== ======
+A simple table this text extends to the right
+cell 3 as does this text
+============== ======
+""",
+"""\
+<document source="test data">
+ <table>
+ <tgroup cols="2" colwidths="auto">
+ <colspec colwidth="14">
+ <colspec colwidth="30">
+ <tbody>
+ <row>
+ <entry>
+ <paragraph>
+ A simple table
+ <entry>
+ <paragraph>
+ this text extends to the right
+ <row>
+ <entry>
+ <paragraph>
+ cell 3
+ <entry>
+ <paragraph>
+ as does this text
+"""],
+["""\
+============== ======
+A simple table this text extends to the right
+ continuation of cell 2
+============== ======
+""",
+"""\
+<document source="test data">
+ <table>
+ <tgroup cols="2" colwidths="auto">
+ <colspec colwidth="14">
+ <colspec colwidth="30">
+ <tbody>
+ <row>
+ <entry>
+ <paragraph>
+ A simple table
+ <entry>
+ <paragraph>
+ this text extends to the right
+ continuation of cell 2
+"""],
+["""\
+============== ======
A simple table with
no bottom border
""",
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tim...@us...> - 2015-06-03 22:02:50
|
Revision: 7899
http://sourceforge.net/p/docutils/code/7899
Author: timehorse
Date: 2015-06-03 22:02:46 +0000 (Wed, 03 Jun 2015)
Log Message:
-----------
Fix for bug number 276 ODT Writer strips classes from inline character markup when more than one class.
Modified Paths:
--------------
trunk/docutils/docutils/writers/odf_odt/__init__.py
trunk/docutils/test/test_writers/test_odt.py
Added Paths:
-----------
trunk/docutils/test/functional/expected/odt_nested_class.odt
trunk/docutils/test/functional/expected/odt_unnested_class.odt
trunk/docutils/test/functional/input/odt_nested_class.txt
trunk/docutils/test/functional/input/odt_no_class.txt
trunk/docutils/test/functional/input/odt_unnested_class.txt
Property Changed:
----------------
trunk/docutils/test/
trunk/docutils/test/functional/output/
Modified: trunk/docutils/docutils/writers/odf_odt/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/odf_odt/__init__.py 2015-05-29 20:49:28 UTC (rev 7898)
+++ trunk/docutils/docutils/writers/odf_odt/__init__.py 2015-06-03 22:02:46 UTC (rev 7899)
@@ -870,6 +870,8 @@
self.table_styles = None
self.in_citation = False
+ # Keep track of nested styling classes
+ self.inline_style_count_stack = []
def get_str_stylesheet(self):
return self.str_stylesheet
@@ -2397,14 +2399,26 @@
def visit_inline(self, node):
styles = node.attributes.get('classes', ())
- if len(styles) > 0:
- inline_style = styles[0]
- el = SubElement(self.current_element, 'text:span',
- attrib={'text:style-name': self.rststyle(inline_style)})
+ if styles:
+ el = self.current_element
+ for inline_style in styles:
+ el = SubElement(el, 'text:span',
+ attrib={'text:style-name':
+ self.rststyle(inline_style)})
+ count = len(styles)
+ else:
+ # No style was specified so use a default style (old code
+ # crashed if no style was given)
+ el = SubElement(self.current_element, 'text:span')
+ count = 1
+
self.set_current_element(el)
+ self.inline_style_count_stack.append(count)
def depart_inline(self, node):
- self.set_to_parent()
+ count = self.inline_style_count_stack.pop()
+ for x in range(count):
+ self.set_to_parent()
def _calculate_code_block_padding(self, line):
count = 0
Index: trunk/docutils/test
===================================================================
--- trunk/docutils/test 2015-05-29 20:49:28 UTC (rev 7898)
+++ trunk/docutils/test 2015-06-03 22:02:46 UTC (rev 7899)
Property changes on: trunk/docutils/test
___________________________________________________________________
Modified: svn:ignore
## -1,2 +1,3 ##
*.pyc
alltests.out
+record.txt
Added: trunk/docutils/test/functional/expected/odt_nested_class.odt
===================================================================
(Binary files differ)
Index: trunk/docutils/test/functional/expected/odt_nested_class.odt
===================================================================
--- trunk/docutils/test/functional/expected/odt_nested_class.odt 2015-05-29 20:49:28 UTC (rev 7898)
+++ trunk/docutils/test/functional/expected/odt_nested_class.odt 2015-06-03 22:02:46 UTC (rev 7899)
Property changes on: trunk/docutils/test/functional/expected/odt_nested_class.odt
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: trunk/docutils/test/functional/expected/odt_unnested_class.odt
===================================================================
(Binary files differ)
Index: trunk/docutils/test/functional/expected/odt_unnested_class.odt
===================================================================
--- trunk/docutils/test/functional/expected/odt_unnested_class.odt 2015-05-29 20:49:28 UTC (rev 7898)
+++ trunk/docutils/test/functional/expected/odt_unnested_class.odt 2015-06-03 22:02:46 UTC (rev 7899)
Property changes on: trunk/docutils/test/functional/expected/odt_unnested_class.odt
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: trunk/docutils/test/functional/input/odt_nested_class.txt
===================================================================
--- trunk/docutils/test/functional/input/odt_nested_class.txt (rev 0)
+++ trunk/docutils/test/functional/input/odt_nested_class.txt 2015-06-03 22:02:46 UTC (rev 7899)
@@ -0,0 +1,4 @@
+.. role:: action
+ :class: action parenthetical direction
+
+Hello... `(beat)`:action: ...there!
Added: trunk/docutils/test/functional/input/odt_no_class.txt
===================================================================
--- trunk/docutils/test/functional/input/odt_no_class.txt (rev 0)
+++ trunk/docutils/test/functional/input/odt_no_class.txt 2015-06-03 22:02:46 UTC (rev 7899)
@@ -0,0 +1,3 @@
+.. role:: action
+
+Hello... `(beat)`:action: ...there!
Added: trunk/docutils/test/functional/input/odt_unnested_class.txt
===================================================================
--- trunk/docutils/test/functional/input/odt_unnested_class.txt (rev 0)
+++ trunk/docutils/test/functional/input/odt_unnested_class.txt 2015-06-03 22:02:46 UTC (rev 7899)
@@ -0,0 +1,4 @@
+.. role:: action
+ :class: action
+
+Hello... `(beat)`:action: ...there!
Index: trunk/docutils/test/functional/output
===================================================================
--- trunk/docutils/test/functional/output 2015-05-29 20:49:28 UTC (rev 7898)
+++ trunk/docutils/test/functional/output 2015-06-03 22:02:46 UTC (rev 7899)
Property changes on: trunk/docutils/test/functional/output
___________________________________________________________________
Added: svn:ignore
## -0,0 +1 ##
+*
Modified: trunk/docutils/test/test_writers/test_odt.py
===================================================================
--- trunk/docutils/test/test_writers/test_odt.py 2015-05-29 20:49:28 UTC (rev 7898)
+++ trunk/docutils/test/test_writers/test_odt.py 2015-06-03 22:02:46 UTC (rev 7899)
@@ -45,13 +45,11 @@
#
# Globals
-TEMP_FILE_PATH = '/tmp'
+TEMP_FILE_PATH = 'functional/output/'
INPUT_PATH = 'functional/input/'
EXPECTED_PATH = 'functional/expected/'
-
class DocutilsOdtTestCase(DocutilsTestSupport.StandardTestCase):
-
#
# Check to see if we can import the needed XML library.
# Report failure if we cannot.
@@ -149,12 +147,26 @@
def test_odt_basic(self):
self.process_test('odt_basic.txt', 'odt_basic.odt',
- #save_output_name='odt_basic.odt'
+ save_output_name='odt_basic.odt'
)
+ def test_odt_nested_class(self):
+ self.process_test('odt_nested_class.txt',
+ 'odt_nested_class.odt',
+ save_output_name='odt_nested_class.odt'
+ )
+ self.process_test('odt_unnested_class.txt',
+ 'odt_unnested_class.odt',
+ save_output_name='odt_unnested_class.odt'
+ )
+ self.process_test('odt_no_class.txt',
+ 'odt_no_class.odt',
+ save_output_name='odt_no_class.odt'
+ )
+
def test_odt_tables1(self):
self.process_test('odt_tables1.txt', 'odt_tables1.odt',
- #save_output_name='odt_tables1.odt'
+ save_output_name='odt_tables1.odt'
)
def test_odt_custom_headfoot(self):
@@ -164,7 +176,7 @@
}
self.process_test('odt_custom_headfoot.txt', 'odt_custom_headfoot.odt',
settings_overrides=settings_overrides,
- #save_output_name='odt_custom_headfoot.odt'
+ save_output_name='odt_custom_headfoot.odt'
)
#
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2015-08-12 15:22:34
|
Revision: 7904
http://sourceforge.net/p/docutils/code/7904
Author: milde
Date: 2015-08-12 15:22:32 +0000 (Wed, 12 Aug 2015)
Log Message:
-----------
Fix footnotes with content that does not start with a paragraph.
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/docs/user/latex.txt
trunk/docutils/docutils/writers/latex2e/__init__.py
trunk/docutils/test/test_writers/test_latex2e.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2015-08-12 15:10:11 UTC (rev 7903)
+++ trunk/docutils/HISTORY.txt 2015-08-12 15:22:32 UTC (rev 7904)
@@ -58,6 +58,7 @@
``default_stylesheet_path`` and ``default_template_path``.
- Fix [ 266 ] creating labels/class values in description list items.
- Do not use <sup> and <sub> tags inside <pre> (parsed-literal blocks).
+ - Fix footnotes with content that does not start with a paragraph.
* docutils/writers/latex2e/__init__.py
Modified: trunk/docutils/docs/user/latex.txt
===================================================================
--- trunk/docutils/docs/user/latex.txt 2015-08-12 15:10:11 UTC (rev 7903)
+++ trunk/docutils/docs/user/latex.txt 2015-08-12 15:22:32 UTC (rev 7904)
@@ -226,8 +226,8 @@
LaTeX code
----------
-Custom LaTeX code can be placed in `style sheets`_, the `LaTeX
- preamble`_, the document body (`raw LaTeX`_), or custom templates_.
+Custom LaTeX code can be placed in `style sheets`_, the
+`LaTeX preamble`_, the document body (`raw LaTeX`_), or custom templates_.
.. _style sheet:
.. _custom style sheets:
@@ -1032,12 +1032,11 @@
By default, footnotes are set with Docutils-specific wrappers around
the standard ``\footnotemark`` and ``\footnotetext`` commands. You
can configure the footnote layout similar to standard LaTeX footnotes
-in a custom `style sheet`_.
+in a custom `style sheet`_ or the `LaTeX preamble`_.
Further configuration is possible by alternative definitions of
``\DUfootnotemark`` and ``\DUfootnotetext``
-
Example 1:
Set footnote text with a hanging indent.
@@ -1068,7 +1067,15 @@
(adapt the ``\hangindent`` value).
Example 2:
- place the footnote text where it appears in the source document (instead
+ Footnote marks in normal font size, not superscript::
+
+ \usepackage{scrextend} % not required with KOMA-script document classes
+ \deffootnote{1em}{1em}{\thefootnotemark\ }
+
+ (See the `KOMA-script Guide`_ for details and other options.)
+
+Example 3:
+ Place the footnote text where it appears in the source document (instead
of at the page bottom). This can be used to get the effect of endnotes
(needs the hanging_ package)::
Modified: trunk/docutils/docutils/writers/latex2e/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/latex2e/__init__.py 2015-08-12 15:10:11 UTC (rev 7903)
+++ trunk/docutils/docutils/writers/latex2e/__init__.py 2015-08-12 15:22:32 UTC (rev 7904)
@@ -2147,15 +2147,16 @@
backref = node['ids'][0] # no backref, use self-ref instead
if self.docutils_footnotes:
self.fallbacks['footnotes'] = PreambleCmds.footnotes
- num,text = node.astext().split(None,1)
+ num = node[0].astext()
if self.settings.footnote_references == 'brackets':
num = '[%s]' % num
self.out.append('%%\n\\DUfootnotetext{%s}{%s}{%s}{' %
(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:
- self.out.append('%')
+ # mask newline to prevent spurious whitespace if paragraph follows:
+ if node[1:] and isinstance(node[1], nodes.paragraph):
+ self.out.append('%')
## else: # TODO: "real" LaTeX \footnote{}s
def depart_footnote(self, node):
Modified: trunk/docutils/test/test_writers/test_latex2e.py
===================================================================
--- trunk/docutils/test/test_writers/test_latex2e.py 2015-08-12 15:10:11 UTC (rev 7903)
+++ trunk/docutils/test/test_writers/test_latex2e.py 2015-08-12 15:22:32 UTC (rev 7904)
@@ -221,7 +221,47 @@
\end{document}
"""],
+]
+totest['footnote text'] = [
+# input
+["""\
+.. [1] paragraph
+
+.. [2]
+
+.. [3] 1. enumeration
+""",
+## # expected output
+head_template.substitute(dict(parts,
+ fallbacks=r"""% numeric or symbol footnotes with hyperlinks
+\providecommand*{\DUfootnotemark}[3]{%
+ \raisebox{1em}{\hypertarget{#1}{}}%
+ \hyperlink{#2}{\textsuperscript{#3}}%
+}
+\providecommand{\DUfootnotetext}[4]{%
+ \begingroup%
+ \renewcommand{\thefootnote}{%
+ \protect\raisebox{1em}{\protect\hypertarget{#1}{}}%
+ \protect\hyperlink{#2}{#3}}%
+ \footnotetext{#4}%
+ \endgroup%
+}
+""")) + r"""%
+\DUfootnotetext{id1}{id1}{1}{%
+paragraph
+}
+%
+\DUfootnotetext{id2}{id2}{2}{}
+%
+\DUfootnotetext{id3}{id3}{3}{\begin{enumerate}
+
+\item enumeration
+\end{enumerate}
+}
+
+\end{document}
+"""],
]
totest_latex_toc['no_sectnum'] = [
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2015-09-11 15:20:16
|
Revision: 7916
http://sourceforge.net/p/docutils/code/7916
Author: milde
Date: 2015-09-11 15:20:14 +0000 (Fri, 11 Sep 2015)
Log Message:
-----------
html-plain: style footnote references and labels with CSS.
Modified Paths:
--------------
trunk/docutils/docutils/writers/html_plain/__init__.py
trunk/docutils/docutils/writers/html_plain/minimal.css
trunk/docutils/test/functional/expected/standalone_rst_html_plain.html
Added Paths:
-----------
trunk/docutils/test/functional/expected/footnotes_html_plain.html
trunk/docutils/test/functional/input/footnotes.txt
trunk/docutils/test/functional/tests/footnotes_html_plain.py
Modified: trunk/docutils/docutils/writers/html_plain/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/html_plain/__init__.py 2015-09-01 15:00:45 UTC (rev 7915)
+++ trunk/docutils/docutils/writers/html_plain/__init__.py 2015-09-11 15:20:14 UTC (rev 7916)
@@ -909,7 +909,8 @@
# TODO: use the new HTML5 element <aside>? (Also for footnote text)
def visit_footnote(self, node):
if not self.in_footnote_list:
- self.body.append('<dl class="footnote">\n')
+ classes = 'footnote ' + self.settings.footnote_references
+ self.body.append('<dl class="%s">\n'%classes)
self.in_footnote_list = True
def depart_footnote(self, node):
@@ -921,19 +922,13 @@
def visit_footnote_reference(self, node):
href = '#' + node['refid']
- format = self.settings.footnote_references
- if format == 'brackets':
- suffix = '['
- self.context.append(']')
- else:
- assert format == 'superscript'
- suffix = '<sup>'
- self.context.append('</sup>')
- self.body.append(self.starttag(node, 'a', suffix,
- CLASS='footnote-reference', href=href))
+ classes = 'footnote-reference ' + self.settings.footnote_references
+ self.body.append(self.starttag(node, 'a', '', #suffix,
+ CLASS=classes, href=href))
def depart_footnote_reference(self, node):
- self.body.append(self.context.pop() + '</a>')
+ # self.body.append(self.context.pop() + '</a>')
+ self.body.append('</a>')
def visit_generated(self, node):
if 'sectnum' in node['classes']:
@@ -1041,30 +1036,24 @@
def depart_inline(self, node):
self.body.append('</span>')
- # footnote and citation label
- def label_delim(self, node, bracket, superscript):
- """put brackets around label?"""
- if isinstance(node.parent, nodes.footnote):
- if self.settings.footnote_references == 'brackets':
- return bracket
- else:
- return superscript
- assert isinstance(node.parent, nodes.citation)
- return bracket
-
+ # footnote and citation labels:
def visit_label(self, node):
+ if (isinstance(node.parent, nodes.footnote)):
+ classes = self.settings.footnote_references
+ else:
+ classes = 'brackets'
# pass parent node to get id into starttag:
self.body.append(self.starttag(node.parent, 'dt', '', CLASS='label'))
+ self.body.append(self.starttag(node, 'span', '', CLASS=classes))
# footnote/citation backrefs:
if self.settings.footnote_backlinks:
backrefs = node.parent['backrefs']
if len(backrefs) == 1:
self.body.append('<a class="fn-backref" href="#%s">'
% backrefs[0])
- self.body.append(self.label_delim(node, '[', ''))
def depart_label(self, node):
- self.body.append(self.label_delim(node, ']', ''))
+ self.body.append('</span>')
if self.settings.footnote_backlinks:
backrefs = node.parent['backrefs']
if len(backrefs) == 1:
Modified: trunk/docutils/docutils/writers/html_plain/minimal.css
===================================================================
--- trunk/docutils/docutils/writers/html_plain/minimal.css 2015-09-01 15:00:45 UTC (rev 7915)
+++ trunk/docutils/docutils/writers/html_plain/minimal.css 2015-09-11 15:20:14 UTC (rev 7916)
@@ -153,8 +153,19 @@
span.option { white-space: nowrap; }
/* Footnotes and Citations */
+dl.footnote.superscript > dd {margin-left: 1em; }
+dl.footnote.brackets > dd {margin-left: 2em; }
dl > dt.label { font-weight: normal; }
-dt.label > span.fn-backref { margin: 0.2em; }
+a.footnote-reference.brackets:before,
+dt.label > span.brackets:before { content: "["; }
+a.footnote-reference.brackets:after,
+dt.label > span.brackets:after { content: "]"; }
+a.footnote-reference.superscript,
+dl.footnote.superscript > dt.label {
+ vertical-align: super;
+ font-size: smaller;
+}
+dt.label > span.fn-backref { margin-left: 0.2em; }
dt.label > span.fn-backref > a { font-style: italic; }
/* Line Blocks */
Added: trunk/docutils/test/functional/expected/footnotes_html_plain.html
===================================================================
--- trunk/docutils/test/functional/expected/footnotes_html_plain.html (rev 0)
+++ trunk/docutils/test/functional/expected/footnotes_html_plain.html 2015-09-11 15:20:14 UTC (rev 7916)
@@ -0,0 +1,66 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<meta name="generator" content="Docutils 0.13: 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" />
+</head>
+<body>
+<div class="document" id="test-footnote-and-citation-rendering">
+<h1 class="title">Test footnote and citation rendering</h1>
+
+<p>Paragraphs may contain footnote references (manually numbered<a class="footnote-reference superscript" href="#id7" id="id1">1</a>, anonymous auto-numbered<a class="footnote-reference superscript" href="#id11" id="id2">3</a>, labeled auto-numbered<a class="footnote-reference superscript" href="#label" id="id3">2</a>, or
+symbolic<a class="footnote-reference superscript" href="#id12" id="id4">*</a>) or citation references (<a class="citation-reference" href="#cit2002" id="id5">[CIT2002]</a>, <a class="citation-reference" href="#du2015" id="id6">[DU2015]</a>).</p>
+<dl class="footnote superscript">
+<dt class="label" id="id7"><span class="superscript">1</span><span class="fn-backref">(<a href="#id1">1</a>,<a href="#id8">2</a>)</span></dt>
+<dd><p>A footnote contains body elements, consistently indented by at
+least 3 spaces.</p>
+<p>This is the footnote's second paragraph.</p>
+</dd>
+<dt class="label" id="label"><span class="superscript">2</span><span class="fn-backref">(<a href="#id3">1</a>,<a href="#id9">2</a>)</span></dt>
+<dd><p>Footnotes may be numbered, either manually (as in<a class="footnote-reference superscript" href="#id7" id="id8">1</a>) or
+automatically using a "#"-prefixed label. This footnote has a
+label so it can be referred to from multiple places, both as a
+footnote reference (<a class="footnote-reference superscript" href="#label" id="id9">2</a>) and as a <a class="reference internal" href="#label">hyperlink reference</a>.</p>
+</dd>
+<dt class="label" id="id11"><span class="superscript"><a class="fn-backref" href="#id2">3</span></a></dt>
+<dd><p>This footnote is numbered automatically and anonymously using a
+label of "#" only.</p>
+<p>This is the second paragraph.</p>
+<p>And this is the third paragraph.</p>
+</dd>
+<dt class="label" id="id12"><span class="superscript"><a class="fn-backref" href="#id4">*</span></a></dt>
+<dd><p>Footnotes may also use symbols, specified with a "*" label.
+Here's a reference to the next footnote:<a class="footnote-reference superscript" href="#id14" id="id13">†</a>.</p>
+</dd>
+<dt class="label" id="id14"><span class="superscript"><a class="fn-backref" href="#id13">†</span></a></dt>
+<dd><p>This footnote shows the next symbol in the sequence.</p>
+</dd>
+<dt class="label" id="id15"><span class="superscript">4</span></dt>
+<dd><p>Here's an unreferenced footnote, with a reference to a
+nonexistent footnote:<a class="footnote-reference superscript" href="#id18" id="id16">5</a>.</p>
+</dd>
+</dl>
+<div class="section" id="citations">
+<h1>Citations</h1>
+<dl class="citation">
+<dt class="label" id="cit2002"><span class="brackets">CIT2002</span><span class="fn-backref">(<a href="#id5">1</a>,<a href="#id17">2</a>)</span></dt>
+<dd><p>Citations are text-labeled footnotes. They may be
+rendered separately and differently from footnotes.</p>
+</dd>
+<dt class="label" id="du2015"><span class="brackets"><a class="fn-backref" href="#id6">DU2015</span></a></dt>
+<dd><p><cite>Example document</cite>, Hometown: 2015.</p>
+</dd>
+</dl>
+<p>Here's a reference to the above, <a class="citation-reference" href="#cit2002" id="id17">[CIT2002]</a>.</p>
+<dl class="footnote superscript">
+<dt class="label" id="id18"><span class="superscript"><a class="fn-backref" href="#id16">5</span></a></dt>
+<dd><p>this footnote is missing in the standard example document.</p>
+</dd>
+</dl>
+</div>
+</div>
+</body>
+</html>
Property changes on: trunk/docutils/test/functional/expected/footnotes_html_plain.html
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/docutils/test/functional/expected/standalone_rst_html_plain.html
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_html_plain.html 2015-09-01 15:00:45 UTC (rev 7915)
+++ trunk/docutils/test/functional/expected/standalone_rst_html_plain.html 2015-09-11 15:20:14 UTC (rev 7916)
@@ -182,12 +182,12 @@
<h3><a class="toc-backref" href="#id44"><span class="sectnum">2.1.1</span> Inline Markup</a></h3>
<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" href="#id25" id="id26">[5]</a>), internal
+(<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="#id25" id="id26">5</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" href="#id25" id="id35">[5]</a> (<a class="reference external" href="http://docutils.sourceforge.net/">a second reference</a> <a class="footnote-reference" href="#id36" id="id37">[9]</a>), footnote references (manually
-numbered <a class="footnote-reference" href="#id8" id="id1">[1]</a>, anonymous auto-numbered <a class="footnote-reference" href="#id12" id="id2">[3]</a>, labeled auto-numbered
-<a class="footnote-reference" href="#label" id="id3">[2]</a>, or symbolic <a class="footnote-reference" href="#id13" id="id4">[*]</a>), citation references (<a class="citation-reference" href="#cit2002" id="id5">[CIT2002]</a>),
+references</a> <a class="footnote-reference brackets" href="#id25" id="id35">5</a> (<a class="reference external" href="http://docutils.sourceforge.net/">a second reference</a> <a class="footnote-reference brackets" href="#id36" id="id37">9</a>), footnote references (manually
+numbered <a class="footnote-reference brackets" href="#id8" id="id1">1</a>, anonymous auto-numbered <a class="footnote-reference brackets" href="#id12" id="id2">3</a>, labeled auto-numbered
+<a class="footnote-reference brackets" href="#label" id="id3">2</a>, or symbolic <a class="footnote-reference brackets" href="#id13" id="id4">*</a>), citation references (<a class="citation-reference" href="#cit2002" id="id5">[CIT2002]</a>),
substitution references (<img alt="EXAMPLE" src="../../../docs/user/rst/images/biohazard.png" />), and <span class="target" id="inline-hyperlink-targets">inline hyperlink targets</span>
(see <a class="reference internal" href="#targets">Targets</a> below for a reference back to here). Character-level
inline markup is also possible (although exceedingly ugly!) in <em>re</em><span class="docutils literal">Structured</span><em>Text</em>. Problems are indicated by <a href="#id23"><span class="problematic" id="id24">|problematic|</span></a> text
@@ -462,32 +462,32 @@
</div>
<div class="section" id="footnotes">
<h2><a class="toc-backref" href="#id54"><span class="sectnum">2.11</span> Footnotes</a></h2>
-<dl class="footnote">
-<dt class="label" id="id8">[1]<span class="fn-backref">(<a href="#id1">1</a>,<a href="#id9">2</a>,<a href="#id22">3</a>)</span></dt>
+<dl class="footnote brackets">
+<dt class="label" id="id8"><span class="brackets">1</span><span class="fn-backref">(<a href="#id1">1</a>,<a href="#id9">2</a>,<a href="#id22">3</a>)</span></dt>
<dd><p>A footnote contains body elements, consistently indented by at
least 3 spaces.</p>
<p>This is the footnote's second paragraph.</p>
</dd>
-<dt class="label" id="label">[2]<span class="fn-backref">(<a href="#id3">1</a>,<a href="#id10">2</a>)</span></dt>
-<dd><p>Footnotes may be numbered, either manually (as in <a class="footnote-reference" href="#id8" id="id9">[1]</a>) or
+<dt class="label" id="label"><span class="brackets">2</span><span class="fn-backref">(<a href="#id3">1</a>,<a href="#id10">2</a>)</span></dt>
+<dd><p>Footnotes may be numbered, either manually (as in <a class="footnote-reference brackets" href="#id8" id="id9">1</a>) or
automatically using a "#"-prefixed label. This footnote has a
label so it can be referred to from multiple places, both as a
-footnote reference (<a class="footnote-reference" href="#label" id="id10">[2]</a>) and as a <a class="reference internal" href="#label">hyperlink reference</a>.</p>
+footnote reference (<a class="footnote-reference brackets" href="#label" id="id10">2</a>) and as a <a class="reference internal" href="#label">hyperlink reference</a>.</p>
</dd>
-<dt class="label" id="id12"><a class="fn-backref" href="#id2">[3]</a></dt>
+<dt class="label" id="id12"><span class="brackets"><a class="fn-backref" href="#id2">3</span></a></dt>
<dd><p>This footnote is numbered automatically and anonymously using a
label of "#" only.</p>
<p>This is the second paragraph.</p>
<p>And this is the third paragraph.</p>
</dd>
-<dt class="label" id="id13"><a class="fn-backref" href="#id4">[*]</a></dt>
+<dt class="label" id="id13"><span class="brackets"><a class="fn-backref" href="#id4">*</span></a></dt>
<dd><p>Footnotes may also use symbols, specified with a "*" label.
-Here's a reference to the next footnote: <a class="footnote-reference" href="#id15" id="id14">[†]</a>.</p>
+Here's a reference to the next footnote: <a class="footnote-reference brackets" href="#id15" id="id14">†</a>.</p>
</dd>
-<dt class="label" id="id15"><a class="fn-backref" href="#id14">[†]</a></dt>
+<dt class="label" id="id15"><span class="brackets"><a class="fn-backref" href="#id14">†</span></a></dt>
<dd><p>This footnote shows the next symbol in the sequence.</p>
</dd>
-<dt class="label" id="id16">[4]</dt>
+<dt class="label" id="id16"><span class="brackets">4</span></dt>
<dd><p>Here's an unreferenced footnote, with a reference to a
nonexistent footnote: <a href="#id96"><span class="problematic" id="id97"><span id="id17"></span>[5]_</span></a>.</p>
</dd>
@@ -496,7 +496,7 @@
<div class="section" id="citations">
<h2><a class="toc-backref" href="#id55"><span class="sectnum">2.12</span> Citations</a></h2>
<dl class="citation">
-<dt class="label" id="cit2002">[CIT2002]<span class="fn-backref">(<a href="#id5">1</a>,<a href="#id18">2</a>)</span></dt>
+<dt class="label" id="cit2002"><span class="brackets">CIT2002</span><span class="fn-backref">(<a href="#id5">1</a>,<a href="#id18">2</a>)</span></dt>
<dd><p>Citations are text-labeled footnotes. They may be
rendered separately and differently from footnotes.</p>
</dd>
@@ -512,7 +512,7 @@
<p>Section headers are implicit targets, referred to by name. See
<a class="reference internal" href="#targets">Targets</a>, which is a subsection of <a class="reference internal" href="#body-elements">Body Elements</a>.</p>
<p>Explicit external targets are interpolated into references such as
-"<a class="reference external" href="http://www.python.org/">Python</a> <a class="footnote-reference" href="#id25" id="id27">[5]</a>".</p>
+"<a class="reference external" href="http://www.python.org/">Python</a> <a class="footnote-reference brackets" href="#id25" id="id27">5</a>".</p>
<p>Targets may be indirect and anonymous. Thus <a class="reference internal" href="#targets">this phrase</a> may also
refer to the <a class="reference internal" href="#targets">Targets</a> section.</p>
<p>Here's a <a href="#id100"><span class="problematic" id="id101">`hyperlink reference without a target`_</span></a>, which generates an
@@ -720,27 +720,27 @@
</div>
<div class="section" id="target-footnotes">
<h3><a class="toc-backref" href="#id91"><span class="sectnum">2.14.5</span> Target Footnotes</a></h3>
-<dl class="footnote">
-<dt class="label" id="id25">[5]<span class="fn-backref">(<a href="#id26">1</a>,<a href="#id27">2</a>,<a href="#id28">3</a>,<a href="#id35">4</a>)</span></dt>
+<dl class="footnote brackets">
+<dt class="label" id="id25"><span class="brackets">5</span><span class="fn-backref">(<a href="#id26">1</a>,<a href="#id27">2</a>,<a href="#id28">3</a>,<a href="#id35">4</a>)</span></dt>
<dd><p><a class="reference external" href="http://www.python.org/">http://www.python.org/</a></p>
</dd>
-<dt class="label" id="id29"><a class="fn-backref" href="#id30">[6]</a></dt>
+<dt class="label" id="id29"><span class="brackets"><a class="fn-backref" href="#id30">6</span></a></dt>
<dd><p><a class="reference external" href="http://pygments.org/">http://pygments.org/</a></p>
</dd>
-<dt class="label" id="id31"><a class="fn-backref" href="#id32">[7]</a></dt>
+<dt class="label" id="id31"><span class="brackets"><a class="fn-backref" href="#id32">7</span></a></dt>
<dd><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>
</dd>
-<dt class="label" id="id33"><a class="fn-backref" href="#id34">[8]</a></dt>
+<dt class="label" id="id33"><span class="brackets"><a class="fn-backref" href="#id34">8</span></a></dt>
<dd><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>
</dd>
-<dt class="label" id="id36"><a class="fn-backref" href="#id37">[9]</a></dt>
+<dt class="label" id="id36"><span class="brackets"><a class="fn-backref" href="#id37">9</span></a></dt>
<dd><p><a class="reference external" href="http://docutils.sourceforge.net/">http://docutils.sourceforge.net/</a></p>
</dd>
</dl>
</div>
<div class="section" id="replacement-text">
<h3><a class="toc-backref" href="#id92"><span class="sectnum">2.14.6</span> Replacement Text</a></h3>
-<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" href="#id25" id="id28">[5]</a>.</p>
+<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="#id25" id="id28">5</a>.</p>
</div>
<div class="section" id="compound-paragraph">
<h3><a class="toc-backref" href="#id93"><span class="sectnum">2.14.7</span> Compound Paragraph</a></h3>
@@ -814,12 +814,12 @@
Inline markup is supported, e.g. <em>emphasis</em>, <strong>strong</strong>, <span class="docutils literal">literal
text</span>, <sub>sub-</sub> and <sup>super</sup>scripts,
inline formulas: <span class="formula"><i>A</i> = 2<i>π</i><i>r</i><sup>2</sup></span>,
-footnotes <a class="footnote-reference" href="#id8" id="id22">[1]</a>, <span class="target" id="hyperlink-targets">hyperlink targets</span>, and <a class="reference external" href="http://www.python.org/">references</a>.</pre>
+footnotes <a class="footnote-reference brackets" href="#id8" id="id22">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>
<div class="section" id="code">
<h3><a class="toc-backref" href="#id95"><span class="sectnum">2.14.9</span> Code</a></h3>
<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" href="#id29" id="id30">[6]</a>
+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="#id29" id="id30">6</a>
syntax highlighter and can be formatted with a style sheet. (Code parsing
is turned off using the <span class="docutils literal"><span class="pre">syntax-highlight</span></span> config setting in the test
conversions in order to get identical results with/without installed
@@ -1290,7 +1290,7 @@
<div class="section" id="table-variants">
<h3><a class="toc-backref" href="#id85"><span class="sectnum">3.2.3</span> Table variants</a></h3>
<p>The following styles can be applied to individual tables via a class
-argument or as document wide setting with the <a class="reference external" href="http://docutils.sourceforge.net/docs/user/config.html#table-style">table-style</a> <a class="footnote-reference" href="#id31" id="id32">[7]</a> configuration
+argument or as document wide setting with the <a class="reference external" href="http://docutils.sourceforge.net/docs/user/config.html#table-style">table-style</a> <a class="footnote-reference brackets" href="#id31" id="id32">7</a> configuration
setting (or command line argument).</p>
<p>Numbered tables can be achieved with the "numbered" class option</p>
<table class="numbered">
@@ -1328,7 +1328,7 @@
<p>Currently, referencing to the table by number is not supported. This is a
common request and already on the <cite>TODO list</cite>.</p>
<p>A table with "booktabs" class argument, is rendered similar to the style
-from the <a class="reference external" href="http://tug.ctan.org/tex-archive/macros/latex/contrib/booktabs/booktabs.pdf">booktabs</a> <a class="footnote-reference" href="#id33" id="id34">[8]</a> LaTeX package.</p>
+from the <a class="reference external" href="http://tug.ctan.org/tex-archive/macros/latex/contrib/booktabs/booktabs.pdf">booktabs</a> <a class="footnote-reference brackets" href="#id33" id="id34">8</a> LaTeX package.</p>
<table class="booktabs">
<colgroup>
<col style="width: 31%" />
Added: trunk/docutils/test/functional/input/footnotes.txt
===================================================================
--- trunk/docutils/test/functional/input/footnotes.txt (rev 0)
+++ trunk/docutils/test/functional/input/footnotes.txt 2015-09-11 15:20:14 UTC (rev 7916)
@@ -0,0 +1,17 @@
+Test footnote and citation rendering
+************************************
+
+Paragraphs may contain footnote references (manually numbered
+[1]_, anonymous auto-numbered [#]_, labeled auto-numbered [#label]_, or
+symbolic [*]_) or citation references ([CIT2002]_, [DU2015]_).
+
+.. include:: data/standard.txt
+ :start-after: Footnotes
+ ---------
+ :end-before: Here's a reference to the above, [CIT2002]_,
+
+.. [DU2015] `Example document`, Hometown: 2015.
+
+Here's a reference to the above, [CIT2002]_.
+
+.. [5] this footnote is missing in the standard example document.
Property changes on: trunk/docutils/test/functional/input/footnotes.txt
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/docutils/test/functional/tests/footnotes_html_plain.py
===================================================================
--- trunk/docutils/test/functional/tests/footnotes_html_plain.py (rev 0)
+++ trunk/docutils/test/functional/tests/footnotes_html_plain.py 2015-09-11 15:20:14 UTC (rev 7916)
@@ -0,0 +1,14 @@
+exec(open('functional/tests/_standalone_rst_defaults.py').read())
+
+# Source and destination file names.
+test_source = "footnotes.txt"
+test_destination = "footnotes_html_plain.html"
+
+# Keyword parameters passed to publish_file.
+writer_name = "html-plain"
+
+# Settings:
+settings_overrides['footnote_references']='superscript'
+# local copy of stylesheets:
+# (Test runs in ``docutils/test/``, we need relative path from there.)
+settings_overrides['stylesheet_dirs'] = ('.', 'functional/input/data')
Property changes on: trunk/docutils/test/functional/tests/footnotes_html_plain.py
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2015-09-22 14:42:44
|
Revision: 7921
http://sourceforge.net/p/docutils/code/7921
Author: milde
Date: 2015-09-22 14:42:41 +0000 (Tue, 22 Sep 2015)
Log Message:
-----------
Fix [ 286 ] Empty column title cause invalid latex file.
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/docutils/writers/latex2e/__init__.py
trunk/docutils/test/test_writers/test_latex2e.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2015-09-16 13:41:51 UTC (rev 7920)
+++ trunk/docutils/HISTORY.txt 2015-09-22 14:42:41 UTC (rev 7921)
@@ -32,7 +32,7 @@
*docutils/parsers/rst/tableparser.py
- Really fix [ 159 ] Spurious table column alignment errors.
-
+
* docutils/transforms/frontmatter.py
- Add name of generic bibliographic fields as a "classes" attribute value
@@ -75,6 +75,8 @@
- Use "hyperref" package together with "bookmark" (improved hyperlinking
by the same author).
+ - Fix [ 286 ] Empty column title cause invalid latex file.
+
* docutils/writers/odf_odt/__init__.py
- remove decode.encode of filename stored in zip.
Modified: trunk/docutils/docutils/writers/latex2e/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/latex2e/__init__.py 2015-09-16 13:41:51 UTC (rev 7920)
+++ trunk/docutils/docutils/writers/latex2e/__init__.py 2015-09-22 14:42:41 UTC (rev 7921)
@@ -1982,7 +1982,7 @@
self.context.append('')
# header / not header
- if isinstance(node.parent.parent, nodes.thead):
+ if len(node) and isinstance(node.parent.parent, nodes.thead):
if self.out[-1].endswith("%"):
self.out.append("\n")
self.out.append('\\textbf{%')
Modified: trunk/docutils/test/test_writers/test_latex2e.py
===================================================================
--- trunk/docutils/test/test_writers/test_latex2e.py 2015-09-16 13:41:51 UTC (rev 7920)
+++ trunk/docutils/test/test_writers/test_latex2e.py 2015-09-22 14:42:41 UTC (rev 7921)
@@ -542,6 +542,45 @@
"""],
]
+totest['table_empty_thead_entry'] = [
+# input
+["""\
+===== ======
+Title
+===== ======
+entry value1
+===== ======
+""",
+head_table + r"""
+\setlength{\DUtablewidth}{\linewidth}
+\begin{longtable*}[c]{|p{0.075\DUtablewidth}|p{0.086\DUtablewidth}|}
+\hline
+\textbf{%
+Title
+} & \\
+\hline
+\endfirsthead
+\hline
+\textbf{%
+Title
+} & \\
+\hline
+\endhead
+\multicolumn{2}{c}{\hfill ... continued on next page} \\
+\endfoot
+\endlastfoot
+
+entry
+ &
+value1
+ \\
+\hline
+\end{longtable*}
+
+\end{document}
+"""],
+]
+
# The "[" needs to be protected (otherwise it will be seen as an
# option to "\\", "\item", etc. ).
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gr...@us...> - 2015-10-14 07:25:56
|
Revision: 7929
http://sourceforge.net/p/docutils/code/7929
Author: grubert
Date: 2015-10-14 07:25:53 +0000 (Wed, 14 Oct 2015)
Log Message:
-----------
FIX markup
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/RELEASE-NOTES.txt
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2015-10-14 07:17:47 UTC (rev 7928)
+++ trunk/docutils/HISTORY.txt 2015-10-14 07:25:53 UTC (rev 7929)
@@ -29,7 +29,7 @@
- Patch [ 120 ] tables accept option widths: list of relative widths, 'auto'
or 'grid'.
-*docutils/parsers/rst/tableparser.py
+* docutils/parsers/rst/tableparser.py
- Really fix [ 159 ] Spurious table column alignment errors.
Modified: trunk/docutils/RELEASE-NOTES.txt
===================================================================
--- trunk/docutils/RELEASE-NOTES.txt 2015-10-14 07:17:47 UTC (rev 7928)
+++ trunk/docutils/RELEASE-NOTES.txt 2015-10-14 07:25:53 UTC (rev 7929)
@@ -53,7 +53,7 @@
.. _HTML 5: http://www.w3.org/TR/html5/
-* rst.el : The problem with `electric-indent-mode' has been fixed.
+* rst.el : The problem with ``electric-indent-mode`` has been fixed.
Release 0.12 (2014-07-06)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2016-01-13 21:05:49
|
Revision: 7932
http://sourceforge.net/p/docutils/code/7932
Author: milde
Date: 2016-01-13 21:05:46 +0000 (Wed, 13 Jan 2016)
Log Message:
-----------
Fix [ 130 ] support streams expectiong byte-strings in ErrorOutput.
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/docutils/utils/error_reporting.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2015-12-28 22:49:45 UTC (rev 7931)
+++ trunk/docutils/HISTORY.txt 2016-01-13 21:05:46 UTC (rev 7932)
@@ -38,6 +38,10 @@
- Add name of generic bibliographic fields as a "classes" attribute value
(after conversion to a valid identifier form).
+* docutils/utils/error_reporting.py
+
+ - Fix [ 130 ] support streams expectiong byte-strings in ErrorOutput.
+
* docutils/utils/math/math2html.py
- Add ``\colon`` macro, fix spacing around colons. Fixes [ 246 ].
Modified: trunk/docutils/docutils/utils/error_reporting.py
===================================================================
--- trunk/docutils/docutils/utils/error_reporting.py 2015-12-28 22:49:45 UTC (rev 7931)
+++ trunk/docutils/docutils/utils/error_reporting.py 2016-01-13 21:05:46 UTC (rev 7932)
@@ -189,7 +189,11 @@
self.stream.write(data)
except UnicodeEncodeError:
self.stream.write(data.encode(self.encoding, self.encoding_errors))
- except TypeError: # in Python 3, stderr expects unicode
+ except TypeError:
+ if isinstance(data, unicode): # passed stream may expect bytes
+ self.stream.write(data.encode(self.encoding,
+ self.encoding_errors))
+ return
if self.stream in (sys.stderr, sys.stdout):
self.stream.buffer.write(data) # write bytes to raw stream
else:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2016-01-13 21:09:16
|
Revision: 7933
http://sourceforge.net/p/docutils/code/7933
Author: milde
Date: 2016-01-13 21:09:13 +0000 (Wed, 13 Jan 2016)
Log Message:
-----------
Various minor documentation edits.
Modified Paths:
--------------
trunk/docutils/docs/index.txt
trunk/docutils/docs/user/html.txt
trunk/docutils/docs/user/latex.txt
trunk/docutils/docs/user/links.txt
trunk/docutils/docutils/utils/smartquotes.py
trunk/docutils/test/test_writers/test_html_plain_misc.py
Modified: trunk/docutils/docs/index.txt
===================================================================
--- trunk/docutils/docs/index.txt 2016-01-13 21:05:46 UTC (rev 7932)
+++ trunk/docutils/docs/index.txt 2016-01-13 21:09:13 UTC (rev 7933)
@@ -87,6 +87,7 @@
Writer-specific:
+* `Docutils HTML writers <user/html.html>`__
* `Easy Slide Shows With reStructuredText & S5 <user/slide-shows.html>`__
* `Docutils LaTeX Writer <user/latex.html>`__
* `Docutils ODF/OpenOffice/odt Writer <user/odt.html>`__
Modified: trunk/docutils/docs/user/html.txt
===================================================================
--- trunk/docutils/docs/user/html.txt 2016-01-13 21:05:46 UTC (rev 7932)
+++ trunk/docutils/docs/user/html.txt 2016-01-13 21:09:13 UTC (rev 7933)
@@ -157,8 +157,9 @@
Currently, `html` is an alias for the html4css1_ writer.
-Suggestion
- The alias `html` points to the "recommended Docutils HTML writer".
+.. admonition:: Suggestion
+
+ Let the alias `html` point to the "recommended Docutils HTML writer".
Its target may change with the development of HTML, browsers, Docutils, and
the web.
@@ -242,7 +243,7 @@
* There is no attribute "lang" (only "xml:lang").
-* Enumerated lists don't support the 'start' attribute.
+* Enumerated lists don't support the "start" attribute.
The style sheet xhtml11.css_ adds support for a "start" value for
enumerated lists via a CSS-counter. This allows also nested enumeration.
Modified: trunk/docutils/docs/user/latex.txt
===================================================================
--- trunk/docutils/docs/user/latex.txt 2016-01-13 21:05:46 UTC (rev 7932)
+++ trunk/docutils/docs/user/latex.txt 2016-01-13 21:09:13 UTC (rev 7933)
@@ -856,7 +856,7 @@
-1 said to be of inferior quality compared to LM.
-2 not part of a minimal standard TeX installation,
- even bigger download size than Latin Modern.
+ even bigger download size than Latin Modern (64 MB).
c) `Bera`_ (Bitstream Vera)
@@ -938,10 +938,12 @@
charter Charter
utopia Utopia
+
+ fourier Utopia Fourier
========= ============ ============= ============= =========
.. [#] Extended versions of the standard Postscript fonts including
- accented chars, Greek and Cyrillic as well as real small-caps
+ accented chars, as well as real small-caps
and old-style numbers are available with the `TeX Gyre`_ bundle
which is part of, e.g., `TeX Live`_.
Modified: trunk/docutils/docs/user/links.txt
===================================================================
--- trunk/docutils/docs/user/links.txt 2016-01-13 21:05:46 UTC (rev 7932)
+++ trunk/docutils/docs/user/links.txt 2016-01-13 21:09:13 UTC (rev 7933)
@@ -150,11 +150,7 @@
.. [#] see http://sphinx-doc.org/config.html#options-for-epub-output
.. _Sphinx: http://sphinx.pocoo.org/
-* Sphinx_ based static blogging Tinkerer_
-
- .. _Tinkerer: http://tinkerer.me/
-
-* Nikola_ static site generator, use restructured text by
+* Nikola_ static site generator, uses restructured text by
default.
.. _nikola: http://getnikola.com/
@@ -164,6 +160,10 @@
.. _pelican: http://docs.getpelican.com
+* tinkerer_ is a static bloggin framework based on Sphinx_.
+
+ .. _tinkerer: http://tinkerer.me
+
* rst2ht_ by Oliver Rutherfurd, converts reStructuredText to an .ht
template, for use with ht2html_.
Modified: trunk/docutils/docutils/utils/smartquotes.py
===================================================================
--- trunk/docutils/docutils/utils/smartquotes.py 2016-01-13 21:05:46 UTC (rev 7932)
+++ trunk/docutils/docutils/utils/smartquotes.py 2016-01-13 21:09:13 UTC (rev 7933)
@@ -43,7 +43,7 @@
`John Gruber`_ did all of the hard work of writing this software in Perl for
`Movable Type`_ and almost all of this useful documentation. `Chad Miller`_
ported it to Python to use with Pyblosxom_.
-Adapted to Docutils_ by Günter Milde
+Adapted to Docutils_ by Günter Milde.
Additional Credits
==================
Modified: trunk/docutils/test/test_writers/test_html_plain_misc.py
===================================================================
--- trunk/docutils/test/test_writers/test_html_plain_misc.py 2016-01-13 21:05:46 UTC (rev 7932)
+++ trunk/docutils/test/test_writers/test_html_plain_misc.py 2016-01-13 21:09:13 UTC (rev 7933)
@@ -40,7 +40,7 @@
def test_definition_list_item_classes(self):
# Do not drop class arguments for the definition list item.
- # Pass them to to the term node instead.
+ # Pass them to the term node instead.
data = """\
first term:
fist def
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2016-02-26 21:40:19
|
Revision: 7934
http://sourceforge.net/p/docutils/code/7934
Author: milde
Date: 2016-02-26 21:40:17 +0000 (Fri, 26 Feb 2016)
Log Message:
-----------
Update doc and links.
Modified Paths:
--------------
trunk/docutils/FAQ.txt
trunk/docutils/docs/user/links.txt
Modified: trunk/docutils/FAQ.txt
===================================================================
--- trunk/docutils/FAQ.txt 2016-01-13 21:09:13 UTC (rev 7933)
+++ trunk/docutils/FAQ.txt 2016-02-26 21:40:17 UTC (rev 7934)
@@ -407,9 +407,6 @@
There are several, with various degrees of completeness. With no
implied endorsement or recommendation, and in no particular order:
-* `Webware for Python wiki
- <http://wiki.webwareforpython.org/thiswiki.html>`__
-
* `Ian Bicking's experimental code
<http://docutils.sf.net/sandbox/ianb/wiki/Wiki.py>`__
@@ -433,9 +430,10 @@
Please `let us know`_ of any other reStructuredText Wikis.
-The example application for the `Web Framework Shootout
-<http://colorstudy.com/docs/shootout.html>`__ article is a Wiki using
-reStructuredText.
+.. dead link
+.. The example application for the `Web Framework Shootout
+.. <http://colorstudy.com/docs/shootout.html>`__ article is a Wiki using
+.. reStructuredText.
Are there any Weblog (Blog) projects that use reStructuredText syntax?
Modified: trunk/docutils/docs/user/links.txt
===================================================================
--- trunk/docutils/docs/user/links.txt 2016-01-13 21:09:13 UTC (rev 7933)
+++ trunk/docutils/docs/user/links.txt 2016-02-26 21:40:17 UTC (rev 7934)
@@ -150,7 +150,7 @@
.. [#] see http://sphinx-doc.org/config.html#options-for-epub-output
.. _Sphinx: http://sphinx.pocoo.org/
-* Nikola_ static site generator, uses restructured text by
+* The Nikola_ static site generator, uses reStructuredText by
default.
.. _nikola: http://getnikola.com/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2016-05-24 10:48:50
|
Revision: 7937
http://sourceforge.net/p/docutils/code/7937
Author: milde
Date: 2016-05-24 10:48:48 +0000 (Tue, 24 May 2016)
Log Message:
-----------
Fix [ 295 ] Class argument for custom role inheriting from math.
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/docutils/parsers/rst/roles.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2016-05-14 21:15:00 UTC (rev 7936)
+++ trunk/docutils/HISTORY.txt 2016-05-24 10:48:48 UTC (rev 7937)
@@ -29,6 +29,10 @@
- Patch [ 120 ] tables accept option widths: list of relative widths, 'auto'
or 'grid'.
+* docutils/parsers/rst/roles.py
+
+ - Fix [ 295 ] Class argument for custom role inheriting from math.
+
* docutils/parsers/rst/tableparser.py
- Really fix [ 159 ] Spurious table column alignment errors.
Modified: trunk/docutils/docutils/parsers/rst/roles.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/roles.py 2016-05-14 21:15:00 UTC (rev 7936)
+++ trunk/docutils/docutils/parsers/rst/roles.py 2016-05-24 10:48:48 UTC (rev 7937)
@@ -334,7 +334,7 @@
node = nodes.literal(rawtext, '', classes=classes)
- # analyze content and add nodes for every token
+ # analyse content and add nodes for every token
for classes, value in tokens:
# print (classes, value)
if classes:
@@ -351,9 +351,10 @@
register_canonical_role('code', code_role)
def math_role(role, rawtext, text, lineno, inliner, options={}, content=[]):
+ set_classes(options)
i = rawtext.find('`')
text = rawtext.split('`')[1]
- node = nodes.math(rawtext, text)
+ node = nodes.math(rawtext, text, **options)
return [node], []
register_canonical_role('math', math_role)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2016-05-24 19:28:03
|
Revision: 7939
http://sourceforge.net/p/docutils/code/7939
Author: milde
Date: 2016-05-24 19:28:01 +0000 (Tue, 24 May 2016)
Log Message:
-----------
Use https in default MathJax URL (report Alan G Isaac).
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/docutils/writers/html4css1/__init__.py
trunk/docutils/docutils/writers/html_plain/__init__.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2016-05-24 11:48:37 UTC (rev 7938)
+++ trunk/docutils/HISTORY.txt 2016-05-24 19:28:01 UTC (rev 7939)
@@ -67,6 +67,7 @@
- Fix [ 266 ] creating labels/class values in description list items.
- Do not use <sup> and <sub> tags inside <pre> (parsed-literal blocks).
- Fix footnotes with content that does not start with a paragraph.
+ - Use https in default MathJax URL (report Alan G Isaac).
* docutils/writers/latex2e/__init__.py
Modified: trunk/docutils/docutils/writers/html4css1/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/html4css1/__init__.py 2016-05-24 11:48:37 UTC (rev 7938)
+++ trunk/docutils/docutils/writers/html4css1/__init__.py 2016-05-24 19:28:01 UTC (rev 7939)
@@ -266,8 +266,8 @@
# The latest version of MathJax from the distributed server:
# avaliable to the public under the `MathJax CDN Terms of Service`__
# __http://www.mathjax.org/download/mathjax-cdn-terms-of-service/
- mathjax_url = ('http://cdn.mathjax.org/mathjax/latest/MathJax.js?'
- 'config=TeX-AMS-MML_HTMLorMML')
+ mathjax_url = ('https://cdn.mathjax.org/mathjax/latest/MathJax.js?'
+ 'config=TeX-AMS_HTML')
# may be overwritten by custom URL appended to "mathjax"
stylesheet_link = '<link rel="stylesheet" href="%s" type="text/css" />\n'
Modified: trunk/docutils/docutils/writers/html_plain/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/html_plain/__init__.py 2016-05-24 11:48:37 UTC (rev 7938)
+++ trunk/docutils/docutils/writers/html_plain/__init__.py 2016-05-24 19:28:01 UTC (rev 7939)
@@ -225,8 +225,8 @@
# The latest version of MathJax from the distributed server:
# avaliable to the public under the `MathJax CDN Terms of Service`__
# __http://www.mathjax.org/download/mathjax-cdn-terms-of-service/
- mathjax_url = ('http://cdn.mathjax.org/mathjax/latest/MathJax.js?'
- 'config=TeX-AMS-MML_HTMLorMML')
+ mathjax_url = ('https://cdn.mathjax.org/mathjax/latest/MathJax.js?'
+ 'config=TeX-AMS_CHTML')
# may be overwritten by custom URL appended to "mathjax"
stylesheet_link = '<link rel="stylesheet" href="%s" type="text/css" />\n'
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2016-05-25 08:07:54
|
Revision: 7941
http://sourceforge.net/p/docutils/code/7941
Author: milde
Date: 2016-05-25 08:07:52 +0000 (Wed, 25 May 2016)
Log Message:
-----------
html-plain writer: fix for field-list
Prevent misalignment of following content if the field is empty.
Modified Paths:
--------------
trunk/docutils/docutils/writers/html_plain/__init__.py
trunk/docutils/test/functional/expected/standalone_rst_html_plain.html
trunk/docutils/test/functional/input/standalone_rst_html_plain.txt
Modified: trunk/docutils/docutils/writers/html_plain/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/html_plain/__init__.py 2016-05-24 19:55:10 UTC (rev 7940)
+++ trunk/docutils/docutils/writers/html_plain/__init__.py 2016-05-25 08:07:52 UTC (rev 7941)
@@ -873,6 +873,9 @@
def visit_field_body(self, node):
self.body.append(self.starttag(node, 'dd', '',
CLASS=''.join(node.parent['classes'])))
+ # prevent misalignment of following content if the field is empty:
+ if not node.children:
+ self.body.append('<p></p>')
def depart_field_body(self, node):
self.body.append('</dd>\n')
Modified: trunk/docutils/test/functional/expected/standalone_rst_html_plain.html
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_html_plain.html 2016-05-24 19:55:10 UTC (rev 7940)
+++ trunk/docutils/test/functional/expected/standalone_rst_html_plain.html 2016-05-25 08:07:52 UTC (rev 7941)
@@ -1199,6 +1199,11 @@
example:</p>
<pre class="literal-block">dl.field-list > dd { margin-left: 6em; }</pre>
</dd>
+<dt>Empty</dt>
+<dd><p></p></dd>
+<dt>fields</dt>
+<dd><p>must not lead to misalignment of the following content.</p>
+</dd>
</dl>
</div>
<div class="section" id="styling-with-class-arguments">
Modified: trunk/docutils/test/functional/input/standalone_rst_html_plain.txt
===================================================================
--- trunk/docutils/test/functional/input/standalone_rst_html_plain.txt 2016-05-24 19:55:10 UTC (rev 7940)
+++ trunk/docutils/test/functional/input/standalone_rst_html_plain.txt 2016-05-25 08:07:52 UTC (rev 7941)
@@ -59,6 +59,10 @@
dl.field-list > dd { margin-left: 6em; }
+:Empty:
+
+:fields: must not lead to misalignment of the following content.
+
Styling with class arguments
----------------------------
@@ -73,7 +77,7 @@
.. class:: description
description lists
- Definition lists that are styled like in most dictionaries,
+ Definition lists that are styled like in most dictionaries,
encyclopedias etc. (as well as the LaTeX `description` environment).
label
The term to be described. Put in boldface.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|