|
From: <mi...@us...> - 2015-02-19 11:24:55
|
Revision: 7794
http://sourceforge.net/p/docutils/code/7794
Author: milde
Date: 2015-02-19 11:24:52 +0000 (Thu, 19 Feb 2015)
Log Message:
-----------
Add ``\\\\colon`` macro, fix spacing around colons. Fixes [ 246 ].
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/docutils/utils/math/math2html.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2015-02-17 14:55:01 UTC (rev 7793)
+++ trunk/docutils/HISTORY.txt 2015-02-19 11:24:52 UTC (rev 7794)
@@ -29,6 +29,10 @@
- patch [ 120 ] tables accept option widths: list of relative widths, 'auto'
or 'grid'.
+* docutils/utils/math/math2html.py
+
+ - add ``\colon`` macro, fix spacing around colons. Fixes [ 246 ].
+
* docutils/writers/html4css1/__init__.py
- Add "docutils" to class values for "container" object to address [ 267 ].
Modified: trunk/docutils/docutils/utils/math/math2html.py
===================================================================
--- trunk/docutils/docutils/utils/math/math2html.py 2015-02-17 14:55:01 UTC (rev 7793)
+++ trunk/docutils/docutils/utils/math/math2html.py 2015-02-19 11:24:52 UTC (rev 7794)
@@ -412,7 +412,7 @@
u'\\cdot':u'⋅', u'\\cdots':u'⋯', u'\\centerdot':u'∙',
u'\\checkmark':u'✓', u'\\chi':u'χ', u'\\circ':u'∘', u'\\circeq':u'≗',
u'\\circledR':u'®', u'\\circledast':u'⊛', u'\\circledcirc':u'⊚',
- u'\\circleddash':u'⊝', u'\\clubsuit':u'♣', u'\\coloneqq':u'≔',
+ u'\\circleddash':u'⊝', u'\\clubsuit':u'♣', u'\\colon':u': ', u'\\coloneqq':u'≔',
u'\\complement':u'∁', u'\\cong':u'≅', u'\\coprod':u'∐',
u'\\copyright':u'©', u'\\cos':u'cos', u'\\cosh':u'cosh', u'\\cot':u'cot',
u'\\coth':u'coth', u'\\csc':u'csc', u'\\cup':u'∪',
@@ -643,8 +643,8 @@
modified = {
u'\n':u'', u' ':u'', u'$':u'', u'&':u' ', u'\'':u'’', u'+':u' + ',
- u',':u', ', u'-':u' − ', u'/':u' ⁄ ', u'<':u' < ', u'=':u' = ',
- u'>':u' > ', u'@':u'', u'~':u'',
+ u',':u', ', u'-':u' − ', u'/':u' ⁄ ',u':':u' : ', u'<':u' < ',
+ u'=':u' = ', u'>':u' > ', u'@':u'', u'~':u'',
}
onefunctions = {
@@ -695,7 +695,7 @@
unmodified = {
- u'characters':[u'.',u'*',u'€',u'(',u')',u'[',u']',u':',u'·',u'!',u';',u'|',u'§',u'"',],
+ u'characters':[u'.',u'*',u'€',u'(',u')',u'[',u']',u'·',u'!',u';',u'|',u'§',u'"',],
}
urls = {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2015-02-19 17:08:33
|
Revision: 7795
http://sourceforge.net/p/docutils/code/7795
Author: milde
Date: 2015-02-19 17:08:20 +0000 (Thu, 19 Feb 2015)
Log Message:
-----------
Apply patch [ 119 ] by Anatoly Techtonik
use absolute paths for ``default_stylesheet_path``
and ``default_template_path``.
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/docutils/writers/html4css1/__init__.py
trunk/docutils/docutils/writers/latex2e/__init__.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2015-02-19 11:24:52 UTC (rev 7794)
+++ trunk/docutils/HISTORY.txt 2015-02-19 17:08:20 UTC (rev 7795)
@@ -36,7 +36,13 @@
* docutils/writers/html4css1/__init__.py
- Add "docutils" to class values for "container" object to address [ 267 ].
+ - Apply patch [ 119 ] by Anatoly Techtonik: use absolute paths for
+ ``default_stylesheet_path`` and ``default_template_path``.
+* docutils/writers/latex2e/__init__.py
+
+ - use absolute path for ``default_template_path``.
+
* docutils/writers/odf_odt/__init__.py
- remove decode.encode of filename stored in zip.
Modified: trunk/docutils/docutils/writers/html4css1/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/html4css1/__init__.py 2015-02-19 11:24:52 UTC (rev 7794)
+++ trunk/docutils/docutils/writers/html4css1/__init__.py 2015-02-19 17:08:20 UTC (rev 7795)
@@ -43,15 +43,12 @@
"""Formats this writer supports."""
default_stylesheet = 'html4css1.css'
- default_stylesheet_dirs = ['.', utils.relative_path(
- os.path.join(os.getcwd(), 'dummy'), os.path.dirname(__file__))]
+ default_stylesheet_dirs = ['.', os.path.abspath(os.path.dirname(__file__))]
default_template = 'template.txt'
+ default_template_path = os.path.join(
+ os.path.dirname(os.path.abspath(__file__)), default_template)
- default_template_path = utils.relative_path(
- os.path.join(os.getcwd(), 'dummy'),
- os.path.join(os.path.dirname(__file__), default_template))
-
settings_spec = (
'HTML-Specific Options',
None,
Modified: trunk/docutils/docutils/writers/latex2e/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/latex2e/__init__.py 2015-02-19 11:24:52 UTC (rev 7794)
+++ trunk/docutils/docutils/writers/latex2e/__init__.py 2015-02-19 17:08:20 UTC (rev 7795)
@@ -34,7 +34,7 @@
"""Formats this writer supports."""
default_template = 'default.tex'
- default_template_path = os.path.dirname(__file__)
+ default_template_path = os.path.dirname(os.path.abspath(__file__))
default_preamble = '\n'.join([r'% PDF Standard Fonts',
r'\usepackage{mathptmx} % Times',
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2015-02-23 21:40:50
|
Revision: 7799
http://sourceforge.net/p/docutils/code/7799
Author: milde
Date: 2015-02-23 21:40:49 +0000 (Mon, 23 Feb 2015)
Log Message:
-----------
Wrap SVG images in <img> tags not <object>.
Addresses bug [ 247 ], but rendering problems remain
(see test output test/functional/expected/standalone_rst_xhtml11.xhtml),
so we might need a config setting.
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/standalone_rst_html4css1.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-02-21 16:59:18 UTC (rev 7798)
+++ trunk/docutils/HISTORY.txt 2015-02-23 21:40:49 UTC (rev 7799)
@@ -42,9 +42,13 @@
* docutils/writers/xhtml11/
- New HTML writer generating `XHTML1.1`_ styled with CSS2.
-
Moved to the docutils core from sandbox/html4strict.
+ - Wrap SVG images in <img> tags not <object>.
+ Addresses bug [ 247 ], but rendering problems remain
+ (see test/functional/expected/standalone_rst_xhtml11.xhtml),
+ so we might need a config setting.
+
.. _XHTML1.1: http://www.w3.org/TR/xhtml11/
* docutils/writers/latex2e/__init__.py
Modified: trunk/docutils/docutils/writers/html4css1/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/html4css1/__init__.py 2015-02-21 16:59:18 UTC (rev 7798)
+++ trunk/docutils/docutils/writers/html4css1/__init__.py 2015-02-23 21:40:49 UTC (rev 7799)
@@ -903,7 +903,7 @@
and len(node.astext()) > self.settings.field_name_limit):
atts['colspan'] = 2
self.context.append('</tr>\n'
- + self.starttag(node.parent, 'tr', '',
+ + self.starttag(node.parent, 'tr', '',
CLASS='field')
+ '<td> </td>')
else:
@@ -1013,16 +1013,19 @@
self.header.extend(header)
del self.body[start:]
+ # Image types to place in an <object> element
+ # SVG not supported by IE up to version 8
+ # (html4css1 strives for IE6 compatibility)
+ object_image_types = {'.svg': 'image/svg+xml',
+ '.swf': 'application/x-shockwave-flash'}
+
def visit_image(self, node):
atts = {}
uri = node['uri']
- # place SVG and SWF images in an <object> element
- types = {'.svg': 'image/svg+xml',
- '.swf': 'application/x-shockwave-flash'}
ext = os.path.splitext(uri)[1].lower()
- if ext in ('.svg', '.swf'):
+ if ext in self.object_image_types: # ('.svg', '.swf'):
atts['data'] = uri
- atts['type'] = types[ext]
+ atts['type'] = self.object_image_types[ext]
else:
atts['src'] = uri
atts['alt'] = node.get('alt', uri)
@@ -1074,8 +1077,7 @@
suffix = '\n'
if 'align' in node:
atts['class'] = 'align-%s' % node['align']
- self.context.append('')
- if ext in ('.svg', '.swf'): # place in an object element,
+ if ext in self.object_image_types: # ('.svg', '.swf')
# do NOT use an empty tag: incorrect rendering in browsers
self.body.append(self.starttag(node, 'object', suffix, **atts) +
node.get('alt', uri) + '</object>' + suffix)
@@ -1083,7 +1085,8 @@
self.body.append(self.emptytag(node, 'img', suffix, **atts))
def depart_image(self, node):
- self.body.append(self.context.pop())
+ # self.body.append(self.context.pop())
+ pass
def visit_inline(self, node):
self.body.append(self.starttag(node, 'span', ''))
Modified: trunk/docutils/docutils/writers/xhtml11/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/xhtml11/__init__.py 2015-02-21 16:59:18 UTC (rev 7798)
+++ trunk/docutils/docutils/writers/xhtml11/__init__.py 2015-02-23 21:40:49 UTC (rev 7799)
@@ -41,7 +41,7 @@
"""Formats this writer supports."""
default_stylesheets = ['html4css1.css', 'xhtml11.css']
- default_stylesheet_dirs = ['.',
+ default_stylesheet_dirs = ['.',
os.path.abspath(os.path.dirname(__file__)),
os.path.abspath(os.path.join(
os.path.dirname(os.path.dirname(__file__)), 'html4css1'))
@@ -313,6 +313,11 @@
# def depart_generated(self, node):
# pass
+ # Image types to place in an <object> element
+ # SVG as <img> supported since IE version 9
+ # (but rendering problems remain (see standalonge_rst2xhtml11.xhtml test output)
+ object_image_types = {'.swf': 'application/x-shockwave-flash'}
+
# Do not mark the first child with 'class="first"'
def visit_list_item(self, node):
self.body.append(self.starttag(node, 'li', ''))
Modified: trunk/docutils/test/functional/expected/standalone_rst_html4css1.html
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_html4css1.html 2015-02-21 16:59:18 UTC (rev 7798)
+++ trunk/docutils/test/functional/expected/standalone_rst_html4css1.html 2015-02-23 21:40:49 UTC (rev 7799)
@@ -1119,6 +1119,9 @@
reStructuredText, the markup syntax</object>
<p class="caption">SVG image in a figure.</p>
</div>
+<object class="align-right" data="../../../docs/user/rst/images/biohazard-bitmap.svg" style="width: 3em;" type="image/svg+xml">
+../../../docs/user/rst/images/biohazard-bitmap.svg</object>
+<p>An SVG image with embedded bitmap. Should be 3 em wide, right aligned.</p>
</div>
<div class="section" id="swf-images">
<h2><a class="toc-backref" href="#id75">2.25 SWF Images</a></h2>
Modified: trunk/docutils/test/functional/expected/standalone_rst_xhtml11.xhtml
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_xhtml11.xhtml 2015-02-21 16:59:18 UTC (rev 7798)
+++ trunk/docutils/test/functional/expected/standalone_rst_xhtml11.xhtml 2015-02-23 21:40:49 UTC (rev 7799)
@@ -1077,39 +1077,34 @@
</div>
<div class="section" id="svg-images">
<h2><a class="toc-backref" href="#id78"><span class="sectnum">2.24</span> SVG Images</a></h2>
-<object data="../../../docs/user/rst/images/biohazard.svg" style="width: 48px; height: 48px;" type="image/svg+xml">
-../../../docs/user/rst/images/biohazard.svg</object>
+<img alt="../../../docs/user/rst/images/biohazard.svg" src="../../../docs/user/rst/images/biohazard.svg" style="width: 48px; height: 48px;" />
<p>Scalable vector graphics (SVG) images are not supported by all backends.
Rendering depends partially on the backend, especially if the size is
not explicitely given.</p>
-<object class="align-left" data="../../../docs/user/rst/images/title-scaling.svg" style="width: 50%;" type="image/svg+xml">
-../../../docs/user/rst/images/title-scaling.svg</object>
+<img alt="../../../docs/user/rst/images/title-scaling.svg" class="align-left" src="../../../docs/user/rst/images/title-scaling.svg" style="width: 50%;" />
<p>A scaling image occupying 50% of the line width (scales with the
browser window).</p>
<p>Whether an SVG image is scaled or clipped/padded cannot be set in the
containing HTML. It depends on the viewport declaration inside its
root <svg> element.</p>
-<p>An inline SVG image <object data="../../../docs/user/rst/images/biohazard-scaling.svg" style="height: 0.8em;" type="image/svg+xml">inline-svg</object> scaled to a height of 0.8 em.</p>
-<object class="align-right" data="../../../docs/user/rst/images/title-scaling.svg" style="width: 50%; height: 1.2em;" type="image/svg+xml">
-../../../docs/user/rst/images/title-scaling.svg</object>
+<p>An inline SVG image <img alt="inline-svg" src="../../../docs/user/rst/images/biohazard-scaling.svg" style="height: 0.8em;" /> scaled to a height of 0.8 em.</p>
+<img alt="../../../docs/user/rst/images/title-scaling.svg" class="align-right" src="../../../docs/user/rst/images/title-scaling.svg" style="width: 50%; height: 1.2em;" />
<p>A scaling image occupying 50% of the line width and 1.2 em high,
right aligned (this SVG image keeps the aspect ratio):</p>
-<object class="align-left" data="../../../docs/user/rst/images/biohazard-scaling.svg" style="height: 1em;" type="image/svg+xml">
-../../../docs/user/rst/images/biohazard-scaling.svg</object>
+<img alt="../../../docs/user/rst/images/biohazard-scaling.svg" class="align-left" src="../../../docs/user/rst/images/biohazard-scaling.svg" style="height: 1em;" />
<p>A scaling image 1 em high, left aligned.</p>
<p>A scaling image 5 mm x 5 mm, centered, with hyperlink reference:</p>
-<a class="reference internal image-reference" href="#directives"><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>
-<object class="align-left" data="../../../docs/user/rst/images/biohazard.svg" style="width: 4cm; height: 2em;" type="image/svg+xml">
-../../../docs/user/rst/images/biohazard.svg</object>
+<a class="reference internal image-reference" href="#directives"><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>
+<img alt="../../../docs/user/rst/images/biohazard.svg" class="align-left" 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>
-<object class="align-left" data="../../../docs/user/rst/images/title.svg" style="width: 50%; height: 15px;" type="image/svg+xml">
-../../../docs/user/rst/images/title.svg</object>
+<img alt="../../../docs/user/rst/images/title.svg" class="align-left" src="../../../docs/user/rst/images/title.svg" style="width: 50%; height: 15px;" />
<p>A fixed-size image in a box 50% the line width and 15 pixle high.</p>
<div class="figure">
-<object data="../../../docs/user/rst/images/title.svg" style="width: 290px; height: 28px;" type="image/svg+xml">
-reStructuredText, the markup syntax</object>
+<img alt="reStructuredText, the markup syntax" src="../../../docs/user/rst/images/title.svg" style="width: 290px; height: 28px;" />
<p class="caption">SVG image in a figure.</p>
</div>
+<img alt="../../../docs/user/rst/images/biohazard-bitmap.svg" class="align-right" src="../../../docs/user/rst/images/biohazard-bitmap.svg" style="width: 3em;" />
+<p>An SVG image with embedded bitmap. Should be 3 em wide, right aligned.</p>
</div>
<div class="section" id="swf-images">
<h2><a class="toc-backref" href="#id79"><span class="sectnum">2.25</span> SWF Images</a></h2>
Modified: trunk/docutils/test/functional/input/data/svg_images.txt
===================================================================
--- trunk/docutils/test/functional/input/data/svg_images.txt 2015-02-21 16:59:18 UTC (rev 7798)
+++ trunk/docutils/test/functional/input/data/svg_images.txt 2015-02-23 21:40:49 UTC (rev 7799)
@@ -67,3 +67,9 @@
:height: 28 px
SVG image in a figure.
+
+.. image:: ../../../docs/user/rst/images/biohazard-bitmap.svg
+ :width: 3em
+ :align: right
+
+An SVG image with embedded bitmap. Should be 3 em wide, right aligned.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2015-02-24 13:51:35
|
Revision: 7801
http://sourceforge.net/p/docutils/code/7801
Author: milde
Date: 2015-02-24 13:51:32 +0000 (Tue, 24 Feb 2015)
Log Message:
-----------
Basic documentation for the xhtml11 writer and frontend.
Modified Paths:
--------------
trunk/docutils/docs/dev/release.txt
trunk/docutils/docs/user/config.txt
trunk/docutils/docs/user/tools.txt
trunk/docutils/docutils/writers/xhtml11/__init__.py
trunk/docutils/tools/rst2xhtml11.py
Modified: trunk/docutils/docs/dev/release.txt
===================================================================
--- trunk/docutils/docs/dev/release.txt 2015-02-24 13:01:43 UTC (rev 7800)
+++ trunk/docutils/docs/dev/release.txt 2015-02-24 13:51:32 UTC (rev 7801)
@@ -185,8 +185,8 @@
.. _wheels: https://packaging.python.org/en/latest/distributing.html#wheels
__ https://pypi.python.org/pypi/pip/
- See also `Bug report [271]
- <https://sourceforge.net/p/docutils/bugs/271/>`__
+ See also `feature request 43
+ <https://sourceforge.net/p/docutils/feature-requests/43/>`__
For current Docutils, this would mean `pure Python wheels`__ for Python 2
and 3 respectively.
Modified: trunk/docutils/docs/user/config.txt
===================================================================
--- trunk/docutils/docs/user/config.txt 2015-02-24 13:01:43 UTC (rev 7800)
+++ trunk/docutils/docs/user/config.txt 2015-02-24 13:51:32 UTC (rev 7801)
@@ -1102,7 +1102,31 @@
__ `xml_declaration [docutils_xml writer]`_
+[xhtml11 writer]
+~~~~~~~~~~~~~~~~~
+The XHTML1.1 Writer derives from the standard HTML Writer, and shares
+most settings defined in the `[html4css1 writer]`_ section. The
+"[html4css1 writer]" section of configuration files is processed
+before the "[xhtml11 writer]" section.
+
+removed options:
+ `field_name_limit`_, `option_limit`_
+
+The XHTML1.1 Writer's default for the following settings differ from
+those of the standard HTML Writer:
+
+`stylesheet_path <stylesheet_path [html4css1 writer]_>`_:
+ Default: "html4css1.css,xhtml11.css"
+
+`stylesheet_dirs <stylesheet_dirs [html4css1 writer]_>`_:
+ Default: Installation-dependent. Use the --help option to get the exact
+ value.
+
+math_output_:
+ Default: "MathML"
+
+
[pep_html writer]
~~~~~~~~~~~~~~~~~
Modified: trunk/docutils/docs/user/tools.txt
===================================================================
--- trunk/docutils/docs/user/tools.txt 2015-02-24 13:01:43 UTC (rev 7800)
+++ trunk/docutils/docs/user/tools.txt 2015-02-24 13:51:32 UTC (rev 7801)
@@ -37,7 +37,7 @@
The two arguments, "source" and "destination", are optional. If only
one argument (source) is specified, the standard output (stdout) is
used for the destination. If no arguments are specified, the standard
-input (stdin) is used for the source as well.
+input (stdin) is used for the source.
Getting Help
@@ -101,10 +101,10 @@
:Reader: Standalone
:Parser: reStructuredText
-:Writer: HTML
+:Writer: HTML (html4css1)
The ``rst2html.py`` front end reads standalone reStructuredText source
-files and produces HTML 4 (XHTML 1) output compatible with modern
+files and produces HTML 4 (XHTML 1) "transitional" output compatible with
browsers that support cascading stylesheets (CSS). A stylesheet is
required for proper rendering; a simple but complete stylesheet is
installed and used by default (see Stylesheets_ below).
@@ -139,6 +139,17 @@
__ ../howto/html-stylesheets.html
+rst2xhtml11.py
+--------------
+
+:Reader: Standalone
+:Parser: reStructuredText
+:Writer: xhtml11
+
+The ``rst2xhtml11.py`` front end reads standalone reStructuredText source
+files and produces clean XHTML 1.1 output. A stylesheet is required for
+proper rendering; a complete stylesheet is installed and used by default.
+
rstpep2html.py
--------------
Modified: trunk/docutils/docutils/writers/xhtml11/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/xhtml11/__init__.py 2015-02-24 13:01:43 UTC (rev 7800)
+++ trunk/docutils/docutils/writers/xhtml11/__init__.py 2015-02-24 13:51:32 UTC (rev 7801)
@@ -63,7 +63,6 @@
{'metavar': '<file[,file,...]>', 'overrides': 'stylesheet',
'validator': frontend.validate_comma_separated_list,
'default': default_stylesheets}),
-
stylesheet_dirs = (
'Comma-separated list of directories where stylesheets are found. '
'Used by --stylesheet-path when expanding relative path arguments. '
Modified: trunk/docutils/tools/rst2xhtml11.py
===================================================================
--- trunk/docutils/tools/rst2xhtml11.py 2015-02-24 13:01:43 UTC (rev 7800)
+++ trunk/docutils/tools/rst2xhtml11.py 2015-02-24 13:51:32 UTC (rev 7801)
@@ -25,15 +25,9 @@
from docutils.core import publish_cmdline, default_description
-# Import the xhtml11 writer from either the canonical place for a
-# Docutils writer or anywhere in the PYTHONPATH::
-
-from docutils.writers.xhtml11 import Writer
-
description = ('Generates CSS2-styled HTML documents from standalone '
'reStructuredText! sources that conform to the XHTML 1.1 DTD '
'(strict XHTML). '
+ default_description)
-publish_cmdline(writer=Writer(),
- description=description)
+publish_cmdline(writer_name='xhtml11', description=description)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2015-02-26 15:29:52
|
Revision: 7804
http://sourceforge.net/p/docutils/code/7804
Author: milde
Date: 2015-02-26 15:29:45 +0000 (Thu, 26 Feb 2015)
Log Message:
-----------
Fix [ 266 ] creating labels/class values in description list items.
Also clarify the documentation of "class" directive and internal hyperlink
targets applying to the next element also if at the end of an indented block.
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/docs/ref/rst/directives.txt
trunk/docutils/docs/ref/rst/restructuredtext.txt
trunk/docutils/docutils/writers/html4css1/__init__.py
trunk/docutils/test/test_writers/test_html4css1_misc.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2015-02-25 20:47:56 UTC (rev 7803)
+++ trunk/docutils/HISTORY.txt 2015-02-26 15:29:45 UTC (rev 7804)
@@ -38,6 +38,7 @@
- Add "docutils" to class values for "container" object to address [ 267 ].
- 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.
* docutils/writers/xhtml11/
Modified: trunk/docutils/docs/ref/rst/directives.txt
===================================================================
--- trunk/docutils/docs/ref/rst/directives.txt 2015-02-25 20:47:56 UTC (rev 7803)
+++ trunk/docutils/docs/ref/rst/directives.txt 2015-02-26 15:29:45 UTC (rev 7804)
@@ -548,7 +548,7 @@
α_t(i) = P(O_1, O_2, … O_t, q_t = S_i λ)
Support is limited to a subset of *LaTeX math* by the conversion
-required for many output formats. For HTML, the the `math_output`_
+required for many output formats. For HTML, the `math_output`_
configuration setting (or the corresponding ``--math-output``
command line option) select between alternative output formats with
different subsets of supported elements. If a writer does not
@@ -1570,9 +1570,9 @@
elements.
The "class" directive sets the `"classes"`_ attribute value on its content
-or on the first immediately following non-comment element [#]_. For
-details of the "classes" attribute, see `its entry`__ in `The Docutils
-Document Tree`_.
+or on the first immediately following [#]_ non-comment element [#]_. For
+details of the "classes" attribute, see the `classes entry in The Docutils
+Document Tree`__.
The directive argument consists of one or more space-separated class
names. The names are transformed to conform to the regular expression
@@ -1621,6 +1621,26 @@
<paragraph classes="multiple">
Second paragraph.
+
+.. [#] This is also true, if the class directive is "nested" at the end of
+ an indented text block, for example::
+
+ .. note:: the class values set in this directive-block do not apply to
+ the note but the next paragraph.
+
+ .. class:: special
+
+ This is a paragraph with class value "special".
+
+ This allows the "classification" of individual list items (except the
+ first, as a preceding class directive applies to the list as a whole)::
+
+ * bullet list
+
+ .. class:: classy item
+
+ * second item, with class argument
+
.. [#] To set a "classes" attribute value on a block quote, the
"class" directive must be followed by an empty comment::
Modified: trunk/docutils/docs/ref/rst/restructuredtext.txt
===================================================================
--- trunk/docutils/docs/ref/rst/restructuredtext.txt 2015-02-25 20:47:56 UTC (rev 7803)
+++ trunk/docutils/docs/ref/rst/restructuredtext.txt 2015-02-26 15:29:45 UTC (rev 7804)
@@ -1551,8 +1551,11 @@
Footnotes
`````````
-Doctree elements: footnote, label.
+Doctree elements: footnote_, label_.
+.. _footnote: ../doctree.html#footnote
+.. _label: ../doctree.html#label
+
Each footnote consists of an explicit markup start (".. "), a left
square bracket, the footnote label, a right square bracket, and
whitespace, followed by indented body elements. A footnote label can
@@ -1748,8 +1751,10 @@
Hyperlink Targets
`````````````````
-Doctree element: target.
+Doctree element: target_.
+.. _target: ../doctree.html#target
+
These are also called _`explicit hyperlink targets`, to differentiate
them from `implicit hyperlink targets`_ defined below.
@@ -1785,7 +1790,7 @@
1. _`Internal hyperlink targets` have empty link blocks. They provide
an end point allowing a hyperlink to connect one place to another
within a document. An internal hyperlink target points to the
- element following the target. For example::
+ element following the target. [#]_ For example::
Clicking on this internal hyperlink will take us to the target_
below.
@@ -1817,6 +1822,18 @@
An inline form of internal hyperlink target is available; see
`Inline Internal Targets`_.
+ .. [#] Works also, if the internal hyperlink target is "nested" at the
+ end of an indented text block. This behaviour allows setting targets
+ to individual list items (except the first, as a preceding internal
+ target applies to the list as a whole)::
+
+ * bullet list
+
+ .. _`second item`:
+
+ * second item, with hyperlink target.
+
+
2. _`External hyperlink targets` have an absolute or relative URI or
email address in their link blocks. For example, take the
following input::
@@ -2754,8 +2771,10 @@
Footnote References
-------------------
-Doctree element: footnote_reference.
+Doctree element: footnote_reference_.
+.. _footnote_reference: ../doctree.html#footnote-reference
+
Start-string = "[", end-string = "]_".
Each footnote reference consists of a square-bracketed label followed
Modified: trunk/docutils/docutils/writers/html4css1/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/html4css1/__init__.py 2015-02-25 20:47:56 UTC (rev 7803)
+++ trunk/docutils/docutils/writers/html4css1/__init__.py 2015-02-26 15:29:45 UTC (rev 7804)
@@ -704,7 +704,13 @@
self.body.append('</dl>\n')
def visit_definition_list_item(self, node):
- pass
+ # pass class arguments, ids and names to definition term:
+ node.children[0]['classes'] = (
+ node.get('classes', []) + node.children[0].get('classes', []))
+ node.children[0]['ids'] = (
+ node.get('ids', []) + node.children[0].get('ids', []))
+ node.children[0]['names'] = (
+ node.get('names', []) + node.children[0].get('names', []))
def depart_definition_list_item(self, node):
pass
Modified: trunk/docutils/test/test_writers/test_html4css1_misc.py
===================================================================
--- trunk/docutils/test/test_writers/test_html4css1_misc.py 2015-02-25 20:47:56 UTC (rev 7803)
+++ trunk/docutils/test/test_writers/test_html4css1_misc.py 2015-02-26 15:29:45 UTC (rev 7804)
@@ -31,6 +31,48 @@
# xmlcharrefreplace handler is used.
self.assertIn(b('EUR = €'), result)
+class MovingArgsTestCase(DocutilsTestSupport.StandardTestCase):
+
+ settings_overrides={'stylesheet_path': '',
+ # 'embed_stylesheet': False,
+ '_disable_config': True,
+ }
+
+ 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.
+ data = """\
+first term:
+ fist def
+
+ .. class:: for the second item
+
+second term:
+ second def
+"""
+ result = core.publish_string(data, writer_name='html4css1',
+ settings_overrides=self.settings_overrides)
+ self.assertIn(b('<dt class="for the second item">second term:</dt>'),
+ result)
+
+ def test_definition_list_item_name(self):
+ # Do not drop the "name" of the definition list item.
+ # Pass it to to the term node instead.
+ data = """\
+first term:
+ first def
+
+ .. _second item:
+
+second term:
+ second def
+"""
+ result = core.publish_string(data, writer_name='html4css1',
+ settings_overrides=self.settings_overrides)
+ self.assertIn(b('<dt id="second-item">second term:</dt>'),
+ result)
+
+
class SettingsTestCase(DocutilsTestSupport.StandardTestCase):
data = 'test'
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2015-02-26 17:28:43
|
Revision: 7805
http://sourceforge.net/p/docutils/code/7805
Author: milde
Date: 2015-02-26 17:28:36 +0000 (Thu, 26 Feb 2015)
Log Message:
-----------
Register xhtml as alias for xhtml11 writer. Copy xhtml11.css in setup.py.
Modified Paths:
--------------
trunk/docutils/docutils/writers/__init__.py
trunk/docutils/setup.py
Modified: trunk/docutils/docutils/writers/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/__init__.py 2015-02-26 15:29:45 UTC (rev 7804)
+++ trunk/docutils/docutils/writers/__init__.py 2015-02-26 17:28:36 UTC (rev 7805)
@@ -121,7 +121,9 @@
_writer_aliases = {
'html': 'html4css1',
+ 'xhtml': 'xhtml11',
'latex': 'latex2e',
+ 'xelatex': 'xetex',
'pprint': 'pseudoxml',
'pformat': 'pseudoxml',
'pdf': 'rlpdf',
Modified: trunk/docutils/setup.py
===================================================================
--- trunk/docutils/setup.py 2015-02-26 15:29:45 UTC (rev 7804)
+++ trunk/docutils/setup.py 2015-02-26 17:28:36 UTC (rev 7805)
@@ -160,7 +160,9 @@
['docutils/writers/s5_html/themes/README.txt']),
('docutils/writers/odf_odt',
['docutils/writers/odf_odt/styles.odt']),
- ]
+ ('docutils/writers/xhtml11',
+ ['docutils/writers/xhtml11/xhtml11.css']),
+ ]
+ s5_theme_files),
'scripts' : ['tools/rst2html.py',
'tools/rst2s5.py',
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2015-02-27 16:12:23
|
Revision: 7806
http://sourceforge.net/p/docutils/code/7806
Author: milde
Date: 2015-02-27 16:12:21 +0000 (Fri, 27 Feb 2015)
Log Message:
-----------
New upstream version (additional macros, piecewise integrals and sums).
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/docutils/utils/math/math2html.py
trunk/docutils/test/functional/expected/math_output_html.html
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2015-02-26 17:28:36 UTC (rev 7805)
+++ trunk/docutils/HISTORY.txt 2015-02-27 16:12:21 UTC (rev 7806)
@@ -26,13 +26,14 @@
* docutils/parsers/rst/directives/tables.py
- - patch [ 120 ] tables accept option widths: list of relative widths, 'auto'
+ - Patch [ 120 ] tables accept option widths: list of relative widths, 'auto'
or 'grid'.
* docutils/utils/math/math2html.py
- - add ``\colon`` macro, fix spacing around colons. Fixes [ 246 ].
-
+ - Add ``\colon`` macro, fix spacing around colons. Fixes [ 246 ].
+ - New upstream version (additional macros, piecewise integrals and sums).
+
* docutils/writers/html4css1/__init__.py
- Add "docutils" to class values for "container" object to address [ 267 ].
Modified: trunk/docutils/docutils/utils/math/math2html.py
===================================================================
--- trunk/docutils/docutils/utils/math/math2html.py 2015-02-26 17:28:36 UTC (rev 7805)
+++ trunk/docutils/docutils/utils/math/math2html.py 2015-02-27 16:12:21 UTC (rev 7806)
@@ -112,7 +112,7 @@
u'@conference':u'$authors: “$title”, <i>$journal</i>,{ pp. $pages,} $year.{ URL <a href="$url">$url</a>.}{ $note.}',
u'@inbook':u'$authors: <i>$title</i>.{{ $publisher,} $year.}{ URL <a href="$url">$url</a>.}{ $note.}',
u'@incollection':u'$authors: <i>$title</i>{ in <i>$booktitle</i>{ ($editor, ed.)}}.{{ $publisher,} $year.}{ URL <a href="$url">$url</a>.}{ $note.}',
- u'@inproceedings':u'$authors: “$title”, <i>$journal</i>,{ pp. $pages,} $year.{ URL <a href="$url">$url</a>.}{ $note.}',
+ u'@inproceedings':u'$authors: “$title”, <i>$booktitle</i>,{ pp. $pages,} $year.{ URL <a href="$url">$url</a>.}{ $note.}',
u'@manual':u'$authors: <i>$title</i>.{{ $publisher,} $year.}{ URL <a href="$url">$url</a>.}{ $note.}',
u'@mastersthesis':u'$authors: <i>$title</i>.{{ $publisher,} $year.}{ URL <a href="$url">$url</a>.}{ $note.}',
u'@misc':u'$authors: <i>$title</i>.{{ $publisher,}{ $howpublished,} $year.}{ URL <a href="$url">$url</a>.}{ $note.}',
@@ -245,7 +245,8 @@
u'\\begin_inset Quotes':u'QuoteContainer',
u'\\begin_inset Tabular':u'Table', u'\\begin_inset Text':u'InsetText',
u'\\begin_inset VSpace':u'VerticalSpace', u'\\begin_inset Wrap':u'Wrap',
- u'\\begin_inset listings':u'Listing', u'\\begin_inset space':u'Space',
+ u'\\begin_inset listings':u'Listing',
+ u'\\begin_inset script':u'ScriptInset', u'\\begin_inset space':u'Space',
u'\\begin_layout':u'Layout', u'\\begin_layout Abstract':u'Abstract',
u'\\begin_layout Author':u'Author',
u'\\begin_layout Bibliography':u'Bibliography',
@@ -291,7 +292,7 @@
"Configuration class from elyxer.config file"
chars = {
- u'\n':u'', u' -- ':u' — ', u'\'':u'’', u'---':u'—', u'`':u'‘',
+ u'\n':u'', u' -- ':u' — ', u' --- ':u' — ', u'\'':u'’', u'`':u'‘',
}
commands = {
@@ -324,21 +325,24 @@
alphacommands = {
u'\\AA':u'Å', u'\\AE':u'Æ',
- u'\\AmS':u'<span class="versalitas">AmS</span>', u'\\DH':u'Ð',
- u'\\L':u'Ł', u'\\O':u'Ø', u'\\OE':u'Œ', u'\\TH':u'Þ', u'\\aa':u'å',
- u'\\ae':u'æ', u'\\alpha':u'α', u'\\beta':u'β', u'\\delta':u'δ',
- u'\\dh':u'ð', u'\\epsilon':u'ϵ', u'\\eta':u'η', u'\\gamma':u'γ',
- u'\\i':u'ı', u'\\imath':u'ı', u'\\iota':u'ι', u'\\j':u'ȷ',
- u'\\jmath':u'ȷ', u'\\kappa':u'κ', u'\\l':u'ł', u'\\lambda':u'λ',
+ u'\\AmS':u'<span class="versalitas">AmS</span>', u'\\Angstroem':u'Å',
+ u'\\DH':u'Ð', u'\\Koppa':u'Ϟ', u'\\L':u'Ł', u'\\Micro':u'µ', u'\\O':u'Ø',
+ u'\\OE':u'Œ', u'\\Sampi':u'Ϡ', u'\\Stigma':u'Ϛ', u'\\TH':u'Þ',
+ u'\\aa':u'å', u'\\ae':u'æ', u'\\alpha':u'α', u'\\beta':u'β',
+ u'\\delta':u'δ', u'\\dh':u'ð', u'\\digamma':u'ϝ', u'\\epsilon':u'ϵ',
+ u'\\eta':u'η', u'\\eth':u'ð', u'\\gamma':u'γ', u'\\i':u'ı',
+ u'\\imath':u'ı', u'\\iota':u'ι', u'\\j':u'ȷ', u'\\jmath':u'ȷ',
+ u'\\kappa':u'κ', u'\\koppa':u'ϟ', u'\\l':u'ł', u'\\lambda':u'λ',
u'\\mu':u'μ', u'\\nu':u'ν', u'\\o':u'ø', u'\\oe':u'œ', u'\\omega':u'ω',
u'\\phi':u'φ', u'\\pi':u'π', u'\\psi':u'ψ', u'\\rho':u'ρ',
- u'\\sigma':u'σ', u'\\ss':u'ß', u'\\tau':u'τ', u'\\textcrh':u'ħ',
- u'\\th':u'þ', u'\\theta':u'θ', u'\\upsilon':u'υ', u'\\varDelta':u'∆',
+ u'\\sampi':u'ϡ', u'\\sigma':u'σ', u'\\ss':u'ß', u'\\stigma':u'ϛ',
+ u'\\tau':u'τ', u'\\tcohm':u'Ω', u'\\textcrh':u'ħ', u'\\th':u'þ',
+ u'\\theta':u'θ', u'\\upsilon':u'υ', u'\\varDelta':u'∆',
u'\\varGamma':u'Γ', u'\\varLambda':u'Λ', u'\\varOmega':u'Ω',
u'\\varPhi':u'Φ', u'\\varPi':u'Π', u'\\varPsi':u'Ψ', u'\\varSigma':u'Σ',
u'\\varTheta':u'Θ', u'\\varUpsilon':u'Υ', u'\\varXi':u'Ξ',
- u'\\varepsilon':u'ε', u'\\varkappa':u'ϰ', u'\\varphi':u'φ',
- u'\\varpi':u'ϖ', u'\\varrho':u'ϱ', u'\\varsigma':u'ς',
+ u'\\varbeta':u'ϐ', u'\\varepsilon':u'ε', u'\\varkappa':u'ϰ',
+ u'\\varphi':u'φ', u'\\varpi':u'ϖ', u'\\varrho':u'ϱ', u'\\varsigma':u'ς',
u'\\vartheta':u'ϑ', u'\\xi':u'ξ', u'\\zeta':u'ζ',
}
@@ -376,59 +380,75 @@
commands = {
u'\\ ':u' ', u'\\!':u'', u'\\#':u'#', u'\\$':u'$', u'\\%':u'%',
- u'\\&':u'&', u'\\,':u' ', u'\\:':u' ', u'\\;':u' ',
- u'\\APLdownarrowbox':u'⍗', u'\\APLleftarrowbox':u'⍇',
+ u'\\&':u'&', u'\\,':u' ', u'\\:':u' ', u'\\;':u' ', u'\\AC':u'∿',
+ u'\\APLcomment':u'⍝', u'\\APLdownarrowbox':u'⍗', u'\\APLinput':u'⍞',
+ u'\\APLinv':u'⌹', u'\\APLleftarrowbox':u'⍇', u'\\APLlog':u'⍟',
u'\\APLrightarrowbox':u'⍈', u'\\APLuparrowbox':u'⍐', u'\\Box':u'□',
- u'\\Bumpeq':u'≎', u'\\CIRCLE':u'●', u'\\Cap':u'⋒', u'\\CheckedBox':u'☑',
- u'\\Circle':u'○', u'\\Coloneqq':u'⩴', u'\\Corresponds':u'≙',
- u'\\Cup':u'⋓', u'\\Delta':u'Δ', u'\\Diamond':u'◇', u'\\Downarrow':u'⇓',
- u'\\EUR':u'€', u'\\Game':u'⅁', u'\\Gamma':u'Γ', u'\\Im':u'ℑ',
- u'\\Join':u'⨝', u'\\LEFTCIRCLE':u'◖', u'\\LEFTcircle':u'◐',
- u'\\Lambda':u'Λ', u'\\Leftarrow':u'⇐', u'\\Lleftarrow':u'⇚',
- u'\\Longleftarrow':u'⟸', u'\\Longleftrightarrow':u'⟺',
- u'\\Longrightarrow':u'⟹', u'\\Lsh':u'↰', u'\\Mapsfrom':u'⇐|',
- u'\\Mapsto':u'|⇒', u'\\Omega':u'Ω', u'\\P':u'¶', u'\\Phi':u'Φ',
- u'\\Pi':u'Π', u'\\Pr':u'Pr', u'\\Psi':u'Ψ', u'\\RIGHTCIRCLE':u'◗',
- u'\\RIGHTcircle':u'◑', u'\\Re':u'ℜ', u'\\Rrightarrow':u'⇛',
- u'\\Rsh':u'↱', u'\\S':u'§', u'\\Sigma':u'Σ', u'\\Square':u'☐',
- u'\\Subset':u'⋐', u'\\Supset':u'⋑', u'\\Theta':u'Θ', u'\\Uparrow':u'⇑',
- u'\\Updownarrow':u'⇕', u'\\Upsilon':u'Υ', u'\\Vdash':u'⊩',
- u'\\Vert':u'∥', u'\\Vvdash':u'⊪', u'\\XBox':u'☒', u'\\Xi':u'Ξ',
- u'\\Yup':u'⅄', u'\\\\':u'<br/>', u'\\_':u'_', u'\\aleph':u'ℵ',
- u'\\amalg':u'∐', u'\\angle':u'∠', u'\\aquarius':u'♒',
- u'\\arccos':u'arccos', u'\\arcsin':u'arcsin', u'\\arctan':u'arctan',
- u'\\arg':u'arg', u'\\aries':u'♈', u'\\ast':u'∗', u'\\asymp':u'≍',
+ u'\\Bumpeq':u'≎', u'\\CIRCLE':u'●', u'\\Cap':u'⋒',
+ u'\\CapitalDifferentialD':u'ⅅ', u'\\CheckedBox':u'☑', u'\\Circle':u'○',
+ u'\\Coloneqq':u'⩴', u'\\ComplexI':u'ⅈ', u'\\ComplexJ':u'ⅉ',
+ u'\\Corresponds':u'≙', u'\\Cup':u'⋓', u'\\Delta':u'Δ', u'\\Diamond':u'◇',
+ u'\\Diamondblack':u'◆', u'\\Diamonddot':u'⟐', u'\\DifferentialD':u'ⅆ',
+ u'\\Downarrow':u'⇓', u'\\EUR':u'€', u'\\Euler':u'ℇ',
+ u'\\ExponetialE':u'ⅇ', u'\\Finv':u'Ⅎ', u'\\Game':u'⅁', u'\\Gamma':u'Γ',
+ u'\\Im':u'ℑ', u'\\Join':u'⨝', u'\\LEFTCIRCLE':u'◖', u'\\LEFTcircle':u'◐',
+ u'\\LHD':u'◀', u'\\Lambda':u'Λ', u'\\Lbag':u'⟅', u'\\Leftarrow':u'⇐',
+ u'\\Lleftarrow':u'⇚', u'\\Longleftarrow':u'⟸',
+ u'\\Longleftrightarrow':u'⟺', u'\\Longrightarrow':u'⟹', u'\\Lparen':u'⦅',
+ u'\\Lsh':u'↰', u'\\Mapsfrom':u'⇐|', u'\\Mapsto':u'|⇒', u'\\Omega':u'Ω',
+ u'\\P':u'¶', u'\\Phi':u'Φ', u'\\Pi':u'Π', u'\\Pr':u'Pr', u'\\Psi':u'Ψ',
+ u'\\Qoppa':u'Ϙ', u'\\RHD':u'▶', u'\\RIGHTCIRCLE':u'◗',
+ u'\\RIGHTcircle':u'◑', u'\\Rbag':u'⟆', u'\\Re':u'ℜ', u'\\Rparen':u'⦆',
+ u'\\Rrightarrow':u'⇛', u'\\Rsh':u'↱', u'\\S':u'§', u'\\Sigma':u'Σ',
+ u'\\Square':u'☐', u'\\Subset':u'⋐', u'\\Sun':u'☉', u'\\Supset':u'⋑',
+ u'\\Theta':u'Θ', u'\\Uparrow':u'⇑', u'\\Updownarrow':u'⇕',
+ u'\\Upsilon':u'Υ', u'\\Vdash':u'⊩', u'\\Vert':u'∥', u'\\Vvdash':u'⊪',
+ u'\\XBox':u'☒', u'\\Xi':u'Ξ', u'\\Yup':u'⅄', u'\\\\':u'<br/>',
+ u'\\_':u'_', u'\\aleph':u'ℵ', u'\\amalg':u'∐', u'\\anchor':u'⚓',
+ u'\\angle':u'∠', u'\\aquarius':u'♒', u'\\arccos':u'arccos',
+ u'\\arcsin':u'arcsin', u'\\arctan':u'arctan', u'\\arg':u'arg',
+ u'\\aries':u'♈', u'\\arrowbullet':u'➢', u'\\ast':u'∗', u'\\asymp':u'≍',
u'\\backepsilon':u'∍', u'\\backprime':u'‵', u'\\backsimeq':u'⋍',
- u'\\backslash':u'\\', u'\\barwedge':u'⊼', u'\\because':u'∵',
- u'\\beth':u'ℶ', u'\\between':u'≬', u'\\bigcap':u'∩', u'\\bigcirc':u'○',
- u'\\bigcup':u'∪', u'\\bigodot':u'⊙', u'\\bigoplus':u'⊕',
- u'\\bigotimes':u'⊗', u'\\bigsqcup':u'⊔', u'\\bigstar':u'★',
- u'\\bigtriangledown':u'▽', u'\\bigtriangleup':u'△', u'\\biguplus':u'⊎',
- u'\\bigvee':u'∨', u'\\bigwedge':u'∧', u'\\blacklozenge':u'⧫',
- u'\\blacksmiley':u'☻', u'\\blacksquare':u'■', u'\\blacktriangle':u'▲',
- u'\\blacktriangledown':u'▼', u'\\blacktriangleright':u'▶', u'\\bot':u'⊥',
- u'\\bowtie':u'⋈', u'\\box':u'▫', u'\\boxdot':u'⊡', u'\\bullet':u'•',
+ u'\\backslash':u'\\', u'\\ballotx':u'✗', u'\\barwedge':u'⊼',
+ u'\\because':u'∵', u'\\beth':u'ℶ', u'\\between':u'≬', u'\\bigcap':u'∩',
+ u'\\bigcirc':u'○', u'\\bigcup':u'∪', u'\\bigodot':u'⊙',
+ u'\\bigoplus':u'⊕', u'\\bigotimes':u'⊗', u'\\bigsqcup':u'⊔',
+ u'\\bigstar':u'★', u'\\bigtriangledown':u'▽', u'\\bigtriangleup':u'△',
+ u'\\biguplus':u'⊎', u'\\bigvee':u'∨', u'\\bigwedge':u'∧',
+ u'\\biohazard':u'☣', u'\\blacklozenge':u'⧫', u'\\blacksmiley':u'☻',
+ u'\\blacksquare':u'■', u'\\blacktriangle':u'▲',
+ u'\\blacktriangledown':u'▼', u'\\blacktriangleleft':u'◂',
+ u'\\blacktriangleright':u'▶', u'\\blacktriangleup':u'▴', u'\\bot':u'⊥',
+ u'\\bowtie':u'⋈', u'\\box':u'▫', u'\\boxast':u'⧆', u'\\boxbar':u'◫',
+ u'\\boxbox':u'⧈', u'\\boxbslash':u'⧅', u'\\boxcircle':u'⧇',
+ u'\\boxdot':u'⊡', u'\\boxminus':u'⊟', u'\\boxplus':u'⊞',
+ u'\\boxslash':u'⧄', u'\\boxtimes':u'⊠', u'\\bullet':u'•',
u'\\bumpeq':u'≏', u'\\cancer':u'♋', u'\\cap':u'∩', u'\\capricornus':u'♑',
- u'\\cdot':u'⋅', u'\\cdots':u'⋯', u'\\centerdot':u'∙',
- u'\\checkmark':u'✓', u'\\chi':u'χ', u'\\circ':u'∘', u'\\circeq':u'≗',
- u'\\circledR':u'®', u'\\circledast':u'⊛', u'\\circledcirc':u'⊚',
- u'\\circleddash':u'⊝', u'\\clubsuit':u'♣', u'\\colon':u': ', u'\\coloneqq':u'≔',
+ u'\\cat':u'⁀', u'\\cdot':u'⋅', u'\\cdots':u'⋯', u'\\cent':u'¢',
+ u'\\centerdot':u'∙', u'\\checkmark':u'✓', u'\\chi':u'χ', u'\\circ':u'∘',
+ u'\\circeq':u'≗', u'\\circlearrowleft':u'↺', u'\\circlearrowright':u'↻',
+ u'\\circledR':u'®', u'\\circledast':u'⊛', u'\\circledbslash':u'⦸',
+ u'\\circledcirc':u'⊚', u'\\circleddash':u'⊝', u'\\circledgtr':u'⧁',
+ u'\\circledless':u'⧀', u'\\clubsuit':u'♣', u'\\colon':u': ', u'\\coloneqq':u'≔',
u'\\complement':u'∁', u'\\cong':u'≅', u'\\coprod':u'∐',
u'\\copyright':u'©', u'\\cos':u'cos', u'\\cosh':u'cosh', u'\\cot':u'cot',
- u'\\coth':u'coth', u'\\csc':u'csc', u'\\cup':u'∪',
- u'\\curvearrowleft':u'↶', u'\\curvearrowright':u'↷', u'\\dag':u'†',
- u'\\dagger':u'†', u'\\daleth':u'ℸ', u'\\dashleftarrow':u'⇠',
- u'\\dashv':u'⊣', u'\\ddag':u'‡', u'\\ddagger':u'‡', u'\\ddots':u'⋱',
- u'\\deg':u'deg', u'\\det':u'det', u'\\diagdown':u'╲', u'\\diagup':u'╱',
- u'\\diamond':u'◇', u'\\diamondsuit':u'♦', u'\\dim':u'dim', u'\\div':u'÷',
- u'\\divideontimes':u'⋇', u'\\dotdiv':u'∸', u'\\doteq':u'≐',
- u'\\doteqdot':u'≑', u'\\dotplus':u'∔', u'\\dots':u'…',
- u'\\doublebarwedge':u'⌆', u'\\downarrow':u'↓', u'\\downdownarrows':u'⇊',
- u'\\downharpoonleft':u'⇃', u'\\downharpoonright':u'⇂', u'\\earth':u'♁',
- u'\\ell':u'ℓ', u'\\emptyset':u'∅', u'\\eqcirc':u'≖', u'\\eqcolon':u'≕',
- u'\\eqsim':u'≂', u'\\euro':u'€', u'\\exists':u'∃', u'\\exp':u'exp',
- u'\\fallingdotseq':u'≒', u'\\female':u'♀', u'\\flat':u'♭',
- u'\\forall':u'∀', u'\\frown':u'⌢', u'\\frownie':u'☹', u'\\gcd':u'gcd',
+ u'\\coth':u'coth', u'\\csc':u'csc', u'\\cup':u'∪', u'\\curlyvee':u'⋎',
+ u'\\curlywedge':u'⋏', u'\\curvearrowleft':u'↶',
+ u'\\curvearrowright':u'↷', u'\\dag':u'†', u'\\dagger':u'†',
+ u'\\daleth':u'ℸ', u'\\dashleftarrow':u'⇠', u'\\dashv':u'⊣',
+ u'\\ddag':u'‡', u'\\ddagger':u'‡', u'\\ddots':u'⋱', u'\\deg':u'deg',
+ u'\\det':u'det', u'\\diagdown':u'╲', u'\\diagup':u'╱',
+ u'\\diameter':u'⌀', u'\\diamond':u'◇', u'\\diamondsuit':u'♦',
+ u'\\dim':u'dim', u'\\div':u'÷', u'\\divideontimes':u'⋇',
+ u'\\dotdiv':u'∸', u'\\doteq':u'≐', u'\\doteqdot':u'≑', u'\\dotplus':u'∔',
+ u'\\dots':u'…', u'\\doublebarwedge':u'⌆', u'\\downarrow':u'↓',
+ u'\\downdownarrows':u'⇊', u'\\downharpoonleft':u'⇃',
+ u'\\downharpoonright':u'⇂', u'\\dsub':u'⩤', u'\\earth':u'♁',
+ u'\\eighthnote':u'♪', u'\\ell':u'ℓ', u'\\emptyset':u'∅',
+ u'\\eqcirc':u'≖', u'\\eqcolon':u'≕', u'\\eqsim':u'≂', u'\\euro':u'€',
+ u'\\exists':u'∃', u'\\exp':u'exp', u'\\fallingdotseq':u'≒',
+ u'\\fcmp':u'⨾', u'\\female':u'♀', u'\\flat':u'♭', u'\\forall':u'∀',
+ u'\\fourth':u'⁗', u'\\frown':u'⌢', u'\\frownie':u'☹', u'\\gcd':u'gcd',
u'\\gemini':u'♊', u'\\geq)':u'≥', u'\\geqq':u'≧', u'\\geqslant':u'≥',
u'\\gets':u'←', u'\\gg':u'≫', u'\\ggg':u'⋙', u'\\gimel':u'ℷ',
u'\\gneqq':u'≩', u'\\gnsim':u'⋧', u'\\gtrdot':u'⋗', u'\\gtreqless':u'⋚',
@@ -439,41 +459,44 @@
u'\\hslash':u'ℏ', u'\\idotsint':u'<span class="bigsymbol">∫⋯∫</span>',
u'\\iiint':u'<span class="bigsymbol">∭</span>',
u'\\iint':u'<span class="bigsymbol">∬</span>', u'\\imath':u'ı',
- u'\\inf':u'inf', u'\\infty':u'∞', u'\\invneg':u'⌐', u'\\jmath':u'ȷ',
- u'\\jupiter':u'♃', u'\\ker':u'ker', u'\\land':u'∧',
- u'\\landupint':u'<span class="bigsymbol">∱</span>', u'\\langle':u'⟨',
- u'\\lbrace':u'{', u'\\lbrace)':u'{', u'\\lbrack':u'[', u'\\lceil':u'⌈',
- u'\\ldots':u'…', u'\\leadsto':u'⇝', u'\\leftarrow)':u'←',
- u'\\leftarrowtail':u'↢', u'\\leftarrowtobar':u'⇤',
+ u'\\inf':u'inf', u'\\infty':u'∞', u'\\intercal':u'⊺',
+ u'\\interleave':u'⫴', u'\\invamp':u'⅋', u'\\invneg':u'⌐',
+ u'\\jmath':u'ȷ', u'\\jupiter':u'♃', u'\\ker':u'ker', u'\\land':u'∧',
+ u'\\landupint':u'<span class="bigsymbol">∱</span>', u'\\lang':u'⟪',
+ u'\\langle':u'⟨', u'\\lblot':u'⦉', u'\\lbrace':u'{', u'\\lbrace)':u'{',
+ u'\\lbrack':u'[', u'\\lceil':u'⌈', u'\\ldots':u'…', u'\\leadsto':u'⇝',
+ u'\\leftarrow)':u'←', u'\\leftarrowtail':u'↢', u'\\leftarrowtobar':u'⇤',
u'\\leftharpoondown':u'↽', u'\\leftharpoonup':u'↼',
u'\\leftleftarrows':u'⇇', u'\\leftleftharpoons':u'⥢', u'\\leftmoon':u'☾',
u'\\leftrightarrow':u'↔', u'\\leftrightarrows':u'⇆',
u'\\leftrightharpoons':u'⇋', u'\\leftthreetimes':u'⋋', u'\\leo':u'♌',
u'\\leq)':u'≤', u'\\leqq':u'≦', u'\\leqslant':u'≤', u'\\lessdot':u'⋖',
u'\\lesseqgtr':u'⋛', u'\\lesseqqgtr':u'⪋', u'\\lessgtr':u'≶',
- u'\\lesssim':u'≲', u'\\lfloor':u'⌊', u'\\lg':u'lg', u'\\lhd':u'⊲',
- u'\\libra':u'♎', u'\\lightning':u'↯', u'\\liminf':u'liminf',
- u'\\limsup':u'limsup', u'\\ll':u'≪', u'\\lll':u'⋘', u'\\ln':u'ln',
+ u'\\lesssim':u'≲', u'\\lfloor':u'⌊', u'\\lg':u'lg', u'\\lgroup':u'⟮',
+ u'\\lhd':u'⊲', u'\\libra':u'♎', u'\\lightning':u'↯', u'\\limg':u'⦇',
+ u'\\liminf':u'liminf', u'\\limsup':u'limsup', u'\\ll':u'≪',
+ u'\\llbracket':u'⟦', u'\\llcorner':u'⌞', u'\\lll':u'⋘', u'\\ln':u'ln',
u'\\lneqq':u'≨', u'\\lnot':u'¬', u'\\lnsim':u'⋦', u'\\log':u'log',
u'\\longleftarrow':u'⟵', u'\\longleftrightarrow':u'⟷',
u'\\longmapsto':u'⟼', u'\\longrightarrow':u'⟶', u'\\looparrowleft':u'↫',
u'\\looparrowright':u'↬', u'\\lor':u'∨', u'\\lozenge':u'◊',
- u'\\ltimes':u'⋉', u'\\lyxlock':u'', u'\\male':u'♂', u'\\maltese':u'✠',
- u'\\mapsfrom':u'↤', u'\\mapsto':u'↦', u'\\mathcircumflex':u'^',
- u'\\max':u'max', u'\\measuredangle':u'∡', u'\\mercury':u'☿',
- u'\\mho':u'℧', u'\\mid':u'∣', u'\\min':u'min', u'\\models':u'⊨',
- u'\\mp':u'∓', u'\\multimap':u'⊸', u'\\nLeftarrow':u'⇍',
- u'\\nLeftrightarrow':u'⇎', u'\\nRightarrow':u'⇏', u'\\nVDash':u'⊯',
- u'\\nabla':u'∇', u'\\napprox':u'≉', u'\\natural':u'♮', u'\\ncong':u'≇',
- u'\\nearrow':u'↗', u'\\neg':u'¬', u'\\neg)':u'¬', u'\\neptune':u'♆',
- u'\\nequiv':u'≢', u'\\newline':u'<br/>', u'\\nexists':u'∄',
- u'\\ngeqslant':u'≱', u'\\ngtr':u'≯', u'\\ngtrless':u'≹', u'\\ni':u'∋',
- u'\\ni)':u'∋', u'\\nleftarrow':u'↚', u'\\nleftrightarrow':u'↮',
- u'\\nleqslant':u'≰', u'\\nless':u'≮', u'\\nlessgtr':u'≸', u'\\nmid':u'∤',
- u'\\nolimits':u'', u'\\nonumber':u'', u'\\not':u'¬', u'\\not<':u'≮',
- u'\\not=':u'≠', u'\\not>':u'≯', u'\\notbackslash':u'⍀', u'\\notin':u'∉',
- u'\\notni':u'∌', u'\\notslash':u'⌿', u'\\nparallel':u'∦',
- u'\\nprec':u'⊀', u'\\nrightarrow':u'↛', u'\\nsim':u'≁', u'\\nsimeq':u'≄',
+ u'\\lrcorner':u'⌟', u'\\ltimes':u'⋉', u'\\lyxlock':u'', u'\\male':u'♂',
+ u'\\maltese':u'✠', u'\\mapsfrom':u'↤', u'\\mapsto':u'↦',
+ u'\\mathcircumflex':u'^', u'\\max':u'max', u'\\measuredangle':u'∡',
+ u'\\medbullet':u'⚫', u'\\medcirc':u'⚪', u'\\mercury':u'☿', u'\\mho':u'℧',
+ u'\\mid':u'∣', u'\\min':u'min', u'\\models':u'⊨', u'\\mp':u'∓',
+ u'\\multimap':u'⊸', u'\\nLeftarrow':u'⇍', u'\\nLeftrightarrow':u'⇎',
+ u'\\nRightarrow':u'⇏', u'\\nVDash':u'⊯', u'\\nabla':u'∇',
+ u'\\napprox':u'≉', u'\\natural':u'♮', u'\\ncong':u'≇', u'\\nearrow':u'↗',
+ u'\\neg':u'¬', u'\\neg)':u'¬', u'\\neptune':u'♆', u'\\nequiv':u'≢',
+ u'\\newline':u'<br/>', u'\\nexists':u'∄', u'\\ngeqslant':u'≱',
+ u'\\ngtr':u'≯', u'\\ngtrless':u'≹', u'\\ni':u'∋', u'\\ni)':u'∋',
+ u'\\nleftarrow':u'↚', u'\\nleftrightarrow':u'↮', u'\\nleqslant':u'≰',
+ u'\\nless':u'≮', u'\\nlessgtr':u'≸', u'\\nmid':u'∤', u'\\nolimits':u'',
+ u'\\nonumber':u'', u'\\not':u'¬', u'\\not<':u'≮', u'\\not=':u'≠',
+ u'\\not>':u'≯', u'\\notbackslash':u'⍀', u'\\notin':u'∉', u'\\notni':u'∌',
+ u'\\notslash':u'⌿', u'\\nparallel':u'∦', u'\\nprec':u'⊀',
+ u'\\nrightarrow':u'↛', u'\\nsim':u'≁', u'\\nsimeq':u'≄',
u'\\nsqsubset':u'⊏̸', u'\\nsubseteq':u'⊈', u'\\nsucc':u'⊁',
u'\\nsucccurlyeq':u'⋡', u'\\nsupset':u'⊅', u'\\nsupseteq':u'⊉',
u'\\ntriangleleft':u'⋪', u'\\ntrianglelefteq':u'⋬',
@@ -485,31 +508,40 @@
u'\\ointclockwise':u'<span class="bigsymbol">∲</span>',
u'\\ointctrclockwise':u'<span class="bigsymbol">∳</span>',
u'\\ominus':u'⊖', u'\\oplus':u'⊕', u'\\oslash':u'⊘', u'\\otimes':u'⊗',
- u'\\owns':u'∋', u'\\parallel':u'∥', u'\\partial':u'∂', u'\\perp':u'⊥',
- u'\\pisces':u'♓', u'\\pitchfork':u'⋔', u'\\pluto':u'♇', u'\\pm':u'±',
- u'\\pointer':u'➪', u'\\pounds':u'£', u'\\prec':u'≺',
- u'\\preccurlyeq':u'≼', u'\\preceq':u'≼', u'\\precsim':u'≾',
- u'\\prime':u'′', u'\\prompto':u'∝', u'\\qquad':u' ', u'\\quad':u' ',
- u'\\quarternote':u'♩', u'\\rangle':u'⟩', u'\\rbrace':u'}',
- u'\\rbrace)':u'}', u'\\rbrack':u']', u'\\rceil':u'⌉', u'\\rfloor':u'⌋',
- u'\\rhd':u'⊳', u'\\rightarrow)':u'→', u'\\rightarrowtail':u'↣',
+ u'\\owns':u'∋', u'\\parallel':u'∥', u'\\partial':u'∂', u'\\pencil':u'✎',
+ u'\\perp':u'⊥', u'\\pisces':u'♓', u'\\pitchfork':u'⋔', u'\\pluto':u'♇',
+ u'\\pm':u'±', u'\\pointer':u'➪', u'\\pointright':u'☞', u'\\pounds':u'£',
+ u'\\prec':u'≺', u'\\preccurlyeq':u'≼', u'\\preceq':u'≼',
+ u'\\precsim':u'≾', u'\\prime':u'′', u'\\prompto':u'∝', u'\\qoppa':u'ϙ',
+ u'\\qquad':u' ', u'\\quad':u' ', u'\\quarternote':u'♩',
+ u'\\radiation':u'☢', u'\\rang':u'⟫', u'\\rangle':u'⟩', u'\\rblot':u'⦊',
+ u'\\rbrace':u'}', u'\\rbrace)':u'}', u'\\rbrack':u']', u'\\rceil':u'⌉',
+ u'\\recycle':u'♻', u'\\rfloor':u'⌋', u'\\rgroup':u'⟯', u'\\rhd':u'⊳',
+ u'\\rightangle':u'∟', u'\\rightarrow)':u'→', u'\\rightarrowtail':u'↣',
u'\\rightarrowtobar':u'⇥', u'\\rightharpoondown':u'⇁',
u'\\rightharpoonup':u'⇀', u'\\rightharpooondown':u'⇁',
u'\\rightharpooonup':u'⇀', u'\\rightleftarrows':u'⇄',
u'\\rightleftharpoons':u'⇌', u'\\rightmoon':u'☽',
u'\\rightrightarrows':u'⇉', u'\\rightrightharpoons':u'⥤',
- u'\\rightthreetimes':u'⋌', u'\\risingdotseq':u'≓', u'\\rtimes':u'⋊',
+ u'\\rightthreetimes':u'⋌', u'\\rimg':u'⦈', u'\\risingdotseq':u'≓',
+ u'\\rrbracket':u'⟧', u'\\rsub':u'⩥', u'\\rtimes':u'⋊',
u'\\sagittarius':u'♐', u'\\saturn':u'♄', u'\\scorpio':u'♏',
- u'\\searrow':u'↘', u'\\sec':u'sec', u'\\setminus':u'∖', u'\\sharp':u'♯',
- u'\\simeq':u'≃', u'\\sin':u'sin', u'\\sinh':u'sinh', u'\\slash':u'∕',
- u'\\smile':u'⌣', u'\\smiley':u'☺', u'\\spadesuit':u'♠',
- u'\\sphericalangle':u'∢', u'\\sqcap':u'⊓', u'\\sqcup':u'⊔',
- u'\\sqsubset':u'⊏', u'\\sqsubseteq':u'⊑', u'\\sqsupset':u'⊐',
- u'\\sqsupseteq':u'⊒', u'\\square':u'□', u'\\star':u'⋆',
+ u'\\searrow':u'↘', u'\\sec':u'sec', u'\\second':u'″', u'\\setminus':u'∖',
+ u'\\sharp':u'♯', u'\\simeq':u'≃', u'\\sin':u'sin', u'\\sinh':u'sinh',
+ u'\\sixteenthnote':u'♬', u'\\skull':u'☠', u'\\slash':u'∕',
+ u'\\smallsetminus':u'∖', u'\\smalltriangledown':u'▿',
+ u'\\smalltriangleleft':u'◃', u'\\smalltriangleright':u'▹',
+ u'\\smalltriangleup':u'▵', u'\\smile':u'⌣', u'\\smiley':u'☺',
+ u'\\spadesuit':u'♠', u'\\spddot':u'¨', u'\\sphat':u'',
+ u'\\sphericalangle':u'∢', u'\\spot':u'⦁', u'\\sptilde':u'~',
+ u'\\sqcap':u'⊓', u'\\sqcup':u'⊔', u'\\sqsubset':u'⊏',
+ u'\\sqsubseteq':u'⊑', u'\\sqsupset':u'⊐', u'\\sqsupseteq':u'⊒',
+ u'\\square':u'□', u'\\sslash':u'⫽', u'\\star':u'⋆', u'\\steaming':u'☕',
u'\\subseteqq':u'⫅', u'\\subsetneqq':u'⫋', u'\\succ':u'≻',
u'\\succcurlyeq':u'≽', u'\\succeq':u'≽', u'\\succnsim':u'⋩',
u'\\succsim':u'≿', u'\\sun':u'☼', u'\\sup':u'sup', u'\\supseteqq':u'⫆',
- u'\\supsetneqq':u'⫌', u'\\surd':u'√', u'\\swarrow':u'↙', u'\\tan':u'tan',
+ u'\\supsetneqq':u'⫌', u'\\surd':u'√', u'\\swarrow':u'↙',
+ u'\\swords':u'⚔', u'\\talloblong':u'⫾', u'\\tan':u'tan',
u'\\tanh':u'tanh', u'\\taurus':u'♉', u'\\textasciicircum':u'^',
u'\\textasciitilde':u'~', u'\\textbackslash':u'\\',
u'\\textcopyright':u'©\'', u'\\textdegree':u'°', u'\\textellipsis':u'…',
@@ -520,20 +552,21 @@
u'\\textregistered':u'®', u'\\textrightarrow':u'→',
u'\\textsection':u'§', u'\\texttrademark':u'™',
u'\\texttwosuperior':u'²', u'\\textvisiblespace':u' ',
- u'\\therefore':u'∴', u'\\top':u'⊤', u'\\triangle':u'△',
+ u'\\therefore':u'∴', u'\\third':u'‴', u'\\top':u'⊤', u'\\triangle':u'△',
u'\\triangleleft':u'⊲', u'\\trianglelefteq':u'⊴', u'\\triangleq':u'≜',
u'\\triangleright':u'▷', u'\\trianglerighteq':u'⊵',
u'\\twoheadleftarrow':u'↞', u'\\twoheadrightarrow':u'↠',
- u'\\twonotes':u'♫', u'\\udot':u'⊍', u'\\unlhd':u'⊴', u'\\unrhd':u'⊵',
- u'\\unrhl':u'⊵', u'\\uparrow':u'↑', u'\\updownarrow':u'↕',
- u'\\upharpoonleft':u'↿', u'\\upharpoonright':u'↾', u'\\uplus':u'⊎',
- u'\\upuparrows':u'⇈', u'\\uranus':u'♅', u'\\vDash':u'⊨',
- u'\\varclubsuit':u'♧', u'\\vardiamondsuit':u'♦', u'\\varheartsuit':u'♥',
- u'\\varnothing':u'∅', u'\\varspadesuit':u'♤', u'\\vdash':u'⊢',
- u'\\vdots':u'⋮', u'\\vee':u'∨', u'\\vee)':u'∨', u'\\veebar':u'⊻',
- u'\\vert':u'∣', u'\\virgo':u'♍', u'\\wedge':u'∧', u'\\wedge)':u'∧',
- u'\\wp':u'℘', u'\\wr':u'≀', u'\\yen':u'¥', u'\\{':u'{', u'\\|':u'∥',
- u'\\}':u'}',
+ u'\\twonotes':u'♫', u'\\udot':u'⊍', u'\\ulcorner':u'⌜', u'\\unlhd':u'⊴',
+ u'\\unrhd':u'⊵', u'\\unrhl':u'⊵', u'\\uparrow':u'↑',
+ u'\\updownarrow':u'↕', u'\\upharpoonleft':u'↿', u'\\upharpoonright':u'↾',
+ u'\\uplus':u'⊎', u'\\upuparrows':u'⇈', u'\\uranus':u'♅',
+ u'\\urcorner':u'⌝', u'\\vDash':u'⊨', u'\\varclubsuit':u'♧',
+ u'\\vardiamondsuit':u'♦', u'\\varheartsuit':u'♥', u'\\varnothing':u'∅',
+ u'\\varspadesuit':u'♤', u'\\vdash':u'⊢', u'\\vdots':u'⋮', u'\\vee':u'∨',
+ u'\\vee)':u'∨', u'\\veebar':u'⊻', u'\\vert':u'∣', u'\\virgo':u'♍',
+ u'\\warning':u'⚠', u'\\wasylozenge':u'⌑', u'\\wedge':u'∧',
+ u'\\wedge)':u'∧', u'\\wp':u'℘', u'\\wr':u'≀', u'\\yen':u'¥',
+ u'\\yinyang':u'☯', u'\\{':u'{', u'\\|':u'∥', u'\\}':u'}',
}
decoratedcommand = {
@@ -580,7 +613,9 @@
}
hybridfunctions = {
-
+ u'\\addcontentsline':[u'{$p!}{$q!}{$r!}',u'f0{}',u'ignored',],
+ u'\\addtocontents':[u'{$p!}{$q!}',u'f0{}',u'ignored',],
+ u'\\backmatter':[u'',u'f0{}',u'ignored',],
u'\\binom':[u'{$1}{$2}',u'f2{(}f0{f1{$1}f1{$2}}f2{)}',u'span class="binom"',u'span class="binomstack"',u'span class="bigsymbol"',],
u'\\boxed':[u'{$1}',u'f0{$1}',u'span class="boxed"',],
u'\\cfrac':[u'[$p!]{$1}{$2}',u'f0{f3{(}f1{$1}f3{)/(}f2{$2}f3{)}}',u'span class="fullfraction"',u'span class="numerator align-$p"',u'span class="denominator"',u'span class="ignored"',],
@@ -589,15 +624,21 @@
u'\\dbinom':[u'{$1}{$2}',u'(f0{f1{f2{$1}}f1{f2{ }}f1{f2{$2}}})',u'span class="binomial"',u'span class="binomrow"',u'span class="binomcell"',],
u'\\dfrac':[u'{$1}{$2}',u'f0{f3{(}f1{$1}f3{)/(}f2{$2}f3{)}}',u'span class="fullfraction"',u'span class="numerator"',u'span class="denominator"',u'span class="ignored"',],
u'\\displaystyle':[u'{$1}',u'f0{$1}',u'span class="displaystyle"',],
+ u'\\fancyfoot':[u'[$p!]{$q!}',u'f0{}',u'ignored',],
+ u'\\fancyhead':[u'[$p!]{$q!}',u'f0{}',u'ignored',],
u'\\fbox':[u'{$1}',u'f0{$1}',u'span class="fbox"',],
u'\\fboxrule':[u'{$p!}',u'f0{}',u'ignored',],
u'\\fboxsep':[u'{$p!}',u'f0{}',u'ignored',],
u'\\fcolorbox':[u'{$p!}{$q!}{$1}',u'f0{$1}',u'span class="boxed" style="border-color: $p; background: $q;"',],
u'\\frac':[u'{$1}{$2}',u'f0{f3{(}f1{$1}f3{)/(}f2{$2}f3{)}}',u'span class="fraction"',u'span class="numerator"',u'span class="denominator"',u'span class="ignored"',],
u'\\framebox':[u'[$p!][$q!]{$1}',u'f0{$1}',u'span class="framebox align-$q" style="width: $p;"',],
+ u'\\frontmatter':[u'',u'f0{}',u'ignored',],
u'\\href':[u'[$o]{$u!}{$t!}',u'f0{$t}',u'a href="$u"',],
u'\\hspace':[u'{$p!}',u'f0{ }',u'span class="hspace" style="width: $p;"',],
u'\\leftroot':[u'{$p!}',u'f0{ }',u'span class="leftroot" style="width: $p;px"',],
+ u'\\mainmatter':[u'',u'f0{}',u'ignored',],
+ u'\\markboth':[u'{$p!}{$q!}',u'f0{}',u'ignored',],
+ u'\\markright':[u'{$p!}',u'f0{}',u'ignored',],
u'\\nicefrac':[u'{$1}{$2}',u'f0{f1{$1}⁄f2{$2}}',u'span class="fraction"',u'sup class="numerator"',u'sub class="denominator"',u'span class="ignored"',],
u'\\parbox':[u'[$p!]{$w!}{$1}',u'f0{1}',u'div class="Boxed" style="width: $w;"',],
u'\\raisebox':[u'{$p!}{$1}',u'f0{$1.font}',u'span class="raisebox" style="vertical-align: $p;"',],
@@ -610,6 +651,7 @@
u'\\tbinom':[u'{$1}{$2}',u'(f0{f1{f2{$1}}f1{f2{ }}f1{f2{$2}}})',u'span class="binomial"',u'span class="binomrow"',u'span class="binomcell"',],
u'\\textcolor':[u'{$p!}{$1}',u'f0{$1}',u'span style="color: $p;"',],
u'\\textstyle':[u'{$1}',u'f0{$1}',u'span class="textstyle"',],
+ u'\\thispagestyle':[u'{$p!}',u'f0{}',u'ignored',],
u'\\unit':[u'[$0]{$1}',u'$0f0{$1.font}',u'span class="unit"',],
u'\\unitfrac':[u'[$0]{$1}{$2}',u'$0f0{f1{$1.font}⁄f2{$2.font}}',u'span class="fraction"',u'sup class="unit"',u'sub class="unit"',],
u'\\uproot':[u'{$p!}',u'f0{ }',u'span class="uproot" style="width: $p;px"',],
@@ -627,23 +669,23 @@
}
limitcommands = {
- u'\\int':u'∫', u'\\intop':u'∫', u'\\lim':u'lim', u'\\prod':u'∏',
- u'\\smallint':u'∫', u'\\sum':u'∑',
+ u'\\biginterleave':u'⫼', u'\\bigsqcap':u'⨅', u'\\fint':u'⨏',
+ u'\\iiiint':u'⨌', u'\\int':u'∫', u'\\intop':u'∫', u'\\lim':u'lim',
+ u'\\prod':u'∏', u'\\smallint':u'∫', u'\\sqint':u'⨖', u'\\sum':u'∑',
+ u'\\varointclockwise':u'∲', u'\\varprod':u'⨉', u'\\zcmp':u'⨟',
+ u'\\zhide':u'⧹', u'\\zpipe':u'⨠', u'\\zproject':u'⨡',
}
- # TODO: setting for simple enlarged vs. piecewise symbols
- for key in (u'\\int', u'\\intop', u'\\prod', u'\\sum'):
- limitcommands[key] = '<span class="symbol">%s</span>' % limitcommands[key]
misccommands = {
u'\\limits':u'LimitPreviousCommand', u'\\newcommand':u'MacroDefinition',
u'\\renewcommand':u'MacroDefinition',
u'\\setcounter':u'SetCounterFunction', u'\\tag':u'FormulaTag',
- u'\\tag*':u'FormulaTag',
+ u'\\tag*':u'FormulaTag', u'\\today':u'TodayCommand',
}
modified = {
- u'\n':u'', u' ':u'', u'$':u'', u'&':u' ', u'\'':u'’', u'+':u' + ',
- u',':u', ', u'-':u' − ', u'/':u' ⁄ ',u':':u' : ', u'<':u' < ',
+ u'\n':u'', u' ':u'', u'$':u'', u'&':u' ', u'\'':u'’', u'+':u' + ',
+ u',':u', ', u'-':u' − ', u'/':u' ⁄ ', u':':u' : ', u'<':u' < ',
u'=':u' = ', u'>':u' > ', u'@':u'', u'~':u'',
}
@@...
[truncated message content] |
|
From: <mi...@us...> - 2015-02-27 16:18:41
|
Revision: 7807
http://sourceforge.net/p/docutils/code/7807
Author: milde
Date: 2015-02-27 16:18:34 +0000 (Fri, 27 Feb 2015)
Log Message:
-----------
Use the "admonition" class argument for all admonitions
(allows easier styling).
Modified Paths:
--------------
trunk/docutils/docutils/transforms/writer_aux.py
trunk/docutils/test/functional/expected/standalone_rst_html4css1.html
trunk/docutils/test/functional/expected/standalone_rst_xhtml11.xhtml
Modified: trunk/docutils/docutils/transforms/writer_aux.py
===================================================================
--- trunk/docutils/docutils/transforms/writer_aux.py 2015-02-27 16:12:21 UTC (rev 7806)
+++ trunk/docutils/docutils/transforms/writer_aux.py 2015-02-27 16:18:34 UTC (rev 7807)
@@ -61,7 +61,7 @@
into generic admonitions, like this::
- <admonition classes="note">
+ <admonition classes="admonition note">
<title>
Note
<paragraph>
@@ -78,11 +78,12 @@
for node in self.document.traverse(nodes.Admonition):
node_name = node.__class__.__name__
# Set class, so that we know what node this admonition came from.
- node['classes'].append(node_name)
+ node['classes'].append('admonition')
if not isinstance(node, nodes.admonition):
# Specific admonition. Transform into a generic admonition.
admonition = nodes.admonition(node.rawsource, *node.children,
**node.attributes)
title = nodes.title('', language.labels[node_name])
+ node['classes'].append(node_name)
admonition.insert(0, title)
node.replace_self(admonition)
Modified: trunk/docutils/test/functional/expected/standalone_rst_html4css1.html
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_html4css1.html 2015-02-27 16:12:21 UTC (rev 7806)
+++ trunk/docutils/test/functional/expected/standalone_rst_html4css1.html 2015-02-27 16:18:34 UTC (rev 7807)
@@ -665,27 +665,27 @@
</div>
<div class="section" id="admonitions">
<h3><a class="toc-backref" href="#id79">2.14.3 Admonitions</a></h3>
-<div class="attention">
+<div class="admonition attention">
<p class="first admonition-title">Attention!</p>
<p class="last">Directives at large.</p>
</div>
-<div class="caution">
+<div class="admonition caution">
<p class="first admonition-title">Caution!</p>
<p class="last">Don't take any wooden nickels.</p>
</div>
-<div class="danger">
+<div class="admonition danger">
<p class="first admonition-title">!DANGER!</p>
<p class="last">Mad scientist at work!</p>
</div>
-<div class="error">
+<div class="admonition error">
<p class="first admonition-title">Error</p>
<p class="last">Does not compute.</p>
</div>
-<div class="hint">
+<div class="admonition hint">
<p class="first admonition-title">Hint</p>
<p class="last">It's bigger than a bread box.</p>
</div>
-<div class="important">
+<div class="admonition important">
<p class="first admonition-title">Important</p>
<ul class="last simple">
<li>Wash behind your ears.</li>
@@ -694,15 +694,15 @@
<li>Back up your data.</li>
</ul>
</div>
-<div class="note">
+<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This is a note.</p>
</div>
-<div class="tip">
+<div class="admonition tip">
<p class="first admonition-title">Tip</p>
<p class="last">15% if the service is good.</p>
</div>
-<div class="warning">
+<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last">Strong prose may provoke extreme mental exertion.
Reader discretion is strongly advised.</p>
Modified: trunk/docutils/test/functional/expected/standalone_rst_xhtml11.xhtml
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_xhtml11.xhtml 2015-02-27 16:12:21 UTC (rev 7806)
+++ trunk/docutils/test/functional/expected/standalone_rst_xhtml11.xhtml 2015-02-27 16:18:34 UTC (rev 7807)
@@ -659,27 +659,27 @@
</div>
<div class="section" id="admonitions">
<h3><a class="toc-backref" href="#id90"><span class="sectnum">2.14.3</span> Admonitions</a></h3>
-<div class="attention">
+<div class="admonition attention">
<p class="admonition-title">Attention!</p>
<p>Directives at large.</p>
</div>
-<div class="caution">
+<div class="admonition caution">
<p class="admonition-title">Caution!</p>
<p>Don't take any wooden nickels.</p>
</div>
-<div class="danger">
+<div class="admonition danger">
<p class="admonition-title">!DANGER!</p>
<p>Mad scientist at work!</p>
</div>
-<div class="error">
+<div class="admonition error">
<p class="admonition-title">Error</p>
<p>Does not compute.</p>
</div>
-<div class="hint">
+<div class="admonition hint">
<p class="admonition-title">Hint</p>
<p>It's bigger than a bread box.</p>
</div>
-<div class="important">
+<div class="admonition important">
<p class="admonition-title">Important</p>
<ul class="simple">
<li><p>Wash behind your ears.</p></li>
@@ -688,15 +688,15 @@
<li><p>Back up your data.</p></li>
</ul>
</div>
-<div class="note">
+<div class="admonition note">
<p class="admonition-title">Note</p>
<p>This is a note.</p>
</div>
-<div class="tip">
+<div class="admonition tip">
<p class="admonition-title">Tip</p>
<p>15% if the service is good.</p>
</div>
-<div class="warning">
+<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>Strong prose may provoke extreme mental exertion.
Reader discretion is strongly advised.</p>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2015-02-27 17:03:34
|
Revision: 7808
http://sourceforge.net/p/docutils/code/7808
Author: milde
Date: 2015-02-27 17:03:32 +0000 (Fri, 27 Feb 2015)
Log Message:
-----------
Make the insertion of "admonition" class in the HTML writer
(keeps doctree clean).
Modified Paths:
--------------
trunk/docutils/docutils/transforms/writer_aux.py
trunk/docutils/docutils/writers/html4css1/__init__.py
trunk/docutils/test/functional/expected/standalone_rst_html4css1.html
trunk/docutils/test/functional/expected/standalone_rst_xhtml11.xhtml
Modified: trunk/docutils/docutils/transforms/writer_aux.py
===================================================================
--- trunk/docutils/docutils/transforms/writer_aux.py 2015-02-27 16:18:34 UTC (rev 7807)
+++ trunk/docutils/docutils/transforms/writer_aux.py 2015-02-27 17:03:32 UTC (rev 7808)
@@ -61,7 +61,7 @@
into generic admonitions, like this::
- <admonition classes="admonition note">
+ <admonition classes="note">
<title>
Note
<paragraph>
@@ -78,12 +78,11 @@
for node in self.document.traverse(nodes.Admonition):
node_name = node.__class__.__name__
# Set class, so that we know what node this admonition came from.
- node['classes'].append('admonition')
+ node['classes'].append(node_name)
if not isinstance(node, nodes.admonition):
# Specific admonition. Transform into a generic admonition.
admonition = nodes.admonition(node.rawsource, *node.children,
**node.attributes)
title = nodes.title('', language.labels[node_name])
- node['classes'].append(node_name)
admonition.insert(0, title)
node.replace_self(admonition)
Modified: trunk/docutils/docutils/writers/html4css1/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/html4css1/__init__.py 2015-02-27 16:18:34 UTC (rev 7807)
+++ trunk/docutils/docutils/writers/html4css1/__init__.py 2015-02-27 17:03:32 UTC (rev 7808)
@@ -505,6 +505,7 @@
self.depart_docinfo_item()
def visit_admonition(self, node):
+ node['classes'].insert(0, 'admonition')
self.body.append(self.starttag(node, 'div'))
self.set_first_last(node)
Modified: trunk/docutils/test/functional/expected/standalone_rst_html4css1.html
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_html4css1.html 2015-02-27 16:18:34 UTC (rev 7807)
+++ trunk/docutils/test/functional/expected/standalone_rst_html4css1.html 2015-02-27 17:03:32 UTC (rev 7808)
@@ -707,7 +707,7 @@
<p class="last">Strong prose may provoke extreme mental exertion.
Reader discretion is strongly advised.</p>
</div>
-<div class="admonition-and-by-the-way admonition">
+<div class="admonition admonition-and-by-the-way">
<p class="first admonition-title">And, by the way...</p>
<p class="last">You can make up your own admonition too.</p>
</div>
Modified: trunk/docutils/test/functional/expected/standalone_rst_xhtml11.xhtml
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_xhtml11.xhtml 2015-02-27 16:18:34 UTC (rev 7807)
+++ trunk/docutils/test/functional/expected/standalone_rst_xhtml11.xhtml 2015-02-27 17:03:32 UTC (rev 7808)
@@ -701,7 +701,7 @@
<p>Strong prose may provoke extreme mental exertion.
Reader discretion is strongly advised.</p>
</div>
-<div class="admonition-and-by-the-way admonition">
+<div class="admonition admonition-and-by-the-way">
<p class="admonition-title">And, by the way...</p>
<p>You can make up your own admonition too.</p>
</div>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2015-03-06 15:43:27
|
Revision: 7809
http://sourceforge.net/p/docutils/code/7809
Author: milde
Date: 2015-03-06 15:43:11 +0000 (Fri, 06 Mar 2015)
Log Message:
-----------
New CSS 2.1 style-sheet for xhtml11 writer.
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/docutils/writers/html4css1/__init__.py
trunk/docutils/docutils/writers/xhtml11/__init__.py
trunk/docutils/docutils/writers/xhtml11/xhtml11.css
trunk/docutils/test/functional/expected/standalone_rst_xhtml11.xhtml
trunk/docutils/test/functional/input/data/svg_images.txt
trunk/docutils/test/functional/input/standalone_rst_xhtml11.txt
trunk/docutils/test/functional/tests/standalone_rst_xhtml11.py
Added Paths:
-----------
trunk/docutils/docs/user/rst/images/biohazard-bitmap.svg
trunk/docutils/docutils/writers/xhtml11/html-base.css
trunk/docutils/test/functional/input/data/html-base.css
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2015-02-27 17:03:32 UTC (rev 7808)
+++ trunk/docutils/HISTORY.txt 2015-03-06 15:43:11 UTC (rev 7809)
@@ -43,14 +43,9 @@
* docutils/writers/xhtml11/
- - New HTML writer generating `XHTML1.1`_ styled with CSS2.
+ - New HTML writer generating `XHTML1.1`_ styled with CSS2.1
Moved to the docutils core from sandbox/html4strict.
- - Wrap SVG images in <img> tags not <object>.
- Addresses bug [ 247 ], but rendering problems remain
- (see test/functional/expected/standalone_rst_xhtml11.xhtml),
- so we might need a config setting.
-
.. _XHTML1.1: http://www.w3.org/TR/xhtml11/
* docutils/writers/latex2e/__init__.py
Added: trunk/docutils/docs/user/rst/images/biohazard-bitmap.svg
===================================================================
--- trunk/docutils/docs/user/rst/images/biohazard-bitmap.svg (rev 0)
+++ trunk/docutils/docs/user/rst/images/biohazard-bitmap.svg 2015-03-06 15:43:11 UTC (rev 7809)
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ version="1.1"
+ width="16"
+ height="16"
+ id="svg2">
+ <metadata
+ id="metadata8">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs6" />
+ <image
+ xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAIRJREFU
+OI2lUkEOwCAIa83+/+XusGCQIWOxF1GhUICSEEFSkvj1BgCjEwwAkkjylW0hyByyBP5+dR2zqrYE
+ux5kvq8e/AVtCh39HlbhqIIlcafdx+jxFezs2BY3fDkxO0lVezElnGA2MWrzmxftkiASxZIjjiWk
+BNlYd6NeJCyzLVbZ/92om331AFqcoAAAAABJRU5ErkJggg==
+"
+ x="4.9541664"
+ y="-5.2426963"
+ width="11.322034"
+ height="9.3559322"
+ transform="matrix(0.77695327,0.62955828,-0.62955828,0.77695327,0,0)"
+ id="image10" />
+ <text
+ x="0.40677962"
+ y="15.186441"
+ id="text2987"
+ xml:space="preserve"
+ style="font-size:4px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:DejaVu Sans;-inkscape-font-specification:DejaVu Sans"><tspan
+ x="0.40677962"
+ y="15.186441"
+ id="tspan2989">turned</tspan></text>
+</svg>
Modified: trunk/docutils/docutils/writers/html4css1/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/html4css1/__init__.py 2015-02-27 17:03:32 UTC (rev 7808)
+++ trunk/docutils/docutils/writers/html4css1/__init__.py 2015-03-06 15:43:11 UTC (rev 7809)
@@ -305,7 +305,8 @@
# A heterogenous stack used in conjunction with the tree traversal.
# Make sure that the pops correspond to the pushes:
self.context = []
- self.topic_classes = []
+
+ self.topic_classes = [] # TODO: replace with self_in_contents
self.colspecs = []
self.compact_p = True
self.compact_simple = False
@@ -568,6 +569,7 @@
and 'open' not in node['classes']
and (self.compact_simple
or self.topic_classes == ['contents']
+ # TODO: self.in_contents
or self.check_simple_list(node))))
def visit_bullet_list(self, node):
@@ -964,11 +966,10 @@
self.context.append('<a class="fn-backref" href="#%s">'
% backrefs[0])
else:
- i = 1
- for backref in backrefs:
+ # Python 2.4 fails with enumerate(backrefs, 1)
+ for (i, backref) in enumerate(backrefs):
backlinks.append('<a class="fn-backref" href="#%s">%s</a>'
- % (backref, i))
- i += 1
+ % (backref, i+1))
self.context.append('<em>(%s)</em> ' % ', '.join(backlinks))
self.context += ['', '']
else:
@@ -1676,10 +1677,13 @@
def visit_topic(self, node):
self.body.append(self.starttag(node, 'div', CLASS='topic'))
self.topic_classes = node['classes']
+ # TODO: replace with ::
+ # self.in_contents = 'contents' in node['classes']
def depart_topic(self, node):
self.body.append('</div>\n')
self.topic_classes = []
+ # TODO self.in_contents = False
def visit_transition(self, node):
self.body.append(self.emptytag(node, 'hr', CLASS='docutils'))
Modified: trunk/docutils/docutils/writers/xhtml11/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/xhtml11/__init__.py 2015-02-27 17:03:32 UTC (rev 7808)
+++ trunk/docutils/docutils/writers/xhtml11/__init__.py 2015-03-06 15:43:11 UTC (rev 7809)
@@ -40,12 +40,13 @@
'xhtml11', 'xhtml1css2')
"""Formats this writer supports."""
- default_stylesheets = ['html4css1.css', 'xhtml11.css']
+ default_stylesheets = ['html-base.css', 'xhtml11.css']
default_stylesheet_dirs = ['.',
os.path.abspath(os.path.dirname(__file__)),
+ # for math.css:
os.path.abspath(os.path.join(
os.path.dirname(os.path.dirname(__file__)), 'html4css1'))
- ]
+ ]
config_section = 'xhtml11 writer'
config_section_dependencies = ('writers', 'html4css1 writer')
@@ -97,6 +98,9 @@
' xml:lang="%(lang)s">\n<head>\n')
lang_attribute = 'xml:lang' # changed from 'lang' in XHTML 1.0
+ def __init__(self, document):
+ html4css1.HTMLTranslator.__init__(self, document)
+ self.in_footnote_list = False
# Do not mark the first child with 'class="first"' and the last
# child with 'class="last"' in definitions, table cells, field
@@ -108,9 +112,10 @@
# Compact lists
# ------------
- # Include field lists (in addition to ordered and unordered lists)
- # in the test if a list is "simple" (cf. the html4css1.HTMLTranslator
- # docstring and the SimpleListChecker class at the end of this file).
+ # Include definition lists and field lists (in addition to ordered
+ # and unordered lists) in the test if a list is "simple" (cf. the
+ # html4css1.HTMLTranslator docstring and the SimpleListChecker class at
+ # the end of this file).
def is_compactable(self, node):
# print "is_compactable %s ?" % node.__class__,
@@ -122,8 +127,9 @@
# print "explicitely open"
return False
# check config setting:
- if (isinstance(node, nodes.field_list) and
- not self.settings.compact_field_lists):
+ if (isinstance(node, nodes.field_list) or
+ isinstance(node, nodes.definition_list)
+ ) and not self.settings.compact_field_lists:
# print "`compact-field-lists` is False"
return False
if (isinstance(node, nodes.enumerated_list) or
@@ -132,8 +138,7 @@
# print "`compact-lists` is False"
return False
# more special cases:
- if (self.compact_simple or self.topic_classes == ['contents']):
- # print "self.compact_simple is True"
+ if (self.topic_classes == ['contents']): # TODO: self.in_contents
return True
# check the list items:
visitor = SimpleListChecker(self.document)
@@ -146,26 +151,75 @@
# print "simple list"
return True
+ # address, literal block, and doctest block: no newline after <pre> tag
+ # (leads to blank line in XHTML1.1)
+ def visit_address(self, node):
+ self.visit_docinfo_item(node, 'address', meta=False)
+ self.body.append(self.starttag(node, 'pre',suffix='',
+ CLASS='address'))
+
+ # author, authors
+ # ---------------
+ # Use paragraphs instead of hard-coded linebreaks.
+
+ def visit_author(self, node):
+ if not(isinstance(node.parent, nodes.authors)):
+ self.visit_docinfo_item(node, 'author')
+ self.body.append('<p>')
+
+ def depart_author(self, node):
+ self.body.append('</p>')
+ if isinstance(node.parent, nodes.authors):
+ self.body.append('\n')
+ else:
+ self.depart_docinfo_item()
+
+ def visit_authors(self, node):
+ self.visit_docinfo_item(node, 'authors')
+
+ def depart_authors(self, node):
+ self.depart_docinfo_item()
+
# citations
# ---------
# Use definition list instead of table for bibliographic references.
# Join adjacent citation entries.
def visit_citation(self, node):
- if self.body[-1] == '<-- next citation -->':
- del(self.body[-1])
- else:
- self.body.append('<dl class="citation">')
- self.context.append(self.starttag(node, 'dd'))
- self.footnote_backrefs(node)
+ if not self.in_footnote_list:
+ self.body.append('<dl class="citation">\n')
+ self.in_footnote_list = True
def depart_citation(self, node):
self.body.append('</dd>\n')
- if isinstance(node.next_node(), nodes.citation):
- self.body.append('<-- next citation -->')
- else:
+ if not isinstance(node.next_node(descend=False, siblings=True),
+ nodes.citation):
self.body.append('</dl>\n')
+ self.in_footnote_list = False
+ # classifier
+ # ----------
+ # don't insert classifier-delimiter here (done by CSS)
+
+ def visit_classifier(self, node):
+ self.body.append(self.starttag(node, 'span', '', CLASS='classifier'))
+
+ def depart_classifier(self, node):
+ self.body.append('</span>')
+
+ # definition list
+ # ---------------
+ # check for simple/complex list and set class attribute
+
+ def visit_definition_list(self, node):
+ classes = node.setdefault('classes', [])
+ if self.is_compactable(node):
+ classes.append('simple')
+ self.body.append(self.starttag(node, 'dl'))
+
+ def depart_definition_list(self, node):
+ self.body.append('</dl>\n')
+
# docinfo
# -------
# use definition list instead of table
@@ -178,7 +232,7 @@
def depart_docinfo(self, node):
self.body.append('</dl>\n')
-
+
def visit_docinfo_item(self, node, name, meta=True):
if meta:
meta_tag = '<meta name="%s" content="%s" />\n' \
@@ -191,6 +245,14 @@
def depart_docinfo_item(self):
self.body.append('</dd>\n')
+ # doctest-block
+ # -------------
+ # no line-break
+ # TODO: RSt-parser should treat this as code-block with class "pycon".
+
+ def visit_doctest_block(self, node):
+ self.body.append(self.starttag(node, 'pre', suffix='',
+ CLASS='code pycon doctest-block'))
# enumerated lists
# ----------------
@@ -200,18 +262,17 @@
def visit_enumerated_list(self, node):
atts = {}
if 'start' in node:
- atts['style'] = 'counter-reset: item %d;' % (
- node['start'] - 1)
+ atts['style'] = 'counter-reset: item %d;' % (node['start'] - 1)
classes = node.setdefault('classes', [])
if 'enumtype' in node:
classes.append(node['enumtype'])
- if self.is_compactable(node) and not self.compact_simple:
+ if self.is_compactable(node):
classes.append('simple')
- # @@@ To do: prefix, suffix. (?)
- self.context.append((self.compact_simple, self.compact_p))
- self.compact_p = False
self.body.append(self.starttag(node, 'ol', **atts))
+ def depart_enumerated_list(self, node):
+ self.body.append('</ol>\n')
+
# field-list
# ----------
# set as definition list, styled with CSS
@@ -219,16 +280,12 @@
def visit_field_list(self, node):
# Keep simple paragraphs in the field_body to enable CSS
# rule to start body on new line if the label is too long
- self.context.append((self.compact_field_list, self.compact_p))
- self.compact_field_list, self.compact_p = False, False
- #
classes = 'field-list'
if (self.is_compactable(node)):
classes += ' simple'
self.body.append(self.starttag(node, 'dl', CLASS=classes))
def depart_field_list(self, node):
- self.compact_field_list, self.compact_p = self.context.pop()
self.body.append('</dl>\n')
def visit_field(self, node):
@@ -254,22 +311,16 @@
# use definition list instead of table for footnote text
def visit_footnote(self, node):
- if self.body[-1] == '<-- next footnote -->':
- del(self.body[-1])
- else:
- self.body.append('<dl class="footnote">')
- self.context.append(self.starttag(node, 'dd'))
- self.footnote_backrefs(node)
+ if not self.in_footnote_list:
+ self.body.append('<dl class="footnote">\n')
+ self.in_footnote_list = True
def depart_footnote(self, node):
self.body.append('</dd>\n')
- next_siblings = node.traverse(descend=False, siblings=True,
- include_self=False)
- next = next_siblings and next_siblings[0]
- if isinstance(next, nodes.footnote):
- self.body.append('<-- next footnote -->')
- else:
+ if not isinstance(node.next_node(descend=False, siblings=True),
+ nodes.footnote):
self.body.append('</dl>\n')
+ self.in_footnote_list = False
# footnote and citation label
def label_delim(self, node, bracket, superscript):
@@ -279,26 +330,34 @@
return bracket
else:
return superscript
- else:
- assert isinstance(node.parent, nodes.citation)
- return bracket
+ assert isinstance(node.parent, nodes.citation)
+ return bracket
def visit_label(self, node):
- # Context added in footnote_backrefs.
- suffix = '%s%s' % (self.context.pop(),
- self.label_delim(node, '[', ''))
- self.body.append(self.starttag(node, 'dt', suffix, CLASS='label'))
+ # pass parent node to get id into starttag:
+ self.body.append(self.starttag(node.parent, 'dt', '', CLASS='label'))
+ # 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):
- delim = self.label_delim(node, ']', '')
- # Context added in footnote_backrefs.
- backref = self.context.pop()
- text = self.context.pop()
- # <dd> starttag added in visit_footnote() / visit_citation()
- starttag = self.context.pop()
- self.body.append('%s%s</dt>\n%s%s' % (delim, backref, starttag, text))
+ self.body.append(self.label_delim(node, ']', ''))
+ if self.settings.footnote_backlinks:
+ backrefs = node.parent['backrefs']
+ if len(backrefs) == 1:
+ self.body.append('</a>')
+ elif len(backrefs) > 1:
+ # Python 2.4 fails with enumerate(backrefs, 1)
+ backlinks = ['<a href="#%s">%s</a>' % (ref, i+1)
+ for (i, ref) in enumerate(backrefs)]
+ self.body.append('<span class="fn-backref">(%s)</span>'
+ % ','.join(backlinks))
+ self.body.append('</dt>\n<dd>')
-
def visit_generated(self, node):
if 'sectnum' in node['classes']:
# get section number (strip trailing no-break-spaces)
@@ -315,7 +374,7 @@
# Image types to place in an <object> element
# SVG as <img> supported since IE version 9
# (but rendering problems remain (see standalonge_rst2xhtml11.xhtml test output)
- object_image_types = {'.swf': 'application/x-shockwave-flash'}
+ # object_image_types = {'.swf': 'application/x-shockwave-flash'}
# Do not mark the first child with 'class="first"'
def visit_list_item(self, node):
@@ -352,16 +411,10 @@
# skipped unless literal element is from "code" role:
self.body.append('</code>')
- # literal block and doctest block: no newline after <pre> tag
- # (leads to blank line in XHTML1.1)
def visit_literal_block(self, node,):
self.body.append(self.starttag(node, 'pre', suffix='',
CLASS='literal-block'))
- def visit_doctest_block(self, node):
- self.body.append(self.starttag(node, 'pre', suffix='',
- CLASS='doctest-block'))
-
# Meta tags: 'lang' attribute replaced by 'xml:lang' in XHTML 1.1
def visit_meta(self, node):
if node.hasattr('lang'):
@@ -419,10 +472,10 @@
# * In XHTML 1.1, e.g. a <blockquote> element may not contain
# character data, so you cannot drop the <p> tags.
# * Keeping simple paragraphs in the field_body enables a CSS
- # rule to start the field-body on new line if the label is too long
+ # rule to start the field-body on a new line if the label is too long
# * it makes the code simpler.
#
- # TODO: omit paragraph tags in simple table cells.
+ # TODO: omit paragraph tags in simple table cells?
def visit_paragraph(self, node):
self.body.append(self.starttag(node, 'p', ''))
@@ -430,7 +483,6 @@
def depart_paragraph(self, node):
self.body.append('</p>')
if not (isinstance(node.parent, (nodes.list_item, nodes.entry)) and
- # (node is node.parent[-1])
(len(node.parent) == 1)
):
self.body.append('\n')
@@ -480,10 +532,8 @@
def visit_list_item(self, node):
# print "visiting list item", node.__class__
- children = []
- for child in node.children:
- if not isinstance(child, nodes.Invisible):
- children.append(child)
+ children = [child for child in node.children
+ if not isinstance(child, nodes.Invisible)]
# print "has %s visible children" % len(children)
if (children and isinstance(children[0], nodes.paragraph)
and (isinstance(children[-1], nodes.bullet_list) or
@@ -509,11 +559,17 @@
visit_status = _simple_node
visit_version = visit_list_item
- # Field list items
+ # Definition list:
+ visit_definition_list = _pass_node
+ visit_definition_list_item = _pass_node
+ visit_term = _pass_node
+ visit_classifier = _pass_node
+ visit_definition = visit_list_item
+
+ # Field list:
visit_field_list = _pass_node
visit_field = _pass_node
# the field body corresponds to a list item
- # visit_field_body = html4css1.SimpleListChecker.visit_list_item
visit_field_body = visit_list_item
visit_field_name = html4css1.SimpleListChecker.invisible_visit
Added: trunk/docutils/docutils/writers/xhtml11/html-base.css
===================================================================
--- trunk/docutils/docutils/writers/xhtml11/html-base.css (rev 0)
+++ trunk/docutils/docutils/writers/xhtml11/html-base.css 2015-03-06 15:43:11 UTC (rev 7809)
@@ -0,0 +1,492 @@
+/* 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, h2.subtitle {
+ text-align: center;
+}
+h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
+h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
+ margin-top: -0.25em;
+}
+span.section-subtitle {
+ /* font-size relative to parent (h1..h6 element) */
+ font-size: 75%;
+}
+
+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;
+}
+
+/* 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.sidebar-subtitle,
+p.system-message-title {
+ font-weight: bold;
+}
+
+/* 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 */
+dd > ul, dd > ol { padding-left: 0pt; }
+
+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: ":";
+}
+
+/* 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;
+}
+
+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;
...
[truncated message content] |
|
From: <mi...@us...> - 2015-03-10 14:15:20
|
Revision: 7815
http://sourceforge.net/p/docutils/code/7815
Author: milde
Date: 2015-03-10 14:15:17 +0000 (Tue, 10 Mar 2015)
Log Message:
-----------
New basic HTML writer: generates polyglott HTML 5 / XHTML 1.1 (transitional)
Added Paths:
-----------
trunk/docutils/docutils/writers/html_base/
trunk/docutils/docutils/writers/html_base/__init__.py
trunk/docutils/docutils/writers/html_base/math.css
trunk/docutils/docutils/writers/html_base/template.txt
trunk/docutils/tools/rst2html5.py
Removed Paths:
-------------
trunk/docutils/docutils/writers/html4css1/math.css
Deleted: trunk/docutils/docutils/writers/html4css1/math.css
===================================================================
--- trunk/docutils/docutils/writers/html4css1/math.css 2015-03-10 13:52:09 UTC (rev 7814)
+++ trunk/docutils/docutils/writers/html4css1/math.css 2015-03-10 14:15:17 UTC (rev 7815)
@@ -1,276 +0,0 @@
-/*
-* math2html: convert LaTeX equations to HTML output.
-*
-* Copyright (C) 2009,2010 Alex Fernández
-*
-* 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
-*
-* Based on eLyXer: convert LyX source files to HTML output.
-* http://elyxer.nongnu.org/
-*/
-/* --end--
-* CSS file for LaTeX formulas.
-*/
-
-/* Formulas */
-.formula {
- text-align: center;
- font-family: "Droid Serif", "DejaVu Serif", "STIX", serif;
- margin: 1.2em 0;
-}
-span.formula {
- white-space: nowrap;
-}
-div.formula {
- padding: 0.5ex;
- margin-left: auto;
- margin-right: auto;
-}
-
-/* Basic features */
-a.eqnumber {
- display: inline-block;
- float: right;
- clear: right;
- font-weight: bold;
-}
-span.unknown {
- color: #800000;
-}
-span.ignored, span.arraydef {
- display: none;
-}
-.formula i {
- letter-spacing: 0.1ex;
-}
-
-/* Alignment */
-.align-left, .align-l {
- text-align: left;
-}
-.align-right, .align-r {
- text-align: right;
-}
-.align-center, .align-c {
- text-align: center;
-}
-
-/* Structures */
-span.overline, span.bar {
- text-decoration: overline;
-}
-.fraction, .fullfraction {
- display: inline-block;
- vertical-align: middle;
- text-align: center;
-}
-.fraction .fraction {
- font-size: 80%;
- line-height: 100%;
-}
-span.numerator {
- display: block;
-}
-span.denominator {
- display: block;
- padding: 0ex;
- border-top: thin solid;
-}
-sup.numerator, sup.unit {
- font-size: 70%;
- vertical-align: 80%;
-}
-sub.denominator, sub.unit {
- font-size: 70%;
- vertical-align: -20%;
-}
-span.sqrt {
- display: inline-block;
- vertical-align: middle;
- padding: 0.1ex;
-}
-sup.root {
- font-size: 70%;
- position: relative;
- left: 1.4ex;
-}
-span.radical {
- display: inline-block;
- padding: 0ex;
- font-size: 150%;
- vertical-align: top;
-}
-span.root {
- display: inline-block;
- border-top: thin solid;
- padding: 0ex;
- vertical-align: middle;
-}
-span.symbol {
- line-height: 125%;
- font-size: 125%;
-}
-span.bigsymbol {
- line-height: 150%;
- font-size: 150%;
-}
-span.largesymbol {
- font-size: 175%;
-}
-span.hugesymbol {
- font-size: 200%;
-}
-span.scripts {
- display: inline-table;
- vertical-align: middle;
-}
-.script {
- display: table-row;
- text-align: left;
- line-height: 150%;
-}
-span.limits {
- display: inline-table;
- vertical-align: middle;
-}
-.limit {
- display: table-row;
- line-height: 99%;
-}
-sup.limit, sub.limit {
- line-height: 100%;
-}
-span.symbolover {
- display: inline-block;
- text-align: center;
- position: relative;
- float: right;
- right: 100%;
- bottom: 0.5em;
- width: 0px;
-}
-span.withsymbol {
- display: inline-block;
-}
-span.symbolunder {
- display: inline-block;
- text-align: center;
- position: relative;
- float: right;
- right: 80%;
- top: 0.3em;
- width: 0px;
-}
-
-/* Environments */
-span.array, span.bracketcases, span.binomial, span.environment {
- display: inline-table;
- text-align: center;
- border-collapse: collapse;
- margin: 0em;
- vertical-align: middle;
-}
-span.arrayrow, span.binomrow {
- display: table-row;
- padding: 0ex;
- border: 0ex;
-}
-span.arraycell, span.bracket, span.case, span.binomcell, span.environmentcell {
- display: table-cell;
- padding: 0ex 0.2ex;
- line-height: 99%;
- border: 0ex;
-}
-/*
-* CSS file for LaTeX formulas, extra stuff:
-* binomials, vertical braces, stackrel, fonts and colors.
-*/
-
-/* Inline binomials */
-span.binom {
- display: inline-block;
- vertical-align: middle;
- text-align: center;
- font-size: 80%;
-}
-span.binomstack {
- display: block;
- padding: 0em;
-}
-
-/* Over- and underbraces */
-span.overbrace {
- border-top: 2pt solid;
-}
-span.underbrace {
- border-bottom: 2pt solid;
-}
-
-/* Stackrel */
-span.stackrel {
- display: inline-block;
- text-align: center;
-}
-span.upstackrel {
- display: block;
- padding: 0em;
- font-size: 80%;
- line-height: 64%;
- position: relative;
- top: 0.15em;
-
-}
-span.downstackrel {
- display: block;
- vertical-align: bottom;
- padding: 0em;
-}
-
-/* Fonts */
-span.mathsf, span.textsf {
- font-style: normal;
- font-family: sans-serif;
-}
-span.mathrm, span.textrm {
- font-style: normal;
- font-family: serif;
-}
-span.text, span.textnormal {
- font-style: normal;
-}
-span.textipa {
- color: #008080;
-}
-span.fraktur {
- font-family: "Lucida Blackletter", eufm10, blackletter;
-}
-span.blackboard {
- font-family: Blackboard, msbm10, serif;
-}
-span.scriptfont {
- font-family: "Monotype Corsiva", "Apple Chancery", "URW Chancery L", cursive;
- font-style: italic;
-}
-
-/* Colors */
-span.colorbox {
- display: inline-block;
- padding: 5px;
-}
-span.fbox {
- display: inline-block;
- border: thin solid black;
- padding: 2px;
-}
-span.boxed, span.framebox {
- display: inline-block;
- border: thin solid black;
- padding: 5px;
-}
-
Added: trunk/docutils/docutils/writers/html_base/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/html_base/__init__.py (rev 0)
+++ trunk/docutils/docutils/writers/html_base/__init__.py 2015-03-10 14:15:17 UTC (rev 7815)
@@ -0,0 +1,1721 @@
+# .. coding: utf8
+# :Author: Günter Milde <mi...@us...>
+# :Revision: $Revision$
+# :Date: $Date: 2005-06-28$
+# :Copyright: © 2005, 2009 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
+
+# Use "best practice" as recommended by the W3C:
+# http://www.w3.org/2009/cheatsheet/
+
+
+"""
+Basic HyperText Markup Language document tree Writer.
+
+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.
+"""
+__docformat__ = 'reStructuredText'
+
+import sys
+import os
+import os.path
+import re
+import urllib
+try: # check for the Python Imaging Library
+ import PIL.Image
+except ImportError:
+ try: # sometimes PIL modules are put in PYTHONPATH's root
+ import Image
+ class PIL(object): pass # dummy wrapper
+ PIL.Image = Image
+ except ImportError:
+ PIL = None
+import docutils
+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
+
+class Writer(writers.Writer):
+
+ supported = ('html', 'html5', 'xhtml')
+ """Formats this writer supports."""
+
+ default_stylesheets = ['html-base.css']
+ default_stylesheet_dirs = ['.', os.path.abspath(os.path.dirname(__file__))]
+
+ default_template = 'template.txt'
+ default_template_path = os.path.join(
+ os.path.dirname(os.path.abspath(__file__)), default_template)
+
+ settings_spec = (
+ 'HTML-Specific Options',
+ None,
+ (('Specify the template file (UTF-8 encoded). Default is "%s".'
+ % default_template_path,
+ ['--template'],
+ {'default': default_template_path, 'metavar': '<file>'}),
+ ('Comma separated list of stylesheet URLs. '
+ 'Overrides previous --stylesheet and --stylesheet-path settings.',
+ ['--stylesheet'],
+ {'metavar': '<URL[,URL,...]>', 'overrides': 'stylesheet_path',
+ 'validator': frontend.validate_comma_separated_list}),
+ ('Comma separated list of stylesheet paths. '
+ 'Relative paths are expanded if a matching file is found in '
+ 'the --stylesheet-dirs. With --link-stylesheet, '
+ 'the path is rewritten relative to the output HTML file. '
+ 'Default: "%s"' % ','.join(default_stylesheets),
+ ['--stylesheet-path'],
+ {'metavar': '<file[,file,...]>', 'overrides': 'stylesheet',
+ 'validator': frontend.validate_comma_separated_list,
+ 'default': default_stylesheets}),
+ ('Embed the stylesheet(s) in the output HTML file. The stylesheet '
+ 'files must be accessible during processing. This is the default.',
+ ['--embed-stylesheet'],
+ {'default': 1, 'action': 'store_true',
+ 'validator': frontend.validate_boolean}),
+ ('Link to the stylesheet(s) in the output HTML file. '
+ 'Default: embed stylesheets.',
+ ['--link-stylesheet'],
+ {'dest': 'embed_stylesheet', 'action': 'store_false'}),
+ ('Comma-separated list of directories where stylesheets are found. '
+ 'Used by --stylesheet-path when expanding relative path arguments. '
+ 'Default: "%s"' % default_stylesheet_dirs,
+ ['--stylesheet-dirs'],
+ {'metavar': '<dir[,dir,...]>',
+ 'validator': frontend.validate_comma_separated_list,
+ 'default': default_stylesheet_dirs}),
+ ('Specify the initial header level. Default is 1 for "<h1>". '
+ 'Does not affect document title & subtitle (see --no-doc-title).',
+ ['--initial-header-level'],
+ {'choices': '1 2 3 4 5 6'.split(), 'default': '1',
+ 'metavar': '<level>'}),
+ ('Format for footnote references: one of "superscript" or '
+ '"brackets". Default is "brackets".',
+ ['--footnote-references'],
+ {'choices': ['superscript', 'brackets'], 'default': 'brackets',
+ 'metavar': '<format>',
+ 'overrides': 'trim_footnote_reference_space'}),
+ ('Format for block quote attributions: one of "dash" (em-dash '
+ 'prefix), "parentheses"/"parens", or "none". Default is "dash".',
+ ['--attribution'],
+ {'choices': ['dash', 'parentheses', 'parens', 'none'],
+ 'default': 'dash', 'metavar': '<format>'}),
+ ('Remove extra vertical whitespace between items of "simple" bullet '
+ 'lists and enumerated lists. Default: enabled.',
+ ['--compact-lists'],
+ {'default': True, 'action': 'store_true',
+ 'validator': frontend.validate_boolean}),
+ ('Disable compact simple bullet and enumerated lists.',
+ ['--no-compact-lists'],
+ {'dest': 'compact_lists', 'action': 'store_false'}),
+ ('Remove extra vertical whitespace between items of simple field '
+ 'lists. Default: enabled.',
+ ['--compact-field-lists'],
+ {'default': True, 'action': 'store_true',
+ 'validator': frontend.validate_boolean}),
+ ('Disable compact simple field lists.',
+ ['--no-compact-field-lists'],
+ {'dest': 'compact_field_lists', 'action': 'store_false'}),
+ ('Added to standard table classes. '
+ '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'],
+ {'default': 'HTML math.css'}),
+ ('Omit the XML declaration. Must be true for HTML5 conformance.',
+ ['--no-xml-declaration'],
+ {'dest': 'xml_declaration', 'default': False,
+ 'action': 'store_false', 'validator': frontend.validate_boolean}),
+ ('Obfuscate email addresses to confuse harvesters while still '
+ 'keeping email links usable with standards-compliant browsers.',
+ ['--cloak-email-addresses'],
+ {'action': 'store_true', 'validator': frontend.validate_boolean}),))
+
+ settings_defaults = {'output_encoding_error_handler': 'xmlcharrefreplace'}
+
+ config_section = 'html-base writer'
+ config_section_dependencies = ('writers',)
+
+ visitor_attributes = (
+ 'head_prefix', 'head', 'stylesheet', 'body_prefix',
+ 'body_pre_docinfo', 'docinfo', 'body', 'body_suffix',
+ 'title', 'subtitle', 'header', 'footer', 'meta', 'fragment',
+ 'html_prolog', 'html_head', 'html_title', 'html_subtitle',
+ 'html_body')
+
+ def get_transforms(self):
+ return writers.Writer.get_transforms(self) + [writer_aux.Admonitions]
+
+ def __init__(self):
+ writers.Writer.__init__(self)
+ self.translator_class = HTMLTranslator
+
+ def translate(self):
+ self.visitor = visitor = self.translator_class(self.document)
+ self.document.walkabout(visitor)
+ for attr in self.visitor_attributes:
+ setattr(self, attr, getattr(visitor, attr))
+ self.output = self.apply_template()
+
+ def apply_template(self):
+ template_file = open(self.document.settings.template, 'rb')
+ template = unicode(template_file.read(), 'utf-8')
+ template_file.close()
+ subs = self.interpolation_dict()
+ return template % subs
+
+ def interpolation_dict(self):
+ subs = {}
+ settings = self.document.settings
+ for attr in self.visitor_attributes:
+ subs[attr] = ''.join(getattr(self, attr)).rstrip('\n')
+ subs['encoding'] = settings.output_encoding
+ subs['version'] = docutils.__version__
+ return subs
+
+ def assemble_parts(self):
+ writers.Writer.assemble_parts(self)
+ for part in self.visitor_attributes:
+ self.parts[part] = ''.join(getattr(self, part))
+
+
+class HTMLTranslator(nodes.NodeVisitor):
+
+ """
+ This writer generates `polyglott markup`: HTML 5 that is also valid XML.
+ """
+
+ xml_declaration = '<?xml version="1.0" encoding="%s" ?>\n'
+ doctype = (
+ '<!DOCTYPE html>\n')
+ doctype_mathml = doctype
+
+ head_prefix_template = ('<html xmlns="http://www.w3.org/1999/xhtml"'
+ ' xml:lang="%(lang)s" lang="%(lang)s">\n<head>\n')
+ content_type = ('<meta http-equiv="Content-Type"'
+ ' content="text/html; charset=%s" />\n')
+ content_type_mathml = ('<meta http-equiv="Content-Type"'
+ ' content="text/html; charset=%s" />\n')
+
+ generator = ('<meta name="generator" content="Docutils %s: '
+ 'http://docutils.sourceforge.net/" />\n')
+
+ # Template for the MathJax script in the header:
+ mathjax_script = '<script type="text/javascript" src="%s"></script>\n'
+ # 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')
+ # may be overwritten by custom URL appended to "mathjax"
+
+ stylesheet_link = '<link rel="stylesheet" href="%s" type="text/css" />\n'
+ embedded_stylesheet = '<style type="text/css">\n\n%s\n</style>\n'
+ words_and_spaces = re.compile(r'\S+| +|\n')
+ sollbruchstelle = re.compile(r'.+\W\W.+|[-?].+', re.U) # wrap point inside word
+ lang_attribute = 'lang' # name changes to 'xml:lang' in XHTML 1.1
+
+ def __init__(self, document):
+ nodes.NodeVisitor.__init__(self, document)
+ self.settings = settings = document.settings
+ lcode = settings.language_code
+ self.language = languages.get_language(lcode, document.reporter)
+ self.meta = [self.generator % docutils.__version__]
+ self.head_prefix = []
+ self.html_prolog = []
+ if settings.xml_declaration:
+ self.head_prefix.append(self.xml_declaration
+ % settings.output_encoding)
+ # encoding not interpolated:
+ self.html_prolog.append(self.xml_declaration)
+ self.head = self.meta[:]
+ self.stylesheet = [self.stylesheet_call(path)
+ for path in utils.get_stylesheet_list(settings)]
+ self.body_prefix = ['</head>\n<body>\n']
+ # document title, subtitle display
+ self.body_pre_docinfo = []
+ # author, date, etc.
+ self.docinfo = []
+ self.body = []
+ self.fragment = []
+ self.body_suffix = ['</body>\n</html>\n']
+ self.section_level = 0
+ self.initial_header_level = int(settings.initial_header_level)
+
+ self.math_output = settings.math_output.split()
+ self.math_output_options = self.math_output[1:]
+ self.math_output = self.math_output[0].lower()
+
+ # A heterogenous stack used in conjunction with the tree traversal.
+ # Make sure that the pops correspond to the pushes:
+ self.context = []
+
+ self.topic_classes = [] # TODO: replace with self_in_contents
+ self.colspecs = []
+ self.compact_p = True
+ self.compact_simple = False
+ self.compact_field_list = False
+ self.in_docinfo = False
+ self.in_sidebar = False
+ self.in_footnote_list = False
+ self.title = []
+ self.subtitle = []
+ self.header = []
+ self.footer = []
+ self.html_head = [self.content_type] # charset not interpolated
+ self.html_title = []
+ self.html_subtitle = []
+ self.html_body = []
+ self.in_document_title = 0 # len(self.body) or 0
+ self.in_mailto = False
+ self.author_in_authors = False
+ self.math_header = []
+
+ def astext(self):
+ return ''.join(self.head_prefix + self.head
+ + self.stylesheet + self.body_prefix
+ + self.body_pre_docinfo + self.docinfo
+ + self.body + self.body_suffix)
+
+ def encode(self, text):
+ """Encode special characters in `text` & return."""
+ # @@@ A codec to do these and all other HTML entities would be nice.
+ text = unicode(text)
+ return text.translate({
+ ord('&'): u'&',
+ ord('<'): u'<',
+ ord('"'): u'"',
+ ord('>'): u'>',
+ ord('@'): u'@', # may thwart some address harvesters
+ })
+
+ def cloak_mailto(self, uri):
+ """Try to hide a mailto: URL from harvesters."""
+ # Encode "@" using a URL octet reference (see RFC 1738).
+ # Further cloaking with HTML entities will be done in the
+ # `attval` function.
+ return uri.replace('@', '%40')
+
+ def cloak_email(self, addr):
+ """Try to hide the link text of a email link from harversters."""
+ # Surround at-signs and periods with <span> tags. ("@" has
+ # already been encoded to "@" by the `encode` method.)
+ addr = addr.replace('@', '<span>@</span>')
+ addr = addr.replace('.', '<span>.</span>')
+ return addr
+
+ def attval(self, text,
+ whitespace=re.compile('[\n\r\t\v\f]')):
+ """Cleanse, HTML encode, and return attribute value text."""
+ encoded = self.encode(whitespace.sub(' ', text))
+ if self.in_mailto and self.settings.cloak_email_addresses:
+ # Cloak at-signs ("%40") and periods with HTML entities.
+ encoded = encoded.replace('%40', '%40')
+ encoded = encoded.replace('.', '.')
+ return encoded
+
+ def stylesheet_call(self, path):
+ """Return code to reference or embed stylesheet file `path`"""
+ if self.settings.embed_stylesheet:
+ try:
+ content = io.FileInput(source_path=path,
+ encoding='utf-8').read()
+ self.settings.record_dependencies.add(path)
+ except IOError, err:
+ msg = u"Cannot embed stylesheet '%s': %s." % (
+ path, SafeString(err.strerror))
+ self.document.reporter.error(msg)
+ return '<--- %s --->\n' % msg
+ return self.embedded_stylesheet % content
+ # else link to style file:
+ if self.settings.stylesheet_path:
+ # adapt path relative to output (cf. config.html#stylesheet-path)
+ path = utils.relative_path(self.settings._destination, path)
+ return self.stylesheet_link % self.encode(path)
+
+ def starttag(self, node, tagname, suffix='\n', empty=False, **attributes):
+ """
+ Construct and return a start tag given a node (id & class attributes
+ are extracted), tag name, and optional attributes.
+ """
+ tagname = tagname.lower()
+ prefix = []
+ atts = {}
+ ids = []
+ for (name, value) in attributes.items():
+ atts[name.lower()] = value
+ classes = []
+ languages = []
+ # unify class arguments and move language specification
+ for cls in node.get('classes', []) + atts.pop('class', '').split() :
+ if cls.startswith('language-'):
+ languages.append(cls[9:])
+ elif cls.strip() and cls not in classes:
+ classes.append(cls)
+ if languages:
+ # attribute name is 'lang' in XHTML 1.0 but 'xml:lang' in 1.1
+ atts[self.lang_attribute] = languages[0]
+ if classes:
+ atts['class'] = ' '.join(classes)
+ assert 'id' not in atts
+ ids.extend(node.get('ids', []))
+ if 'ids' in atts:
+ ids.extend(atts['ids'])
+ del atts['ids']
+ if ids:
+ atts['id'] = ids[0]
+ for id in ids[1:]:
+ # Add empty "span" elements for additional IDs. Note
+ # that we cannot use empty "a" elements because there
+ # may be targets inside of references, but nested "a"
+ # elements aren't allowed in XHTML (even if they do
+ # not all have a "href" attribute).
+ if empty:
+ # Empty tag. Insert target right in front of element.
+ prefix.append('<span id="%s"></span>' % id)
+ else:
+ # Non-empty tag. Place the auxiliary <span> tag
+ # *inside* the element, as the first child.
+ suffix += '<span id="%s"></span>' % id
+ attlist = atts.items()
+ attlist.sort()
+ parts = [tagname]
+ for name, value in attlist:
+ # value=None was used for boolean attributes without
+ # value, but this isn't supported by XHTML.
+ assert value is not None
+ if isinstance(value, list):
+ values = [unicode(v) for v in value]
+ parts.append('%s="%s"' % (name.lower(),
+ self.attval(' '.join(values))))
+ else:
+ parts.append('%s="%s"' % (name.lower(),
+ self.attval(unicode(value))))
+ if empty:
+ infix = ' /'
+ else:
+ infix = ''
+ return ''.join(prefix) + '<%s%s>' % (' '.join(parts), infix) + suffix
+
+ def emptytag(self, node, tagname, suffix='\n', **attributes):
+ """Construct and return an XML-compatible empty tag."""
+ return self.starttag(node, tagname, suffix, empty=True, **attributes)
+
+ def set_class_on_child(self, node, class_, index=0):
+ """
+ Set class `class_` on the visible child no. index of `node`.
+ Do nothing if node has fewer children than `index`.
+ """
+ children = [n for n in node if not isinstance(n, nodes.Invisible)]
+ try:
+ child = children[index]
+ except IndexError:
+ return
+ child['classes'].append(class_)
+
+ def set_first_last(self, node):
+ pass
+ # TODO: remove calls to this function
+
+ def visit_Text(self, node):
+ text = node.astext()
+ encoded = self.encode(text)
+ if self.in_mailto and self.settings.cloak_email_addresses:
+ encoded = self.cloak_email(encoded)
+ self.body.append(encoded)
+
+ def depart_Text(self, node):
+ pass
+
+ def visit_abbreviation(self, node):
+ # @@@ implementation incomplete ("title" attribute)
+ self.body.append(self.starttag(node, 'abbr', ''))
+
+ def depart_abbreviation(self, node):
+ self.body.append('</abbr>')
+
+ def visit_acronym(self, node):
+ # @@@ implementation incomplete ("title" attribute)
+ self.body.append(self.starttag(node, 'abbr', ''))
+
+ def depart_acronym(self, node):
+ self.body.append('</abbr>')
+
+ def visit_address(self, node):
+ self.visit_docinfo_item(node, 'address', meta=False)
+ self.body.append(self.starttag(node, 'pre', '', CLASS='address'))
+
+ def depart_address(self, node):
+ self.body.append('\n</pre>\n')
+ self.depart_docinfo_item()
+
+ def visit_admonition(self, node):
+ node['classes'].insert(0, 'admonition')
+ self.body.append(self.starttag(node, 'div'))
+ self.set_first_last(node)
+
+ def depart_admonition(self, node=None):
+ self.body.append('</div>\n')
+
+ attribution_formats = {'dash': ('—', ''),
+ 'parentheses': ('(', ')'),
+ 'parens': ('(', ')'),
+ 'none': ('', '')}
+
+ def visit_attribution(self, node):
+ prefix, suffix = self.attribution_formats[self.settings.attribution]
+ self.context.append(suffix)
+ self.body.append(
+ self.starttag(node, 'p', prefix, CLASS='attribution'))
+
+ def depart_attribution(self, node):
+ self.body.append(self.context.pop() + '</p>\n')
+
+ # author, authors
+ # ---------------
+ # Use paragraphs instead of hard-coded linebreaks.
+
+ def visit_author(self, node):
+ if not(isinstance(node.parent, nodes.authors)):
+ self.visit_docinfo_item(node, 'author')
+ self.body.append('<p>')
+
+ def depart_author(self, node):
+ self.body.append('</p>')
+ if isinstance(node.parent, nodes.authors):
+ self.body.append('\n')
+ else:
+ self.depart_docinfo_item()
+
+ def visit_authors(self, node):
+ self.visit_docinfo_item(node, 'authors', meta=False)
+
+ def depart_authors(self, node):
+ self.depart_docinfo_item()
+
+ def visit_block_quote(self, node):
+ self.body.append(self.starttag(node, 'blockquote'))
+
+ def depart_block_quote(self, node):
+ self.body.append('</blockquote>\n')
+
+ def check_simple_list(self, node):
+ """Check for a simple list that can be rendered compactly."""
+ visitor = SimpleListChecker(self.document)
+ try:
+ node.walk(visitor)
+ except nodes.NodeFound:
+ return None
+ else:
+ return 1
+
+ # Compact lists
+ # ------------
+ # Include definition lists and field lists (in addition to ordered
+ # and unordered lists) in the test if a list is "simple" (cf. the
+ # html4css1.HTMLTranslator docstring and the SimpleListChecker class at
+ # the end of this file).
+
+ def is_compactable(self, node):
+ # print "is_compactable %s ?" % node.__class__,
+ # explicite class arguments have precedence
+ if 'compact' in node['classes']:
+ # print "explicitely compact"
+ return True
+ if 'open' in node['classes']:
+ # print "explicitely open"
+ return False
+ # check config setting:
+ if (isinstance(node, nodes.field_list) or
+ isinstance(node, nodes.definition_list)
+ ) and not self.settings.compact_field_lists:
+ # print "`compact-field-lists` is False"
+ return False
+ if (isinstance(node, nodes.enumerated_list) or
+ isinstance(node, nodes.bullet_list)
+ ) and not self.settings.compact_lists:
+ # print "`compact-lists` is False"
+ return False
+ # more special cases:
+ if (self.topic_classes == ['contents']): # TODO: self.in_contents
+ return True
+ # check the list items:
+ visitor = SimpleListChecker(self.document)
+ try:
+ node.walk(visitor)
+ except nodes.NodeFound:
+ # print "complex node"
+ return False
+ else:
+ # print "simple list"
+ return True
+
+ def visit_bullet_list(self, node):
+ atts = {}
+ old_compact_simple = self.compact_simple
+ self.context.append((self.compact_simple, self.compact_p))
+ self.compact_p = None
+ self.compact_simple = self.is_compactable(node)
+ if self.compact_simple and not old_compact_simple:
+ atts['class'] = 'simple'
+ self.body.append(self.starttag(node, 'ul', **atts))
+
+ def...
[truncated message content] |
|
From: <mi...@us...> - 2015-03-10 15:11:49
|
Revision: 7817
http://sourceforge.net/p/docutils/code/7817
Author: milde
Date: 2015-03-10 15:11:37 +0000 (Tue, 10 Mar 2015)
Log Message:
-----------
Fix setup.py and tests after addition of writers/html_base and mv of math.css.
Modified Paths:
--------------
trunk/docutils/docutils/writers/__init__.py
trunk/docutils/docutils/writers/html4css1/__init__.py
trunk/docutils/setup.py
trunk/docutils/test/test_writers/test_html4css1_misc.py
Modified: trunk/docutils/docutils/writers/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/__init__.py 2015-03-10 14:26:05 UTC (rev 7816)
+++ trunk/docutils/docutils/writers/__init__.py 2015-03-10 15:11:37 UTC (rev 7817)
@@ -121,6 +121,7 @@
_writer_aliases = {
'html': 'html4css1',
+ 'html-base': 'html_base',
'xhtml': 'xhtml11',
'latex': 'latex2e',
'xelatex': 'xetex',
Modified: trunk/docutils/docutils/writers/html4css1/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/html4css1/__init__.py 2015-03-10 14:26:05 UTC (rev 7816)
+++ trunk/docutils/docutils/writers/html4css1/__init__.py 2015-03-10 15:11:37 UTC (rev 7817)
@@ -43,7 +43,12 @@
"""Formats this writer supports."""
default_stylesheets = ['html4css1.css']
- default_stylesheet_dirs = ['.', os.path.abspath(os.path.dirname(__file__))]
+ default_stylesheet_dirs = ['.',
+ os.path.abspath(os.path.dirname(__file__)),
+ # for math.css
+ os.path.abspath(os.path.join(
+ os.path.dirname(os.path.dirname(__file__)), 'html_base'))
+ ]
default_template = 'template.txt'
default_template_path = os.path.join(
Modified: trunk/docutils/setup.py
===================================================================
--- trunk/docutils/setup.py 2015-03-10 14:26:05 UTC (rev 7816)
+++ trunk/docutils/setup.py 2015-03-10 15:11:37 UTC (rev 7817)
@@ -135,6 +135,7 @@
'docutils.utils.math',
'docutils.writers',
'docutils.writers.html4css1',
+ 'docutils.writers.html_base',
'docutils.writers.xhtml11',
'docutils.writers.pep_html',
'docutils.writers.s5_html',
@@ -145,9 +146,12 @@
],
'data_files': ([('docutils/parsers/rst/include',
glob.glob('docutils/parsers/rst/include/*.txt')),
+ ('docutils/writers/html_base',
+ ['docutils/writers/html_base/html-base.css',
+ 'docutils/writers/html_base/math.css',
+ 'docutils/writers/html_base/template.txt']),
('docutils/writers/html4css1',
['docutils/writers/html4css1/html4css1.css',
- 'docutils/writers/html4css1/math.css',
'docutils/writers/html4css1/template.txt']),
('docutils/writers/latex2e',
['docutils/writers/latex2e/default.tex',
@@ -165,6 +169,7 @@
]
+ s5_theme_files),
'scripts' : ['tools/rst2html.py',
+ 'tools/rst2html5.py',
'tools/rst2s5.py',
'tools/rst2latex.py',
'tools/rst2xetex.py',
Modified: trunk/docutils/test/test_writers/test_html4css1_misc.py
===================================================================
--- trunk/docutils/test/test_writers/test_html4css1_misc.py 2015-03-10 14:26:05 UTC (rev 7816)
+++ trunk/docutils/test/test_writers/test_html4css1_misc.py 2015-03-10 15:11:37 UTC (rev 7817)
@@ -100,7 +100,7 @@
styles = core.publish_parts(self.data, writer_name='html4css1',
settings_overrides=mysettings)['stylesheet']
self.assertIn('docutils/writers/html4css1/html4css1.css', styles)
- self.assertIn('docutils/writers/html4css1/math.css', styles)
+ self.assertIn('docutils/writers/html_base/math.css', styles)
def test_custom_stylesheet_linked(self):
# default + custom style sheet, linked
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2015-03-10 17:56:49
|
Revision: 7818
http://sourceforge.net/p/docutils/code/7818
Author: milde
Date: 2015-03-10 17:56:46 +0000 (Tue, 10 Mar 2015)
Log Message:
-----------
Base xhtml11 writer on html-base. Adapt and fix tests.
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/data/html-base.css
trunk/docutils/test/functional/input/standalone_rst_xhtml11.txt
trunk/docutils/test/functional/tests/math_output_mathml.py
trunk/docutils/test/functional/tests/standalone_rst_xhtml11.py
trunk/docutils/tools/rst2html5.py
trunk/docutils/tools/rst2xhtml11.py
Added Paths:
-----------
trunk/docutils/docutils/writers/html_base/html-base.css
trunk/docutils/test/functional/input/data/html4css1.css
Removed Paths:
-------------
trunk/docutils/docutils/writers/xhtml11/html-base.css
trunk/docutils/test/functional/input/data/html4css1.css
Modified: trunk/docutils/docutils/writers/html_base/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/html_base/__init__.py 2015-03-10 15:11:37 UTC (rev 7817)
+++ trunk/docutils/docutils/writers/html_base/__init__.py 2015-03-10 17:56:46 UTC (rev 7818)
@@ -136,10 +136,14 @@
'or "LaTeX") and options(s). Default: "HTML math.css"',
['--math-output'],
{'default': 'HTML math.css'}),
- ('Omit the XML declaration. Must be true for HTML5 conformance.',
+ ('Prepend an XML declaration. (Thwarts HTML5 conformance.) '
+ 'Default: False',
+ ['--xml-declaration'],
+ {'default': False, 'action': 'store_true',
+ 'validator': frontend.validate_boolean}),
+ ('Omit the XML declaration.',
['--no-xml-declaration'],
- {'dest': 'xml_declaration', 'default': False,
- 'action': 'store_false', 'validator': frontend.validate_boolean}),
+ {'dest': 'xml_declaration', 'action': 'store_false'}),
('Obfuscate email addresses to confuse harvesters while still '
'keeping email links usable with standards-compliant browsers.',
['--cloak-email-addresses'],
@@ -208,8 +212,8 @@
' xml:lang="%(lang)s" lang="%(lang)s">\n<head>\n')
content_type = ('<meta http-equiv="Content-Type"'
' content="text/html; charset=%s" />\n')
- content_type_mathml = ('<meta http-equiv="Content-Type"'
- ' content="text/html; charset=%s" />\n')
+ content_type_xml = ('<meta http-equiv="Content-Type"'
+ ' content="application/xhtml+xml; charset=%s" />\n')
generator = ('<meta name="generator" content="Docutils %s: '
'http://docutils.sourceforge.net/" />\n')
@@ -240,6 +244,7 @@
if settings.xml_declaration:
self.head_prefix.append(self.xml_declaration
% settings.output_encoding)
+ self.content_type = self.content_type_xml
# encoding not interpolated:
self.html_prolog.append(self.xml_declaration)
self.head = self.meta[:]
@@ -831,18 +836,11 @@
atts['start'] = node['start']
if 'enumtype' in node:
atts['class'] = node['enumtype']
- # @@@ To do: prefix, suffix. How? Change prefix/suffix to a
- # single "format" attribute? Use CSS2?
- old_compact_simple = self.compact_simple
- self.context.append((self.compact_simple, self.compact_p))
- self.compact_p = None
- self.compact_simple = self.is_compactable(node)
- if self.compact_simple and not old_compact_simple:
+ if self.is_compactable(node):
atts['class'] = (atts.get('class', '') + ' simple').strip()
self.body.append(self.starttag(node, 'ol', **atts))
def depart_enumerated_list(self, node):
- self.compact_simple, self.compact_p = self.context.pop()
self.body.append('</ol>\n')
# field-list
@@ -1192,7 +1190,7 @@
math_code = math2html.math2html(math_code)
elif self.math_output == 'mathml':
self.doctype = self.doctype_mathml
- self.content_type = self.content_type_mathml
+ # self.content_type = self.content_type_mathml
try:
mathml_tree = parse_latex_math(math_code, inline=not(math_env))
math_code = ''.join(mathml_tree.xml())
Copied: trunk/docutils/docutils/writers/html_base/html-base.css (from rev 7814, trunk/docutils/docutils/writers/xhtml11/html-base.css)
===================================================================
--- trunk/docutils/docutils/writers/html_base/html-base.css (rev 0)
+++ trunk/docutils/docutils/writers/html_base/html-base.css 2015-03-10 17:56:46 UTC (rev 7818)
@@ -0,0 +1,508 @@
+/* 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;
+}
+
+/* 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 */
+dd > ul, dd > ol { padding-left: 0pt; }
+
+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 & 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 */
Modified: trunk/docutils/docutils/writers/xhtml11/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/xhtml11/__init__.py 2015-03-10 15:11:37 UTC (rev 7817)
+++ trunk/docutils/docutils/writers/xhtml11/__init__.py 2015-03-10 17:56:46 UTC (rev 7818)
@@ -31,9 +31,9 @@
import docutils
from docutils import frontend, nodes, utils, writers, languages
-from docutils.writers import html4css1
+from docutils.writers import html_base
-class Writer(html4css1.Writer):
+class Writer(html_base.Writer):
supported = ('html', 'xhtml', 'xhtml1',
'html4strict', 'xhtml1strict',
@@ -43,17 +43,15 @@
default_stylesheets = ['html-base.css', 'xhtml11.css']
default_stylesheet_dirs = ['.',
os.path.abspath(os.path.dirname(__file__)),
- # for math.css:
os.path.abspath(os.path.join(
- os.path.dirname(os.path.dirname(__file__)), 'html4css1'))
+ os.path.dirname(os.path.dirname(__file__)), 'html_base'))
]
config_section = 'xhtml11 writer'
- config_section_dependencies = ('writers', 'html4css1 writer')
+ config_section_dependencies = ('writers', 'html writer')
settings_spec = frontend.filter_settings_spec(
- html4css1.Writer.settings_spec,
- 'field_name_limit', 'option_limit', # removed options
+ html_base.Writer.settings_spec,
stylesheet_path = (
'Comma separated list of stylesheet paths. '
'Relative paths are expanded if a matching file is found in '
@@ -75,14 +73,19 @@
math_output = ('Math output format, one of "MathML", "HTML", '
'"MathJax" or "LaTeX". Default: "MathML"',
['--math-output'],
- {'default': 'MathML'}))
+ {'default': 'MathML'}),
+ xml_declaration = ('Prepend an XML declaration. '
+ 'Default: True',
+ ['--xml-declaration'],
+ {'default': True, 'action': 'store_true',
+ 'validator': frontend.validate_boolean}))
def __init__(self):
writers.Writer.__init__(self)
self.translator_class = HTMLTranslator
-class HTMLTranslator(html4css1.HTMLTranslator):
+class HTMLTranslator(html_base.HTMLTranslator):
"""
This writer generates XHTML 1.1
without formatting that interferes with a CSS stylesheet.
@@ -94,170 +97,15 @@
'"http://www.w3.org/Math/DTD/mathml2/xhtml-math11-f.dtd">\n')
# 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')
- lang_attribute = 'xml:lang' # changed from 'lang' in XHTML 1.0
- def __init__(self, document):
- html4css1.HTMLTranslator.__init__(self, document)
- self.in_footnote_list = False
- # Do not mark the first child with 'class="first"' and the last
- # child with 'class="last"' in definitions, table cells, field
- # bodies, option descriptions, and list items. Use the
- # ``:first-child`` and ``:last-child`` selectors instad.
-
- def set_first_last(self, node):
- pass
-
- # Compact lists
- # ------------
- # Include definition lists and field lists (in addition to ordered
- # and unordered lists) in the test if a list is "simple" (cf. the
- # html4css1.HTMLTranslator docstring and the SimpleListChecker class at
- # the end of this file).
-
- def is_compactable(self, node):
- # print "is_compactable %s ?" % node.__class__,
- # explicite class arguments have precedence
- if 'compact' in node['classes']:
- # print "explicitely compact"
- return True
- if 'open' in node['classes']:
- # print "explicitely open"
- return False
- # check config setting:
- if (isinstance(node, nodes.field_list) or
- isinstance(node, nodes.definition_list)
- ) and not self.settings.compact_field_lists:
- # print "`compact-field-lists` is False"
- return False
- if (isinstance(node, nodes.enumerated_list) or
- isinstance(node, nodes.bullet_list)
- ) and not self.settings.compact_lists:
- # print "`compact-lists` is False"
- return False
- # more special cases:
- if (self.topic_classes == ['contents']): # TODO: self.in_contents
- return True
- # check the list items:
- visitor = SimpleListChecker(self.document)
- try:
- node.walk(visitor)
- except nodes.NodeFound:
- # print "complex node"
- return False
- else:
- # print "simple list"
- return True
-
- # address, literal block, and doctest block: no newline after <pre> tag
- # (leads to blank line in XHTML1.1)
- def visit_address(self, node):
- self.visit_docinfo_item(node, 'address', meta=False)
- self.body.append(self.starttag(node, 'pre',suffix='',
- CLASS='address'))
-
- # author, authors
- # ---------------
- # Use paragraphs instead of hard-coded linebreaks.
-
- def visit_author(self, node):
- if not(isinstance(node.parent, nodes.authors)):
- self.visit_docinfo_item(node, 'author')
- self.body.append('<p>')
-
- def depart_author(self, node):
- self.body.append('</p>')
- if isinstance(node.parent, nodes.authors):
- self.body.append('\n')
- else:
- self.depart_docinfo_item()
-
- def visit_authors(self, node):
- self.visit_docinfo_item(node, 'authors')
-
- def depart_authors(self, node):
- self.depart_docinfo_item()
-
- # citations
- # ---------
- # Use definition list instead of table for bibliographic references.
- # Join adjacent citation entries.
-
- def visit_citation(self, node):
- if not self.in_footnote_list:
- self.body.append('<dl class="citation">\n')
- self.in_footnote_list = True
-
- def depart_citation(self, node):
- self.body.append('</dd>\n')
- if not isinstance(node.next_node(descend=False, siblings=True),
- nodes.citation):
- self.body.append('</dl>\n')
- self.in_footnote_list = False
-
- # classifier
- # ----------
- # don't insert classifier-delimiter here (done by CSS)
-
- def visit_classifier(self, node):
- self.body.append(self.starttag(node, 'span', '', CLASS='classifier'))
-
- def depart_classifier(self, node):
- self.body.append('</span>')
-
- # definition list
- # ---------------
- # check for simple/complex list and set class attribute
-
- def visit_definition_list(self, node):
- classes = node.setdefault('classes', [])
- if self.is_compactable(node):
- classes.append('simple')
- self.body.append(self.starttag(node, 'dl'))
-
- def depart_definition_list(self, node):
- self.body.append('</dl>\n')
-
- # docinfo
- # -------
- # use definition list instead of table
-
- def visit_docinfo(self, node):
- classes = 'docinfo'
- if (self.is_compactable(node)):
- classes += ' simple'
- self.body.append(self.starttag(node, 'dl', CLASS=classes))
-
- def depart_docinfo(self, node):
- self.body.append('</dl>\n')
-
- def visit_docinfo_item(self, node, name, meta=True):
- if meta:
- meta_tag = '<meta name="%s" content="%s" />\n' \
- % (name, self.attval(node.astext()))
- self.add_meta(meta_tag)
- self.body.append('<dt class="%s">%s</dt>\n'
- % (name, self.language.labels[name]))
- self.body.append(self.starttag(node, 'dd', '', CLASS=name))
-
- def depart_docinfo_item(self):
- self.body.append('</dd>\n')
-
- # doctest-block
- # -------------
- # no line-break
- # TODO: RSt-parser should treat this as code-block with class "pycon".
-
- def visit_doctest_block(self, node):
- self.body.append(self.starttag(node, 'pre', suffix='',
- CLASS='code pycon doctest-block'))
-
# enumerated lists
# ----------------
# The 'start' attribute does not conform to HTML4/XHTML1 Strict
- # (it will resurface in HTML5)
+ # (resurfaced in HTML5)
def visit_enumerated_list(self, node):
atts = {}
@@ -270,308 +118,13 @@
classes.append('simple')
self.body.append(self.starttag(node, 'ol', **atts))
- def depart_enumerated_list(self, node):
- self.body.append('</ol>\n')
- # field-list
- # ----------
- # set as definition list, styled with CSS
+ # Meta tags: 'lang' attribute replaced by 'xml:lang' in XHTML 1.1
+ # HTML5/polyglott recommends using both
- def visit_field_list(self, node):
- # Keep simple paragraphs in the field_body to enable CSS
- # rule to start body on new line if the label is too long
- classes = 'field-list'
- if (self.is_compactable(node)):
- classes += ' simple'
- self.body.append(self.starttag(node, 'dl', CLASS=classes))
-
- def depart_field_list(self, node):
- self.body.append('</dl>\n')
-
- def visit_field(self, node):
- pass
-
- def depart_field(self, node):
- pass
-
- def visit_field_name(self, node):
- self.body.append(self.starttag(node, 'dt', ''))
-
- def depart_field_name(self, node):
- self.body.append('</dt>\n')
-
- def visit_field_body(self, node):
- self.body.append(self.starttag(node, 'dd', ''))
-
- def depart_field_body(self, node):
- self.body.append('</dd>\n')
-
- # footnotes
- # ---------
- # use definition list instead of table for footnote text
-
- def visit_footnote(self, node):
- if not self.in_footnote_list:
- self.body.append('<dl class="footnote">\n')
- self.in_footnote_list = True
-
- def depart_footnote(self, node):
- self.body.append('</dd>\n')
- if not isinstance(node.next_node(descend=False, siblings=True),
- nodes.footnote):
- self.body.append('</dl>\n')
- self.in_footnote_list = False
-
- # 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
-
- def visit_label(self, node):
- # pass parent node to get id into starttag:
- self.body.append(self.starttag(node.parent, 'dt', '', CLASS='label'))
- # 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, ']', ''))
- if self.settings.footnote_backlinks:
- backrefs = node.parent['backrefs']
- if len(backrefs) == 1:
- self.body.append('</a>')
- elif len(backrefs) > 1:
- # Python 2.4 fails with enumerate(backrefs, 1)
- backlinks = ['<a href="#%s">%s</a>' % (ref, i+1)
- for (i, ref) in enumerate(backrefs)]
- self.body.append('<span class="fn-backref">(%s)</span>'
- % ','.join(backlinks))
- self.body.append('</dt>\n<dd>')
-
- def visit_generated(self, node):
- if 'sectnum' in node['classes']:
- # get section number (strip trailing no-break-spaces)
- sectnum = node.astext().rstrip(u' ')
- # print sectnum.encode('utf-8')
- self.body.append('<span class="sectnum">%s</span> '
- % self.encode(sectnum))
- # Content already processed:
- raise nodes.SkipNode
-
- # def depart_generated(self, node):
- # pass
-
- # Image types to place in an <object> element
- # SVG as <img> supported since IE version 9
- # (but rendering problems remain (see standalonge_rst2xhtml11.xhtml test output)
- # object_image_types = {'.swf': 'application/x-shockwave-flash'}
-
- # Do not mark the first child with 'class="first"'
- def visit_list_item(self, node):
- self.body.append(self.starttag(node, 'li', ''))
-
- # inline literal
- def visit_literal(self, node):
- # special case: "code" role
- classes = node.get('classes', [])
- if 'code' in classes:
- # filter 'code' from class arguments
- node['classes'] = [cls for cls in classes if cls != 'code']
- self.body.append(self.starttag(node, 'code', ''))
- return
- self.body.append(
- self.starttag(node, 'tt', '', CLASS='literal'))
- text = node.astext()
- # remove hard line breaks (except if in a parsed-literal block)
- if not isinstance(node.parent, nodes.literal_block):
- text...
[truncated message content] |
|
From: <mi...@us...> - 2015-03-11 15:56:32
|
Revision: 7820
http://sourceforge.net/p/docutils/code/7820
Author: milde
Date: 2015-03-11 15:55:43 +0000 (Wed, 11 Mar 2015)
Log Message:
-----------
Announce the new HTML writers. Small fixes to get valid HTML.
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/RELEASE-NOTES.txt
trunk/docutils/docutils/writers/html_base/__init__.py
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
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2015-03-11 15:47:51 UTC (rev 7819)
+++ trunk/docutils/HISTORY.txt 2015-03-11 15:55:43 UTC (rev 7820)
@@ -33,7 +33,16 @@
- Add ``\colon`` macro, fix spacing around colons. Fixes [ 246 ].
- New upstream version (additional macros, piecewise integrals and sums).
-
+
+* docutils/writers/html_base/
+
+ - New HTML writer generating basic HTML (`polyglot markup`_ conforming to
+ both, `HTML 5`_ and `XHTML 1.0`_ (transitional)).
+
+ New stylesheet ``html-base.css`` for default layout using CSS 2.1 rules.
+
+ Also base for the `xhtml11` writer.
+
* docutils/writers/html4css1/__init__.py
- Add "docutils" to class values for "container" object to address [ 267 ].
@@ -43,11 +52,9 @@
* docutils/writers/xhtml11/
- - New HTML writer generating `XHTML1.1`_ styled with CSS2.1
+ - New HTML writer generating `XHTML 1.1`_ styled with CSS2.1
Moved to the docutils core from sandbox/html4strict.
- .. _XHTML1.1: http://www.w3.org/TR/xhtml11/
-
* docutils/writers/latex2e/__init__.py
- use absolute path for ``default_template_path``.
@@ -61,6 +68,17 @@
- Fix [ 262 ] Use ``\linewidth`` instead of ``\textwidth`` for figures,
admonitions and docinfo.
+* tools/
+
+ - New front-ends ``rst2xhtml.py`` and ``rst2html5.py`` for the
+ corresponding writers.
+
+.. _polyglot markup: http://www.w3.org/TR/html-polyglot/
+.. _HTML 5: http://www.w3.org/TR/html5/
+.. _XHTML 1.0: http://www.w3.org/TR/xhtml1/
+.. _XHTML 1.1: http://www.w3.org/TR/xhtml11/
+
+
Release 0.12 (2014-07-06)
=========================
Modified: trunk/docutils/RELEASE-NOTES.txt
===================================================================
--- trunk/docutils/RELEASE-NOTES.txt 2015-03-11 15:47:51 UTC (rev 7819)
+++ trunk/docutils/RELEASE-NOTES.txt 2015-03-11 15:55:43 UTC (rev 7820)
@@ -38,7 +38,7 @@
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 0.12 release.
+ - 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
@@ -46,7 +46,21 @@
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/
+
+ - New front-ends ``rst2xhtml.py`` and ``rst2html5.py`` for the
+ corresponding writers.
+
+.. _HTML 5: http://www.w3.org/TR/html5/
+.. _XHTML 1.1: http://www.w3.org/TR/xhtml11/
+
+
Release 0.12 (2014-07-06)
=========================
Modified: trunk/docutils/docutils/writers/html_base/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/html_base/__init__.py 2015-03-11 15:47:51 UTC (rev 7819)
+++ trunk/docutils/docutils/writers/html_base/__init__.py 2015-03-11 15:55:43 UTC (rev 7820)
@@ -19,7 +19,7 @@
"""
Basic HyperText Markup Language document tree Writer.
-The output conforms to the `HTML 5` specification as well as
+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.
@@ -298,7 +298,8 @@
def encode(self, text):
"""Encode special characters in `text` & return."""
- # @@@ A codec to do these and all other HTML entities would be nice.
+ # Use only named entities known in both XML and HTML
+ # other characters are automatically encoded "by number" if required.
text = unicode(text)
return text.translate({
ord('&'): u'&',
@@ -432,10 +433,6 @@
return
child['classes'].append(class_)
- def set_first_last(self, node):
- pass
- # TODO: remove calls to this function
-
def visit_Text(self, node):
text = node.astext()
encoded = self.encode(text)
@@ -471,12 +468,11 @@
def visit_admonition(self, node):
node['classes'].insert(0, 'admonition')
self.body.append(self.starttag(node, 'div'))
- self.set_first_last(node)
def depart_admonition(self, node=None):
self.body.append('</div>\n')
- attribution_formats = {'dash': ('—', ''),
+ attribution_formats = {'dash': (u'\u2014', ''),
'parentheses': ('(', ')'),
'parens': ('(', ')'),
'none': ('', '')}
@@ -486,9 +482,10 @@
self.context.append(suffix)
self.body.append(
self.starttag(node, 'p', prefix, CLASS='attribution'))
+ self.body.append(self.starttag(node, 'cite', ''))
def depart_attribution(self, node):
- self.body.append(self.context.pop() + '</p>\n')
+ self.body.append('</cite>' + self.context.pop() + '</p>\n')
# author, authors
# ---------------
@@ -699,7 +696,6 @@
def visit_definition(self, node):
self.body.append('</dt>\n')
self.body.append(self.starttag(node, 'dd', ''))
- self.set_first_last(node)
def depart_definition(self, node):
self.body.append('</dd>\n')
@@ -744,7 +740,7 @@
def depart_docinfo(self, node):
self.body.append('</dl>\n')
-
+
def visit_docinfo_item(self, node, name, meta=True):
if meta:
meta_tag = '<meta name="%s" content="%s" />\n' \
@@ -818,9 +814,9 @@
node.parent.column += node['morecols']
self.body.append(self.starttag(node, tagname, '', **atts))
self.context.append('</%s>\n' % tagname.lower())
- if len(node) == 0: # empty cell
- self.body.append(' ')
- self.set_first_last(node)
+ # TODO: why did the html4css1 writer insert an NBSP into empty cells?
+ # if len(node) == 0: # empty cell
+ # self.body.append(' ') # no-break space
def depart_entry(self, node):
self.body.append(self.context.pop())
@@ -905,6 +901,7 @@
# ---------
# use definition list instead of table for footnote text
+ # 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')
@@ -1134,9 +1131,13 @@
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 depart_literal_block(self, node):
- self.body.append('\n</pre>\n')
+ if 'code' in node.get('classes', []):
+ self.body.append('</code>')
+ self.body.append('</pre>\n')
def visit_math(self, node, math_env=''):
# If the method is called from visit_math_block(), math_env != ''.
@@ -1401,7 +1402,6 @@
def visit_sidebar(self, node):
self.body.append(
self.starttag(node, 'div', CLASS='sidebar'))
- self.set_first_last(node)
self.in_sidebar = True
def depart_sidebar(self, node):
@@ -1612,6 +1612,7 @@
def depart_title_reference(self, node):
self.body.append('</cite>')
+ # TODO: use the new HTML5 element <aside>? (Also for footnote text)
def visit_topic(self, node):
self.body.append(self.starttag(node, 'div', CLASS='topic'))
self.topic_classes = node['classes']
@@ -1647,10 +1648,10 @@
Here "simple" means a list item containing nothing other than a single
paragraph, a simple list, or a paragraph followed by a simple list.
-
+
This version also checks for simple field lists and docinfo.
"""
-
+
def default_visit(self, node):
raise nodes.NodeFound
Modified: trunk/docutils/test/functional/expected/standalone_rst_html_base.html
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_html_base.html 2015-03-11 15:47:51 UTC (rev 7819)
+++ trunk/docutils/test/functional/expected/standalone_rst_html_base.html 2015-03-11 15:55:43 UTC (rev 7820)
@@ -352,13 +352,11 @@
<pre class="literal-block">if literal_block:
text = 'is left as-is'
spaces_and_linebreaks = 'are preserved'
- markup_processing = None
-</pre>
+ markup_processing = None</pre>
<p>Or they can be quoted without indentation:</p>
<pre class="literal-block">>> Great idea!
>
-> Why didn't I think of that?
-</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>
@@ -443,7 +441,7 @@
end, much much thicker in the middle and then thin again at the
far end. That is my theory, it is mine, and belongs to me and I
own it, and what it is too.</p>
-<p class="attribution">—Anne Elk (Miss)</p>
+<p class="attribution">—<cite>Anne Elk (Miss)</cite></p>
</blockquote>
<p>The language of a quote (like any other object) can be specified by
a class attribute:</p>
@@ -756,8 +754,7 @@
<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">Compound 2, literal.</pre>
<p class="compound-last">Compound 2, this is a test.</p>
</div>
<div class="compound">
@@ -765,8 +762,7 @@
</div>
<div class="compound">
<pre class="compound-first literal-block">Compound 4.
-This one starts with a literal block.
-</pre>
+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
@@ -815,8 +811,7 @@
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>, 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>
+text</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">
<h3><a class="toc-backref" href="#id95"><span class="sectnum">2.14.9</span> Code</a></h3>
@@ -826,14 +821,12 @@
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
Pygments highlighter.)</p>
-<pre class="code python literal-block">print 'This is Python code.'
-</pre>
+<pre class="code python literal-block"><code>print 'This is Python code.'</code></pre>
<p>The <span class="docutils literal"><span class="pre">:number-lines:</span></span> 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:
+<pre class="code python literal-block"><code><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
-</pre>
+<span class="ln">10 </span> print i</code></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)
or as base for special code roles, e.g. the LaTeX code in the next
@@ -842,9 +835,8 @@
<code class="tex">\alpha = f(x)</code> prints <span class="formula"><i>α</i> = <i>f</i>(<i>x</i>)</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"><span class="ln">1 </span>.. header:: Document header
-<span class="ln">2 </span>.. footer:: Document footer
-</pre>
+<pre class="code rst literal-block"><code><span class="ln">1 </span>.. header:: Document header
+<span class="ln">2 </span>.. footer:: Document footer</code></pre>
</div>
</div>
<div class="section" id="substitution-definitions">
@@ -992,7 +984,7 @@
<tr><td><p>body row 5</p></td>
<td colspan="2"><p>Cells may also be
empty: <span class="docutils literal"><span class="pre">--></span></span></p></td>
-<td> </td>
+<td></td>
</tr>
</tbody>
</table>
@@ -1053,8 +1045,7 @@
<style type="text/css"><!--
.green {color: green;}
.sc {font-variant: small-caps;}
- --></style>
-</pre>
+ --></style></pre>
<p><span class="green sc" lang="en-gb">British colourful text in small-caps</span>.</p>
</li>
</ul>
@@ -1180,8 +1171,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">dl.field-list > dd { margin-left: 6em; }</pre>
</dd>
</dl>
<div class="section" id="styling-with-class-arguments">
@@ -1436,7 +1426,7 @@
<div class="footer">
<hr class="footer" />
<p>Document footer</p>
-<p><a class="reference external" href="http://validator.w3.org/check?uri=referer"><img alt="Conforms to HTML 5!" src="https://validator-suite.w3.org/icons/vs-blue-256.png" style="width: 88px; height: 31px;" /></a> <a class="reference external" href="http://jigsaw.w3.org/css-validator/check/referer"><img alt="Valid CSS 2.1!" src="http://jigsaw.w3.org/css-validator/images/vcss" style="width: 88px; height: 31px;" /></a></p>
+<p><a class="reference external" href="http://www.w3.org/TR/html5/"><img alt="Conforms to HTML 5" src="http://www.w3.org/html/logo/badge/html5-badge-h-css3-semantics.png" style="width: 88px; height: 31px;" /></a> <a class="reference external" href="http://validator.w3.org/check?uri=referer"><img alt="Check validity!" src="https://validator-suite.w3.org/icons/vs-blue-256.png" style="width: 88px; height: 31px;" /></a> <a class="reference external" href="http://jigsaw.w3.org/css-validator/check/referer"><img alt="Valid CSS 2.1!" src="http://jigsaw.w3.org/css-validator/images/vcss" style="width: 88px; height: 31px;" /></a></p>
</div>
</body>
Modified: trunk/docutils/test/functional/expected/standalone_rst_xhtml11.xhtml
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_xhtml11.xhtml 2015-03-11 15:47:51 UTC (rev 7819)
+++ trunk/docutils/test/functional/expected/standalone_rst_xhtml11.xhtml 2015-03-11 15:55:43 UTC (rev 7820)
@@ -354,13 +354,11 @@
<pre class="literal-block">if literal_block:
text = 'is left as-is'
spaces_and_linebreaks = 'are preserved'
- markup_processing = None
-</pre>
+ markup_processing = None</pre>
<p>Or they can be quoted without indentation:</p>
<pre class="literal-block">>> Great idea!
>
-> Why didn't I think of that?
-</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>
@@ -445,7 +443,7 @@
end, much much thicker in the middle and then thin again at the
far end. That is my theory, it is mine, and belongs to me and I
own it, and what it is too.</p>
-<p class="attribution">—Anne Elk (Miss)</p>
+<p class="attribution">—<cite>Anne Elk (Miss)</cite></p>
</blockquote>
<p>The language of a quote (like any other object) can be specified by
a class attribute:</p>
@@ -758,8 +756,7 @@
<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">Compound 2, literal.</pre>
<p class="compound-last">Compound 2, this is a test.</p>
</div>
<div class="compound">
@@ -767,8 +764,7 @@
</div>
<div class="compound">
<pre class="compound-first literal-block">Compound 4.
-This one starts with a literal block.
-</pre>
+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
@@ -817,8 +813,7 @@
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>, 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>
+text</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">
<h3><a class="toc-backref" href="#id96"><span class="sectnum">2.14.9</span> Code</a></h3>
@@ -828,14 +823,12 @@
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
Pygments highlighter.)</p>
-<pre class="code python literal-block">print 'This is Python code.'
-</pre>
+<pre class="code python literal-block"><code>print 'This is Python code.'</code></pre>
<p>The <span class="docutils literal"><span class="pre">:number-lines:</span></span> 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:
+<pre class="code python literal-block"><code><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
-</pre>
+<span class="ln">10 </span> print i</code></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)
or as base for special code roles, e.g. the LaTeX code in the next
@@ -845,9 +838,8 @@
<mrow><mi>α</mi><mo>=</mo><mi>f</mi><mo>(</mo><mi>x</mi><mo>)</mo></mrow></math>.</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"><span class="ln">1 </span>.. header:: Document header
-<span class="ln">2 </span>.. footer:: Document footer
-</pre>
+<pre class="code rst literal-block"><code><span class="ln">1 </span>.. header:: Document header
+<span class="ln">2 </span>.. footer:: Document footer</code></pre>
</div>
</div>
<div class="section" id="substitution-definitions">
@@ -995,7 +987,7 @@
<tr><td><p>body row 5</p></td>
<td colspan="2"><p>Cells may also be
empty: <span class="docutils literal"><span class="pre">--></span></span></p></td>
-<td> </td>
+<td></td>
</tr>
</tbody>
</table>
@@ -1056,8 +1048,7 @@
<style type="text/css"><!--
.green {color: green;}
.sc {font-variant: small-caps;}
- --></style>
-</pre>
+ --></style></pre>
<p><span class="green sc" xml:lang="en-gb">British colourful text in small-caps</span>.</p>
</li>
</ul>
@@ -1202,8 +1193,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">dl.field-list > dd { margin-left: 6em; }</pre>
</dd>
</dl>
<div class="section" id="styling-with-class-arguments">
Modified: trunk/docutils/test/functional/input/standalone_rst_html_base.txt
===================================================================
--- trunk/docutils/test/functional/input/standalone_rst_html_base.txt 2015-03-11 15:47:51 UTC (rev 7819)
+++ trunk/docutils/test/functional/input/standalone_rst_html_base.txt 2015-03-11 15:55:43 UTC (rev 7820)
@@ -202,7 +202,7 @@
Maths
-----
-For maximal compatibility, the ``html-output`` setting defaults to »HTML«.
+For maximal compatibility, the ``html-output`` setting defaults to »HTML«.
(HTML 5 accepts also MathML and SVG as nested languages.)
The linear mapping :math:`f: \mathbb{C}^{N}\longmapsto\mathbb{C}^{N}`
@@ -219,12 +219,18 @@
.. include:: data/errors.txt
-.. footer:: |validator| |valid-CSS2|
+.. footer:: |HTML 5| |validator| |valid-CSS2|
+.. |HTML 5| image:: http://www.w3.org/html/logo/badge/html5-badge-h-css3-semantics.png
+ :height: 31
+ :width: 88
+ :alt: Conforms to HTML 5
+ :target: http://www.w3.org/TR/html5/
+
.. |validator| image:: https://validator-suite.w3.org/icons/vs-blue-256.png
:height: 31
:width: 88
- :alt: Conforms to HTML 5!
+ :alt: Check validity!
:target: http://validator.w3.org/check?uri=referer
.. |valid-CSS2| image:: http://jigsaw.w3.org/css-validator/images/vcss
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2015-03-13 11:42:45
|
Revision: 7827
http://sourceforge.net/p/docutils/code/7827
Author: milde
Date: 2015-03-13 11:42:35 +0000 (Fri, 13 Mar 2015)
Log Message:
-----------
Let "html-base" and "xhtml11" writers wrap SVG images in <img> tags.
Edit of the SVG image functional test section.
Modified Paths:
--------------
trunk/docutils/docs/user/rst/images/title-scaling.svg
trunk/docutils/docs/user/rst/images/title.svg
trunk/docutils/docs/user/tools.txt
trunk/docutils/docutils/writers/html_base/__init__.py
trunk/docutils/docutils/writers/html_base/html-base.css
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
Added Paths:
-----------
trunk/docutils/docs/user/rst/images/biohazard-bitmap-scaling.svg
Added: trunk/docutils/docs/user/rst/images/biohazard-bitmap-scaling.svg
===================================================================
--- trunk/docutils/docs/user/rst/images/biohazard-bitmap-scaling.svg (rev 0)
+++ trunk/docutils/docs/user/rst/images/biohazard-bitmap-scaling.svg 2015-03-13 11:42:35 UTC (rev 7827)
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ version="1.1"
+ viewBox="0 0 16 16"
+ width="100%"
+ height="100%"
+ id="svg2">
+ <metadata
+ id="metadata8">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs6" />
+ <image
+ xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAIRJREFU
+OI2lUkEOwCAIa83+/+XusGCQIWOxF1GhUICSEEFSkvj1BgCjEwwAkkjylW0hyByyBP5+dR2zqrYE
+ux5kvq8e/AVtCh39HlbhqIIlcafdx+jxFezs2BY3fDkxO0lVezElnGA2MWrzmxftkiASxZIjjiWk
+BNlYd6NeJCyzLVbZ/92om331AFqcoAAAAABJRU5ErkJggg==
+"
+ x="4.9541664"
+ y="-5.2426963"
+ width="11.322034"
+ height="9.3559322"
+ transform="matrix(0.77695327,0.62955828,-0.62955828,0.77695327,0,0)"
+ id="image10" />
+ <text
+ x="0.40677962"
+ y="15.186441"
+ id="text2987"
+ xml:space="preserve"
+ style="font-size:4px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:DejaVu Sans;-inkscape-font-specification:DejaVu Sans"><tspan
+ x="0.40677962"
+ y="15.186441"
+ id="tspan2989">turned</tspan></text>
+</svg>
Modified: trunk/docutils/docs/user/rst/images/title-scaling.svg
===================================================================
--- trunk/docutils/docs/user/rst/images/title-scaling.svg 2015-03-12 22:43:12 UTC (rev 7826)
+++ trunk/docutils/docs/user/rst/images/title-scaling.svg 2015-03-13 11:42:35 UTC (rev 7827)
@@ -9,13 +9,33 @@
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- id="svg2"
version="1.1"
- inkscape:version="0.47 r22583"
viewBox="0 0 280.82999 27.34"
width="100%"
height="100%"
+ id="svg2"
+ inkscape:version="0.48.5 r10040"
sodipodi:docname="title.svg">
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1000"
+ inkscape:window-height="680"
+ id="namedview10"
+ showgrid="false"
+ inkscape:zoom="1.573906"
+ inkscape:cx="58.770981"
+ inkscape:cy="13.67"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="svg2" />
<metadata
id="metadata8">
<rdf:RDF>
@@ -29,46 +49,22 @@
</rdf:RDF>
</metadata>
<defs
- id="defs6">
- <inkscape:perspective
- sodipodi:type="inkscape:persp3d"
- inkscape:vp_x="0 : 0.5 : 1"
- inkscape:vp_y="0 : 1000 : 0"
- inkscape:vp_z="1 : 0.5 : 1"
- inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
- id="perspective10" />
- </defs>
- <sodipodi:namedview
- pagecolor="#ffffff"
- bordercolor="#666666"
- borderopacity="1"
- objecttolerance="10"
- gridtolerance="10"
- guidetolerance="10"
- inkscape:pageopacity="0"
- inkscape:pageshadow="2"
- inkscape:window-width="941"
- inkscape:window-height="791"
- id="namedview4"
- showgrid="false"
- inkscape:zoom="1.0620155"
- inkscape:cx="251.41436"
- inkscape:cy="14.837708"
- inkscape:window-x="142"
- inkscape:window-y="267"
- inkscape:window-maximized="0"
- inkscape:current-layer="svg2" />
+ id="defs6" />
<text
+ x="1.1959002"
+ y="24.185671"
+ transform="scale(0.95603363,1.0459883)"
+ id="text2818"
xml:space="preserve"
- style="font-size:36px;font-style:italic;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:TeXGyrePagella;-inkscape-font-specification:TeXGyrePagella Italic"
- x="-0.93599999"
- y="26.908001"
- id="text2818"
+ style="font-size:34.41720963px;font-style:italic;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:TeXGyrePagella;-inkscape-font-specification:TeXGyrePagella Italic"
sodipodi:linespacing="100%"><tspan
- sodipodi:role="line"
- id="tspan2820"
- x="-0.93599999"
- y="26.908001">re<tspan
- style="font-size:36px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:LMMono12;-inkscape-font-specification:LMMono12"
- id="tspan2822">Structured</tspan>Text</tspan></text>
+ x="1.1959002"
+ y="24.185671"
+ id="tspan2820"><tspan
+ id="tspan2985"
+ style="font-family:Times New Roman;-inkscape-font-specification:Times New Roman">re</tspan><tspan
+ id="tspan2822"
+ style="font-size:34.41720963px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Courier New;-inkscape-font-specification:Courier New">Structured</tspan><tspan
+ id="tspan2989"
+ style="font-family:Times New Roman;-inkscape-font-specification:Times New Roman">Text</tspan></tspan></text>
</svg>
Modified: trunk/docutils/docs/user/rst/images/title.svg
===================================================================
--- trunk/docutils/docs/user/rst/images/title.svg 2015-03-12 22:43:12 UTC (rev 7826)
+++ trunk/docutils/docs/user/rst/images/title.svg 2015-03-13 11:42:35 UTC (rev 7827)
@@ -9,12 +9,32 @@
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- id="svg2"
version="1.1"
- inkscape:version="0.47 r22583"
width="280.82999"
height="27.34"
+ id="svg2"
+ inkscape:version="0.48.5 r10040"
sodipodi:docname="title.svg">
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1000"
+ inkscape:window-height="680"
+ id="namedview10"
+ showgrid="false"
+ inkscape:zoom="1.573906"
+ inkscape:cx="58.770981"
+ inkscape:cy="13.67"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="svg2" />
<metadata
id="metadata8">
<rdf:RDF>
@@ -28,46 +48,22 @@
</rdf:RDF>
</metadata>
<defs
- id="defs6">
- <inkscape:perspective
- sodipodi:type="inkscape:persp3d"
- inkscape:vp_x="0 : 0.5 : 1"
- inkscape:vp_y="0 : 1000 : 0"
- inkscape:vp_z="1 : 0.5 : 1"
- inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
- id="perspective10" />
- </defs>
- <sodipodi:namedview
- pagecolor="#ffffff"
- bordercolor="#666666"
- borderopacity="1"
- objecttolerance="10"
- gridtolerance="10"
- guidetolerance="10"
- inkscape:pageopacity="0"
- inkscape:pageshadow="2"
- inkscape:window-width="941"
- inkscape:window-height="791"
- id="namedview4"
- showgrid="false"
- inkscape:zoom="1.0620155"
- inkscape:cx="251.41436"
- inkscape:cy="14.837708"
- inkscape:window-x="142"
- inkscape:window-y="267"
- inkscape:window-maximized="0"
- inkscape:current-layer="svg2" />
+ id="defs6" />
<text
+ x="1.1959002"
+ y="24.185671"
+ transform="scale(0.95603363,1.0459883)"
+ id="text2818"
xml:space="preserve"
- style="font-size:36px;font-style:italic;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:TeXGyrePagella;-inkscape-font-specification:TeXGyrePagella Italic"
- x="-0.93599999"
- y="26.908001"
- id="text2818"
+ style="font-size:34.41720963px;font-style:italic;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:TeXGyrePagella;-inkscape-font-specification:TeXGyrePagella Italic"
sodipodi:linespacing="100%"><tspan
- sodipodi:role="line"
- id="tspan2820"
- x="-0.93599999"
- y="26.908001">re<tspan
- style="font-size:36px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:LMMono12;-inkscape-font-specification:LMMono12"
- id="tspan2822">Structured</tspan>Text</tspan></text>
+ x="1.1959002"
+ y="24.185671"
+ id="tspan2820"><tspan
+ id="tspan2985"
+ style="font-family:Times New Roman;-inkscape-font-specification:Times New Roman">re</tspan><tspan
+ id="tspan2822"
+ style="font-size:34.41720963px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Courier New;-inkscape-font-specification:Courier New">Structured</tspan><tspan
+ id="tspan2989"
+ style="font-family:Times New Roman;-inkscape-font-specification:Times New Roman">Text</tspan></tspan></text>
</svg>
Modified: trunk/docutils/docs/user/tools.txt
===================================================================
--- trunk/docutils/docs/user/tools.txt 2015-03-12 22:43:12 UTC (rev 7826)
+++ trunk/docutils/docs/user/tools.txt 2015-03-13 11:42:35 UTC (rev 7827)
@@ -150,6 +150,17 @@
files and produces clean XHTML 1.1 output. A stylesheet is required for
proper rendering; a complete stylesheet is installed and used by default.
+rst2html5.py
+------------
+
+:Reader: Standalone
+:Parser: reStructuredText
+:Writer: html5
+
+The ``rst2html5.py`` front end reads standalone reStructuredText source
+files and produces simple HTML 5 output. A stylesheet is required for
+proper rendering; a complete stylesheet is installed and used by default.
+
rstpep2html.py
--------------
Modified: trunk/docutils/docutils/writers/html_base/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/html_base/__init__.py 2015-03-12 22:43:12 UTC (rev 7826)
+++ trunk/docutils/docutils/writers/html_base/__init__.py 2015-03-13 11:42:35 UTC (rev 7827)
@@ -958,14 +958,14 @@
# Image types to place in an <object> element
# SVG not supported by IE up to version 8
# (html4css1 strives for IE6 compatibility)
- object_image_types = {'.svg': 'image/svg+xml',
+ object_image_types = {#'.svg': 'image/svg+xml',
'.swf': 'application/x-shockwave-flash'}
def visit_image(self, node):
atts = {}
uri = node['uri']
ext = os.path.splitext(uri)[1].lower()
- if ext in self.object_image_types: # ('.svg', '.swf'):
+ if ext in self.object_image_types:
atts['data'] = uri
atts['type'] = self.object_image_types[ext]
else:
@@ -1019,7 +1019,7 @@
suffix = '\n'
if 'align' in node:
atts['class'] = 'align-%s' % node['align']
- if ext in self.object_image_types: # ('.svg', '.swf')
+ if ext in self.object_image_types:
# do NOT use an empty tag: incorrect rendering in browsers
self.body.append(self.starttag(node, 'object', suffix, **atts) +
node.get('alt', uri) + '</object>' + suffix)
Modified: trunk/docutils/docutils/writers/html_base/html-base.css
===================================================================
--- trunk/docutils/docutils/writers/html_base/html-base.css 2015-03-12 22:43:12 UTC (rev 7826)
+++ trunk/docutils/docutils/writers/html_base/html-base.css 2015-03-13 11:42:35 UTC (rev 7827)
@@ -73,6 +73,7 @@
width: 80%;
margin-top: 1em;
margin-bottom: 1em;
+ clear: both;
}
/* Paragraphs */
Modified: trunk/docutils/test/functional/expected/standalone_rst_html4css1.html
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_html4css1.html 2015-03-12 22:43:12 UTC (rev 7826)
+++ trunk/docutils/test/functional/expected/standalone_rst_html4css1.html 2015-03-13 11:42:35 UTC (rev 7827)
@@ -1088,47 +1088,97 @@
<h2><a class="toc-backref" href="#id74">2.24 SVG Images</a></h2>
<object class="align-left" data="../../../docs/user/rst/images/biohazard.svg" style="width: 48px; height: 48px;" type="image/svg+xml">
../../../docs/user/rst/images/biohazard.svg</object>
-<p>Scalable vector graphics (SVG) images are not supported by all backends.
-Rendering depends partially on the backend, especially if the size is
-not explicitely given.</p>
-<object class="align-left" data="../../../docs/user/rst/images/title-scaling.svg" style="width: 50%;" type="image/svg+xml">
+<p>Scalable vector graphics (SVG) images are the only standards-compliable way
+to include vector graphics in HTML documents. However, they are not
+supported by all backends/output formats. (E.g., LaTeX supports the
+PDF or Postscript formats for vector graphics instead.)</p>
+<p>Rendering behaviour varies, depending on</p>
+<ol class="loweralpha">
+<li><p class="first">The SVG image itself, e.g. fixed-size vs. scaling:</p>
+<pre class="literal-block">
+width="280" viewBox="0 0 280 27"
+height="27" width="100%"
+ height="100%"
+</pre>
+</li>
+<li><p class="first">The method used to put the image in the document.</p>
+<p>For HTML, there are several alternatives including:</p>
+<ul class="simple">
+<li>using the HTML <tt class="docutils literal"><img></tt> tag (not for interactive/animated SVG),</li>
+<li>using the HTML <tt class="docutils literal"><object></tt> tag,</li>
+<li>including within SVG using the SVG <tt class="docutils literal"><image></tt> tag,</li>
+<li>embedd the SVG code within HTML (inlining).</li>
+</ul>
+<p>The <cite>html4css1</cite> writer uses <tt class="docutils literal"><object></tt> tags, the <cite>html-base</cite> and <cite>xhtml11</cite>
+writers use <tt class="docutils literal"><img></tt> tags.</p>
+<!-- cf. http://edutechwiki.unige.ch/en/Using_SVG_with_HTML5_tutorial -->
+</li>
+<li><p class="first">The viewing agent.</p>
+<p>All up-to-date HTML browsers support SVG, however not all do this fully
+and in the same manner. Many older versions, especially IE < 9, have
+deficiencies or require plug-ins (i.e. don't support the <tt class="docutils literal"><img></tt> tag).</p>
+</li>
+</ol>
+<p>If the image is wrapped in <tt class="docutils literal"><object></tt> or <tt class="docutils literal"><svg></tt> tags, it depends on the
+<tt class="docutils literal">viewBox</tt> declaration inside the images root <tt class="docutils literal"><svg></tt> element whether an
+SVG image is scaled or clipped/padded. Images wrapped in <tt class="docutils literal"><img></tt> are
+always scaled.</p>
+<ul>
+<li><object class="first align-right" data="../../../docs/user/rst/images/title-scaling.svg" style="width: 50%;" type="image/svg+xml">
../../../docs/user/rst/images/title-scaling.svg</object>
-<p>A scaling image occupying 50% of the line width (scales with the browser
-window).</p>
-<p>Whether an SVG image is scaled or clipped/padded cannot be set in the
-containing HTML. If the image is wrapped in <tt class="docutils literal"><object></tt> tags, it
-depends on the viewport declaration inside its root <svg> element, if it is
-wrapped in <tt class="docutils literal"><img></tt> it depends on the browser.</p>
-<object class="align-left" data="../../../docs/user/rst/images/title.svg" style="width: 50%; height: 15px;" type="image/svg+xml">
+<p>A scaling image (scales with the browser window), occupying 50% of the line
+width. The <tt class="docutils literal">viewBox</tt> setting in the image file enables auto-scaling also in
+<tt class="docutils literal"><object></tt> tags and embedded SVG (if width and hight are set to 100% in the
+SVG <image> tag).</p>
+</li>
+<li><object class="first align-right" data="../../../docs/user/rst/images/title.svg" style="width: 50%; height: 15px;" type="image/svg+xml">
../../../docs/user/rst/images/title.svg</object>
-<p>A fixed-size image in a box with 50% of the line width, 15 pixles high.</p>
-<object class="align-right" data="../../../docs/user/rst/images/title-scaling.svg" style="width: 50%; height: 1.2em;" type="image/svg+xml">
+<p>A fixed-size image in a box 50% wide and 15 pixles high. This image is
+scaled, if wrapped in an <tt class="docutils literal"><img></tt> tag but clipped in an <tt class="docutils literal"><object></tt> tag
+or within SVG.</p>
+</li>
+<li><object class="first align-right" data="../../../docs/user/rst/images/title-scaling.svg" style="width: 50%; height: 1.5em;" type="image/svg+xml">
../../../docs/user/rst/images/title-scaling.svg</object>
-<p>A scaling image occupying 50% of the line width and 1.2 em high,
-right aligned (this SVG image keeps the aspect ratio):</p>
-<ul class="simple">
-<li>An inline SVG image <object data="../../../docs/user/rst/images/biohazard-scaling.svg" style="height: 0.8em;" type="image/svg+xml">inline-svg</object> scaled to a height of 0.8 em.</li>
-</ul>
-<object class="align-left" data="../../../docs/user/rst/images/biohazard-scaling.svg" style="height: 1em;" type="image/svg+xml">
+<p>A right aligned, scaling image 50% wide and 1.5 em high. (This SVG image
+keeps the aspect ratio.)</p>
+</li>
+<li><p class="first">An inline image <object data="../../../docs/user/rst/images/biohazard-scaling.svg" style="height: 0.8em;" type="image/svg+xml">inline-svg</object> scaled to a height of 0.8 em.</p>
+</li>
+<li><object class="first align-right" data="../../../docs/user/rst/images/biohazard-scaling.svg" style="height: 1em;" type="image/svg+xml">
../../../docs/user/rst/images/biohazard-scaling.svg</object>
-<p>A scaling image 1 em high, left aligned.</p>
-<p>A scaling image 5 mm x 5 mm, centered, with hyperlink reference:</p>
-<a class="reference internal image-reference" href="#directives"><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>
-<object class="align-left" data="../../../docs/user/rst/images/biohazard.svg" style="width: 4cm; height: 2em;" type="image/svg+xml">
+<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>
+</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>
<p>A fixed-size image in a 4 cm x 2 em box.</p>
-<div class="figure">
+</li>
+</ul>
+<p>Older versions of <cite>webkit</cite> based browsers (chromium, safari, midori,
+konqueror) support the <tt class="docutils literal"><img></tt> tag but don't display contained bitmap
+images in this case.</p>
+<ul>
+<li><object class="first align-right" data="../../../docs/user/rst/images/biohazard-bitmap.svg" style="width: 3em;" type="image/svg+xml">
+../../../docs/user/rst/images/biohazard-bitmap.svg</object>
+<p>A small, fixed-size SVG image with embedded bitmap, The <tt class="docutils literal">:width:</tt> is
+set to 3 em in the rST source. Does not scale if wrapped in <tt class="docutils literal"><object></tt>
+tags.</p>
+</li>
+<li><object class="first align-right" data="../../../docs/user/rst/images/biohazard-bitmap-scaling.svg" style="width: 3em;" type="image/svg+xml">
+../../../docs/user/rst/images/biohazard-bitmap-scaling.svg</object>
+<p>A scaling SVG image with embedded bitmap, 3 em wide.</p>
+</li>
+</ul>
+<p>SVG images can also be put in figures:</p>
+<blockquote>
+<div class="figure align-center">
<object data="../../../docs/user/rst/images/title.svg" style="width: 290px; height: 28px;" type="image/svg+xml">
reStructuredText, the markup syntax</object>
-<p class="caption">SVG image in a figure.</p>
+<p class="caption"><strong>Figure:</strong> SVG image in a figure.</p>
</div>
-<object class="align-right" data="../../../docs/user/rst/images/biohazard-bitmap.svg" style="width: 3em;" type="image/svg+xml">
-../../../docs/user/rst/images/biohazard-bitmap.svg</object>
-<p>An SVG image with embedded bitmap, 3 em wide, right aligned.
-Older versions of <cite>webkit</cite> based browsers (chromium, safari, midori,
-konqueror) cannot display the contained bitmap image if the SVG is wrapped
-in <tt class="docutils literal"><img></tt> tags. The image does not scale properly if wrapped in
-<tt class="docutils literal"><object></tt> tags.</p>
+</blockquote>
</div>
<div class="section" id="swf-images">
<h2><a class="toc-backref" href="#id75">2.25 SWF Images</a></h2>
Modified: trunk/docutils/test/functional/expected/standalone_rst_html_base.html
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_html_base.html 2015-03-12 22:43:12 UTC (rev 7826)
+++ trunk/docutils/test/functional/expected/standalone_rst_html_base.html 2015-03-13 11:42:35 UTC (rev 7827)
@@ -1052,49 +1052,88 @@
</div>
<div class="section" id="svg-images">
<h2><a class="toc-backref" href="#id78"><span class="sectnum">2.24</span> SVG Images</a></h2>
-<object class="align-left" data="../../../docs/user/rst/images/biohazard.svg" style="width: 48px; height: 48px;" type="image/svg+xml">
-../../../docs/user/rst/images/biohazard.svg</object>
-<p>Scalable vector graphics (SVG) images are not supported by all backends.
-Rendering depends partially on the backend, especially if the size is
-not explicitely given.</p>
-<object class="align-left" data="../../../docs/user/rst/images/title-scaling.svg" style="width: 50%;" type="image/svg+xml">
-../../../docs/user/rst/images/title-scaling.svg</object>
-<p>A scaling image occupying 50% of the line width (scales with the browser
-window).</p>
-<p>Whether an SVG image is scaled or clipped/padded cannot be set in the
-containing HTML. If the image is wrapped in <span class="docutils literal"><object></span> tags, it
-depends on the viewport declaration inside its root <svg> element, if it is
-wrapped in <span class="docutils literal"><img></span> it depends on the browser.</p>
-<object class="align-left" data="../../../docs/user/rst/images/title.svg" style="width: 50%; height: 15px;" type="image/svg+xml">
-../../../docs/user/rst/images/title.svg</object>
-<p>A fixed-size image in a box with 50% of the line width, 15 pixles high.</p>
-<object class="align-right" data="../../../docs/user/rst/images/title-scaling.svg" style="width: 50%; height: 1.2em;" type="image/svg+xml">
-../../../docs/user/rst/images/title-scaling.svg</object>
-<p>A scaling image occupying 50% of the line width and 1.2 em high,
-right aligned (this SVG image keeps the aspect ratio):</p>
+<img alt="../../../docs/user/rst/images/biohazard.svg" class="align-left" src="../../../docs/user/rst/images/biohazard.svg" style="width: 48px; height: 48px;" />
+<p>Scalable vector graphics (SVG) images are the only standards-compliable way
+to include vector graphics in HTML documents. However, they are not
+supported by all backends/output formats. (E.g., LaTeX supports the
+PDF or Postscript formats for vector graphics instead.)</p>
+<p>Rendering behaviour varies, depending on</p>
+<ol class="loweralpha">
+<li><p>The SVG image itself, e.g. fixed-size vs. scaling:</p>
+<pre class="literal-block">width="280" viewBox="0 0 280 27"
+height="27" width="100%"
+ height="100%"</pre>
+</li>
+<li><p>The method used to put the image in the document.</p>
+<p>For HTML, there are several alternatives including:</p>
<ul class="simple">
-<li><p>An inline SVG image <object data="../../../docs/user/rst/images/biohazard-scaling.svg" style="height: 0.8em;" type="image/svg+xml">inline-svg</object> scaled to a height of 0.8 em.</p></li>
+<li><p>using the HTML <span class="docutils literal"><img></span> tag (not for interactive/animated SVG),</p></li>
+<li><p>using the HTML <span class="docutils literal"><object></span> tag,</p></li>
+<li><p>including within SVG using the SVG <span class="docutils literal"><image></span> tag,</p></li>
+<li><p>embedd the SVG code within HTML (inlining).</p></li>
</ul>
-<object class="align-left" data="../../../docs/user/rst/images/biohazard-scaling.svg" style="height: 1em;" type="image/svg+xml">
-../../../docs/user/rst/images/biohazard-scaling.svg</object>
-<p>A scaling image 1 em high, left aligned.</p>
-<p>A scaling image 5 mm x 5 mm, centered, with hyperlink reference:</p>
-<a class="reference internal image-reference" href="#directives"><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>
-<object class="align-left" data="../../../docs/user/rst/images/biohazard.svg" style="width: 4cm; height: 2em;" type="image/svg+xml">
-../../../docs/user/rst/images/biohazard.svg</object>
+<p>The <cite>html4css1</cite> writer uses <span class="docutils literal"><object></span> tags, the <cite>html-base</cite> and <cite>xhtml11</cite>
+writers use <span class="docutils literal"><img></span> tags.</p>
+<!-- cf. http://edutechwiki.unige.ch/en/Using_SVG_with_HTML5_tutorial -->
+</li>
+<li><p>The viewing agent.</p>
+<p>All up-to-date HTML browsers support SVG, however not all do this fully
+and in the same manner. Many older versions, especially IE < 9, have
+deficiencies or require plug-ins (i.e. don't support the <span class="docutils literal"><img></span> tag).</p>
+</li>
+</ol>
+<p>If the image is wrapped in <span class="docutils literal"><object></span> or <span class="docutils literal"><svg></span> tags, it depends on the
+<span class="docutils literal">viewBox</span> declaration inside the images root <span class="docutils literal"><svg></span> element whether an
+SVG image is scaled or clipped/padded. Images wrapped in <span class="docutils literal"><img></span> are
+always scaled.</p>
+<ul>
+<li><img alt="../../../docs/user/rst/images/title-scaling.svg" class="align-right" src="../../../docs/user/rst/images/title-scaling.svg" style="width: 50%;" />
+<p>A scaling image (scales with the browser window), occupying 50% of the line
+width. The <span class="docutils literal">viewBox</span> setting in the image file enables auto-scaling also in
+<span class="docutils literal"><object></span> tags and embedded SVG (if width and hight are set to 100% in the
+SVG <image> tag).</p>
+</li>
+<li><img alt="../../../docs/user/rst/images/title.svg" class="align-right" src="../../../docs/user/rst/images/title.svg" style="width: 50%; height: 15px;" />
+<p>A fixed-size image in a box 50% wide and 15 pixles high. This image is
+scaled, if wrapped in an <span class="docutils literal"><img></span> tag but clipped in an <span class="docutils literal"><object></span> tag
+or within SVG.</p>
+</li>
+<li><img alt="../../../docs/user/rst/images/title-scaling.svg" class="align-right" src="../../../docs/user/rst/images/title-scaling.svg" style="width: 50%; height: 1.5em;" />
+<p>A right aligned, scaling image 50% wide and 1.5 em ...
[truncated message content] |
|
From: <mi...@us...> - 2015-03-13 13:39:03
|
Revision: 7828
http://sourceforge.net/p/docutils/code/7828
Author: milde
Date: 2015-03-13 13:38:56 +0000 (Fri, 13 Mar 2015)
Log Message:
-----------
Documentation update.
Modified Paths:
--------------
trunk/docutils/docs/user/config.txt
trunk/docutils/docs/user/tools.txt
trunk/docutils/docutils/parsers/rst/states.py
Modified: trunk/docutils/docs/user/config.txt
===================================================================
--- trunk/docutils/docs/user/config.txt 2015-03-13 11:42:35 UTC (rev 7827)
+++ trunk/docutils/docs/user/config.txt 2015-03-13 13:38:56 UTC (rev 7828)
@@ -1102,22 +1102,37 @@
__ `xml_declaration [docutils_xml writer]`_
+[html-base writer]
+~~~~~~~~~~~~~~~~~~
+
+The `html-base` writer uses the settings described in the `[html4css1
+writer]`_ section with the following exceptions:
+
+Removed options:
+ `field_name_limit`_, `option_limit`_.
+
+Different default for:
+
+`stylesheet_path <stylesheet_path [html4css1 writer]_>`_:
+ Default: "html-base.css"
+
+`stylesheet_dirs <stylesheet_dirs [html4css1 writer]_>`_:
+ Default: Installation-dependent. Use the --help option to get the exact
+ value.
+
+
[xhtml11 writer]
~~~~~~~~~~~~~~~~~
-The XHTML1.1 Writer derives from the standard HTML Writer, and shares
-most settings defined in the `[html4css1 writer]`_ section. The
-"[html4css1 writer]" section of configuration files is processed
-before the "[xhtml11 writer]" section.
+The XHTML1.1 Writer derives from the `html-base` writer and uses the same
+setings. The "[html-base writer]" section of configuration files is
+processed before the "[xhtml11 writer]" section.
-removed options:
- `field_name_limit`_, `option_limit`_
-The XHTML1.1 Writer's default for the following settings differ from
-those of the standard HTML Writer:
+Different default for:
`stylesheet_path <stylesheet_path [html4css1 writer]_>`_:
- Default: "html4css1.css,xhtml11.css"
+ Default: "html-base.css,xhtml11.css"
`stylesheet_dirs <stylesheet_dirs [html4css1 writer]_>`_:
Default: Installation-dependent. Use the --help option to get the exact
Modified: trunk/docutils/docs/user/tools.txt
===================================================================
--- trunk/docutils/docs/user/tools.txt 2015-03-13 11:42:35 UTC (rev 7827)
+++ trunk/docutils/docs/user/tools.txt 2015-03-13 13:38:56 UTC (rev 7828)
@@ -158,8 +158,9 @@
:Writer: html5
The ``rst2html5.py`` front end reads standalone reStructuredText source
-files and produces simple HTML 5 output. A stylesheet is required for
-proper rendering; a complete stylesheet is installed and used by default.
+files and produces simple HTML 5 output (compatible to XHTML 1.0
+transitional). A stylesheet is required for proper rendering; a complete
+stylesheet is installed and used by default.
rstpep2html.py
--------------
@@ -310,7 +311,29 @@
For details see `Generating LaTeX with Docutils`_.
+rst2xetex.py
+------------
+:Reader: Standalone
+:Parser: reStructuredText
+:Writer: XeTeX
+
+The ``rst2xetex.py`` front end reads standalone reStructuredText source
+files and produces `LaTeX` output for processing with unicode-aware
+TeX engines (`XeTeX` or `LuaTeX`_). For example, to process a
+reStructuredText file "``test.txt``" into LaTeX::
+
+ rst2xetex.py test.txt test.tex
+
+The output file "``test.tex``" should then be processed with ``xelatex`` or
+``lualatex`` to get a document in PDF format for printing or on-screen
+viewing.
+
+For details see `Generating LaTeX with Docutils`_.
+
+.. _XeTeX: https://en.wikipedia.org/wiki/XeTeX
+.. _LuaTeX: https://en.wikipedia.org/wiki/LuaTeX
+
XML-Generating Tools
====================
Modified: trunk/docutils/docutils/parsers/rst/states.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/states.py 2015-03-13 11:42:35 UTC (rev 7827)
+++ trunk/docutils/docutils/parsers/rst/states.py 2015-03-13 13:38:56 UTC (rev 7828)
@@ -1547,6 +1547,9 @@
def doctest(self, match, context, next_state):
data = '\n'.join(self.state_machine.get_text_block())
+ # TODO: prepend class value ['pycon'] (Python Console)
+ # parse with `directives.body.CodeBlock` (returns literal-block
+ # with class "code" and syntax highlight markup).
self.parent += nodes.doctest_block(data, data)
return [], next_state, []
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2015-03-13 14:54:54
|
Revision: 7829
http://sourceforge.net/p/docutils/code/7829
Author: milde
Date: 2015-03-13 14:54:46 +0000 (Fri, 13 Mar 2015)
Log Message:
-----------
Clarify the use of "pycon" for "Python console" code.
Modified Paths:
--------------
trunk/docutils/RELEASE-NOTES.txt
trunk/docutils/docutils/writers/html_base/__init__.py
Modified: trunk/docutils/RELEASE-NOTES.txt
===================================================================
--- trunk/docutils/RELEASE-NOTES.txt 2015-03-13 13:38:56 UTC (rev 7828)
+++ trunk/docutils/RELEASE-NOTES.txt 2015-03-13 14:54:46 UTC (rev 7829)
@@ -29,8 +29,8 @@
* »Prune« the doctree (no change to the reST input syntax):
- - "doctest" element -> literal block with 'pycon' class argument
- and syntax highlight (like the "code" directive),
+ - "doctest" element -> literal block with "pycon" (python-console)
+ class argument and syntax highlight (like the "code" directive),
- special admonitions (note, hint, warning, ...) -> generic "admonition"
element with class attribute and auto-generated title.
Modified: trunk/docutils/docutils/writers/html_base/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/html_base/__init__.py 2015-03-13 13:38:56 UTC (rev 7828)
+++ trunk/docutils/docutils/writers/html_base/__init__.py 2015-03-13 14:54:46 UTC (rev 7829)
@@ -753,10 +753,9 @@
def depart_docinfo_item(self):
self.body.append('</dd>\n')
- # TODO: RSt-parser should treat this as code-block with class "pycon".
def visit_doctest_block(self, node):
self.body.append(self.starttag(node, 'pre', suffix='',
- CLASS='code pycon doctest-block'))
+ CLASS='code python doctest'))
def depart_doctest_block(self, node):
self.body.append('\n</pre>\n')
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2015-03-15 17:16:32
|
Revision: 7837
http://sourceforge.net/p/docutils/code/7837
Author: milde
Date: 2015-03-15 17:16:30 +0000 (Sun, 15 Mar 2015)
Log Message:
-----------
Remove deprecated features (long announced in RELEASE NOTES).
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/RELEASE-NOTES.txt
trunk/docutils/docutils/io.py
trunk/docutils/docutils/writers/latex2e/__init__.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2015-03-15 17:13:56 UTC (rev 7836)
+++ trunk/docutils/HISTORY.txt 2015-03-15 17:16:30 UTC (rev 7837)
@@ -16,6 +16,10 @@
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.
@@ -59,6 +63,9 @@
- use absolute path for ``default_template_path``.
+ - removed deprecated options ``--use-latex-footnotes`` and
+ ``--figure-footnotes``.
+
* docutils/writers/odf_odt/__init__.py
- remove decode.encode of filename stored in zip.
Modified: trunk/docutils/RELEASE-NOTES.txt
===================================================================
--- trunk/docutils/RELEASE-NOTES.txt 2015-03-15 17:13:56 UTC (rev 7836)
+++ trunk/docutils/RELEASE-NOTES.txt 2015-03-15 17:16:30 UTC (rev 7837)
@@ -20,13 +20,6 @@
Future changes
==============
-* remove the `handle_io_errors` option from io.FileInput/Output.
-
-* remove deprecated options from the latex2e writer:
-
- --use-latex-footnotes Alias for --docutils-footnotes (deprecated)
- --figure-footnotes Use figure floats for footnote text (deprecated)
-
* »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-03-15 17:13:56 UTC (rev 7836)
+++ trunk/docutils/docutils/io.py 2015-03-15 17:16:30 UTC (rev 7837)
@@ -204,7 +204,7 @@
"""
def __init__(self, source=None, source_path=None,
encoding=None, error_handler='strict',
- autoclose=True, handle_io_errors=None, mode='rU'):
+ autoclose=True, mode='rU'):
"""
:Parameters:
- `source`: either a file-like object (which is read directly), or
@@ -214,7 +214,6 @@
- `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.
@@ -303,7 +302,7 @@
def __init__(self, destination=None, destination_path=None,
encoding=None, error_handler='strict', autoclose=True,
- handle_io_errors=None, mode=None):
+ mode=None):
"""
:Parameters:
- `destination`: either a file-like object (which is written
@@ -315,7 +314,6 @@
- `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.
Modified: trunk/docutils/docutils/writers/latex2e/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/latex2e/__init__.py 2015-03-15 17:13:56 UTC (rev 7836)
+++ trunk/docutils/docutils/writers/latex2e/__init__.py 2015-03-15 17:16:30 UTC (rev 7837)
@@ -54,14 +54,6 @@
['--docutils-footnotes'],
{'default': True, 'action': 'store_true',
'validator': frontend.validate_boolean}),
- ('Alias for --docutils-footnotes (deprecated)',
- ['--use-latex-footnotes'],
- {'action': 'store_true',
- 'validator': frontend.validate_boolean}),
- ('Use figure floats for footnote text (deprecated)',
- ['--figure-footnotes'],
- {'action': 'store_true',
- 'validator': frontend.validate_boolean}),
('Format for footnote references: one of "superscript" or '
'"brackets". Default is "superscript".',
['--footnote-references'],
@@ -546,17 +538,6 @@
\endgroup%
}"""
-PreambleCmds.footnote_floats = r"""% settings for footnotes as floats:
-\setlength{\floatsep}{0.5em}
-\setlength{\textfloatsep}{\fill}
-\addtolength{\textfloatsep}{3em}
-\renewcommand{\textfraction}{0.5}
-\renewcommand{\topfraction}{0.5}
-\renewcommand{\bottomfraction}{0.5}
-\setcounter{totalnumber}{50}
-\setcounter{topnumber}{50}
-\setcounter{bottomnumber}{50}"""
-
PreambleCmds.graphicx_auto = r"""% Check output format
\ifx\pdftexversion\undefined
\usepackage{graphicx}
@@ -1204,16 +1185,6 @@
self.settings.graphicx_option)
# footnotes:
self.docutils_footnotes = settings.docutils_footnotes
- if settings.use_latex_footnotes:
- self.docutils_footnotes = True
- self.warn('`use_latex_footnotes` is deprecated. '
- 'The setting has been renamed to `docutils_footnotes` '
- 'and the alias will be removed in a future version.')
- self.figure_footnotes = settings.figure_footnotes
- if self.figure_footnotes:
- self.docutils_footnotes = True
- self.warn('The "figure footnotes" workaround/setting is strongly '
- 'deprecated and will be removed in a future version.')
# Output collection stacks
# ~~~~~~~~~~~~~~~~~~~~~~~~
@@ -2165,13 +2136,7 @@
backref = node['backrefs'][0]
except IndexError:
backref = node['ids'][0] # no backref, use self-ref instead
- if self.settings.figure_footnotes:
- self.requirements['~fnt_floats'] = PreambleCmds.footnote_floats
- self.out.append('\\begin{figure}[b]')
- self.append_hypertargets(node)
- if node.get('id') == node.get('name'): # explicite label
- self.out += self.ids_to_labels(node)
- elif self.docutils_footnotes:
+ if self.docutils_footnotes:
self.fallbacks['footnotes'] = PreambleCmds.footnotes
num,text = node.astext().split(None,1)
if self.settings.footnote_references == 'brackets':
@@ -2185,10 +2150,7 @@
## else: # TODO: "real" LaTeX \footnote{}s
def depart_footnote(self, node):
- if self.figure_footnotes:
- self.out.append('\\end{figure}\n')
- else:
- self.out.append('}\n')
+ self.out.append('}\n')
def visit_footnote_reference(self, node):
href = ''
@@ -2223,12 +2185,7 @@
# footnote/citation label
def label_delim(self, node, bracket, superscript):
if isinstance(node.parent, nodes.footnote):
- if not self.figure_footnotes:
- raise nodes.SkipNode
- if self.settings.footnote_references == 'brackets':
- self.out.append(bracket)
- else:
- self.out.append(superscript)
+ raise nodes.SkipNode
else:
assert isinstance(node.parent, nodes.citation)
if not self._use_latex_citations:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2015-03-17 17:08:17
|
Revision: 7845
http://sourceforge.net/p/docutils/code/7845
Author: milde
Date: 2015-03-17 17:08:09 +0000 (Tue, 17 Mar 2015)
Log Message:
-----------
Cleaner LaTeX code for enumerations.
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/docutils/writers/latex2e/__init__.py
trunk/docutils/test/functional/expected/standalone_rst_latex.tex
trunk/docutils/test/functional/expected/standalone_rst_xetex.tex
trunk/docutils/test/test_writers/test_latex2e.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2015-03-17 15:35:15 UTC (rev 7844)
+++ trunk/docutils/HISTORY.txt 2015-03-17 17:08:09 UTC (rev 7845)
@@ -61,11 +61,13 @@
* docutils/writers/latex2e/__init__.py
- - use absolute path for ``default_template_path``.
+ - Use absolute path for ``default_template_path``.
- - removed deprecated options ``--use-latex-footnotes`` and
+ - Removed deprecated options ``--use-latex-footnotes`` and
``--figure-footnotes``.
+ - Cleaner LaTeX code for enumerations.
+
* 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-03-17 15:35:15 UTC (rev 7844)
+++ trunk/docutils/docutils/writers/latex2e/__init__.py 2015-03-17 17:08:09 UTC (rev 7845)
@@ -2005,59 +2005,63 @@
self.out.extend(self.active_table.depart_row())
def visit_enumerated_list(self, node):
- # We create our own enumeration list environment.
- # This allows to set the style and starting value
- # and unlimited nesting.
- enum_style = {'arabic':'arabic',
- 'loweralpha':'alph',
- 'upperalpha':'Alph',
- 'lowerroman':'roman',
- 'upperroman':'Roman' }
- enum_suffix = ''
- if 'suffix' in node:
- enum_suffix = node['suffix']
- enum_prefix = ''
- if 'prefix' in node:
- enum_prefix = node['prefix']
+ # enumeration styles:
+ types = {'': '',
+ 'arabic':'arabic',
+ 'loweralpha':'alph',
+ 'upperalpha':'Alph',
+ 'lowerroman':'roman',
+ 'upperroman':'Roman'}
+ # the 4 default LaTeX enumeration labels: präfix, enumtype, suffix,
+ labels = [('', 'arabic', '.'), # 1.
+ ('(', 'alph', ')'), # (a)
+ ('', 'roman', '.'), # i.
+ ('', 'Alph', '.')] # A.
+
+ prefix = ''
if self.compound_enumerators:
- pref = ''
- if self.section_prefix_for_enumerators and self.section_level:
- for i in range(self.section_level):
- pref += '%d.' % self._section_number[i]
- pref = pref[:-1] + self.section_enumerator_separator
- enum_prefix += pref
- for ctype, cname in self._enumeration_counters:
- enum_prefix += '\\%s{%s}.' % (ctype, cname)
- enum_type = 'arabic'
- if 'enumtype' in node:
- enum_type = node['enumtype']
- if enum_type in enum_style:
- enum_type = enum_style[enum_type]
+ if (self.section_prefix_for_enumerators and self.section_level
+ and not self._enumeration_counters):
+ prefix = '.'.join([str(n) for n in
+ self._section_number[:self.section_level]]
+ ) + self.section_enumerator_separator
+ if self._enumeration_counters:
+ prefix += self._enumeration_counters[-1]
+ # TODO: use LaTeX default for unspecified label-type?
+ # (needs change of parser)
+ prefix += node.get('prefix', '')
+ enumtype = types[node.get('enumtype' '')]
+ suffix = node.get('suffix', '')
- counter_name = 'listcnt%d' % len(self._enumeration_counters)
- self._enumeration_counters.append((enum_type, counter_name))
- # If we haven't used this counter name before, then create a
- # new counter; otherwise, reset & reuse the old counter.
- if len(self._enumeration_counters) > self._max_enumeration_counters:
- self._max_enumeration_counters = len(self._enumeration_counters)
- self.out.append('\\newcounter{%s}\n' % counter_name)
+ enumeration_level = len(self._enumeration_counters)+1
+ counter_name = 'enum' + roman.toRoman(enumeration_level).lower()
+ label = r'%s\%s{%s}%s' % (prefix, enumtype, counter_name, suffix)
+ self._enumeration_counters.append(label)
+
+ if enumeration_level <= 4:
+ self.out.append('\\begin{enumerate}\n')
+ if (prefix, enumtype, suffix
+ ) != labels[enumeration_level-1]:
+ self.out.append('\\renewcommand{\\label%s}{%s}\n' %
+ (counter_name, label))
else:
- self.out.append('\\setcounter{%s}{0}\n' % counter_name)
-
- self.out.append('\\begin{list}{%s\\%s{%s}%s}\n' %
- (enum_prefix,enum_type,counter_name,enum_suffix))
- self.out.append('{\n')
- self.out.append('\\usecounter{%s}\n' % counter_name)
- # set start after usecounter, because it initializes to zero.
+ self.fallbacks[counter_name] = '\\newcounter{%s}' % counter_name
+ self.out.append('\\begin{list}')
+ self.out.append('{%s}' % label)
+ self.out.append('{\\usecounter{%s}}\n' % counter_name)
if 'start' in node:
- self.out.append('\\addtocounter{%s}{%d}\n' %
+ self.out.append('\\setcounter{%s}{%d}\n' %
(counter_name,node['start']-1))
- ## set rightmargin equal to leftmargin
- self.out.append('\\setlength{\\rightmargin}{\\leftmargin}\n')
- self.out.append('}\n')
+ # ## set rightmargin equal to leftmargin
+ # self.out.append('\\setlength{\\rightmargin}{\\leftmargin}\n')
+
+
def depart_enumerated_list(self, node):
- self.out.append('\\end{list}\n')
+ if len(self._enumeration_counters) <= 4:
+ self.out.append('\\end{enumerate}\n')
+ else:
+ self.out.append('\\end{list}\n')
self._enumeration_counters.pop()
def visit_field(self, node):
Modified: trunk/docutils/test/functional/expected/standalone_rst_latex.tex
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_latex.tex 2015-03-17 15:35:15 UTC (rev 7844)
+++ trunk/docutils/test/functional/expected/standalone_rst_latex.tex 2015-03-17 17:08:09 UTC (rev 7845)
@@ -66,6 +66,7 @@
% subtitle (in document title)
\providecommand*{\DUdocumentsubtitle}[1]{{\large #1}}
+\newcounter{enumv}
% error admonition title
\providecommand*{\DUtitleerror}[1]{\DUtitle{\color{red}#1}}
@@ -423,89 +424,54 @@
\subsection{2.3~~~Enumerated Lists%
\label{enumerated-lists}%
}
-\newcounter{listcnt0}
-\begin{list}{\arabic{listcnt0}.}
-{
-\usecounter{listcnt0}
-\setlength{\rightmargin}{\leftmargin}
-}
+\begin{enumerate}
\item Arabic numerals.
-\newcounter{listcnt1}
-\begin{list}{\alph{listcnt1})}
-{
-\usecounter{listcnt1}
-\setlength{\rightmargin}{\leftmargin}
-}
+\begin{enumerate}
+\renewcommand{\labelenumii}{\alph{enumii})}
\item lower alpha)
-\newcounter{listcnt2}
-\begin{list}{(\roman{listcnt2})}
-{
-\usecounter{listcnt2}
-\setlength{\rightmargin}{\leftmargin}
-}
+\begin{enumerate}
+\renewcommand{\labelenumiii}{(\roman{enumiii})}
\item (lower roman)
-\newcounter{listcnt3}
-\begin{list}{\Alph{listcnt3}.}
-{
-\usecounter{listcnt3}
-\setlength{\rightmargin}{\leftmargin}
-}
+\begin{enumerate}
\item upper alpha.
-\newcounter{listcnt4}
-\begin{list}{\Roman{listcnt4})}
-{
-\usecounter{listcnt4}
-\setlength{\rightmargin}{\leftmargin}
-}
+\begin{list}{\Roman{enumv})}{\usecounter{enumv}}
\item upper roman)
\end{list}
-\end{list}
-\end{list}
-\end{list}
+\end{enumerate}
+\end{enumerate}
+\end{enumerate}
\item Lists that don’t start at 1:
-\setcounter{listcnt1}{0}
-\begin{list}{\arabic{listcnt1}.}
-{
-\usecounter{listcnt1}
-\addtocounter{listcnt1}{2}
-\setlength{\rightmargin}{\leftmargin}
-}
+\begin{enumerate}
+\renewcommand{\labelenumii}{\arabic{enumii}.}
+\setcounter{enumii}{2}
\item Three
\item Four
-\end{list}
-\setcounter{listcnt1}{0}
-\begin{list}{\Alph{listcnt1}.}
-{
-\usecounter{listcnt1}
-\addtocounter{listcnt1}{2}
-\setlength{\rightmargin}{\leftmargin}
-}
+\end{enumerate}
+\begin{enumerate}
+\renewcommand{\labelenumii}{\Alph{enumii}.}
+\setcounter{enumii}{2}
\item C
\item D
-\end{list}
-\setcounter{listcnt1}{0}
-\begin{list}{\roman{listcnt1}.}
-{
-\usecounter{listcnt1}
-\addtocounter{listcnt1}{2}
-\setlength{\rightmargin}{\leftmargin}
-}
+\end{enumerate}
+\begin{enumerate}
+\renewcommand{\labelenumii}{\roman{enumii}.}
+\setcounter{enumii}{2}
\item iii
\item iv
-\end{list}
-\end{list}
+\end{enumerate}
+\end{enumerate}
\subsection{2.4~~~Definition Lists%
Modified: trunk/docutils/test/functional/expected/standalone_rst_xetex.tex
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_xetex.tex 2015-03-17 15:35:15 UTC (rev 7844)
+++ trunk/docutils/test/functional/expected/standalone_rst_xetex.tex 2015-03-17 17:08:09 UTC (rev 7845)
@@ -62,6 +62,7 @@
% subtitle (in document title)
\providecommand*{\DUdocumentsubtitle}[1]{{\large #1}}
+\newcounter{enumv}
% error admonition title
\providecommand*{\DUtitleerror}[1]{\DUtitle{\color{red}#1}}
@@ -422,89 +423,54 @@
\subsection{2.3 Enumerated Lists%
\label{enumerated-lists}%
}
-\newcounter{listcnt0}
-\begin{list}{\arabic{listcnt0}.}
-{
-\usecounter{listcnt0}
-\setlength{\rightmargin}{\leftmargin}
-}
+\begin{enumerate}
\item Arabic numerals.
-\newcounter{listcnt1}
-\begin{list}{\alph{listcnt1})}
-{
-\usecounter{listcnt1}
-\setlength{\rightmargin}{\leftmargin}
-}
+\begin{enumerate}
+\renewcommand{\labelenumii}{\alph{enumii})}
\item lower alpha)
-\newcounter{listcnt2}
-\begin{list}{(\roman{listcnt2})}
-{
-\usecounter{listcnt2}
-\setlength{\rightmargin}{\leftmargin}
-}
+\begin{enumerate}
+\renewcommand{\labelenumiii}{(\roman{enumiii})}
\item (lower roman)
-\newcounter{listcnt3}
-\begin{list}{\Alph{listcnt3}.}
-{
-\usecounter{listcnt3}
-\setlength{\rightmargin}{\leftmargin}
-}
+\begin{enumerate}
\item upper alpha.
-\newcounter{listcnt4}
-\begin{list}{\Roman{listcnt4})}
-{
-\usecounter{listcnt4}
-\setlength{\rightmargin}{\leftmargin}
-}
+\begin{list}{\Roman{enumv})}{\usecounter{enumv}}
\item upper roman)
\end{list}
-\end{list}
-\end{list}
-\end{list}
+\end{enumerate}
+\end{enumerate}
+\end{enumerate}
\item Lists that don’t start at 1:
-\setcounter{listcnt1}{0}
-\begin{list}{\arabic{listcnt1}.}
-{
-\usecounter{listcnt1}
-\addtocounter{listcnt1}{2}
-\setlength{\rightmargin}{\leftmargin}
-}
+\begin{enumerate}
+\renewcommand{\labelenumii}{\arabic{enumii}.}
+\setcounter{enumii}{2}
\item Three
\item Four
-\end{list}
-\setcounter{listcnt1}{0}
-\begin{list}{\Alph{listcnt1}.}
-{
-\usecounter{listcnt1}
-\addtocounter{listcnt1}{2}
-\setlength{\rightmargin}{\leftmargin}
-}
+\end{enumerate}
+\begin{enumerate}
+\renewcommand{\labelenumii}{\Alph{enumii}.}
+\setcounter{enumii}{2}
\item C
\item D
-\end{list}
-\setcounter{listcnt1}{0}
-\begin{list}{\roman{listcnt1}.}
-{
-\usecounter{listcnt1}
-\addtocounter{listcnt1}{2}
-\setlength{\rightmargin}{\leftmargin}
-}
+\end{enumerate}
+\begin{enumerate}
+\renewcommand{\labelenumii}{\roman{enumii}.}
+\setcounter{enumii}{2}
\item iii
\item iv
-\end{list}
-\end{list}
+\end{enumerate}
+\end{enumerate}
\subsection{2.4 Definition Lists%
Modified: trunk/docutils/test/test_writers/test_latex2e.py
===================================================================
--- trunk/docutils/test/test_writers/test_latex2e.py 2015-03-17 15:35:15 UTC (rev 7844)
+++ trunk/docutils/test/test_writers/test_latex2e.py 2015-03-17 17:08:09 UTC (rev 7845)
@@ -396,55 +396,37 @@
(II) in roman numerals.
""",
# expected output
-head + r"""\newcounter{listcnt0}
-\begin{list}{\arabic{listcnt0}.}
-{
-\usecounter{listcnt0}
-\setlength{\rightmargin}{\leftmargin}
-}
+head + r"""\begin{enumerate}
\item Item 1.
\item Second to the previous item this one will explain
-\end{list}
+\end{enumerate}
%
\begin{quote}
-\setcounter{listcnt0}{0}
-\begin{list}{\alph{listcnt0})}
-{
-\usecounter{listcnt0}
-\setlength{\rightmargin}{\leftmargin}
-}
+\begin{enumerate}
+\renewcommand{\labelenumi}{\alph{enumi})}
\item nothing.
\item or some other.
-\end{list}
+\end{enumerate}
\end{quote}
-\setcounter{listcnt0}{0}
-\begin{list}{\arabic{listcnt0}.}
-{
-\usecounter{listcnt0}
-\addtocounter{listcnt0}{2}
-\setlength{\rightmargin}{\leftmargin}
-}
+\begin{enumerate}
+\setcounter{enumi}{2}
\item Third is
-\end{list}
+\end{enumerate}
%
\begin{quote}
-\setcounter{listcnt0}{0}
-\begin{list}{(\Roman{listcnt0})}
-{
-\usecounter{listcnt0}
-\setlength{\rightmargin}{\leftmargin}
-}
+\begin{enumerate}
+\renewcommand{\labelenumi}{(\Roman{enumi})}
\item having pre and postfixes
\item in roman numerals.
-\end{list}
+\end{enumerate}
\end{quote}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2015-03-17 17:30:55
|
Revision: 7847
http://sourceforge.net/p/docutils/code/7847
Author: milde
Date: 2015-03-17 17:30:47 +0000 (Tue, 17 Mar 2015)
Log Message:
-----------
Small fixes to the writer aliases, supported formats, and front-end tools.
Modified Paths:
--------------
trunk/docutils/docutils/writers/__init__.py
trunk/docutils/docutils/writers/html4css1/__init__.py
trunk/docutils/docutils/writers/html_base/__init__.py
trunk/docutils/docutils/writers/xhtml11/__init__.py
trunk/docutils/tools/rst2html5.py
trunk/docutils/tools/rst2xetex.py
trunk/docutils/tools/rst2xhtml11.py
Modified: trunk/docutils/docutils/writers/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/__init__.py 2015-03-17 17:11:15 UTC (rev 7846)
+++ trunk/docutils/docutils/writers/__init__.py 2015-03-17 17:30:47 UTC (rev 7847)
@@ -120,9 +120,11 @@
_writer_aliases = {
- 'html': 'html4css1',
+ 'html': 'html4css1', # will change to html_base some day
'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',
Modified: trunk/docutils/docutils/writers/html4css1/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/html4css1/__init__.py 2015-03-17 17:11:15 UTC (rev 7846)
+++ trunk/docutils/docutils/writers/html4css1/__init__.py 2015-03-17 17:30:47 UTC (rev 7847)
@@ -39,7 +39,7 @@
class Writer(writers.Writer):
- supported = ('html', 'html4css1', 'xhtml')
+ supported = ('html', 'html4', 'html4css1', 'xhtml', 'xhtml10')
"""Formats this writer supports."""
default_stylesheets = ['html4css1.css']
Modified: trunk/docutils/docutils/writers/html_base/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/html_base/__init__.py 2015-03-17 17:11:15 UTC (rev 7846)
+++ trunk/docutils/docutils/writers/html_base/__init__.py 2015-03-17 17:30:47 UTC (rev 7847)
@@ -49,7 +49,7 @@
class Writer(writers.Writer):
- supported = ('html', 'html5', 'xhtml')
+ supported = ('html', 'html5', 'html4', 'xhtml', 'xhtml10')
"""Formats this writer supports."""
default_stylesheets = ['html-base.css']
Modified: trunk/docutils/docutils/writers/xhtml11/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/xhtml11/__init__.py 2015-03-17 17:11:15 UTC (rev 7846)
+++ trunk/docutils/docutils/writers/xhtml11/__init__.py 2015-03-17 17:30:47 UTC (rev 7847)
@@ -35,9 +35,8 @@
class Writer(html_base.Writer):
- supported = ('html', 'xhtml', 'xhtml1',
- 'html4strict', 'xhtml1strict',
- 'xhtml11', 'xhtml1css2')
+ supported = ('html', 'html4', 'html4strict', 'html4css2',
+ 'xhtml', 'xhtml1', 'xhtml1strict', 'xhtml11')
"""Formats this writer supports."""
default_stylesheets = ['html-base.css', 'xhtml11.css']
Modified: trunk/docutils/tools/rst2html5.py
===================================================================
--- trunk/docutils/tools/rst2html5.py 2015-03-17 17:11:15 UTC (rev 7846)
+++ trunk/docutils/tools/rst2html5.py 2015-03-17 17:30:47 UTC (rev 7847)
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf8 -*-
-# :Copyright: © 2005, 2009 Günter Milde.
+# :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,
@@ -14,7 +14,7 @@
# Date: $Date$
"""
-A minimal front end to the Docutils Publisher, producing basic HTML 5
+A minimal front end to the Docutils Publisher, producing HTML 5 documents.
The output also conforms to XHTML 1.0 transitional
(except for the doctype declaration).
@@ -32,4 +32,4 @@
u'reStructuredText sources '
+ default_description)
-publish_cmdline(writer_name='html-base', description=description)
+publish_cmdline(writer_name='html5', description=description)
Modified: trunk/docutils/tools/rst2xetex.py
===================================================================
--- trunk/docutils/tools/rst2xetex.py 2015-03-17 17:11:15 UTC (rev 7846)
+++ trunk/docutils/tools/rst2xetex.py 2015-03-17 17:30:47 UTC (rev 7847)
@@ -5,7 +5,7 @@
# Copyright: This module has been placed in the public domain.
"""
-A minimal front end to the Docutils Publisher, producing XeLaTeX source code.
+A minimal front end to the Docutils Publisher, producing Lua/XeLaTeX code.
"""
try:
@@ -16,8 +16,9 @@
from docutils.core import publish_cmdline
-description = ('Generates XeLaTeX documents from standalone reStructuredText '
- 'sources. '
+description = ('Generates LaTeX documents from standalone reStructuredText '
+ 'sources for compilation with the Unicode-aware TeX variants '
+ 'XeLaTeX or LuaLaTeX. '
'Reads from <source> (default is stdin) and writes to '
'<destination> (default is stdout). See '
'<http://docutils.sourceforge.net/docs/user/latex.html> for '
Modified: trunk/docutils/tools/rst2xhtml11.py
===================================================================
--- trunk/docutils/tools/rst2xhtml11.py 2015-03-17 17:11:15 UTC (rev 7846)
+++ trunk/docutils/tools/rst2xhtml11.py 2015-03-17 17:30:47 UTC (rev 7847)
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf8 -*-
-# :Copyright: © 2005, 2009 Günter Milde.
+# :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,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2015-03-19 09:22:18
|
Revision: 7848
http://sourceforge.net/p/docutils/code/7848
Author: milde
Date: 2015-03-19 09:22:15 +0000 (Thu, 19 Mar 2015)
Log Message:
-----------
Cleaner LaTeX code for literal blocks (use "alltt" environment).
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/docutils/writers/latex2e/__init__.py
trunk/docutils/test/functional/expected/standalone_rst_latex.tex
trunk/docutils/test/functional/expected/standalone_rst_xetex.tex
trunk/docutils/test/test_writers/test_latex2e.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2015-03-17 17:30:47 UTC (rev 7847)
+++ trunk/docutils/HISTORY.txt 2015-03-19 09:22:15 UTC (rev 7848)
@@ -54,29 +54,28 @@
``default_stylesheet_path`` and ``default_template_path``.
- Fix [ 266 ] creating labels/class values in description list items.
-* docutils/writers/xhtml11/
+* docutils/writers/latex2e/__init__.py
- - New HTML writer generating `XHTML 1.1`_ styled with CSS2.1
- Moved to the docutils core from sandbox/html4strict.
+ - Fix [ 262 ] Use ``\linewidth`` instead of ``\textwidth`` for figures,
+ admonitions and docinfo.
-* docutils/writers/latex2e/__init__.py
-
- Use absolute path for ``default_template_path``.
- Removed deprecated options ``--use-latex-footnotes`` and
``--figure-footnotes``.
- - Cleaner LaTeX code for enumerations.
+ - Cleaner LaTeX code for enumerations and literal blocks.
* docutils/writers/odf_odt/__init__.py
- remove decode.encode of filename stored in zip.
-* docutils/writers/latex2e/__init__.py
+* docutils/writers/xhtml11/
- - Fix [ 262 ] Use ``\linewidth`` instead of ``\textwidth`` for figures,
- admonitions and docinfo.
+ - New HTML writer generating `XHTML 1.1`_ styled with CSS2.1
+ Moved to the docutils core from sandbox/html4strict.
+
* tools/
- New front-ends ``rst2xhtml.py`` and ``rst2html5.py`` for the
Modified: trunk/docutils/docutils/writers/latex2e/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/latex2e/__init__.py 2015-03-17 17:30:47 UTC (rev 7847)
+++ trunk/docutils/docutils/writers/latex2e/__init__.py 2015-03-19 09:22:15 UTC (rev 7848)
@@ -692,7 +692,13 @@
class CharMaps(object):
"""LaTeX representations for active and Unicode characters."""
- # characters that always need escaping:
+ # characters that need escaping even in `alltt` environments:
+ alltt = {
+ ord('\\'): ur'\textbackslash{}',
+ ord('{'): ur'\{',
+ ord('}'): ur'\}',
+ }
+ # characters that normally need escaping:
special = {
ord('#'): ur'\#',
ord('$'): ur'\$',
@@ -701,9 +707,6 @@
ord('~'): ur'\textasciitilde{}',
ord('_'): ur'\_',
ord('^'): ur'\textasciicircum{}',
- ord('\\'): ur'\textbackslash{}',
- ord('{'): ur'\{',
- ord('}'): ur'\}',
# straight double quotes are 'active' in many languages
ord('"'): ur'\textquotedbl{}',
# Square brackets are ordinary chars and cannot be escaped with '\',
@@ -1123,8 +1126,8 @@
insert_non_breaking_blanks = False # replace blanks by "~"
insert_newline = False # add latex newline commands
literal = False # literal text (block or inline)
+ alltt = False # inside `alltt` environment
-
def __init__(self, document, babel_class=Babel):
nodes.NodeVisitor.__init__(self, document)
# Reporter
@@ -1418,16 +1421,17 @@
def encode(self, text):
"""Return text with 'problematic' characters escaped.
- * Escape the ten special printing characters ``# $ % & ~ _ ^ \ { }``,
+ * Escape the special printing characters ``# $ % & ~ _ ^ \ { }``,
square brackets ``[ ]``, double quotes and (in OT1) ``< | >``.
* Translate non-supported Unicode characters.
* Separate ``-`` (and more in literal text) to prevent input ligatures.
"""
if self.verbatim:
return text
-
# Set up the translation table:
- table = CharMaps.special.copy()
+ table = CharMaps.alltt.copy()
+ if not self.alltt:
+ table.update(CharMaps.special)
# keep the underscore in citation references
if self.inside_citation_reference_label:
del(table[ord('_')])
@@ -1825,7 +1829,7 @@
raise nodes.SkipNode
self.out.append('\\textbf{%s}: &\n\t' % self.language_label(name))
if name == 'address':
- self.insert_newline = 1
+ self.insert_newline = True
self.out.append('{\\raggedright\n')
self.context.append(' } \\\\\n')
else:
@@ -2027,7 +2031,7 @@
) + self.section_enumerator_separator
if self._enumeration_counters:
prefix += self._enumeration_counters[-1]
- # TODO: use LaTeX default for unspecified label-type?
+ # TODO: use LaTeX default for unspecified label-type?
# (needs change of parser)
prefix += node.get('prefix', '')
enumtype = types[node.get('enumtype' '')]
@@ -2403,7 +2407,8 @@
def visit_literal_block(self, node):
"""Render a literal block."""
# environments and packages to typeset literal blocks
- packages = {'listing': r'\usepackage{moreverb}',
+ packages = {'alltt': r'\usepackage{alltt}',
+ 'listing': r'\usepackage{moreverb}',
'lstlisting': r'\usepackage{listings}',
'Verbatim': r'\usepackage{fancyvrb}',
# 'verbatim': '',
@@ -2413,37 +2418,33 @@
# no quote inside tables, to avoid vertical space between
# table border and literal block.
# BUG: fails if normal text precedes the literal block.
- self.out.append('%\n\\begin{quote}')
+ self.out.append('%\n\\begin{quote}\n')
self.context.append('\n\\end{quote}\n')
else:
self.out.append('\n')
self.context.append('\n')
if self.literal_block_env != '' and self.is_plaintext(node):
- self.requirements['literal_block'] = packages.get(
- self.literal_block_env, '')
+ environment = self.literal_block_env
self.verbatim = True
- self.out.append('\\begin{%s}%s\n' % (self.literal_block_env,
- self.literal_block_options))
else:
- self.literal = True
- self.insert_newline = True
- self.insert_non_breaking_blanks = True
- if 'code' in node['classes'] and (
- self.settings.syntax_highlight != 'none'):
+ environment = 'alltt'
+ self.alltt = True
+ if ('code' in node['classes']
+ and self.settings.syntax_highlight != 'none'):
self.requirements['color'] = PreambleCmds.color
self.fallbacks['code'] = PreambleCmds.highlight_rules
- self.out.append('{\\ttfamily \\raggedright \\noindent\n')
+ self.requirements['literal_block'] = packages.get(environment, '')
+ self.out.append('\\begin{%s}%s\n' %
+ (environment, self.literal_block_options))
+ self.context.append('\n\\end{%s}' % environment)
+
+
def depart_literal_block(self, node):
- if self.verbatim:
- self.out.append('\n\\end{%s}\n' % self.literal_block_env)
- self.verbatim = False
- else:
- self.out.append('\n}')
- self.insert_non_breaking_blanks = False
- self.insert_newline = False
- self.literal = False
+ self.verbatim = False
+ self.alltt = False
self.out.append(self.context.pop())
+ self.out.append(self.context.pop())
## def visit_meta(self, node):
## self.out.append('[visit_meta]\n')
@@ -2470,7 +2471,10 @@
if node.get('ids'):
math_code = '\n'.join([math_code] + self.ids_to_labels(node))
if math_env == '$':
- wrapper = u'$%s$'
+ if self.alltt:
+ wrapper = u'\(%s\)'
+ else:
+ wrapper = u'$%s$'
else:
wrapper = u'\n'.join(['%%',
r'\begin{%s}' % math_env,
Modified: trunk/docutils/test/functional/expected/standalone_rst_latex.tex
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_latex.tex 2015-03-17 17:30:47 UTC (rev 7847)
+++ trunk/docutils/test/functional/expected/standalone_rst_latex.tex 2015-03-19 09:22:15 UTC (rev 7848)
@@ -14,6 +14,7 @@
\usepackage{float} % float configuration
\floatplacement{figure}{H} % place figures here definitely
\usepackage{graphicx}
+\usepackage{alltt}
\usepackage{multirow}
\usepackage{pifont}
\setcounter{secnumdepth}{0}
@@ -567,21 +568,23 @@
Literal blocks are indicated with a double-colon (“::”) at the end of
the preceding paragraph (over there \texttt{-{}->}). They can be indented:
%
-\begin{quote}{\ttfamily \raggedright \noindent
-if~literal\_block:\\
-~~~~text~=~'is~left~as-is'\\
-~~~~spaces\_and\_linebreaks~=~'are~preserved'\\
-~~~~markup\_processing~=~None
-}
+\begin{quote}
+\begin{alltt}
+if literal_block:
+ text = 'is left as-is'
+ spaces_and_linebreaks = 'are preserved'
+ markup_processing = None
+\end{alltt}
\end{quote}
Or they can be quoted without indentation:
%
-\begin{quote}{\ttfamily \raggedright \noindent
->{}>~Great~idea!\\
->\\
->~Why~didn't~I~think~of~that?
-}
+\begin{quote}
+\begin{alltt}
+>> Great idea!
+>
+> Why didn't I think of that?
+\end{alltt}
\end{quote}
@@ -717,12 +720,13 @@
\label{doctest-blocks}%
}
%
-\begin{quote}{\ttfamily \raggedright \noindent
->{}>{}>~print~'Python-specific~usage~examples;~begun~with~\textquotedbl{}>{}>{}>\textquotedbl{}'\\
-Python-specific~usage~examples;~begun~with~\textquotedbl{}>{}>{}>\textquotedbl{}\\
->{}>{}>~print~'(cut~and~pasted~from~interactive~Python~sessions)'\\
-(cut~and~pasted~from~interactive~Python~sessions)
-}
+\begin{quote}
+\begin{alltt}
+>>> print 'Python-specific usage examples; begun with ">>>"'
+Python-specific usage examples; begun with ">>>"
+>>> print '(cut and pasted from interactive Python sessions)'
+(cut and pasted from interactive Python sessions)
+\end{alltt}
\end{quote}
@@ -1150,18 +1154,20 @@
Compound 2, a literal block:
%
-\begin{quote}{\ttfamily \raggedright \noindent
-Compound~2,~literal.
-}
+\begin{quote}
+\begin{alltt}
+Compound 2, literal.
+\end{alltt}
\end{quote}
Compound 2, this is a test.
Compound 3, only consisting of one paragraph.
%
-\begin{quote}{\ttfamily \raggedright \noindent
-Compound~4.\\
-This~one~starts~with~a~literal~block.
-}
+\begin{quote}
+\begin{alltt}
+Compound 4.
+This one starts with a literal block.
+\end{alltt}
\end{quote}
Compound 4, a paragraph.
@@ -1211,14 +1217,15 @@
\label{parsed-literal-blocks}%
}
%
-\begin{quote}{\ttfamily \raggedright \noindent
-This~is~a~parsed~literal~block.\\
-~~~~This~line~is~indented.~~The~next~line~is~blank.\\
-~\\
-Inline~markup~is~supported,~e.g.~\emph{emphasis},~\textbf{strong},~\texttt{literal\\
-text},~footnotes\DUfootnotemark{id22}{id8}{1},~%
-\phantomsection\label{hyperlink-targets}hyperlink~targets,~and~\href{http://www.python.org/}{references}.
-}
+\begin{quote}
+\begin{alltt}
+This is a parsed literal block.
+ This line is indented. The next line is blank.
+
+Inline markup is supported, e.g. \emph{emphasis}, \textbf{strong}, \texttt{literal
+text}, footnotes\DUfootnotemark{id22}{id8}{1}, %
+\phantomsection\label{hyperlink-targets}hyperlink targets, and \href{http://www.python.org/}{references}.
+\end{alltt}
\end{quote}
@@ -1233,19 +1240,21 @@
conversions in order to get identical results with/without installed
Pygments highlighter.)
%
-\begin{quote}{\ttfamily \raggedright \noindent
-print~'This~is~Python~code.'
-}
+\begin{quote}
+\begin{alltt}
+print 'This is Python code.'
+\end{alltt}
\end{quote}
The \texttt{:number-lines:} option (with optional start value) generates line
numbers:
%
-\begin{quote}{\ttfamily \raggedright \noindent
-\DUrole{ln}{~8~}\#~print~integers~from~0~to~9:\\
-\DUrole{ln}{~9~}for~i~in~range(10):\\
-\DUrole{ln}{10~}~~~~print~i
-}
+\begin{quote}
+\begin{alltt}
+\DUrole{ln}{ 8 }# print integers from 0 to 9:
+\DUrole{ln}{ 9 }for i in range(10):
+\DUrole{ln}{10 } print i
+\end{alltt}
\end{quote}
For inline code snippets, there is the \DUroletitlereference{code} role, which can be used
@@ -1259,10 +1268,11 @@
The \texttt{:code:} option of the \DUroletitlereference{include} directive sets the included content
as a code block, here the rst file \texttt{header\_footer.txt} with line numbers:
%
-\begin{quote}{\ttfamily \raggedright \noindent
-\DUrole{ln}{1~}..~header::~Document~header\\
-\DUrole{ln}{2~}..~footer::~Document~footer
-}
+\begin{quote}
+\begin{alltt}
+\DUrole{ln}{1 }.. header:: Document header
+\DUrole{ln}{2 }.. footer:: Document footer
+\end{alltt}
\end{quote}
@@ -1490,14 +1500,15 @@
The following works in most browsers but does not validate
(\texttt{<style>} is only allowed in the document head):
%
-\begin{quote}{\ttfamily \raggedright \noindent
-..~raw::~html\\
-~\\
-~~<style~type=\textquotedbl{}text/css\textquotedbl{}><!-{}-\\
-~~~.green~\{color:~green;\}\\
-~~~.sc~\{font-variant:~small-caps;\}\\
-~~~-{}-></style>
-}
+\begin{quote}
+\begin{alltt}
+.. raw:: html
+
+ <style type="text/css"><!-{}-
+ .green \{color: green;\}
+ .sc \{font-variant: small-caps;\}
+ -{}-></style>
+\end{alltt}
\end{quote}
\DUrole{green}{\DUrole{sc}{\foreignlanguage{british}{British colourful text in small-caps}}}.
@@ -2232,11 +2243,12 @@
(some have an Euro sign at its place). You might see an error
like:
%
-\begin{quote}{\ttfamily \raggedright \noindent
-!~Package~textcomp~Error:~Symbol~\textbackslash{}textcurrency~not~provided~by\\
-(textcomp)~~~~~~~~~~~~~~~~font~family~ptm~in~TS1~encoding.\\
-(textcomp)~~~~~~~~~~~~~~~~Default~family~used~instead.
-}
+\begin{quote}
+\begin{alltt}
+! Package textcomp Error: Symbol \textbackslash{}textcurrency not provided by
+(textcomp) font family ptm in TS1 encoding.
+(textcomp) Default family used instead.
+\end{alltt}
\end{quote}
(which in case of font family ptm is a false positive). Add either
@@ -2277,9 +2289,10 @@
The special chars verbatim:
%
-\begin{quote}{\ttfamily \raggedright \noindent
-\#~\$~\%~\&~\textasciitilde{}~\_~\textasciicircum{}~\textbackslash{}~\{~\}
-}
+\begin{quote}
+\begin{alltt}
+# $ % & ~ _ ^ \textbackslash{} \{ \}
+\end{alltt}
\end{quote}
However also \emph{square brackets} {[}{]} need special care.
@@ -2319,9 +2332,10 @@
The OT1 font-encoding has different characters for the less-than,
greater-than and bar, < | >, except for typewriter font \DUroletitlereference{cmtt}:
%
-\begin{quote}{\ttfamily \raggedright \noindent
-<~|~>
-}
+\begin{quote}
+\begin{alltt}
+< | >
+\end{alltt}
\end{quote}
@@ -2439,10 +2453,11 @@
\item Unbalanced braces, \{ or \}, will fail (both with href and url):
%
-\begin{quote}{\ttfamily \raggedright \noindent
-`file~with~\{~<../strange\{name>`\_\_\\
-`<../strange\{name>`\_\_
-}
+\begin{quote}
+\begin{alltt}
+`file with \{ <../strange\{name>`__
+`<../strange\{name>`__
+\end{alltt}
\end{quote}
while balanced braces are suported:
Modified: trunk/docutils/test/functional/expected/standalone_rst_xetex.tex
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_xetex.tex 2015-03-17 17:30:47 UTC (rev 7847)
+++ trunk/docutils/test/functional/expected/standalone_rst_xetex.tex 2015-03-19 09:22:15 UTC (rev 7848)
@@ -12,6 +12,7 @@
\usepackage{float} % float configuration
\floatplacement{figure}{H} % place figures here definitely
\usepackage{graphicx}
+\usepackage{alltt}
\usepackage{multirow}
\setcounter{secnumdepth}{0}
\usepackage{longtable,ltcaption,array}
@@ -566,21 +567,23 @@
Literal blocks are indicated with a double-colon (“::”) at the end of
the preceding paragraph (over there \texttt{-->}). They can be indented:
%
-\begin{quote}{\ttfamily \raggedright \noindent
-if~literal\_block:\\
-~~~~text~=~'is~left~as-is'\\
-~~~~spaces\_and\_linebreaks~=~'are~preserved'\\
-~~~~markup\_processing~=~None
-}
+\begin{quote}
+\begin{alltt}
+if literal_block:
+ text = 'is left as-is'
+ spaces_and_linebreaks = 'are preserved'
+ markup_processing = None
+\end{alltt}
\end{quote}
Or they can be quoted without indentation:
%
-\begin{quote}{\ttfamily \raggedright \noindent
->>~Great~idea!\\
->\\
->~Why~didn't~I~think~of~that?
-}
+\begin{quote}
+\begin{alltt}
+>> Great idea!
+>
+> Why didn't I think of that?
+\end{alltt}
\end{quote}
@@ -716,12 +719,13 @@
\label{doctest-blocks}%
}
%
-\begin{quote}{\ttfamily \raggedright \noindent
->>>~print~'Python-specific~usage~examples;~begun~with~\textquotedbl{}>>>\textquotedbl{}'\\
-Python-specific~usage~examples;~begun~with~\textquotedbl{}>>>\textquotedbl{}\\
->>>~print~'(cut~and~pasted~from~interactive~Python~sessions)'\\
-(cut~and~pasted~from~interactive~Python~sessions)
-}
+\begin{quote}
+\begin{alltt}
+>>> print 'Python-specific usage examples; begun with ">>>"'
+Python-specific usage examples; begun with ">>>"
+>>> print '(cut and pasted from interactive Python sessions)'
+(cut and pasted from interactive Python sessions)
+\end{alltt}
\end{quote}
@@ -1149,18 +1153,20 @@
Compound 2, a literal block:
%
-\begin{quote}{\ttfamily \raggedright \noindent
-Compound~2,~literal.
-}
+\begin{quote}
+\begin{alltt}
+Compound 2, literal.
+\end{alltt}
\end{quote}
Compound 2, this is a test.
Compound 3, only consisting of one paragraph.
%
-\begin{quote}{\ttfamily \raggedright \noindent
-Compound~4.\\
-This~one~starts~with~a~literal~block.
-}
+\begin{quote}
+\begin{alltt}
+Compound 4.
+This one starts with a literal block.
+\end{alltt}
\end{quote}
Compound 4, a paragraph.
@@ -1210,14 +1216,15 @@
\label{parsed-literal-blocks}%
}
%
-\begin{quote}{\ttfamily \raggedright \noindent
-This~is~a~parsed~literal~block.\\
-~~~~This~line~is~indented.~~The~next~line~is~blank.\\
-~\\
-Inline~markup~is~supported,~e.g.~\emph{emphasis},~\textbf{strong},~\texttt{literal\\
-text},~footnotes\DUfootnotemark{id22}{id8}{1},~%
-\phantomsection\label{hyperlink-targets}hyperlink~targets,~and~\href{http://www.python.org/}{references}.
-}
+\begin{quote}
+\begin{alltt}
+This is a parsed literal block.
+ This line is indented. The next line is blank.
+
+Inline markup is supported, e.g. \emph{emphasis}, \textbf{strong}, \texttt{literal
+text}, footnotes\DUfootnotemark{id22}{id8}{1}, %
+\phantomsection\label{hyperlink-targets}hyperlink targets, and \href{http://www.python.org/}{references}.
+\end{alltt}
\end{quote}
@@ -1232,19 +1239,21 @@
conversions in order to get identical results with/without installed
Pygments highlighter.)
%
-\begin{quote}{\ttfamily \raggedright \noindent
-print~'This~is~Python~code.'
-}
+\begin{quote}
+\begin{alltt}
+print 'This is Python code.'
+\end{alltt}
\end{quote}
The \texttt{:number-lines:} option (with optional start value) generates line
numbers:
%
-\begin{quote}{\ttfamily \raggedright \noindent
-\DUrole{ln}{~8~}\#~print~integers~from~0~to~9:\\
-\DUrole{ln}{~9~}for~i~in~range(10):\\
-\DUrole{ln}{10~}~~~~print~i
-}
+\begin{quote}
+\begin{alltt}
+\DUrole{ln}{ 8 }# print integers from 0 to 9:
+\DUrole{ln}{ 9 }for i in range(10):
+\DUrole{ln}{10 } print i
+\end{alltt}
\end{quote}
For inline code snippets, there is the \DUroletitlereference{code} role, which can be used
@@ -1258,10 +1267,11 @@
The \texttt{:code:} option of the \DUroletitlereference{include} directive sets the included content
as a code block, here the rst file \texttt{header\_footer.txt} with line numbers:
%
-\begin{quote}{\ttfamily \raggedright \noindent
-\DUrole{ln}{1~}..~header::~Document~header\\
-\DUrole{ln}{2~}..~footer::~Document~footer
-}
+\begin{quote}
+\begin{alltt}
+\DUrole{ln}{1 }.. header:: Document header
+\DUrole{ln}{2 }.. footer:: Document footer
+\end{alltt}
\end{quote}
@@ -1489,14 +1499,15 @@
The following works in most browsers but does not validate
(\texttt{<style>} is only allowed in the document head):
%
-\begin{quote}{\ttfamily \raggedright \noindent
-..~raw::~html\\
-~\\
-~~<style~type=\textquotedbl{}text/css\textquotedbl{}><!--\\
-~~~.green~\{color:~green;\}\\
-~~~.sc~\{font-variant:~small-caps;\}\\
-~~~--></style>
-}
+\begin{quote}
+\begin{alltt}
+.. raw:: html
+
+ <style type="text/css"><!--
+ .green \{color: green;\}
+ .sc \{font-variant: small-caps;\}
+ --></style>
+\end{alltt}
\end{quote}
\DUrole{green}{\DUrole{sc}{\foreignlanguage{british}{British colourful text in small-caps}}}.
@@ -2000,11 +2011,12 @@
(some have an Euro sign at its place). You might see an error
like:
%
-\begin{quote}{\ttfamily \raggedright \noindent
-!~Package~textcomp~Error:~Symbol~\textbackslash{}textcurrency~not~provided~by\\
-(textcomp)~~~~~~~~~~~~~~~~font~family~ptm~in~TS1~encoding.\\
-(textcomp)~~~~~~~~~~~~~~~~Default~family~used~instead.
-}
+\begin{quote}
+\begin{alltt}
+! Package textcomp Error: Symbol \textbackslash{}textcurrency not provided by
+(textcomp) font family ptm in TS1 encoding.
+(textcomp) Default family used instead.
+\end{alltt}
\end{quote}
(which in case of font family ptm is a false positive). Add either
@@ -2045,9 +2057,10 @@
The special chars verbatim:
%
-\begin{quote}{\ttfamily \raggedright \noindent
-\#~\$~\%~\&~\textasciitilde{}~\_~\textasciicircum{}~\textbackslash{}~\{~\}
-}
+\begin{quote}
+\begin{alltt}
+# $ % & ~ _ ^ \textbackslash{} \{ \}
+\end{alltt}
\end{quote}
However also \emph{square brackets} {[}{]} need special care.
@@ -2087,9 +2100,10 @@
The OT1 font-encoding has different characters for the less-than,
greater-than and bar, < | >, except for typewriter font \DUroletitlereference{cmtt}:
%
-\begin{quote}{\ttfamily \raggedright \noindent
-<~|~>
-}
+\begin{quote}
+\begin{alltt}
+< | >
+\end{alltt}
\end{quote}
@@ -2207,10 +2221,11 @@
\item Unbalanced braces, \{ or \}, will fail (both with href and url):
%
-\begin{quote}{\ttfamily \raggedright \noindent
-`file~with~\{~<../strange\{name>`\_\_\\
-`<../strange\{name>`\_\_
-}
+\begin{quote}
+\begin{alltt}
+`file with \{ <../strange\{name>`__
+`<../strange\{name>`__
+\end{alltt}
\end{quote}
while balanced braces are suported:
Modified: trunk/docutils/test/test_writers/test_latex2e.py
===================================================================
--- trunk/docutils/test/test_writers/test_latex2e.py 2015-03-17 17:30:47 UTC (rev 7847)
+++ trunk/docutils/test/test_writers/test_latex2e.py 2015-03-19 09:22:15 UTC (rev 7848)
@@ -104,6 +104,12 @@
r"""\usepackage{textcomp} % text symbol macros
"""))
+head_alltt = head_template.substitute(
+ dict(parts, requirements = parts['requirements'] +
+r"""\usepackage{alltt}
+"""))
+
+
totest = {}
totest_latex_toc = {}
totest_latex_sectnum = {}
@@ -500,23 +506,38 @@
totest['bracket_protection'] = [
# input
+["""
+* [no option] to this item
+""",
+head + r"""%
+\begin{itemize}
+
+\item {[}no option{]} to this item
+
+\end{itemize}
+
+\end{document}
+"""],
+]
+
+totest['literal_block'] = [
+# input
["""\
-::
+Test special characters { [ \\\\ ] } in literal block::
- something before to get a end of line.
- [
+ { [ ( \macro
- the empty line gets tested too
- ]
+ } ] )
""",
-head + r"""%
-\begin{quote}{\ttfamily \raggedright \noindent
-something~before~to~get~a~end~of~line.\\
-{[}\\
-~\\
-the~empty~line~gets~tested~too\\
-{]}
-}
+head_alltt + r"""
+Test special characters \{ {[} \textbackslash{} {]} \} in literal block:
+%
+\begin{quote}
+\begin{alltt}
+\{ [ ( \textbackslash{}macro
+
+\} ] )
+\end{alltt}
\end{quote}
\end{document}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2015-03-19 15:55:01
|
Revision: 7849
http://sourceforge.net/p/docutils/code/7849
Author: milde
Date: 2015-03-19 15:54:58 +0000 (Thu, 19 Mar 2015)
Log Message:
-----------
Fix the latest latex writer patch: no "alltt" in parsed literal blocks.
More inline markup examples for functional test of parsed literal blocks.
Modified Paths:
--------------
trunk/docutils/docutils/writers/latex2e/__init__.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_latex.tex
trunk/docutils/test/functional/expected/standalone_rst_pseudoxml.txt
trunk/docutils/test/functional/expected/standalone_rst_xetex.tex
trunk/docutils/test/functional/expected/standalone_rst_xhtml11.xhtml
trunk/docutils/test/functional/input/data/latex_encoding.txt
trunk/docutils/test/functional/input/data/standard.txt
Modified: trunk/docutils/docutils/writers/latex2e/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/latex2e/__init__.py 2015-03-19 09:22:15 UTC (rev 7848)
+++ trunk/docutils/docutils/writers/latex2e/__init__.py 2015-03-19 15:54:58 UTC (rev 7849)
@@ -1151,7 +1151,7 @@
self.section_enumerator_separator = (
settings.section_enumerator_separator.replace('_', r'\_'))
# literal blocks:
- self.literal_block_env = ''
+ self.literal_block_env = 'alltt'
self.literal_block_options = ''
if settings.literal_block_env != '':
(none,
@@ -2417,30 +2417,39 @@
if not self.active_table.is_open():
# no quote inside tables, to avoid vertical space between
# table border and literal block.
- # BUG: fails if normal text precedes the literal block.
+ # TODO: fails if normal text precedes the literal block.
+ # check parent node instead?
self.out.append('%\n\\begin{quote}\n')
self.context.append('\n\\end{quote}\n')
else:
self.out.append('\n')
self.context.append('\n')
- if self.literal_block_env != '' and self.is_plaintext(node):
+
+ if self.is_plaintext(node):
environment = self.literal_block_env
- self.verbatim = True
+ self.requirements['literal_block'] = packages.get(environment, '')
+ if environment == 'alltt':
+ self.alltt = True
+ else:
+ self.verbatim = True
+ self.out.append('\\begin{%s}%s\n' %
+ (environment, self.literal_block_options))
+ self.context.append('\n\\end{%s}' % environment)
else:
- environment = 'alltt'
- self.alltt = True
- if ('code' in node['classes']
- and self.settings.syntax_highlight != 'none'):
+ self.literal = True
+ self.insert_newline = True
+ self.insert_non_breaking_blanks = True
+ if 'code' in node['classes'] and (
+ self.settings.syntax_highlight != 'none'):
self.requirements['color'] = PreambleCmds.color
self.fallbacks['code'] = PreambleCmds.highlight_rules
+ self.out.append('{\\ttfamily \\raggedright \\noindent\n')
+ self.context.append('\n}')
- self.requirements['literal_block'] = packages.get(environment, '')
- self.out.append('\\begin{%s}%s\n' %
- (environment, self.literal_block_options))
- self.context.append('\n\\end{%s}' % environment)
-
-
def depart_literal_block(self, node):
+ self.insert_non_breaking_blanks = False
+ self.insert_newline = False
+ self.literal = False
self.verbatim = False
self.alltt = False
self.out.append(self.context.pop())
Modified: trunk/docutils/test/functional/expected/standalone_rst_html4css1.html
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_html4css1.html 2015-03-19 09:22:15 UTC (rev 7848)
+++ trunk/docutils/test/functional/expected/standalone_rst_html4css1.html 2015-03-19 15:54:58 UTC (rev 7849)
@@ -836,7 +836,9 @@
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>, 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>.
+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>.
</pre>
</div>
<div class="section" id="code">
Modified: trunk/docutils/test/functional/expected/standalone_rst_html_base.html
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_html_base.html 2015-03-19 09:22:15 UTC (rev 7848)
+++ trunk/docutils/test/functional/expected/standalone_rst_html_base.html 2015-03-19 15:54:58 UTC (rev 7849)
@@ -811,7 +811,9 @@
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>, 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>
+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>
</div>
<div class="section" id="code">
<h3><a class="toc-backref" href="#id95"><span class="sectnum">2.14.9</span> Code</a></h3>
Modified: trunk/docutils/test/functional/expected/standalone_rst_latex.tex
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_latex.tex 2015-03-19 09:22:15 UTC (rev 7848)
+++ trunk/docutils/test/functional/expected/standalone_rst_latex.tex 2015-03-19 15:54:58 UTC (rev 7849)
@@ -1218,14 +1218,16 @@
}
%
\begin{quote}
-\begin{alltt}
-This is a parsed literal block.
- This line is indented. The next line is blank.
-
-Inline markup is supported, e.g. \emph{emphasis}, \textbf{strong}, \texttt{literal
-text}, footnotes\DUfootnotemark{id22}{id8}{1}, %
-\phantomsection\label{hyperlink-targets}hyperlink targets, and \href{http://www.python.org/}{references}.
-\end{alltt}
+{\ttfamily \raggedright \noindent
+This~is~a~parsed~literal~block.\\
+~~~~This~line~is~indented.~~The~next~line~is~blank.\\
+~\\
+Inline~markup~is~supported,~e.g.~\emph{emphasis},~\textbf{strong},~\texttt{literal\\
+text},~\textsubscript{sub-}~and~\textsuperscript{super}scripts,\\
+inline~formulas:~$A = 2 \pi r^2$,\\
+footnotes\DUfootnotemark{id22}{id8}{1},~%
+\phantomsection\label{hyperlink-targets}hyperlink~targets,~and~\href{http://www.python.org/}{references}.
+}
\end{quote}
@@ -1250,11 +1252,11 @@
numbers:
%
\begin{quote}
-\begin{alltt}
-\DUrole{ln}{ 8 }# print integers from 0 to 9:
-\DUrole{ln}{ 9 }for i in range(10):
-\DUrole{ln}{10 } print i
-\end{alltt}
+{\ttfamily \raggedright \noindent
+\DUrole{ln}{~8~}\#~print~integers~from~0~to~9:\\
+\DUrole{ln}{~9~}for~i~in~range(10):\\
+\DUrole{ln}{10~}~~~~print~i
+}
\end{quote}
For inline code snippets, there is the \DUroletitlereference{code} role, which can be used
@@ -1269,10 +1271,10 @@
as a code block, here the rst file \texttt{header\_footer.txt} with line numbers:
%
\begin{quote}
-\begin{alltt}
-\DUrole{ln}{1 }.. header:: Document header
-\DUrole{ln}{2 }.. footer:: Document footer
-\end{alltt}
+{\ttfamily \raggedright \noindent
+\DUrole{ln}{1~}..~header::~Document~header\\
+\DUrole{ln}{2~}..~footer::~Document~footer
+}
\end{quote}
@@ -2299,7 +2301,7 @@
%
\begin{quote}
-item and all the other commands with optional arguments check
+Commands with optional arguments (e.g. \texttt{\textbackslash{}item}) check
if the token right after the macro name is an opening bracket.
In that case the contents between that bracket and the following
closing bracket on the same grouping level are taken as the
Modified: trunk/docutils/test/functional/expected/standalone_rst_pseudoxml.txt
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_pseudoxml.txt 2015-03-19 09:22:15 UTC (rev 7848)
+++ trunk/docutils/test/functional/expected/standalone_rst_pseudoxml.txt 2015-03-19 15:54:58 UTC (rev 7849)
@@ -1607,7 +1607,18 @@
<literal>
literal
text
- , footnotes
+ ,
+ <subscript>
+ sub-
+ and
+ <superscript>
+ super
+ scripts,
+ inline formulas:
+ <math>
+ A = 2 \pi r^2
+ ,
+ footnotes
<footnote_reference ids="id22" refid="id8">
1
,
Modified: trunk/docutils/test/functional/expected/standalone_rst_xetex.tex
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_xetex.tex 2015-03-19 09:22:15 UTC (rev 7848)
+++ trunk/docutils/test/functional/expected/standalone_rst_xetex.tex 2015-03-19 15:54:58 UTC (rev 7849)
@@ -1217,14 +1217,16 @@
}
%
\begin{quote}
-\begin{alltt}
-This is a parsed literal block.
- This line is indented. The next line is blank.
-
-Inline markup is supported, e.g. \emph{emphasis}, \textbf{strong}, \texttt{literal
-text}, footnotes\DUfootnotemark{id22}{id8}{1}, %
-\phantomsection\label{hyperlink-targets}hyperlink targets, and \href{http://www.python.org/}{references}.
-\end{alltt}
+{\ttfamily \raggedright \noindent
+This~is~a~parsed~literal~block.\\
+~~~~This~line~is~indented.~~The~next~line~is~blank.\\
+~\\
+Inline~markup~is~supported,~e.g.~\emph{emphasis},~\textbf{strong},~\texttt{literal\\
+text},~\textsubscript{sub-}~and~\textsuperscript{super}scripts,\\
+inline~formulas:~$A = 2 \pi r^2$,\\
+footnotes\DUfootnotemark{id22}{id8}{1},~%
+\phantomsection\label{hyperlink-targets}hyperlink~targets,~and~\href{http://www.python.org/}{references}.
+}
\end{quote}
@@ -1249,11 +1251,11 @@
numbers:
%
\begin{quote}
-\begin{alltt}
-\DUrole{ln}{ 8 }# print integers from 0 to 9:
-\DUrole{ln}{ 9 }for i in range(10):
-\DUrole{ln}{10 } print i
-\end{alltt}
+{\ttfamily \raggedright \noindent
+\DUrole{ln}{~8~}\#~print~integers~from~0~to~9:\\
+\DUrole{ln}{~9~}for~i~in~range(10):\\
+\DUrole{ln}{10~}~~~~print~i
+}
\end{quote}
For inline code snippets, there is the \DUroletitlereference{code} role, which can be used
@@ -1268,10 +1270,10 @@
as a code block, here the rst file \texttt{header\_footer.txt} with line numbers:
%
\begin{quote}
-\begin{alltt}
-\DUrole{ln}{1 }.. header:: Document header
-\DUrole{ln}{2 }.. footer:: Document footer
-\end{alltt}
+{\ttfamily \raggedright \noindent
+\DUrole{ln}{1~}..~header::~Document~header\\
+\DUrole{ln}{2~}..~footer::~Document~footer
+}
\end{quote}
@@ -2067,7 +2069,7 @@
%
\begin{quote}
-item and all the other commands with optional arguments check
+Commands with optional arguments (e.g. \texttt{\textbackslash{}item}) check
if the token right after the macro name is an opening bracket.
In that case the contents between that bracket and the following
closing bracket on the same grouping level are taken as the
Modified: trunk/docutils/test/functional/expected/standalone_rst_xhtml11.xhtml
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_xhtml11.xhtml 2015-03-19 09:22:15 UTC (rev 7848)
+++ trunk/docutils/test/functional/expected/standalone_rst_xhtml11.xhtml 2015-03-19 15:54:58 UTC (rev 7849)
@@ -813,7 +813,10 @@
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>, 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>
+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>
</div>
<div class="section" id="code">
<h3><a class="toc-backref" href="#id96"><span class="sectnum">2.14.9</span> Code</a></h3>
Modified: trunk/docutils/test/functional/input/data/latex_encoding.txt
===================================================================
--- trunk/docutils/test/functional/input/data/latex_encoding.txt 2015-03-19 09:22:15 UTC (rev 7848)
+++ trunk/docutils/test/functional/input/data/latex_encoding.txt 2015-03-19 15:54:58 UTC (rev 7849)
@@ -14,7 +14,7 @@
However also *square brackets* [] need special care.
- \item and all the other commands with optional arguments check
+ Commands with optional arguments (e.g. ``\item``) check
if the token right after the macro name is an opening bracket.
In that case the contents between that bracket and the following
closing bracket on the same grouping level are taken as the
Modified: trunk/docutils/test/functional/input/data/standard.txt
===================================================================
--- trunk/docutils/test/functional/input/data/standard.txt 2015-03-19 09:22:15 UTC (rev 7848)
+++ trunk/docutils/test/functional/input/data/standard.txt 2015-03-19 15:54:58 UTC (rev 7849)
@@ -317,8 +317,8 @@
also be centre-aligned:
.. class:: language-de align-center
-
-| **Die Trichter**
+
+| **Die Trichter**
|
| Zwei Trichter wandeln durch die Nacht.
| Durch ihres Rumpfs verengten Schacht
@@ -752,7 +752,9 @@
This line is indented. The next line is blank.
Inline markup is supported, e.g. *emphasis*, **strong**, ``literal
- text``, footnotes [1]_, _`hyperlink targets`, and `references
+ text``, :sub:`sub-` and :sup:`super`\ scripts,
+ inline formulas: :math:`A = 2 \pi r^2`,
+ footnotes [1]_, _`hyperlink targets`, and `references
<http://www.python.org/>`_.
Code
@@ -787,7 +789,7 @@
.. role:: tex(code)
:language: tex
-Docutils uses LaTeX syntax for math directives and roles:
+Docutils uses LaTeX syntax for math directives and roles:
:tex:`\alpha = f(x)` prints :math:`\alpha = f(x)`.
The ``:code:`` option of the `include` directive sets the included content
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2015-03-19 17:36:01
|
Revision: 7850
http://sourceforge.net/p/docutils/code/7850
Author: milde
Date: 2015-03-19 17:35:54 +0000 (Thu, 19 Mar 2015)
Log Message:
-----------
Make "xetex" writer LuaLaTex compatible: do not load "xunicode".
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/docutils/writers/latex2e/xelatex.tex
trunk/docutils/test/functional/expected/standalone_rst_xetex.tex
trunk/docutils/test/functional/expected/xetex-cyrillic.tex
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2015-03-19 15:54:58 UTC (rev 7849)
+++ trunk/docutils/HISTORY.txt 2015-03-19 17:35:54 UTC (rev 7850)
@@ -70,6 +70,10 @@
- remove decode.encode of filename stored in zip.
+* docutils/writers/xetex/__init__.py
+
+ - LuaLaTex compatibility: do not load "xunicode".
+
* docutils/writers/xhtml11/
- New HTML writer generating `XHTML 1.1`_ styled with CSS2.1
@@ -240,7 +244,7 @@
- Apply [ 3527401 ] addmonition's don't preserve indentation
- Apply [ 3527397 ] Add indentation to literal blocks in manpage writer.
-, docutils/writers/xetex/__init__.py
+* docutils/writers/xetex/__init__.py
- Apply [ 3555160 ] ensure order of "otherlanguages".
- Fix section numbering by LaTeX.
Modified: trunk/docutils/docutils/writers/latex2e/xelatex.tex
===================================================================
--- trunk/docutils/docutils/writers/latex2e/xelatex.tex 2015-03-19 15:54:58 UTC (rev 7849)
+++ trunk/docutils/docutils/writers/latex2e/xelatex.tex 2015-03-19 17:35:54 UTC (rev 7850)
@@ -1,6 +1,7 @@
$head_prefix% generated by Docutils <http://docutils.sourceforge.net/>
% rubber: set program xelatex
-\usepackage[no-sscript]{xltxtra} % loads fixltx2e, metalogo, xunicode, fontspec
+\usepackage{fixltx2e}
+\usepackage{fontspec}
% \defaultfontfeatures{Scale=MatchLowercase}
$requirements
%%% Custom LaTeX preamble
Modified: trunk/docutils/test/functional/expected/standalone_rst_xetex.tex
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_xetex.tex 2015-03-19 15:54:58 UTC (rev 7849)
+++ trunk/docutils/test/functional/expected/standalone_rst_xetex.tex 2015-03-19 17:35:54 UTC (rev 7850)
@@ -1,7 +1,8 @@
\documentclass[a4paper]{article}
% generated by Docutils <http://docutils.sourceforge.net/>
% rubber: set program xelatex
-\usepackage[no-sscript]{xltxtra} % loads fixltx2e, metalogo, xunicode, fontspec
+\usepackage{fixltx2e}
+\usepackage{fontspec}
% \defaultfontfeatures{Scale=MatchLowercase}
\usepackage{ifthen}
\usepackage{amsmath}
Modified: trunk/docutils/test/functional/expected/xetex-cyrillic.tex
===================================================================
--- trunk/docutils/test/functional/expected/xetex-cyrillic.tex 2015-03-19 15:54:58 UTC (rev 7849)
+++ trunk/docutils/test/functional/expected/xetex-cyrillic.tex 2015-03-19 17:35:54 UTC (rev 7850)
@@ -1,7 +1,8 @@
\documentclass[a4paper,russian]{article}
% generated by Docutils <http://docutils.sourceforge.net/>
% rubber: set program xelatex
-\usepackage[no-sscript]{xltxtra} % loads fixltx2e, metalogo, xunicode, fontspec
+\usepackage{fixltx2e}
+\usepackage{fontspec}
% \defaultfontfeatures{Scale=MatchLowercase}
\usepackage{ifthen}
\usepackage{polyglossia}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2015-03-21 15:59:43
|
Revision: 7851
http://sourceforge.net/p/docutils/code/7851
Author: milde
Date: 2015-03-21 15:59:36 +0000 (Sat, 21 Mar 2015)
Log Message:
-----------
Use "hyperref" package together with "bookmark"
(improved hyperlinking by the same author).
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/docutils/writers/latex2e/__init__.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2015-03-19 17:35:54 UTC (rev 7850)
+++ trunk/docutils/HISTORY.txt 2015-03-21 15:59:36 UTC (rev 7851)
@@ -66,6 +66,9 @@
- Cleaner LaTeX code for enumerations and literal blocks.
+ - Use "hyperref" package together with "bookmark" (improved hyperlinking
+ by the same author).
+
* 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-03-19 17:35:54 UTC (rev 7850)
+++ trunk/docutils/docutils/writers/latex2e/__init__.py 2015-03-21 15:59:36 UTC (rev 7851)
@@ -593,6 +593,7 @@
%% hyperlinks:
\ifthenelse{\isundefined{\hypersetup}}{
\usepackage[%s]{hyperref}
+ \usepackage{bookmark}
\urlstyle{same} %% normal text font (alternatives: tt, rm, sf)
}{}"""
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2015-03-21 16:07:58
|
Revision: 7852
http://sourceforge.net/p/docutils/code/7852
Author: milde
Date: 2015-03-21 16:07:49 +0000 (Sat, 21 Mar 2015)
Log Message:
-----------
Documentation update.
Modified Paths:
--------------
trunk/docutils/docs/howto/html-stylesheets.txt
trunk/docutils/docs/user/config.txt
trunk/docutils/docs/user/tools.txt
trunk/docutils/docutils/writers/xetex/__init__.py
Modified: trunk/docutils/docs/howto/html-stylesheets.txt
===================================================================
--- trunk/docutils/docs/howto/html-stylesheets.txt 2015-03-21 15:59:36 UTC (rev 7851)
+++ trunk/docutils/docs/howto/html-stylesheets.txt 2015-03-21 16:07:49 UTC (rev 7852)
@@ -11,18 +11,30 @@
.. _Docutils: http://docutils.sourceforge.net/
-The look of Docutils' HTML output is customizable via CSS
-stylesheets. The default stylesheet is called ``html4css1.css`` and
-can be found in the ``writers/html4css1/`` directory of the Docutils
-installation. Use the command ``rst2html.py --help`` and look at the
-description of the ``--stylesheet-path`` command-line option for the
-exact machine-specific location.
+The look of Docutils' HTML output is customizable via CSS stylesheets.
+The default stylesheets can be found in the
+``docutils/writers/html*/`` directories of the ``html4css1`` and
+``html-base`` writers in the Docutils installation. Use the front-end
+command (``rst2html.py``, ``rst2html5.py`` or ``rst2xhtml.py``) with the
+``--help`` option and look at the description of the ``--stylesheet-path``
+command-line option for the exact machine-specific location.
-To customize the stylesheet, first copy ``html4css1.css`` to the same
-place as your output HTML files will go. Next, place a new file
-(e.g. called ``my-docutils.css``) in the same directory and use the
-following template::
+To customize the look of HTML documents, you can override the settings
+of the default stylesheet in your own stylesheet. Specify both, the
+default stylesheet and your stylesheet to the ``--stylesheet`` or
+``--stylesheet-path`` command line option (or the corresponding
+settings in a configuration_ file), e.g. ::
+ rst2html.py --stylesheet=html4css1.css,transition-stars.css
+
+This is the preferable approach if you want to embed the stylesheet(s), as
+this ensures that an up-to-date version of ``html4css1.css`` is embedded.
+
+Alternatively, copy the default style sheet to the same place as your
+output HTML files will go and place a new file (e.g. called
+``my-docutils.css``) in the same directory and use the following
+template::
+
/*
:Author: Your Name
:Contact: Your Email Address
@@ -37,10 +49,10 @@
/* Your customizations go here. For example: */
h1, h2, h3, h4, h5, h6, p.topic-title {
- font-family: sans-serif }
+ font-family: sans-serif }
For help on the CSS syntax, please see `the WDG's guide to Cascading
-Style Sheets`__ and, in particular, their `list of CSS1 properties`__.
+Style Sheets`__ and, in particular, their `list of CSS properties`__.
Another good reference site is http://selfhtml.org (German and French).
__ http://www.htmlhelp.com/reference/css/
@@ -55,15 +67,6 @@
default stylesheet are required for correct rendering (margins,
alignment, etc.).
-Alternatively, specify both, the default stylesheet and your stylesheet
-to the ``--stylesheet`` or ``--stylesheet-path`` command line option (or the
-corresponding settings in a configuration_ file), e.g. ::
-
- rst2html.py --stylesheet=html4css1.css,transition-stars.css
-
-This is the preferable approach if you want to embed the stylesheet(s), as
-this ensures that an up-to-date version of ``html4css1.css`` is embedded.
-
If you think your stylesheet is fancy and you would like to let others
benefit from your efforts, you are encouraged to post the stylesheet to the
Docutils-users_ mailing list. It might find its place in the `stylesheet
Modified: trunk/docutils/docs/user/config.txt
===================================================================
--- trunk/docutils/docs/user/config.txt 2015-03-21 15:59:36 UTC (rev 7851)
+++ trunk/docutils/docs/user/config.txt 2015-03-21 16:07:49 UTC (rev 7852)
@@ -313,7 +313,7 @@
Enable or disable backlinks from footnotes and citations to their
references.
-Default: enabled (1).
+Default: enabled (True).
Options: ``--footnote-backlinks, --no-footnote-backlinks``.
generator
@@ -474,7 +474,7 @@
If disabled, section numbers might be added to the output by the
renderer (e.g. LaTeX or via a CSS style definition).
-Default: enabled (1).
+Default: enabled (True).
Options: ``--section-numbering``, ``--no-section-numbering``.
.. _sectnum directive: ../ref/rst/directives.html#sectnum
@@ -594,7 +594,7 @@
message (including the directive text) is inserted instead. (See
also raw_enabled_ for another security-relevant setting.)
-Default: enabled (1).
+Default: enabled (True).
Options: ``--file-insertion-enabled, --no-file-insertion``.
.. _include: ../ref/rst/directives.html#include
@@ -605,7 +605,7 @@
Recognize and link to standalone PEP references (like "PEP 258").
-Default: disabled (None); enabled (1) in PEP Reader.
+Default: disabled (None); enabled (True) in PEP Reader.
Options: ``--pep-references``.
pep_base_url
@@ -630,14 +630,14 @@
(including the directive text) is inserted instead. (See also
file_insertion_enabled_ for another security-relevant setting.)
-Default: enabled (1). Options: ``--raw-enabled, --no-raw``.
+Default: enabled (True). Options: ``--raw-enabled, --no-raw``.
rfc_references
~~~~~~~~~~~~~~
Recognize and link to standalone RFC references (like "RFC 822").
-Default: disabled (None); enabled (1) in PEP Reader.
+Default: disabled (None); enabled (True) in PEP Reader.
Options: ``--rfc-references``.
rfc_base_url
@@ -730,7 +730,7 @@
Enable or disable the bibliographic field list transform
(docutils.transforms.frontmatter.DocInfo).
-Default: enabled (1). Options: ``--no-doc-info``.
+Default: enabled (True). Options: ``--no-doc-info``.
doctitle_xform
~~~~~~~~~~~~~~
@@ -739,7 +739,7 @@
to document title (and subsequent section title to document
subtitle promotion; docutils.transforms.frontmatter.DocTitle).
-Default: enabled (1). Options: ``--no-doc-title``.
+Default: enabled (True). Options: ``--no-doc-title``.
sectsubtitle_xform
~~~~~~~~~~~~~~~~~~
@@ -857,7 +857,7 @@
behaviour can be specified directly via "class" attributes (values
"compact" and "open") in the document.
-Default: enabled (1).
+Default: enabled (True).
Options: ``--compact-lists, --no-compact-lists``.
compact_field_lists
@@ -868,7 +868,7 @@
paragraph). The behaviour can be specified directly via "class"
attributes (values "compact" and "open") in the document.
-Default: enabled (1).
+Default: enabled (True).
Options: ``--compact-field-lists, --no-compact-field-lists``.
.. _embed_stylesheet [html4css1 writer]:
@@ -982,7 +982,8 @@
The failsave fallback.
-Default: "HTML math.css". Option: ``--math-output``.
+Default: "HTML math.css" (MathML for the xhtml11 writer).
+Option: ``--math-output``.
New in Docutils 0.8.
@@ -1102,46 +1103,7 @@
__ `xml_declaration [docutils_xml writer]`_
-[html-base writer]
-~~~~~~~~~~~~~~~~~~
-The `html-base` writer uses the settings described in the `[html4css1
-writer]`_ section with the following exceptions:
-
-Removed options:
- `field_name_limit`_, `option_limit`_.
-
-Different default for:
-
-`stylesheet_path <stylesheet_path [html4css1 writer]_>`_:
- Default: "html-base.css"
-
-`stylesheet_dirs <stylesheet_dirs [html4css1 writer]_>`_:
- Default: Installation-dependent. Use the --help option to get the exact
- value.
-
-
-[xhtml11 writer]
-~~~~~~~~~~~~~~~~~
-
-The XHTML1.1 Writer derives from the `html-base` writer and uses the same
-setings. The "[html-base writer]" section of configuration files is
-processed before the "[xhtml11 writer]" section.
-
-
-Different default for:
-
-`stylesheet_path <stylesheet_path [html4css1 writer]_>`_:
- Default: "html-base.css,xhtml11.css"
-
-`stylesheet_dirs <stylesheet_dirs [html4css1 writer]_>`_:
- Default: Installation-dependent. Use the --help option to get the exact
- value.
-
-math_output_:
- Default: "MathML"
-
-
[pep_html writer]
~~~~~~~~~~~~~~~~~
@@ -1256,6 +1218,50 @@
Default: "slidewhow". Option: ``--view-mode``.
+[html-base writer]
+------------------
+
+The `html-base` writer uses the settings described in the `[html4css1
+writer]`_ section with the following exceptions:
+
+Removed options:
+ `field_name_limit`_, `option_limit`_.
+
+Different default for:
+
+`stylesheet_path <stylesheet_path [html4css1 writer]_>`_:
+ Default: "html-base.css"
+
+`stylesheet_dirs <stylesheet_dirs [html4css1 writer]_>`_:
+ Default: Installation-dependent. Use the --help option to get the exact
+ value.
+
+New in Docutils 0.13.
+
+
+[xhtml11 writer]
+----------------
+
+The XHTML1.1 Writer derives from the `html-base` writer and uses the same
+setings. The "[html-base writer]" section of configuration files is
+processed before the "[xhtml11 writer]" section.
+
+
+Different default for:
+
+`stylesheet_path <stylesheet_path [html4css1 writer]_>`_:
+ Default: "html-base.css,xhtml11.css"
+
+`stylesheet_dirs <stylesheet_dirs [html4css1 writer]_>`_:
+ Default: Installation-dependent. Use the --help option to get the exact
+ value.
+
+math_output_:
+ Default: "MathML"
+
+New in Docutils 0.13.
+
+
[latex2e writer]
----------------
Modified: trunk/docutils/docs/user/tools.txt
===================================================================
--- trunk/docutils/docs/user/tools.txt 2015-03-21 15:59:36 UTC (rev 7851)
+++ trunk/docutils/docs/user/tools.txt 2015-03-21 16:07:49 UTC (rev 7852)
@@ -21,7 +21,7 @@
many small front ends, each specialized for a specific "Reader" (which
knows how to interpret a file in context), a "Parser" (which
understands the syntax of the text), and a "Writer" (which knows how
-to generate a specific data format).
+to generate a specific data format).
Most front ends have common options and the same command-line usage
pattern::
@@ -66,7 +66,7 @@
:Parser: reStructuredText
:Writers: HTML, PEP/HTML
-Use ``buildhtml.py`` to generate .html from all the .txt files
+Use ``buildhtml.py`` to generate ``*.html`` from all the ``*.txt`` files
(including PEPs) in each <directory> given, and their subdirectories
too. (Use the ``--local`` option to skip subdirectories.)
@@ -101,13 +101,14 @@
:Reader: Standalone
:Parser: reStructuredText
-:Writer: HTML (html4css1)
+: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 (XHTML 1) "transitional" output compatible with
-browsers that support cascading stylesheets (CSS). A stylesheet is
-required for proper rendering; a simple but complete stylesheet is
-installed and used by default (see Stylesheets_ below).
+files and produces `HTML 4.1`_ Transitional (or `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).
For example, to process a reStructuredText file "``test.txt``" into
HTML::
@@ -128,39 +129,41 @@
(or a link to a stylesheet, when passing the "``--link-stylesheet``"
option). A stylesheet is required for proper rendering. The default
stylesheet (``docutils/writers/html4css1/html4css1.css``, located in
-the installation directory) is provided for basic use. To use a
-different stylesheet, you must specify the stylesheet's location with
-a "``--stylesheet``" (for a URL) or "``--stylesheet-path``" (for a
-local file) command-line option, or with `configuration file`_
-settings (e.g. ``./docutils.conf`` or ``~/.docutils``). To experiment
-with styles, please see the `guide to writing HTML (CSS) stylesheets
-for Docutils`__.
+the installation directory) is provided for basic use. To use
+different stylesheet(s), you must specify the stylesheets' locations
+as comma-separated list with the "``--stylesheet``" (for a URL)
+or "``--stylesheet-path``" (for a local file) command-line option,
+or with `configuration file`_ settings (e.g. ``./docutils.conf``
+or ``~/.docutils``). To experiment with styles, please see the
+`guide to writing HTML (CSS) stylesheets for Docutils`__.
__ ../howto/html-stylesheets.html
-rst2xhtml11.py
+rst2xhtml.py
--------------
:Reader: Standalone
:Parser: reStructuredText
-:Writer: xhtml11
+:Writer: xhtml (xhtml11)
-The ``rst2xhtml11.py`` front end reads standalone reStructuredText source
-files and produces clean XHTML 1.1 output. A stylesheet is required for
-proper rendering; a complete stylesheet is installed and used by default.
+The ``rst2xhtml11.py`` front end reads standalone reStructuredText
+source files and produces clean `XHTML 1.1`_ (or `HTML 4.1`_ Strict)
+output. A CSS 2 stylesheet is required for proper rendering; a complete
+stylesheet is installed and used by default.
rst2html5.py
------------
:Reader: Standalone
:Parser: reStructuredText
-:Writer: html5
+: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). A stylesheet is required for proper rendering; a complete
-stylesheet is installed and used by default.
+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.
rstpep2html.py
--------------
@@ -169,12 +172,12 @@
:Parser: reStructuredText
:Writer: PEP/HTML
-``rstpep2html.py`` reads a new-style PEP (marked up with
-reStructuredText) and produces HTML. It requires a template file and
-a stylesheet. By default, it makes use of a "``pep-html-template``"
-file and the "``pep.css``" stylesheet (both in the
-``docutils/writers/pep_html/`` directory), but these can be overridden
-by command-line options or configuration files.
+``rstpep2html.py`` reads a new-style PEP (marked up with reStructuredText)
+and produces `XHTML 1.0 Transitional`_. It requires a template file and a
+stylesheet. By default, it makes use of a "``pep-html-template``" file and
+the "``pep.css``" stylesheet (both in the ``docutils/writers/pep_html/``
+directory), but these can be overridden by command-line options or
+configuration files.
For example, to process a PEP into HTML::
@@ -289,6 +292,12 @@
S5 <slide-shows.html>`_.
+.. _HTML 5: http://www.w3.org/TR/html5/
+.. _HTML 4.1: http://www.w3.org/TR/html401/
+.. _XHTML 1.0 Transitional: http://www.w3.org/TR/xhtml1/
+.. _XHTML 1.1: http://www.w3.org/TR/xhtml1/
+
+
LaTeX-Generating Tools
======================
@@ -297,10 +306,10 @@
:Reader: Standalone
:Parser: reStructuredText
-:Writer: LaTeX2e
+:Writer: latex2e
The ``rst2latex.py`` front end reads standalone reStructuredText
-source files and produces LaTeX2e output. For example, to process a
+source files and produces LaTeX_ output. For example, to process a
reStructuredText file "``test.txt``" into LaTeX::
rst2latex.py test.txt test.tex
@@ -316,11 +325,11 @@
:Reader: Standalone
:Parser: reStructuredText
-:Writer: XeTeX
+:Writer: xetex
The ``rst2xetex.py`` front end reads standalone reStructuredText source
files and produces `LaTeX` output for processing with unicode-aware
-TeX engines (`XeTeX` or `LuaTeX`_). For example, to process a
+TeX engines (`LuaTeX`_ or `XeTeX`_). For example, to process a
reStructuredText file "``test.txt``" into LaTeX::
rst2xetex.py test.txt test.tex
@@ -331,9 +340,11 @@
For details see `Generating LaTeX with Docutils`_.
+.. _LaTeX: https://en.wikipedia.org/wiki/LaTeX
.. _XeTeX: https://en.wikipedia.org/wiki/XeTeX
.. _LuaTeX: https://en.wikipedia.org/wiki/LuaTeX
+
XML-Generating Tools
====================
Modified: trunk/docutils/docutils/writers/xetex/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/xetex/__init__.py 2015-03-21 15:59:36 UTC (rev 7851)
+++ trunk/docutils/docutils/writers/xetex/__init__.py 2015-03-21 16:07:49 UTC (rev 7852)
@@ -17,8 +17,9 @@
"""
XeLaTeX document tree Writer.
-A variant of Docutils' standard 'latex2e' writer producing output
-suited for processing with XeLaTeX (http://tug.org/xetex/).
+A variant of Docutils' standard 'latex2e' writer producing LaTeX output
+suited for processing with the Unicode-aware TeX engines
+LuaTeX and XeTeX.
"""
__docformat__ = 'reStructuredText'
@@ -32,9 +33,9 @@
from docutils.writers import latex2e
class Writer(latex2e.Writer):
- """A writer for Unicode-based LaTeX variants (XeTeX, LuaTeX)"""
+ """A writer for Unicode-aware LaTeX variants (XeTeX, LuaTeX)"""
- supported = ('xetex','xelatex','luatex')
+ supported = ('lxtex', 'xetex','xelatex','luatex', 'lualatex')
"""Formats this writer supports."""
default_template = 'xelatex.tex'
@@ -54,7 +55,7 @@
template=('Template file. Default: "%s".' % default_template,
['--template'], {'default': default_template, 'metavar': '<file>'}),
latex_preamble=('Customization by LaTeX code in the preamble. '
- 'Default: select PDF standard fonts (Times, Helvetica, Courier).',
+ 'Default: select "Linux Libertine" fonts.',
['--latex-preamble'],
{'default': default_preamble}),
)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|