|
From: <mi...@us...> - 2016-05-25 12:48:28
|
Revision: 7942
http://sourceforge.net/p/docutils/code/7942
Author: milde
Date: 2016-05-25 12:48:25 +0000 (Wed, 25 May 2016)
Log Message:
-----------
Apply [ 103 ] inline markup without word boundaries; escaping in embedded URIs.
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/docs/ref/rst/restructuredtext.txt
trunk/docutils/docs/user/config.txt
trunk/docutils/docutils/parsers/rst/__init__.py
trunk/docutils/docutils/parsers/rst/states.py
trunk/docutils/test/test_parsers/test_rst/test_inline_markup.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2016-05-25 08:07:52 UTC (rev 7941)
+++ trunk/docutils/HISTORY.txt 2016-05-25 12:48:25 UTC (rev 7942)
@@ -19,7 +19,12 @@
* docutils/nodes.py
- Fix [ 253 ] Attribute key without value not allowed in XML.
+
+* docutils/parsers/
+ - Apply [ 103 ] Recognize inline markups without word boundaries.
+ - Enable escaping in embedded URIs and aliases (fixes [ 284 ]).
+
* docutils/parsers/rst/__init__.py
- Fix [ 233 ] Change the base URL for the :rfc: role.
Modified: trunk/docutils/docs/ref/rst/restructuredtext.txt
===================================================================
--- trunk/docutils/docs/ref/rst/restructuredtext.txt 2016-05-25 08:07:52 UTC (rev 7941)
+++ trunk/docutils/docs/ref/rst/restructuredtext.txt 2016-05-25 12:48:25 UTC (rev 7942)
@@ -2417,55 +2417,55 @@
Inline markup recognition rules
-------------------------------
-Inline markup start-strings and end-strings are only recognized if all of
+Inline markup start-strings and end-strings are only recognized if
the following conditions are met:
-1. Inline markup start-strings must start a text block or be
- immediately preceded by
-
- * whitespace,
- * one of the ASCII characters ``- : / ' " < ( [ {``, or
- * a punctuation character with `Unicode category`_
- `Pd` (Dash),
- `Po` (Other),
- `Pi` (Initial quote),
- `Pf` (Final quote), or
- `Ps` (Open).
-
-2. Inline markup start-strings must be immediately followed by
+1. Inline markup start-strings must be immediately followed by
non-whitespace.
-3. Inline markup end-strings must be immediately preceded by
+2. Inline markup end-strings must be immediately preceded by
non-whitespace.
-4. Inline markup end-strings must end a text block or be immediately
- followed by
+3. The inline markup end-string must be separated by at least one
+ character from the start-string.
- * whitespace,
- * one of the ASCII characters ``- . , : ; ! ? \ / ' " ) ] } >``, or
- * a punctuation character with `Unicode category`_
- `Pd` (Dash),
- `Po` (Other),
- `Pi` (Initial quote),
- `Pf` (Final quote), or
- `Pe` (Close).
+4. Both, inline markup start-string and end-string must not be preceded by
+ an unescaped backslash (except for the end-string of `inline literals`_).
+ See `Escaping Mechanism`_ above for details.
5. If an inline markup start-string is immediately preceded by one of the
- ASCII characters ``' " < ( [ {`` or a character with Unicode character
- category `Ps`, `Pi`, or `Pf`, it must not be followed by the
- corresponding closing character from ``' " ) ] } >`` or the categories
- `Pe`, `Pf`, or `Pi`.
- (For quotes, corresponding characters can be
- any of the `quotation marks in international usage`_.)
+ ASCII characters ``' " < ( [ {`` or a similar Unicode character\ [#]_, it
+ must not be followed by the corresponding closing character from ``' " )
+ ] } >`` or a similar Unicode character\ [#]_.
+ (For quotes, corresponding characters can be any of the `quotation marks
+ in international usage`_.)
-6. An inline markup end-string must be separated by at least one
- character from the start-string.
+If the configuration setting `simple-inline-markup`_ is False (default),
+additional conditions apply to the characters "around" the
+inline markup:
-7. An unescaped backslash preceding a start-string or end-string will
- disable markup recognition, except for the end-string of `inline
- literals`_. See `Escaping Mechanism`_ above for details.
+6. Inline markup start-strings must start a text block or be
+ immediately preceded by
-.. _Unicode category:
+ * whitespace,
+ * one of the ASCII characters ``- : / ' " < ( [ {``
+ * or a similar Unicode punctuation character.\ [#]_
+
+7. Inline markup end-strings must end a text block or be immediately
+ followed by
+
+ * whitespace,
+ * one of the ASCII characters ``- . , : ; ! ? \ / ' " ) ] } >``
+ * or a similar Unicode punctuation character.\ [#]_
+
+.. [#] `Unicode categories`_ `Ps`, `Pi`, or `Pf`
+.. [#] Unicode categories `Pe`, `Pf`, or `Pi`
+.. [#] Unicode categories `Pd` (Dash), `Po` (Other), `Pi` (Initial quote),
+ `Pf` (Final quote), or `Ps` (Open)
+.. [#] Unicode categories `Pd` (Dash), `Po` (Other), `Pi` (Initial quote),
+ `Pf` (Final quote), or `Pe` (Close)
+
+.. _Unicode categories:
http://www.unicode.org/Public/5.1.0/ucd/UCD.html#General_Category_Values
.. _quotation marks in international usage:
@@ -2475,19 +2475,19 @@
uses of "*", "`", "_", and "|" without escaping. For example, none of the
following terms are recognized as containing inline markup strings:
-- 2*x a**b O(N**2) e**(x*y) f(x)*f(y) a|b file*.* (breaks 1)
-- 2 * x a ** b (* BOM32_* ` `` _ __ | (breaks 2)
+- 2 * x a ** b (* BOM32_* ` `` _ __ | (breaks 1)
+- || (breaks 3)
- "*" '|' (*) [*] {*} <*>
‘*’ ‚*‘ ‘*‚ ’*’ ‚*’
“*” „*“ “*„ ”*” „*”
»*« ›*‹ «*» »*» ›*› (breaks 5)
-- || (breaks 6)
-- __init__ __init__()
+- 2*x a**b O(N**2) e**(x*y) f(x)*f(y) a|b file*.*
+ __init__ __init__() (breaks 6)
No escaping is required inside the following inline markup examples:
-- *2 * x *a **b *.txt* (breaks 3)
-- *2*x a**b O(N**2) e**(x*y) f(x)*f(y) a*(1+2)* (breaks 4)
+- *2 * x *a **b *.txt* (breaks 2)
+- *2*x a**b O(N**2) e**(x*y) f(x)*f(y) a*(1+2)* (breaks 7)
It may be desirable to use `inline literals`_ for some of these anyhow,
especially if they represent code snippets. It's a judgment call.
@@ -2502,6 +2502,16 @@
*4, class_, *args, **kwargs, `TeX-quoted', *ML, *.txt
+For languages that don't use whitespace between words (e.g. Japanese or
+Chinese) it is recommended to set `simple-inline-markup`_ to True and
+eventually escape inline markup characters.
+The examples breaking rules 6 and 7 above show which constructs may need
+special attention.
+
+
+.. _simple-inline-markup: ../../user/config.html#simple-inline-markup
+
+
Recognition order
-----------------
Modified: trunk/docutils/docs/user/config.txt
===================================================================
--- trunk/docutils/docs/user/config.txt 2016-05-25 08:07:52 UTC (rev 7941)
+++ trunk/docutils/docs/user/config.txt 2016-05-25 12:48:25 UTC (rev 7942)
@@ -649,6 +649,22 @@
Default: "http://www.faqs.org/rfcs/". Option: ``--rfc-base-url``.
+simple_inline_markup
+~~~~~~~~~~~~~~~~~~~~
+
+Relax the `inline markup recognition rules`_ --
+no constraints on the characters before/after inline markup.
+
+This results in simpler to predict behaviour and is especially suited for
+langauges that do not use whitespace to separate words (e.g. Japanese,
+Chinese).
+
+Default: disabled (False).
+Options: ``--simple-inline-markup, --conservative-inline-markup``.
+
+New in Docutils 0.12.
+
+
smart_quotes
~~~~~~~~~~~~
@@ -943,8 +959,9 @@
Pro:
Works 'out of the box' across multiple browsers and platforms.
- Supports a large subset of LaTeX math commands and constructs
- (see http://www.mathjax.org/docs/1.1/tex.html).
+ Large set of `supported LaTeX math commands and constructs`__
+
+ __ http://docs.mathjax.org/en/latest/tex.html#supported-latex-commands
Con:
Requires an Internet connection (or a local MathJax
@@ -957,11 +974,7 @@
math-output: MathJax file:/usr/share/javascript/mathjax/MathJax.js
- or a URI to `access the MathJax CDN using a https secure
- connection`__.
- __ http://www.mathjax.org/resources/faqs/#problem-https
-
:MathML:
Embed math content as presentational MathML_.
@@ -1896,6 +1909,8 @@
.. _field names: ../ref/rst/restructuredtext.html#field-names
.. _footnotes: ../ref/rst/restructuredtext.html#footnotes
.. _footnote references: ../ref/rst/restructuredtext.html#footnote-references
+.. _inline markup recognition rules:
+ ../ref/rst/restructuredtext.html#inline-markup-recognition-rules
.. _literal blocks: ../ref/rst/restructuredtext.html#literal-blocks
.. _option lists: ../ref/rst/restructuredtext.html#option-lists
.. _tables: ../ref/rst/restructuredtext.html#tables
Modified: trunk/docutils/docutils/parsers/rst/__init__.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/__init__.py 2016-05-25 08:07:52 UTC (rev 7941)
+++ trunk/docutils/docutils/parsers/rst/__init__.py 2016-05-25 12:48:25 UTC (rev 7942)
@@ -142,6 +142,14 @@
'one of "yes", "no", "alt[ernative]" (default "no").',
['--smart-quotes'],
{'default': False, 'validator': frontend.validate_ternary}),
+ ('Ignore inline markup unless surrounded by whitespace '
+ 'or punctuation. Enabled by default.',
+ ['--conservative-inline-markup'],
+ {'action': 'store_false', 'dest': 'simple_inline_markup'}),
+ ('No restrictions on characters around inline markup.',
+ ['--simple-inline-markup'],
+ {'action': 'store_true', 'default': False,
+ 'dest': 'simple_inline_markup'}),
))
config_section = 'restructuredtext parser'
Modified: trunk/docutils/docutils/parsers/rst/states.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/states.py 2016-05-25 08:07:52 UTC (rev 7941)
+++ trunk/docutils/docutils/parsers/rst/states.py 2016-05-25 12:48:25 UTC (rev 7942)
@@ -463,12 +463,142 @@
"""
def __init__(self):
+ pass
+
+ def init_customizations(self, settings):
+ # lookahead and look-behind expressions for inline markup rules
+ if settings.simple_inline_markup:
+ start_string_prefix = u'(^|(?<!\x00))'
+ end_string_suffix = u''
+ else:
+ start_string_prefix = (u'(^|(?<=\\s|[%s%s]))' %
+ (punctuation_chars.openers,
+ punctuation_chars.delimiters))
+ end_string_suffix = (u'($|(?=\\s|[\x00%s%s%s]))' %
+ (punctuation_chars.closing_delimiters,
+ punctuation_chars.delimiters,
+ punctuation_chars.closers))
+
+ args = locals().copy()
+ args.update(vars(self.__class__))
+
+ parts = ('initial_inline', start_string_prefix, '',
+ [('start', '', self.non_whitespace_after, # simple start-strings
+ [r'\*\*', # strong
+ r'\*(?!\*)', # emphasis but not strong
+ r'``', # literal
+ r'_`', # inline internal target
+ r'\|(?!\|)'] # substitution reference
+ ),
+ ('whole', '', end_string_suffix, # whole constructs
+ [# reference name & end-string
+ r'(?P<refname>%s)(?P<refend>__?)' % self.simplename,
+ ('footnotelabel', r'\[', r'(?P<fnend>\]_)',
+ [r'[0-9]+', # manually numbered
+ r'\#(%s)?' % self.simplename, # auto-numbered (w/ label?)
+ r'\*', # auto-symbol
+ r'(?P<citationlabel>%s)' % self.simplename] # citation reference
+ )
+ ]
+ ),
+ ('backquote', # interpreted text or phrase reference
+ '(?P<role>(:%s:)?)' % self.simplename, # optional role
+ self.non_whitespace_after,
+ ['`(?!`)'] # but not literal
+ )
+ ]
+ )
+
+ self.patterns = Struct(
+ initial=build_regexp(parts),
+ emphasis=re.compile(self.non_whitespace_escape_before
+ + r'(\*)' + end_string_suffix, re.UNICODE),
+ strong=re.compile(self.non_whitespace_escape_before
+ + r'(\*\*)' + end_string_suffix, re.UNICODE),
+ interpreted_or_phrase_ref=re.compile(
+ r"""
+ %(non_unescaped_whitespace_escape_before)s
+ (
+ `
+ (?P<suffix>
+ (?P<role>:%(simplename)s:)?
+ (?P<refend>__?)?
+ )
+ )
+ %(end_string_suffix)s
+ """ % args, re.VERBOSE | re.UNICODE),
+ embedded_link=re.compile(
+ r"""
+ (
+ (?:[ \n]+|^) # spaces or beginning of line/string
+ < # open bracket
+ %(non_whitespace_after)s
+ (([^<>]|\x00[<>])+) # anything but unescaped angle brackets
+ %(non_whitespace_escape_before)s
+ > # close bracket
+ )
+ $ # end of string
+ """ % args, re.VERBOSE | re.UNICODE),
+ literal=re.compile(self.non_whitespace_before + '(``)'
+ + end_string_suffix),
+ target=re.compile(self.non_whitespace_escape_before
+ + r'(`)' + end_string_suffix),
+ substitution_ref=re.compile(self.non_whitespace_escape_before
+ + r'(\|_{0,2})'
+ + end_string_suffix),
+ email=re.compile(self.email_pattern % args + '$',
+ re.VERBOSE | re.UNICODE),
+ uri=re.compile(
+ (r"""
+ %(start_string_prefix)s
+ (?P<whole>
+ (?P<absolute> # absolute URI
+ (?P<scheme> # scheme (http, ftp, mailto)
+ [a-zA-Z][a-zA-Z0-9.+-]*
+ )
+ :
+ (
+ ( # either:
+ (//?)? # hierarchical URI
+ %(uric)s* # URI characters
+ %(uri_end)s # final URI char
+ )
+ ( # optional query
+ \?%(uric)s*
+ %(uri_end)s
+ )?
+ ( # optional fragment
+ \#%(uric)s*
+ %(uri_end)s
+ )?
+ )
+ )
+ | # *OR*
+ (?P<email> # email address
+ """ + self.email_pattern + r"""
+ )
+ )
+ %(end_string_suffix)s
+ """) % args, re.VERBOSE | re.UNICODE),
+ pep=re.compile(
+ r"""
+ %(start_string_prefix)s
+ (
+ (pep-(?P<pepnum1>\d+)(.txt)?) # reference to source file
+ |
+ (PEP\s+(?P<pepnum2>\d+)) # reference by name
+ )
+ %(end_string_suffix)s""" % args, re.VERBOSE | re.UNICODE),
+ rfc=re.compile(
+ r"""
+ %(start_string_prefix)s
+ (RFC(-|\s+)?(?P<rfcnum>\d+))
+ %(end_string_suffix)s""" % args, re.VERBOSE | re.UNICODE))
+
self.implicit_dispatch = [(self.patterns.uri, self.standalone_uri),]
"""List of (pattern, bound method) tuples, used by
`self.implicit_inline`."""
- def init_customizations(self, settings):
- """Setting-based customizations; run when parsing begins."""
if settings.pep_references:
self.implicit_dispatch.append((self.patterns.pep,
self.pep_reference))
@@ -526,14 +656,6 @@
# Inline object recognition
# -------------------------
- # lookahead and look-behind expressions for inline markup rules
- start_string_prefix = (u'(^|(?<=\\s|[%s%s]))' %
- (punctuation_chars.openers,
- punctuation_chars.delimiters))
- end_string_suffix = (u'($|(?=\\s|[\x00%s%s%s]))' %
- (punctuation_chars.closing_delimiters,
- punctuation_chars.delimiters,
- punctuation_chars.closers))
# print start_string_prefix.encode('utf8')
# TODO: support non-ASCII whitespace in the following 4 patterns?
non_whitespace_before = r'(?<![ \n])'
@@ -559,118 +681,6 @@
%(emailc)s+(?:\.%(emailc)s*)* # host
%(uri_end)s # final URI char
"""
- parts = ('initial_inline', start_string_prefix, '',
- [('start', '', non_whitespace_after, # simple start-strings
- [r'\*\*', # strong
- r'\*(?!\*)', # emphasis but not strong
- r'``', # literal
- r'_`', # inline internal target
- r'\|(?!\|)'] # substitution reference
- ),
- ('whole', '', end_string_suffix, # whole constructs
- [# reference name & end-string
- r'(?P<refname>%s)(?P<refend>__?)' % simplename,
- ('footnotelabel', r'\[', r'(?P<fnend>\]_)',
- [r'[0-9]+', # manually numbered
- r'\#(%s)?' % simplename, # auto-numbered (w/ label?)
- r'\*', # auto-symbol
- r'(?P<citationlabel>%s)' % simplename] # citation reference
- )
- ]
- ),
- ('backquote', # interpreted text or phrase reference
- '(?P<role>(:%s:)?)' % simplename, # optional role
- non_whitespace_after,
- ['`(?!`)'] # but not literal
- )
- ]
- )
- patterns = Struct(
- initial=build_regexp(parts),
- emphasis=re.compile(non_whitespace_escape_before
- + r'(\*)' + end_string_suffix, re.UNICODE),
- strong=re.compile(non_whitespace_escape_before
- + r'(\*\*)' + end_string_suffix, re.UNICODE),
- interpreted_or_phrase_ref=re.compile(
- r"""
- %(non_unescaped_whitespace_escape_before)s
- (
- `
- (?P<suffix>
- (?P<role>:%(simplename)s:)?
- (?P<refend>__?)?
- )
- )
- %(end_string_suffix)s
- """ % locals(), re.VERBOSE | re.UNICODE),
- embedded_link=re.compile(
- r"""
- (
- (?:[ \n]+|^) # spaces or beginning of line/string
- < # open bracket
- %(non_whitespace_after)s
- ([^<>\x00]+(\x00_)?) # anything but angle brackets & nulls
- # except escaped trailing low line
- %(non_whitespace_before)s
- > # close bracket w/o whitespace before
- )
- $ # end of string
- """ % locals(), re.VERBOSE | re.UNICODE),
- literal=re.compile(non_whitespace_before + '(``)'
- + end_string_suffix),
- target=re.compile(non_whitespace_escape_before
- + r'(`)' + end_string_suffix),
- substitution_ref=re.compile(non_whitespace_escape_before
- + r'(\|_{0,2})'
- + end_string_suffix),
- email=re.compile(email_pattern % locals() + '$',
- re.VERBOSE | re.UNICODE),
- uri=re.compile(
- (r"""
- %(start_string_prefix)s
- (?P<whole>
- (?P<absolute> # absolute URI
- (?P<scheme> # scheme (http, ftp, mailto)
- [a-zA-Z][a-zA-Z0-9.+-]*
- )
- :
- (
- ( # either:
- (//?)? # hierarchical URI
- %(uric)s* # URI characters
- %(uri_end)s # final URI char
- )
- ( # optional query
- \?%(uric)s*
- %(uri_end)s
- )?
- ( # optional fragment
- \#%(uric)s*
- %(uri_end)s
- )?
- )
- )
- | # *OR*
- (?P<email> # email address
- """ + email_pattern + r"""
- )
- )
- %(end_string_suffix)s
- """) % locals(), re.VERBOSE | re.UNICODE),
- pep=re.compile(
- r"""
- %(start_string_prefix)s
- (
- (pep-(?P<pepnum1>\d+)(.txt)?) # reference to source file
- |
- (PEP\s+(?P<pepnum2>\d+)) # reference by name
- )
- %(end_string_suffix)s""" % locals(), re.VERBOSE | re.UNICODE),
- rfc=re.compile(
- r"""
- %(start_string_prefix)s
- (RFC(-|\s+)?(?P<rfcnum>\d+))
- %(end_string_suffix)s""" % locals(), re.VERBOSE | re.UNICODE))
def quoted_start(self, match):
"""Test if inline markup start-string is 'quoted'.
@@ -786,8 +796,10 @@
match = self.patterns.embedded_link.search(escaped)
if match: # embedded <URI> or <alias_>
text = unescape(escaped[:match.start(0)])
- aliastext = unescape(match.group(2), restore_backslashes=True)
- if aliastext.endswith('_') and not (aliastext.endswith(r'\_')
+ aliastext = match.group(2)
+ underscore_escaped = aliastext.endswith('\x00_')
+ aliastext = unescape(aliastext)
+ if aliastext.endswith('_') and not (underscore_escaped
or self.patterns.uri.match(aliastext)):
aliastype = 'name'
alias = normalize_name(aliastext[:-1])
Modified: trunk/docutils/test/test_parsers/test_rst/test_inline_markup.py
===================================================================
--- trunk/docutils/test/test_parsers/test_rst/test_inline_markup.py 2016-05-25 08:07:52 UTC (rev 7941)
+++ trunk/docutils/test/test_parsers/test_rst/test_inline_markup.py 2016-05-25 12:48:25 UTC (rev 7942)
@@ -1050,7 +1050,7 @@
<reference name="anonymous" refuri="anonymous">
anonymous
"""],
-["""\
+[r"""
Escape trailing low-line char in URIs:
`<reference\_>`_
@@ -1069,6 +1069,25 @@
<reference name="anonymous_" refuri="anonymous_">
anonymous_
"""],
+["""\
+Escape other char in URIs:
+
+`<reference\:1>`_
+
+`<anonymous\\call>`__
+""",
+"""\
+<document source="test data">
+ <paragraph>
+ Escape other char in URIs:
+ <paragraph>
+ <reference name="reference:1" refuri="reference:1">
+ reference:1
+ <target ids="reference-1" names="reference:1" refuri="reference:1">
+ <paragraph>
+ <reference name="anonymouscall" refuri="anonymouscall">
+ anonymouscall
+"""],
]
totest['embedded_aliases'] = [
@@ -1122,19 +1141,37 @@
embedded alias with whitespace
"""],
[r"""
-`embedded alias with too much whitespace < alias_ >`__
+`no embedded alias (whitespace inside bracket) < alias_ >`__
-`embedded alias with no preceding whitespace<alias_>`__
+`no embedded alias (no preceding whitespace)<alias_>`__
""",
"""\
<document source="test data">
<paragraph>
- <reference anonymous="1" name="embedded alias with too much whitespace < alias_ >">
- embedded alias with too much whitespace < alias_ >
+ <reference anonymous="1" name="no embedded alias (whitespace inside bracket) < alias_ >">
+ no embedded alias (whitespace inside bracket) < alias_ >
<paragraph>
- <reference anonymous="1" name="embedded alias with no preceding whitespace<alias_>">
- embedded alias with no preceding whitespace<alias_>
+ <reference anonymous="1" name="no embedded alias (no preceding whitespace)<alias_>">
+ no embedded alias (no preceding whitespace)<alias_>
"""],
+[r"""
+`anonymous reference <alias\ with\\ escaped \:characters_>`__
+""",
+"""\
+<document source="test data">
+ <paragraph>
+ <reference name="anonymous reference" refname="aliaswith\ escaped :characters">
+ anonymous reference
+"""],
+[r"""
+`anonymous reference <alias\ with\\ escaped \:characters_>`__
+""",
+"""\
+<document source="test data">
+ <paragraph>
+ <reference name="anonymous reference" refname="aliaswith\ escaped :characters">
+ anonymous reference
+"""],
]
totest['inline_targets'] = [
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2016-05-25 22:57:14
|
Revision: 7943
http://sourceforge.net/p/docutils/code/7943
Author: milde
Date: 2016-05-25 22:57:12 +0000 (Wed, 25 May 2016)
Log Message:
-----------
Fixes for html-plain writer:
use "html-plain writer" configuration section,
fix order of closing tags for footnote labels
Modified Paths:
--------------
trunk/docutils/docutils/writers/html_plain/__init__.py
trunk/docutils/test/functional/expected/footnotes_html_plain.html
trunk/docutils/test/functional/expected/standalone_rst_html_plain.html
Modified: trunk/docutils/docutils/writers/html_plain/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/html_plain/__init__.py 2016-05-25 12:48:25 UTC (rev 7942)
+++ trunk/docutils/docutils/writers/html_plain/__init__.py 2016-05-25 22:57:12 UTC (rev 7943)
@@ -17,13 +17,13 @@
"""
-Basic HyperText Markup Language document tree Writer.
+Plain 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 "minimal.css" is required for proper viewing,
-the style sheet "plain.css" provides a better reading experience.
+the style sheet "plain.css" improves reading experience.
"""
__docformat__ = 'reStructuredText'
@@ -153,7 +153,7 @@
settings_defaults = {'output_encoding_error_handler': 'xmlcharrefreplace'}
- config_section = 'html-base writer'
+ config_section = 'html-plain writer'
config_section_dependencies = ('writers',)
visitor_attributes = (
@@ -1056,17 +1056,17 @@
% backrefs[0])
def depart_label(self, node):
- self.body.append('</span>')
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('</span>')
+ if self.settings.footnote_backlinks and 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_legend(self, node):
Modified: trunk/docutils/test/functional/expected/footnotes_html_plain.html
===================================================================
--- trunk/docutils/test/functional/expected/footnotes_html_plain.html 2016-05-25 12:48:25 UTC (rev 7942)
+++ trunk/docutils/test/functional/expected/footnotes_html_plain.html 2016-05-25 22:57:12 UTC (rev 7943)
@@ -25,17 +25,17 @@
label so it can be referred to from multiple places, both as a
footnote reference (<a class="footnote-reference superscript" href="#label" id="id9">2</a>) and as a <a class="reference internal" href="#label">hyperlink reference</a>.</p>
</dd>
-<dt class="label" id="id11"><span class="superscript"><a class="fn-backref" href="#id2">3</span></a></dt>
+<dt class="label" id="id11"><span class="superscript"><a class="fn-backref" href="#id2">3</a></span></dt>
<dd><p>This footnote is numbered automatically and anonymously using a
label of "#" only.</p>
<p>This is the second paragraph.</p>
<p>And this is the third paragraph.</p>
</dd>
-<dt class="label" id="id12"><span class="superscript"><a class="fn-backref" href="#id4">*</span></a></dt>
+<dt class="label" id="id12"><span class="superscript"><a class="fn-backref" href="#id4">*</a></span></dt>
<dd><p>Footnotes may also use symbols, specified with a "*" label.
Here's a reference to the next footnote:<a class="footnote-reference superscript" href="#id14" id="id13">†</a>.</p>
</dd>
-<dt class="label" id="id14"><span class="superscript"><a class="fn-backref" href="#id13">†</span></a></dt>
+<dt class="label" id="id14"><span class="superscript"><a class="fn-backref" href="#id13">†</a></span></dt>
<dd><p>This footnote shows the next symbol in the sequence.</p>
</dd>
<dt class="label" id="id15"><span class="superscript">4</span></dt>
@@ -50,13 +50,13 @@
<dd><p>Citations are text-labeled footnotes. They may be
rendered separately and differently from footnotes.</p>
</dd>
-<dt class="label" id="du2015"><span class="brackets"><a class="fn-backref" href="#id6">DU2015</span></a></dt>
+<dt class="label" id="du2015"><span class="brackets"><a class="fn-backref" href="#id6">DU2015</a></span></dt>
<dd><p><cite>Example document</cite>, Hometown: 2015.</p>
</dd>
</dl>
<p>Here's a reference to the above, <a class="citation-reference" href="#cit2002" id="id17">[CIT2002]</a>.</p>
<dl class="footnote superscript">
-<dt class="label" id="id18"><span class="superscript"><a class="fn-backref" href="#id16">5</span></a></dt>
+<dt class="label" id="id18"><span class="superscript"><a class="fn-backref" href="#id16">5</a></span></dt>
<dd><p>this footnote is missing in the standard example document.</p>
</dd>
</dl>
Modified: trunk/docutils/test/functional/expected/standalone_rst_html_plain.html
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_html_plain.html 2016-05-25 12:48:25 UTC (rev 7942)
+++ trunk/docutils/test/functional/expected/standalone_rst_html_plain.html 2016-05-25 22:57:12 UTC (rev 7943)
@@ -474,17 +474,17 @@
label so it can be referred to from multiple places, both as a
footnote reference (<a class="footnote-reference brackets" href="#label" id="id10">2</a>) and as a <a class="reference internal" href="#label">hyperlink reference</a>.</p>
</dd>
-<dt class="label" id="id12"><span class="brackets"><a class="fn-backref" href="#id2">3</span></a></dt>
+<dt class="label" id="id12"><span class="brackets"><a class="fn-backref" href="#id2">3</a></span></dt>
<dd><p>This footnote is numbered automatically and anonymously using a
label of "#" only.</p>
<p>This is the second paragraph.</p>
<p>And this is the third paragraph.</p>
</dd>
-<dt class="label" id="id13"><span class="brackets"><a class="fn-backref" href="#id4">*</span></a></dt>
+<dt class="label" id="id13"><span class="brackets"><a class="fn-backref" href="#id4">*</a></span></dt>
<dd><p>Footnotes may also use symbols, specified with a "*" label.
Here's a reference to the next footnote: <a class="footnote-reference brackets" href="#id15" id="id14">†</a>.</p>
</dd>
-<dt class="label" id="id15"><span class="brackets"><a class="fn-backref" href="#id14">†</span></a></dt>
+<dt class="label" id="id15"><span class="brackets"><a class="fn-backref" href="#id14">†</a></span></dt>
<dd><p>This footnote shows the next symbol in the sequence.</p>
</dd>
<dt class="label" id="id16"><span class="brackets">4</span></dt>
@@ -724,16 +724,16 @@
<dt class="label" id="id25"><span class="brackets">5</span><span class="fn-backref">(<a href="#id26">1</a>,<a href="#id27">2</a>,<a href="#id28">3</a>,<a href="#id35">4</a>)</span></dt>
<dd><p><a class="reference external" href="http://www.python.org/">http://www.python.org/</a></p>
</dd>
-<dt class="label" id="id29"><span class="brackets"><a class="fn-backref" href="#id30">6</span></a></dt>
+<dt class="label" id="id29"><span class="brackets"><a class="fn-backref" href="#id30">6</a></span></dt>
<dd><p><a class="reference external" href="http://pygments.org/">http://pygments.org/</a></p>
</dd>
-<dt class="label" id="id31"><span class="brackets"><a class="fn-backref" href="#id32">7</span></a></dt>
+<dt class="label" id="id31"><span class="brackets"><a class="fn-backref" href="#id32">7</a></span></dt>
<dd><p><a class="reference external" href="http://docutils.sourceforge.net/docs/user/config.html#table-style">http://docutils.sourceforge.net/docs/user/config.html#table-style</a></p>
</dd>
-<dt class="label" id="id33"><span class="brackets"><a class="fn-backref" href="#id34">8</span></a></dt>
+<dt class="label" id="id33"><span class="brackets"><a class="fn-backref" href="#id34">8</a></span></dt>
<dd><p><a class="reference external" href="http://tug.ctan.org/tex-archive/macros/latex/contrib/booktabs/booktabs.pdf">http://tug.ctan.org/tex-archive/macros/latex/contrib/booktabs/booktabs.pdf</a></p>
</dd>
-<dt class="label" id="id36"><span class="brackets"><a class="fn-backref" href="#id37">9</span></a></dt>
+<dt class="label" id="id36"><span class="brackets"><a class="fn-backref" href="#id37">9</a></span></dt>
<dd><p><a class="reference external" href="http://docutils.sourceforge.net/">http://docutils.sourceforge.net/</a></p>
</dd>
</dl>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2016-05-26 07:59:48
|
Revision: 7944
http://sourceforge.net/p/docutils/code/7944
Author: milde
Date: 2016-05-26 07:59:45 +0000 (Thu, 26 May 2016)
Log Message:
-----------
Avoid misleading name "simple" for unescaped character-level inline markup setting.
Modified Paths:
--------------
trunk/docutils/docs/user/config.txt
trunk/docutils/docutils/parsers/rst/__init__.py
trunk/docutils/docutils/parsers/rst/states.py
Modified: trunk/docutils/docs/user/config.txt
===================================================================
--- trunk/docutils/docs/user/config.txt 2016-05-25 22:57:12 UTC (rev 7943)
+++ trunk/docutils/docs/user/config.txt 2016-05-26 07:59:45 UTC (rev 7944)
@@ -649,18 +649,30 @@
Default: "http://www.faqs.org/rfcs/". Option: ``--rfc-base-url``.
-simple_inline_markup
-~~~~~~~~~~~~~~~~~~~~
+character_level_inline_markup
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Relax the `inline markup recognition rules`_ --
-no constraints on the characters before/after inline markup.
+Relax the `inline markup recognition rules`_ requiring whitespace or
+punctuation around inline markup.
-This results in simpler to predict behaviour and is especially suited for
-langauges that do not use whitespace to separate words (e.g. Japanese,
-Chinese).
+This allows character level inline markup without escaped whithespace and is
+especially suited for langauges that do not use whitespace to separate words
+(e.g. Japanese, Chinese).
+.. WARNING:: Potentially dangerous; use with caution.
+
+ When changing this setting to "True", inline markup charactes in
+ URLs, names and formulas must be escaped to prevent errors.
+ Examples::
+
+ http://rST_for_all.html (hyperlinks to rST_ and for_)
+ x_2, inline_markup (hyperlinks to x_ and inline_)
+ 2*x (starts emphasised text)
+ a|b (starts a substitution reference)
+
+
Default: disabled (False).
-Options: ``--simple-inline-markup, --conservative-inline-markup``.
+Options: ``--character-level-inline-markup, --conservative-inline-markup``.
New in Docutils 0.12.
Modified: trunk/docutils/docutils/parsers/rst/__init__.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/__init__.py 2016-05-25 22:57:12 UTC (rev 7943)
+++ trunk/docutils/docutils/parsers/rst/__init__.py 2016-05-26 07:59:45 UTC (rev 7944)
@@ -145,11 +145,11 @@
('Ignore inline markup unless surrounded by whitespace '
'or punctuation. Enabled by default.',
['--conservative-inline-markup'],
- {'action': 'store_false', 'dest': 'simple_inline_markup'}),
+ {'action': 'store_false', 'dest': 'character_level_inline_markup'}),
('No restrictions on characters around inline markup.',
- ['--simple-inline-markup'],
+ ['--character-level-inline-markup'],
{'action': 'store_true', 'default': False,
- 'dest': 'simple_inline_markup'}),
+ 'dest': 'character_level_inline_markup'}),
))
config_section = 'restructuredtext parser'
Modified: trunk/docutils/docutils/parsers/rst/states.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/states.py 2016-05-25 22:57:12 UTC (rev 7943)
+++ trunk/docutils/docutils/parsers/rst/states.py 2016-05-26 07:59:45 UTC (rev 7944)
@@ -467,7 +467,7 @@
def init_customizations(self, settings):
# lookahead and look-behind expressions for inline markup rules
- if settings.simple_inline_markup:
+ if settings.character_level_inline_markup:
start_string_prefix = u'(^|(?<!\x00))'
end_string_suffix = u''
else:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2016-05-26 16:24:18
|
Revision: 7945
http://sourceforge.net/p/docutils/code/7945
Author: milde
Date: 2016-05-26 16:24:15 +0000 (Thu, 26 May 2016)
Log Message:
-----------
Fix/Complete Setting for character-level-inline-markup.
rename options following Davids suggestion,
add test file.
Modified Paths:
--------------
trunk/docutils/docs/user/config.txt
trunk/docutils/docutils/parsers/rst/__init__.py
Added Paths:
-----------
trunk/docutils/test/test_parsers/test_rst/test_character_level_inline_markup.py
Modified: trunk/docutils/docs/user/config.txt
===================================================================
--- trunk/docutils/docs/user/config.txt 2016-05-26 07:59:45 UTC (rev 7944)
+++ trunk/docutils/docs/user/config.txt 2016-05-26 16:24:15 UTC (rev 7945)
@@ -652,29 +652,28 @@
character_level_inline_markup
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Relax the `inline markup recognition rules`_ requiring whitespace or
-punctuation around inline markup.
+Experimental setting to relax the `inline markup recognition rules`_
+requiring whitespace or punctuation around inline markup.
-This allows character level inline markup without escaped whithespace and is
+Allows character level inline markup without escaped whithespace and is
especially suited for langauges that do not use whitespace to separate words
(e.g. Japanese, Chinese).
.. WARNING:: Potentially dangerous; use with caution.
When changing this setting to "True", inline markup charactes in
- URLs, names and formulas must be escaped to prevent errors.
- Examples::
-
+ URLs, names and formulas must be escaped to prevent recognition and
+ possible errors. Examples::
+
http://rST_for_all.html (hyperlinks to rST_ and for_)
x_2, inline_markup (hyperlinks to x_ and inline_)
2*x (starts emphasised text)
a|b (starts a substitution reference)
-
Default: disabled (False).
-Options: ``--character-level-inline-markup, --conservative-inline-markup``.
+Options: ``--character-level-inline-markup, --word-level-inline-markup``.
-New in Docutils 0.12.
+New in Docutils 0.13.
smart_quotes
@@ -972,7 +971,7 @@
Works 'out of the box' across multiple browsers and platforms.
Large set of `supported LaTeX math commands and constructs`__
-
+
__ http://docs.mathjax.org/en/latest/tex.html#supported-latex-commands
Con:
Modified: trunk/docutils/docutils/parsers/rst/__init__.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/__init__.py 2016-05-26 07:59:45 UTC (rev 7944)
+++ trunk/docutils/docutils/parsers/rst/__init__.py 2016-05-26 16:24:15 UTC (rev 7945)
@@ -142,11 +142,16 @@
'one of "yes", "no", "alt[ernative]" (default "no").',
['--smart-quotes'],
{'default': False, 'validator': frontend.validate_ternary}),
- ('Ignore inline markup unless surrounded by whitespace '
- 'or punctuation. Enabled by default.',
- ['--conservative-inline-markup'],
+ ('Inline markup recognized at word boundaries only '
+ '(adjacent to punctuation or whitespace). '
+ 'Force character-level inline markup recognition with '
+ '"\ " (backslash + space). Default.',
+ ['--word-level-inline-markup'],
{'action': 'store_false', 'dest': 'character_level_inline_markup'}),
- ('No restrictions on characters around inline markup.',
+ ('Inline markup recognized anywhere, regardless of surrounding '
+ 'characters. Backslash-escapes must be used to avoid unwanted '
+ 'markup recognition. Useful for East Asian languages. '
+ 'Experimental.',
['--character-level-inline-markup'],
{'action': 'store_true', 'default': False,
'dest': 'character_level_inline_markup'}),
Added: trunk/docutils/test/test_parsers/test_rst/test_character_level_inline_markup.py
===================================================================
--- trunk/docutils/test/test_parsers/test_rst/test_character_level_inline_markup.py (rev 0)
+++ trunk/docutils/test/test_parsers/test_rst/test_character_level_inline_markup.py 2016-05-26 16:24:15 UTC (rev 7945)
@@ -0,0 +1,632 @@
+#! /usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# $Id$
+# Author: David Goodger <go...@py...>
+# Copyright: This module has been placed in the public domain.
+
+"""
+Tests for inline markup in docutils/parsers/rst/states.py
+with the "character-level-inline-markup" setting.
+
+Experimental.
+"""
+
+from __init__ import DocutilsTestSupport
+
+def suite():
+ s = DocutilsTestSupport.ParserTestSuite(suite_settings={'character_level_inline_markup': True})
+ s.generateTests(totest)
+ return s
+
+totest = {}
+
+totest['emphasis'] = [
+[r"""some punctuation is allowed around inline markup, e.g.
+/*emphasis*/, -*emphasis*-, and :*emphasis*: (delimiters),
+(*emphasis*), [*emphasis*], <*emphasis*>, {*emphasis*} (open/close pairs)
+*emphasis*., *emphasis*,, *emphasis*!, and *emphasis*\ (closing delimiters),
+
+With simple-inline-markup also
+)*emphasis*(, ]*emphasis*[, >*emphasis*>, }*emphasis*{ (close/open pairs),
+x*2* or 2*x* (alphanumeric char before),
+
+but not
+(*), [*], '*' or '"*"' ("quoted" start-string),
+\*args or * (escaped; whitespace behind start-string),
+or *the\* *stars\* *inside* (escaped; whitespace before end-string).
+
+However, '*args' triggers a warning.
+
+Also *this**.
+""",
+"""\
+<document source="test data">
+ <paragraph>
+ some punctuation is allowed around inline markup, e.g.
+ /
+ <emphasis>
+ emphasis
+ /, -
+ <emphasis>
+ emphasis
+ -, and :
+ <emphasis>
+ emphasis
+ : (delimiters),
+ (
+ <emphasis>
+ emphasis
+ ), [
+ <emphasis>
+ emphasis
+ ], <
+ <emphasis>
+ emphasis
+ >, {
+ <emphasis>
+ emphasis
+ } (open/close pairs)
+ <emphasis>
+ emphasis
+ .,
+ <emphasis>
+ emphasis
+ ,,
+ <emphasis>
+ emphasis
+ !, and
+ <emphasis>
+ emphasis
+ (closing delimiters),
+ <paragraph>
+ With simple-inline-markup also
+ )
+ <emphasis>
+ emphasis
+ (, ]
+ <emphasis>
+ emphasis
+ [, >
+ <emphasis>
+ emphasis
+ >, }
+ <emphasis>
+ emphasis
+ { (close/open pairs),
+ x
+ <emphasis>
+ 2
+ or 2
+ <emphasis>
+ x
+ (alphanumeric char before),
+ <paragraph>
+ but not
+ (*), [*], '*' or '"*"' ("quoted" start-string),
+ *args or * (escaped; whitespace behind start-string),
+ or
+ <emphasis>
+ the* *stars* *inside
+ (escaped; whitespace before end-string).
+ <paragraph>
+ However, '
+ <problematic ids="id2" refid="id1">
+ *
+ args' triggers a warning.
+ <system_message backrefs="id2" ids="id1" level="2" line="15" source="test data" type="WARNING">
+ <paragraph>
+ Inline emphasis start-string without end-string.
+ <paragraph>
+ Also
+ <emphasis>
+ this
+ <problematic ids="id4" refid="id3">
+ *
+ .
+ <system_message backrefs="id4" ids="id3" level="2" line="17" source="test data" type="WARNING">
+ <paragraph>
+ Inline emphasis start-string without end-string.
+"""],
+[r"""
+Emphasized asterisk: *\**
+
+Emphasized double asterisk: *\*\** (requires two escape chars).
+""",
+"""\
+<document source="test data">
+ <paragraph>
+ Emphasized asterisk: \n\
+ <emphasis>
+ *
+ <paragraph>
+ Emphasized double asterisk: \n\
+ <emphasis>
+ **
+ (requires two escape chars).
+"""],
+]
+
+totest['strong'] = [
+[r"""
+(**strong**) but not (**) or '(** '
+
+However, '**kwargs' and x**2 are recognized as strong markup
+and \**kwargs or ** as emphasized.
+""",
+"""\
+<document source="test data">
+ <paragraph>
+ (
+ <strong>
+ strong
+ ) but not (**) or '(** '
+ <paragraph>
+ However, '
+ <strong>
+ kwargs' and x
+ 2 are recognized as strong markup
+ and *
+ <emphasis>
+ kwargs or *
+ as emphasized.
+"""],
+["""\
+Strong asterisk: **\***
+and
+strong double asterisk: **\*\***
+require escaping with simple-inline-markup.
+""",
+"""\
+<document source="test data">
+ <paragraph>
+ Strong asterisk: \n\
+ <strong>
+ *
+
+ and
+ strong double asterisk:
+ <strong>
+ **
+
+ require escaping with simple-inline-markup.
+"""],
+]
+
+totest['literal'] = [
+["""\
+With simple-inline-markup, this is ```interpreted text``` in backquotes!
+""",
+"""\
+<document source="test data">
+ <paragraph>
+ With simple-inline-markup, this is
+ <literal>
+ `interpreted text
+ ` in backquotes!
+"""],
+["""\
+``literal without closing backquotes
+""",
+"""\
+<document source="test data">
+ <paragraph>
+ <problematic ids="id2" refid="id1">
+ ``
+ literal without closing backquotes
+ <system_message backrefs="id2" ids="id1" level="2" line="1" source="test data" type="WARNING">
+ <paragraph>
+ Inline literal start-string without end-string.
+"""],
+[r"""
+Python ``list``s use square bracket syntax.
+""",
+"""\
+<document source="test data">
+ <paragraph>
+ Python \n\
+ <literal>
+ list
+ s use square bracket syntax.
+"""],
+]
+
+totest['references'] = [
+["""\
+ref_, r_, r_e-f_, -ref_, and anonymousref__,
+beware of _ref_ or __attr__ or object.__attr__
+""",
+"""\
+<document source="test data">
+ <paragraph>
+ <reference name="ref" refname="ref">
+ ref
+ , \n\
+ <reference name="r" refname="r">
+ r
+ , \n\
+ <reference name="r_e-f" refname="r_e-f">
+ r_e-f
+ , -
+ <reference name="ref" refname="ref">
+ ref
+ , and \n\
+ <reference anonymous="1" name="anonymousref">
+ anonymousref
+ ,
+ beware of _
+ <reference name="ref" refname="ref">
+ ref
+ or __
+ <reference anonymous="1" name="attr">
+ attr
+ or object.__
+ <reference anonymous="1" name="attr">
+ attr
+"""],
+]
+
+totest['embedded_URIs'] = [
+[r"""
+Escape chars in URIs:
+
+`<reference\:1>`_
+
+`<anonymous\\call>`__
+
+`<anonymous\_call>`__
+""",
+"""\
+<document source="test data">
+ <paragraph>
+ Escape chars in URIs:
+ <paragraph>
+ <reference name="reference:1" refuri="reference:1">
+ reference:1
+ <target ids="reference-1" names="reference:1" refuri="reference:1">
+ <paragraph>
+ <reference name="anonymous\call" refuri="anonymous\call">
+ anonymous\call
+ <paragraph>
+ <reference name="anonymous_call" refuri="anonymous_call">
+ anonymous_call
+"""],
+]
+
+totest['inline_targets'] = [
+["""\
+This isn't a _target; targets require backquotes.
+
+With simple-inline-markup, _`this`_ is a a target followed by an
+underscore.
+""",
+"""\
+<document source="test data">
+ <paragraph>
+ This isn't a _target; targets require backquotes.
+ <paragraph>
+ With simple-inline-markup,
+ <target ids="this" names="this">
+ this
+ _ is a a target followed by an
+ underscore.
+"""],
+]
+
+totest['footnote_reference'] = [
+["""\
+Adjacent footnote refs are possible with simple-inline-markup:
+[*]_[#label]_ [#]_[2]_ [1]_[*]_
+
+.. [#] test1
+.. [*] test2
+""",
+"""\
+<document source="test data">
+ <paragraph>
+ Adjacent footnote refs are possible with simple-inline-markup:
+ <footnote_reference auto="*" ids="id1">
+ <footnote_reference auto="1" ids="id2" refname="label">
+
+ <footnote_reference auto="1" ids="id3">
+ <footnote_reference ids="id4" refname="2">
+ 2
+
+ <footnote_reference ids="id5" refname="1">
+ 1
+ <footnote_reference auto="*" ids="id6">
+ <footnote auto="1" ids="id7">
+ <paragraph>
+ test1
+ <footnote auto="*" ids="id8">
+ <paragraph>
+ test2
+"""],
+]
+
+totest['citation_reference'] = [
+["""\
+Adjacent citation refs are possible with simple-inline-markup:
+[citation]_[CIT1]_
+""",
+"""\
+<document source="test data">
+ <paragraph>
+ Adjacent citation refs are possible with simple-inline-markup:
+ <citation_reference ids="id1" refname="citation">
+ citation
+ <citation_reference ids="id2" refname="cit1">
+ CIT1
+"""],
+]
+
+totest['substitution_references'] = [
+["""\
+|sub|ref
+""",
+"""\
+<document source="test data">
+ <paragraph>
+ <substitution_reference refname="sub">
+ sub
+ ref
+"""],
+]
+
+totest['standalone_hyperlink'] = [
+[r"""
+Valid URLs with escaped markup characters:
+
+http://example.com/\*content\*/whatever
+
+Invalid with the simple-inline-markup setting:
+
+http://example.com/\*content*/whatever
+http://example.com/rST_for_all.html
+""",
+"""\
+<document source="test data">
+ <paragraph>
+ Valid URLs with escaped markup characters:
+ <paragraph>
+ <reference refuri="http://example.com/*content*/whatever">
+ http://example.com/*content*/whatever
+ <paragraph>
+ Invalid with the simple-inline-markup setting:
+ <paragraph>
+ <reference refuri="http://example.com/*content">
+ http://example.com/*content
+ <problematic ids="id2" refid="id1">
+ *
+ /whatever
+ <reference refuri="http://example.com/">
+ http://example.com/
+ <reference name="rST_for" refname="rst_for">
+ rST_for
+ all.html
+ <system_message backrefs="id2" ids="id1" level="2" line="8" source="test data" type="WARNING">
+ <paragraph>
+ Inline emphasis start-string without end-string.
+"""],
+]
+
+totest['markup recognition rules'] = [
+["""\
+__This__ is an anonymous reference with simple-inline-markup.
+""",
+"""\
+<document source="test data">
+ <paragraph>
+ __
+ <reference anonymous="1" name="This">
+ This
+ is an anonymous reference with simple-inline-markup.
+"""],
+[r"""
+Character-level m*a***r**``k``\ `u`:title:\p
+with backslash-escaped whitespace, including new\
+lines.
+""",
+"""\
+<document source="test data">
+ <paragraph>
+ Character-level m
+ <emphasis>
+ a
+ <strong>
+ r
+ <literal>
+ k
+ <title_reference>
+ u
+ p
+ with backslash-escaped whitespace, including newlines.
+"""],
+[u"""\
+text-*separated*\u2010*by*\u2011*various*\u2012*dashes*\u2013*and*\u2014*hyphens*.
+\u00bf*punctuation*? \u00a1*examples*!\u00a0*\u00a0no-break-space\u00a0*.
+""",
+u"""\
+<document source="test data">
+ <paragraph>
+ text-
+ <emphasis>
+ separated
+ \u2010
+ <emphasis>
+ by
+ \u2011
+ <emphasis>
+ various
+ \u2012
+ <emphasis>
+ dashes
+ \u2013
+ <emphasis>
+ and
+ \u2014
+ <emphasis>
+ hyphens
+ .
+ \xbf
+ <emphasis>
+ punctuation
+ ? \xa1
+ <emphasis>
+ examples
+ !\xa0
+ <emphasis>
+ \u00a0no-break-space\u00a0
+ .
+"""],
+# Whitespace characters:
+# \u180e*MONGOLIAN VOWEL SEPARATOR*\u180e, fails in Python 2.4
+[u"""\
+text separated by
+*newline*
+or *space* or one of
+\xa0*NO-BREAK SPACE*\xa0,
+\u1680*OGHAM SPACE MARK*\u1680,
+\u2000*EN QUAD*\u2000,
+\u2001*EM QUAD*\u2001,
+\u2002*EN SPACE*\u2002,
+\u2003*EM SPACE*\u2003,
+\u2004*THREE-PER-EM SPACE*\u2004,
+\u2005*FOUR-PER-EM SPACE*\u2005,
+\u2006*SIX-PER-EM SPACE*\u2006,
+\u2007*FIGURE SPACE*\u2007,
+\u2008*PUNCTUATION SPACE*\u2008,
+\u2009*THIN SPACE*\u2009,
+\u200a*HAIR SPACE*\u200a,
+\u202f*NARROW NO-BREAK SPACE*\u202f,
+\u205f*MEDIUM MATHEMATICAL SPACE*\u205f,
+\u3000*IDEOGRAPHIC SPACE*\u3000,
+\u2028*LINE SEPARATOR*\u2028
+""",
+u"""\
+<document source="test data">
+ <paragraph>
+ text separated by
+ <emphasis>
+ newline
+ \n\
+ or \n\
+ <emphasis>
+ space
+ or one of
+ \xa0
+ <emphasis>
+ NO-BREAK SPACE
+ \xa0,
+ \u1680
+ <emphasis>
+ OGHAM SPACE MARK
+ \u1680,
+ \u2000
+ <emphasis>
+ EN QUAD
+ \u2000,
+ \u2001
+ <emphasis>
+ EM QUAD
+ \u2001,
+ \u2002
+ <emphasis>
+ EN SPACE
+ \u2002,
+ \u2003
+ <emphasis>
+ EM SPACE
+ \u2003,
+ \u2004
+ <emphasis>
+ THREE-PER-EM SPACE
+ \u2004,
+ \u2005
+ <emphasis>
+ FOUR-PER-EM SPACE
+ \u2005,
+ \u2006
+ <emphasis>
+ SIX-PER-EM SPACE
+ \u2006,
+ \u2007
+ <emphasis>
+ FIGURE SPACE
+ \u2007,
+ \u2008
+ <emphasis>
+ PUNCTUATION SPACE
+ \u2008,
+ \u2009
+ <emphasis>
+ THIN SPACE
+ \u2009,
+ \u200a
+ <emphasis>
+ HAIR SPACE
+ \u200a,
+ \u202f
+ <emphasis>
+ NARROW NO-BREAK SPACE
+ \u202f,
+ \u205f
+ <emphasis>
+ MEDIUM MATHEMATICAL SPACE
+ \u205f,
+ \u3000
+ <emphasis>
+ IDEOGRAPHIC SPACE
+ \u3000,
+ <paragraph>
+ <emphasis>
+ LINE SEPARATOR
+"""],
+# « * » ‹ * › « * » ‹ * › « * » ‹ * › French,
+[u"""\
+"Quoted" markup start-string (matched openers & closers) -> no markup:
+
+'*' "*" (*) <*> [*] {*}
+⁅*⁆
+
+Some international quoting styles:
+‘*’ “*” English, ...,
+„*“ ‚*‘ »*« ›*‹ German, Czech, ...,
+„*” «*» Romanian,
+“*„ ‘*‚ Greek,
+「*」 『*』traditional Chinese,
+”*” ’*’ »*» ›*› Swedish, Finnish,
+„*” ‚*’ Polish,
+„*” »*« ’*’ Hungarian,
+
+But this is „*’ emphasized »*‹.
+""",
+u"""\
+<document source="test data">
+ <paragraph>
+ "Quoted" markup start-string (matched openers & closers) -> no markup:
+ <paragraph>
+ '*' "*" (*) <*> [*] {*}
+ ⁅*⁆
+ <paragraph>
+ Some international quoting styles:
+ ‘*’ “*” English, ...,
+ „*“ ‚*‘ »*« ›*‹ German, Czech, ...,
+ „*” «*» Romanian,
+ “*„ ‘*‚ Greek,
+ 「*」 『*』traditional Chinese,
+ ”*” ’*’ »*» ›*› Swedish, Finnish,
+ „*” ‚*’ Polish,
+ „*” »*« ’*’ Hungarian,
+ <paragraph>
+ But this is „
+ <emphasis>
+ ’ emphasized »
+ ‹.
+"""],
+]
+
+
+if __name__ == '__main__':
+ import unittest
+ unittest.main(defaultTest='suite')
Property changes on: trunk/docutils/test/test_parsers/test_rst/test_character_level_inline_markup.py
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2016-05-26 17:47:39
|
Revision: 7946
http://sourceforge.net/p/docutils/code/7946
Author: milde
Date: 2016-05-26 17:47:37 +0000 (Thu, 26 May 2016)
Log Message:
-----------
Update html-plain writer.
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/docutils/writers/html_plain/__init__.py
trunk/docutils/test/functional/expected/footnotes_html_plain.html
trunk/docutils/test/functional/expected/math_output_mathml.xhtml
trunk/docutils/test/functional/expected/standalone_rst_html_plain.html
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2016-05-26 16:24:15 UTC (rev 7945)
+++ trunk/docutils/HISTORY.txt 2016-05-26 17:47:37 UTC (rev 7946)
@@ -59,7 +59,7 @@
* docutils/writers/html_plain/
- New HTML writer generating clean, polyglot_ markup conforming to
- `HTML 5`_ and compatible with `XHTML 1.0`_ Transitional.
+ `HTML 5`_.
The CSS stylesheets ``minimal.css`` and ``plain.css`` contain required
and recommended layout rules.
Modified: trunk/docutils/docutils/writers/html_plain/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/html_plain/__init__.py 2016-05-26 16:24:15 UTC (rev 7945)
+++ trunk/docutils/docutils/writers/html_plain/__init__.py 2016-05-26 17:47:37 UTC (rev 7946)
@@ -1,5 +1,5 @@
# .. coding: utf8
-# :Author: Günter Milde <mi...@us...>
+# :Author: Günter Milde <mi...@us...>
# :Revision: $Revision$
# :Date: $Date: 2005-06-28$
# :Copyright: © 2005, 2009 Günter Milde.
@@ -19,8 +19,7 @@
"""
Plain HyperText Markup Language document tree Writer.
-The output conforms to the `HTML 5` specification as well as
-to `XHTML 1.0 transitional`.
+The output conforms to the `HTML 5` specification.
The cascading style sheet "minimal.css" is required for proper viewing,
the style sheet "plain.css" improves reading experience.
@@ -212,10 +211,7 @@
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_xml = ('<meta http-equiv="Content-Type"'
- ' content="application/xhtml+xml; charset=%s" />\n')
+ content_type = ('<meta charset="%s"/>\n')
generator = ('<meta name="generator" content="Docutils %s: '
'http://docutils.sourceforge.net/" />\n')
@@ -225,9 +221,9 @@
# 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/
+ # may be overwritten by custom URL appended to "mathjax"
mathjax_url = ('https://cdn.mathjax.org/mathjax/latest/MathJax.js?'
'config=TeX-AMS_CHTML')
- # may be overwritten by custom URL appended to "mathjax"
stylesheet_link = '<link rel="stylesheet" href="%s" type="text/css" />\n'
embedded_stylesheet = '<style type="text/css">\n\n%s\n</style>\n'
@@ -246,7 +242,7 @@
if settings.xml_declaration:
self.head_prefix.append(self.xml_declaration
% settings.output_encoding)
- self.content_type = self.content_type_xml
+ self.content_type = ""
# encoding not interpolated:
self.html_prolog.append(self.xml_declaration)
self.head = self.meta[:]
Modified: trunk/docutils/test/functional/expected/footnotes_html_plain.html
===================================================================
--- trunk/docutils/test/functional/expected/footnotes_html_plain.html 2016-05-26 16:24:15 UTC (rev 7945)
+++ trunk/docutils/test/functional/expected/footnotes_html_plain.html 2016-05-26 17:47:37 UTC (rev 7946)
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<meta charset="utf-8"/>
<meta name="generator" content="Docutils 0.13: http://docutils.sourceforge.net/" />
<title>Test footnote and citation rendering</title>
<link rel="stylesheet" href="../input/data/minimal.css" type="text/css" />
Modified: trunk/docutils/test/functional/expected/math_output_mathml.xhtml
===================================================================
--- trunk/docutils/test/functional/expected/math_output_mathml.xhtml 2016-05-26 16:24:15 UTC (rev 7945)
+++ trunk/docutils/test/functional/expected/math_output_mathml.xhtml 2016-05-26 17:47:37 UTC (rev 7946)
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<meta charset="utf-8"/>
<meta name="generator" content="Docutils 0.13: http://docutils.sourceforge.net/" />
<title>Mathematics</title>
<link rel="stylesheet" href="../input/data/minimal.css" type="text/css" />
Modified: trunk/docutils/test/functional/expected/standalone_rst_html_plain.html
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_html_plain.html 2016-05-26 16:24:15 UTC (rev 7945)
+++ trunk/docutils/test/functional/expected/standalone_rst_html_plain.html 2016-05-26 17:47:37 UTC (rev 7946)
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<meta charset="utf-8"/>
<meta name="generator" content="Docutils 0.13: http://docutils.sourceforge.net/" />
<title>reStructuredText Test Document</title>
<meta name="author" content="David Goodger" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2016-07-26 00:01:44
|
Revision: 7949
http://sourceforge.net/p/docutils/code/7949
Author: milde
Date: 2016-07-26 00:01:42 +0000 (Tue, 26 Jul 2016)
Log Message:
-----------
Fix [ 224 ] Fix rowspan support for tables.
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/docutils/writers/latex2e/__init__.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2016-07-25 11:26:17 UTC (rev 7948)
+++ trunk/docutils/HISTORY.txt 2016-07-26 00:01:42 UTC (rev 7949)
@@ -19,7 +19,7 @@
* docutils/nodes.py
- Fix [ 253 ] Attribute key without value not allowed in XML.
-
+
* docutils/parsers/
- Apply [ 103 ] Recognize inline markups without word boundaries.
@@ -91,6 +91,8 @@
- Fix [ 286 ] Empty column title cause invalid latex file.
+ - Fix [ 224 ] Fix rowspan support for tables.
+
* 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 2016-07-25 11:26:17 UTC (rev 7948)
+++ trunk/docutils/docutils/writers/latex2e/__init__.py 2016-07-26 00:01:42 UTC (rev 7949)
@@ -939,8 +939,12 @@
# horizontal lines are drawn below a row,
def get_opening(self):
+ align_map = {'left': 'l',
+ 'center': 'c',
+ 'right': 'r'}
+ align = align_map.get(self.get('align') or 'center')
return '\n'.join([r'\setlength{\DUtablewidth}{\linewidth}',
- r'\begin{%s}[c]' % self.get_latex_type()])
+ r'\begin{%s}[%s]' % (self.get_latex_type(), align)])
def get_closing(self):
closing = []
@@ -992,12 +996,12 @@
def get_column_width(self):
"""Return columnwidth for current cell (not multicell)."""
- return '%.2f\\DUtablewidth' % self._col_width[self._cell_in_row-1]
+ return '%.2f\\DUtablewidth' % self._col_width[self._cell_in_row]
def get_multicolumn_width(self, start, len_):
"""Return sum of columnwidths for multicell."""
mc_width = sum([width
- for width in ([self._col_width[start + co - 1]
+ for width in ([self._col_width[start + co]
for co in range (len_)])])
return '%.2f\\DUtablewidth' % mc_width
@@ -1039,8 +1043,10 @@
# for longtable one could add firsthead, foot and lastfoot
self._in_thead -= 1
return a
+
def visit_row(self):
self._cell_in_row = 0
+
def depart_row(self):
res = [' \\\\\n']
self._cell_in_row = None # remove cell counter
@@ -1071,15 +1077,19 @@
self._rowspan[cell] = value
except:
pass
+
def get_rowspan(self,cell):
try:
return self._rowspan[cell]
except:
return 0
+
def get_entry_number(self):
return self._cell_in_row
+
def visit_entry(self):
self._cell_in_row += 1
+
def is_stub_column(self):
if len(self.stubs) >= self._cell_in_row:
return self.stubs[self._cell_in_row-1]
@@ -1930,52 +1940,50 @@
self.depart_inline(node)
self.out.append('}')
+ # Append column delimiters and advance column counter,
+ # if the current cell is a multi-row continuation."""
+ def insert_additional_table_colum_delimiters(self):
+ while self.active_table.get_rowspan(
+ self.active_table.get_entry_number()):
+ self.out.append(' & ')
+ self.active_table.visit_entry() # increment cell count
+
def visit_entry(self, node):
- self.active_table.visit_entry()
# cell separation
- # BUG: the following fails, with more than one multirow
- # starting in the second column (or later) see
- # ../../../test/functional/input/data/latex.txt
- if self.active_table.get_entry_number() == 1:
- # if the first row is a multirow, this actually is the second row.
- # this gets hairy if rowspans follow each other.
- if self.active_table.get_rowspan(0):
- count = 0
- while self.active_table.get_rowspan(count):
- count += 1
- self.out.append(' & ')
- self.active_table.visit_entry() # increment cell count
+ if self.active_table.get_entry_number() == 0:
+ self.insert_additional_table_colum_delimiters()
else:
self.out.append(' & ')
+
# multirow, multicolumn
- # IN WORK BUG TODO HACK continues here
- # multirow in LaTeX simply will enlarge the cell over several rows
- # (the following n if n is positive, the former if negative).
if 'morerows' in node and 'morecols' in node:
raise NotImplementedError('Cells that '
'span multiple rows *and* columns are not supported, sorry.')
+ # multirow in LaTeX simply will enlarge the cell over several rows
+ # (the following n if n is positive, the former if negative).
if 'morerows' in node:
self.requirements['multirow'] = r'\usepackage{multirow}'
- count = node['morerows'] + 1
+ mrows = node['morerows'] + 1
self.active_table.set_rowspan(
- self.active_table.get_entry_number()-1,count)
- # TODO why does multirow end on % ? needs to be checked for below
+ self.active_table.get_entry_number(), mrows)
self.out.append('\\multirow{%d}{%s}{%%' %
- (count,self.active_table.get_column_width()))
+ (mrows, self.active_table.get_column_width()))
+ # (end line with "%" to mask the line break,
+ # needs to be checked for below).
self.context.append('}')
elif 'morecols' in node:
# the vertical bar before column is missing if it is the first
# column. the one after always.
- if self.active_table.get_entry_number() == 1:
+ if self.active_table.get_entry_number() == 0:
bar1 = self.active_table.get_vertical_bar()
else:
bar1 = ''
- count = node['morecols'] + 1
+ mcols = node['morecols'] + 1
self.out.append('\\multicolumn{%d}{%sp{%s}%s}{' %
- (count, bar1,
+ (mcols, bar1,
self.active_table.get_multicolumn_width(
self.active_table.get_entry_number(),
- count),
+ mcols),
self.active_table.get_vertical_bar()))
self.context.append('}')
else:
@@ -1994,14 +2002,13 @@
self.context.append('}')
else:
self.context.append('')
+ self.active_table.visit_entry() # increment cell count
def depart_entry(self, node):
self.out.append(self.context.pop()) # header / not header
self.out.append(self.context.pop()) # multirow/column
- # if following row is spanned from above.
- if self.active_table.get_rowspan(self.active_table.get_entry_number()):
- self.out.append(' & ')
- self.active_table.visit_entry() # increment cell count
+ # insert extra "&"s, if following rows are spanned from above:
+ self.insert_additional_table_colum_delimiters()
def visit_row(self, node):
self.active_table.visit_row()
@@ -2416,6 +2423,9 @@
# 'verbatim': '',
'verbatimtab': r'\usepackage{moreverb}'}
+ if node.get('ids'):
+ self.out += ['\n'] + self.ids_to_labels(node)
+
if not self.active_table.is_open():
# no quote inside tables, to avoid vertical space between
# table border and literal block.
@@ -2784,6 +2794,8 @@
self.active_table.open()
for cls in node['classes']:
self.active_table.set_table_style(cls)
+ if 'align' in node:
+ self.active_table.set('align', node['align'])
if self.active_table._table_style == 'booktabs':
self.requirements['booktabs'] = r'\usepackage{booktabs}'
self.push_output_collector([])
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2016-07-26 18:16:01
|
Revision: 7952
http://sourceforge.net/p/docutils/code/7952
Author: milde
Date: 2016-07-26 18:15:59 +0000 (Tue, 26 Jul 2016)
Log Message:
-----------
Implement feature request [ 48 ]
Add :align: option to the table directives.
Thanks to Takeshi KOMIYA for the patch.
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/docs/ref/rst/directives.txt
trunk/docutils/docutils/parsers/rst/directives/tables.py
trunk/docutils/docutils/writers/html4css1/__init__.py
trunk/docutils/docutils/writers/html4css1/html4css1.css
trunk/docutils/docutils/writers/html_plain/__init__.py
trunk/docutils/docutils/writers/html_plain/minimal.css
trunk/docutils/docutils/writers/html_plain/plain.css
trunk/docutils/test/functional/expected/standalone_rst_html4css1.html
trunk/docutils/test/functional/expected/standalone_rst_html_plain.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/input/data/list_table.txt
trunk/docutils/test/functional/input/data/standard.txt
trunk/docutils/test/functional/input/data/svg_images.txt
trunk/docutils/test/functional/input/data/tables_latex.txt
trunk/docutils/test/functional/input/standalone_rst_html_plain.txt
trunk/docutils/test/functional/input/standalone_rst_latex.txt
trunk/docutils/test/test_parsers/test_rst/test_directives/test_tables.py
trunk/docutils/test/test_writers/test_html4css1_parts.py
trunk/docutils/test/test_writers/test_latex2e.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2016-07-26 12:30:31 UTC (rev 7951)
+++ trunk/docutils/HISTORY.txt 2016-07-26 18:15:59 UTC (rev 7952)
@@ -34,6 +34,10 @@
- Patch [ 120 ] tables accept option widths: list of relative widths, 'auto'
or 'grid'.
+ - Implement feature request [ 48 ]
+ Add :align: option to the table directives.
+ Thanks to Takeshi KOMIYA for the patch.
+
* docutils/parsers/rst/roles.py
- Fix [ 295 ] Class argument for custom role inheriting from math.
Modified: trunk/docutils/docs/ref/rst/directives.txt
===================================================================
--- trunk/docutils/docs/ref/rst/directives.txt 2016-07-26 12:30:31 UTC (rev 7951)
+++ trunk/docutils/docs/ref/rst/directives.txt 2016-07-26 18:15:59 UTC (rev 7952)
@@ -223,7 +223,9 @@
``align`` : "top", "middle", "bottom", "left", "center", or "right"
The alignment of the image, equivalent to the HTML ``<img>`` tag's
- "align" attribute. The values "top", "middle", and "bottom"
+ deprecated "align" attribute or the corresponding "vertical-align" and
+ "text-align" CSS properties.
+ The values "top", "middle", and "bottom"
control an image's vertical alignment (relative to the text
baseline); they are only useful for inline images (substitutions).
The values "left", "center", and "right" control an image's
@@ -749,7 +751,7 @@
:Directive Type: "table"
:Doctree Element: table_
:Directive Arguments: 1, optional (table title).
-:Directive Options: `:class:`_, `:name:`_
+:Directive Options: Possible (see below).
:Directive Content: A normal reStructuredText table.
(New in Docutils 0.3.1)
@@ -766,7 +768,14 @@
True False
===== =====
+The following options are recognized:
+``align`` : "left", "center", or "right"
+ The horizontal alignment of the table.
+ (New in Docutils 0.13)
+
+and the common options `:class:`_ and `:name:`_.
+
.. _csv-table:
CSV Table
@@ -880,6 +889,10 @@
.. Add another possible value, "double", to explicitly indicate
the default case?
+``align`` : "left", "center", or "right"
+ The horizontal alignment of the table.
+ (New in Docutils 0.13)
+
and the common options `:class:`_ and `:name:`_.
@@ -935,6 +948,10 @@
The number of table columns to use as stubs (row titles, on the
left). Defaults to 0.
+``align`` : "left", "center", or "right"
+ The horizontal alignment of the table.
+ (New in Docutils 0.13)
+
and the common options `:class:`_ and `:name:`_.
Modified: trunk/docutils/docutils/parsers/rst/directives/tables.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/directives/tables.py 2016-07-26 12:30:31 UTC (rev 7951)
+++ trunk/docutils/docutils/parsers/rst/directives/tables.py 2016-07-26 18:15:59 UTC (rev 7952)
@@ -20,6 +20,10 @@
from docutils.parsers.rst import directives
+def align(argument):
+ return directives.choice(argument, ('left', 'center', 'right'))
+
+
class Table(Directive):
"""
@@ -30,6 +34,7 @@
final_argument_whitespace = True
option_spec = {'class': directives.class_option,
'name': directives.unchanged,
+ 'align': align,
'widths': directives.value_or(('auto', 'grid'),
directives.positive_int_list)}
has_content = True
@@ -140,6 +145,8 @@
return [error]
table_node = node[0]
table_node['classes'] += self.options.get('class', [])
+ if 'align' in self.options:
+ table_node['align'] = self.options.get('align')
tgroup = table_node[0]
if type(self.widths) == list:
colspecs = [child for child in tgroup.children
@@ -168,6 +175,7 @@
'encoding': directives.encoding,
'class': directives.class_option,
'name': directives.unchanged,
+ 'align': align,
# field delimiter char
'delim': directives.single_char_or_whitespace_or_unicode,
# treat whitespace after delimiter as significant
@@ -258,6 +266,8 @@
table_node = self.state.build_table(table, self.content_offset,
stub_columns, widths=widths)
table_node['classes'] += self.options.get('class', [])
+ if 'align' in self.options:
+ table_node['align'] = self.options.get('align')
self.add_name(table_node)
if title:
table_node.insert(0, title)
@@ -384,7 +394,8 @@
'widths': directives.value_or(('auto', ),
directives.positive_int_list),
'class': directives.class_option,
- 'name': directives.unchanged}
+ 'name': directives.unchanged,
+ 'align': align}
def run(self):
if not self.content:
@@ -407,6 +418,8 @@
return [detail.args[0]]
table_node = self.build_table_from_list(table_data, widths, col_widths,
header_rows, stub_columns)
+ if 'align' in self.options:
+ table_node['align'] = self.options.get('align')
table_node['classes'] += self.options.get('class', [])
self.add_name(table_node)
if title:
Modified: trunk/docutils/docutils/writers/html4css1/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/html4css1/__init__.py 2016-07-26 12:30:31 UTC (rev 7951)
+++ trunk/docutils/docutils/writers/html4css1/__init__.py 2016-07-26 18:15:59 UTC (rev 7952)
@@ -1582,9 +1582,11 @@
def visit_table(self, node):
self.context.append(self.compact_p)
self.compact_p = True
- classes = ' '.join(['docutils', self.settings.table_style]).strip()
+ classes = ['docutils', self.settings.table_style]
+ if 'align' in node:
+ classes.append('align-%s' % node['align'])
self.body.append(
- self.starttag(node, 'table', CLASS=classes, border="1"))
+ self.starttag(node, 'table', CLASS=' '.join(classes), border="1"))
def depart_table(self, node):
self.compact_p = self.context.pop()
Modified: trunk/docutils/docutils/writers/html4css1/html4css1.css
===================================================================
--- trunk/docutils/docutils/writers/html4css1/html4css1.css 2016-07-26 12:30:31 UTC (rev 7951)
+++ trunk/docutils/docutils/writers/html4css1/html4css1.css 2016-07-26 18:15:59 UTC (rev 7952)
@@ -160,12 +160,12 @@
hr.docutils {
width: 75% }
-img.align-left, .figure.align-left, object.align-left {
+img.align-left, .figure.align-left, object.align-left, table.align-left {
clear: left ;
float: left ;
margin-right: 1em }
-img.align-right, .figure.align-right, object.align-right {
+img.align-right, .figure.align-right, object.align-right, table.align-right {
clear: right ;
float: right ;
margin-left: 1em }
@@ -176,6 +176,11 @@
margin-right: auto;
}
+table.align-center {
+ margin-left: auto;
+ margin-right: auto;
+}
+
.align-left {
text-align: left }
@@ -193,6 +198,15 @@
/* div.align-center * { */
/* text-align: left } */
+.align-top {
+ vertical-align: top }
+
+.align-middle {
+ vertical-align: middle }
+
+.align-bottom {
+ vertical-align: bottom }
+
ol.simple, ul.simple {
margin-bottom: 1em }
Modified: trunk/docutils/docutils/writers/html_plain/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/html_plain/__init__.py 2016-07-26 12:30:31 UTC (rev 7951)
+++ trunk/docutils/docutils/writers/html_plain/__init__.py 2016-07-26 18:15:59 UTC (rev 7952)
@@ -1514,6 +1514,8 @@
def visit_table(self, node):
classes = [cls.strip(u' \t\n')
for cls in self.settings.table_style.split(',')]
+ if 'align' in node:
+ classes.append('align-%s' % node['align'])
tag = self.starttag(node, 'table', CLASS=' '.join(classes))
self.body.append(tag)
Modified: trunk/docutils/docutils/writers/html_plain/minimal.css
===================================================================
--- trunk/docutils/docutils/writers/html_plain/minimal.css 2016-07-26 12:30:31 UTC (rev 7951)
+++ trunk/docutils/docutils/writers/html_plain/minimal.css 2016-07-26 18:15:59 UTC (rev 7952)
@@ -20,10 +20,13 @@
/* .. _CSS2.1: http://www.w3.org/TR/CSS2 */
/* .. _validates: http://jigsaw.w3.org/css-validator/validator$link */
-/* Figure/table alignment */
-.align-left { text-align: left; }
-.align-right { text-align: right; }
-.align-center { clear: both; text-align: center;}
+/* alignment of text and inline objects inside block objects*/
+.align-left { text-align: left; }
+.align-right { text-align: right; }
+.align-center { clear: both; text-align: center; }
+.align-top { vertical-align: top; }
+.align-middle { vertical-align: middle; }
+.align-bottom { vertical-align: bottom; }
/* titles */
h1.title, p.subtitle {
@@ -176,28 +179,34 @@
margin-left: 40px;
}
-/* Images and Figures */
+/* Figures, Images, and Tables */
+.figure.align-left,
img.align-left,
-.figure.align-left,
-object.align-left {
- display: block;
+object.align-left,
+table.align-left {
margin-right: auto;
}
+.figure.align-center,
img.align-center,
-.figure.align-center,
object.align-center {
+ margin-left: auto;
+ margin-right: auto;
display: block;
+}
+table.align-center {
margin-left: auto;
margin-right: auto;
}
+.figure.align-right,
img.align-right,
-.figure.align-right,
-object.align-right {
- display: block;
+object.align-right,
+table.align-right {
margin-left: auto;
}
-/* reset inner alignment in figures */
-div.align-right { text-align: inherit }
+/* reset inner alignment in figures and tables */
+div.align-left, div.align-center, div.align-right,
+table.align-left, table.align-center, table.align-right
+{ text-align: inherit }
/* Admonitions and System Messages */
div.admonition,
Modified: trunk/docutils/docutils/writers/html_plain/plain.css
===================================================================
--- trunk/docutils/docutils/writers/html_plain/plain.css 2016-07-26 12:30:31 UTC (rev 7951)
+++ trunk/docutils/docutils/writers/html_plain/plain.css 2016-07-26 18:15:59 UTC (rev 7952)
@@ -153,6 +153,8 @@
/* th { vertical-align: bottom; } */
+table tr { text-align: left; }
+
/* "booktabs" style (no vertical lines) */
table.booktabs {
border: 0;
@@ -165,7 +167,6 @@
}
table.booktabs th {
border-bottom: thin solid;
- text-align: left;
}
/* numbered tables (counter defined in div.document) */
@@ -195,16 +196,20 @@
/* ~~~~~~~~~~~~~ */
/* Images and Figures */
+
+/* let content flow to the side of aligned images and figures */
+.figure.align-left,
img.align-left,
-.figure.align-left,
object.align-left {
+ display: block;
clear: left;
float: left;
margin-right: 1em
}
+.figure.align-right,
img.align-right,
-.figure.align-right,
object.align-right {
+ display: block;
clear: right;
float: right;
margin-left: 1em
Modified: trunk/docutils/test/functional/expected/standalone_rst_html4css1.html
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_html4css1.html 2016-07-26 12:30:31 UTC (rev 7951)
+++ trunk/docutils/test/functional/expected/standalone_rst_html4css1.html 2016-07-26 18:15:59 UTC (rev 7952)
@@ -662,6 +662,68 @@
</div>
<p>This paragraph might flow around the figure. The specific behavior depends
upon the style sheet and the browser or rendering software used.</p>
+<p>Tables may be given titles and additional arguments with the <em>table</em>
+directive:</p>
+<table border="1" class="docutils align-left">
+<caption>left-aligned table</caption>
+<colgroup>
+<col width="50%" />
+<col width="50%" />
+</colgroup>
+<thead valign="bottom">
+<tr><th class="head">A</th>
+<th class="head">not A</th>
+</tr>
+</thead>
+<tbody valign="top">
+<tr><td>False</td>
+<td>True</td>
+</tr>
+<tr><td>True</td>
+<td>False</td>
+</tr>
+</tbody>
+</table>
+<table border="1" class="docutils align-center">
+<caption>center-aligned table</caption>
+<colgroup>
+<col width="50%" />
+<col width="50%" />
+</colgroup>
+<thead valign="bottom">
+<tr><th class="head">A</th>
+<th class="head">not A</th>
+</tr>
+</thead>
+<tbody valign="top">
+<tr><td>False</td>
+<td>True</td>
+</tr>
+<tr><td>True</td>
+<td>False</td>
+</tr>
+</tbody>
+</table>
+<table border="1" class="docutils align-right">
+<caption>right-aligned table</caption>
+<colgroup>
+<col width="50%" />
+<col width="50%" />
+</colgroup>
+<thead valign="bottom">
+<tr><th class="head">A</th>
+<th class="head">not A</th>
+</tr>
+</thead>
+<tbody valign="top">
+<tr><td>False</td>
+<td>True</td>
+</tr>
+<tr><td>True</td>
+<td>False</td>
+</tr>
+</tbody>
+</table>
</div>
<div class="section" id="admonitions">
<h3><a class="toc-backref" href="#id79">2.14.3 Admonitions</a></h3>
@@ -1055,6 +1117,24 @@
</tr>
</tbody>
</table>
+<table border="1" class="docutils align-center">
+<caption>center aligned list table</caption>
+<colgroup>
+<col width="50%" />
+<col width="50%" />
+</colgroup>
+<tbody valign="top">
+<tr><td>Albatross</td>
+<td>2.99</td>
+</tr>
+<tr><td>Crunchy Frog</td>
+<td>1.49</td>
+</tr>
+<tr><td>Gannet Ripple</td>
+<td>1.99</td>
+</tr>
+</tbody>
+</table>
</div>
<div class="section" id="custom-roles">
<h2><a class="toc-backref" href="#id73">2.23 Custom Roles</a></h2>
@@ -1111,8 +1191,8 @@
<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>
+<p>The <cite>html4css1</cite> writer uses <tt class="docutils literal"><object></tt> tags, the <cite>html5</cite>
+writer uses <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>
Modified: trunk/docutils/test/functional/expected/standalone_rst_html_plain.html
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_html_plain.html 2016-07-26 12:30:31 UTC (rev 7951)
+++ trunk/docutils/test/functional/expected/standalone_rst_html_plain.html 2016-07-26 18:15:59 UTC (rev 7952)
@@ -644,6 +644,68 @@
</div>
<p>This paragraph might flow around the figure. The specific behavior depends
upon the style sheet and the browser or rendering software used.</p>
+<p>Tables may be given titles and additional arguments with the <em>table</em>
+directive:</p>
+<table class="align-left">
+<caption>left-aligned table</caption>
+<colgroup>
+<col style="width: 50%" />
+<col style="width: 50%" />
+</colgroup>
+<thead>
+<tr><th class="head"><p>A</p></th>
+<th class="head"><p>not A</p></th>
+</tr>
+</thead>
+<tbody>
+<tr><td><p>False</p></td>
+<td><p>True</p></td>
+</tr>
+<tr><td><p>True</p></td>
+<td><p>False</p></td>
+</tr>
+</tbody>
+</table>
+<table class="align-center">
+<caption>center-aligned table</caption>
+<colgroup>
+<col style="width: 50%" />
+<col style="width: 50%" />
+</colgroup>
+<thead>
+<tr><th class="head"><p>A</p></th>
+<th class="head"><p>not A</p></th>
+</tr>
+</thead>
+<tbody>
+<tr><td><p>False</p></td>
+<td><p>True</p></td>
+</tr>
+<tr><td><p>True</p></td>
+<td><p>False</p></td>
+</tr>
+</tbody>
+</table>
+<table class="align-right">
+<caption>right-aligned table</caption>
+<colgroup>
+<col style="width: 50%" />
+<col style="width: 50%" />
+</colgroup>
+<thead>
+<tr><th class="head"><p>A</p></th>
+<th class="head"><p>not A</p></th>
+</tr>
+</thead>
+<tbody>
+<tr><td><p>False</p></td>
+<td><p>True</p></td>
+</tr>
+<tr><td><p>True</p></td>
+<td><p>False</p></td>
+</tr>
+</tbody>
+</table>
</div>
<div class="section" id="admonitions">
<h3><a class="toc-backref" href="#id89"><span class="sectnum">2.14.3</span> Admonitions</a></h3>
@@ -1024,6 +1086,24 @@
</tr>
</tbody>
</table>
+<table class="align-center">
+<caption>center aligned list table</caption>
+<colgroup>
+<col style="width: 50%" />
+<col style="width: 50%" />
+</colgroup>
+<tbody>
+<tr><td><p>Albatross</p></td>
+<td><p>2.99</p></td>
+</tr>
+<tr><td><p>Crunchy Frog</p></td>
+<td><p>1.49</p></td>
+</tr>
+<tr><td><p>Gannet Ripple</p></td>
+<td><p>1.99</p></td>
+</tr>
+</tbody>
+</table>
</div>
<div class="section" id="custom-roles">
<h2><a class="toc-backref" href="#id77"><span class="sectnum">2.23</span> Custom Roles</a></h2>
@@ -1075,8 +1155,8 @@
<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>
-<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>
+<p>The <cite>html4css1</cite> writer uses <span class="docutils literal"><object></span> tags, the <cite>html5</cite>
+writer uses <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>
@@ -1359,9 +1439,9 @@
</tr>
</tbody>
</table>
-<p>This table also uses the "align-left" class argument, to left-align
-the headers:</p>
-<table class="booktabs align-left">
+<p>This table also uses the "align-right" class argument, to right-align
+the table:</p>
+<table class="booktabs align-right">
<colgroup>
<col style="width: 29%" />
<col style="width: 29%" />
@@ -1392,8 +1472,8 @@
</tr>
</tbody>
</table>
-<p>Of course, also "booktabs" style tables can be numbered:</p>
-<table class="numbered booktabs">
+<p>"Booktabs" style table, numbered and centre-aligned:</p>
+<table class="numbered booktabs align-center">
<caption>I/O values</caption>
<colgroup>
<col style="width: 31%" />
Modified: trunk/docutils/test/functional/expected/standalone_rst_latex.tex
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_latex.tex 2016-07-26 12:30:31 UTC (rev 7951)
+++ trunk/docutils/test/functional/expected/standalone_rst_latex.tex 2016-07-26 18:15:59 UTC (rev 7952)
@@ -988,7 +988,121 @@
This paragraph might flow around the figure. The specific behavior depends
upon the style sheet and the browser or rendering software used.
+Tables may be given titles and additional arguments with the \emph{table}
+directive:
+\setlength{\DUtablewidth}{\linewidth}
+\begin{longtable}[l]{|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|}
+\caption{left-aligned table}\\
+\hline
+\textbf{%
+A
+} & \textbf{%
+not A
+} \\
+\hline
+\endfirsthead
+\caption[]{left-aligned table (... continued)}\\
+\hline
+\textbf{%
+A
+} & \textbf{%
+not A
+} \\
+\hline
+\endhead
+\multicolumn{2}{c}{\hfill ... continued on next page} \\
+\endfoot
+\endlastfoot
+
+False
+ &
+True
+ \\
+\hline
+
+True
+ &
+False
+ \\
+\hline
+\end{longtable}
+
+\setlength{\DUtablewidth}{\linewidth}
+\begin{longtable}[c]{|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|}
+\caption{center-aligned table}\\
+\hline
+\textbf{%
+A
+} & \textbf{%
+not A
+} \\
+\hline
+\endfirsthead
+\caption[]{center-aligned table (... continued)}\\
+\hline
+\textbf{%
+A
+} & \textbf{%
+not A
+} \\
+\hline
+\endhead
+\multicolumn{2}{c}{\hfill ... continued on next page} \\
+\endfoot
+\endlastfoot
+
+False
+ &
+True
+ \\
+\hline
+
+True
+ &
+False
+ \\
+\hline
+\end{longtable}
+
+\setlength{\DUtablewidth}{\linewidth}
+\begin{longtable}[r]{|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|}
+\caption{right-aligned table}\\
+\hline
+\textbf{%
+A
+} & \textbf{%
+not A
+} \\
+\hline
+\endfirsthead
+\caption[]{right-aligned table (... continued)}\\
+\hline
+\textbf{%
+A
+} & \textbf{%
+not A
+} \\
+\hline
+\endhead
+\multicolumn{2}{c}{\hfill ... continued on next page} \\
+\endfoot
+\endlastfoot
+
+False
+ &
+True
+ \\
+\hline
+
+True
+ &
+False
+ \\
+\hline
+\end{longtable}
+
+
\subsubsection{2.14.3~~~Admonitions%
\label{admonitions}%
}
@@ -1701,7 +1815,7 @@
\label{more-tables}%
}
-A multicolumn table with multi-paragraph rowspanning cells:
+A table with multi-paragraph multicolumn cells:
\setlength{\DUtablewidth}{\linewidth}
\begin{longtable*}[c]{|p{0.133\DUtablewidth}|p{0.179\DUtablewidth}|p{0.179\DUtablewidth}|p{0.110\DUtablewidth}|p{0.121\DUtablewidth}|p{0.145\DUtablewidth}|}
@@ -1758,7 +1872,10 @@
\hline
\end{longtable*}
-A table with multirow header
+Tables with multi-paragraph multirow cells currently fail due to a LaTeX
+limitation (see \url{https://sourceforge.net/p/docutils/bugs/225/}).
+
+A table with multirow header:
%
\begin{quote}
@@ -2523,8 +2640,8 @@
an unsupported level.
-% unusual combinations (from newlatex, for interactive testing)
-% .. include:: data/latex.txt
+% unusual combinations (currently separately tested)
+% .. include:: data/latex_cornercases.txt
% Preface for System Messages:
Modified: trunk/docutils/test/functional/expected/standalone_rst_pseudoxml.txt
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_pseudoxml.txt 2016-07-26 12:30:31 UTC (rev 7951)
+++ trunk/docutils/test/functional/expected/standalone_rst_pseudoxml.txt 2016-07-26 18:15:59 UTC (rev 7952)
@@ -1361,6 +1361,99 @@
<paragraph>
This paragraph might flow around the figure. The specific behavior depends
upon the style sheet and the browser or rendering software used.
+ <paragraph>
+ Tables may be given titles and additional arguments with the
+ <emphasis>
+ table
+
+ directive:
+ <table align="left">
+ <title>
+ left-aligned table
+ <tgroup cols="2" colwidths="auto">
+ <colspec colwidth="5">
+ <colspec colwidth="5">
+ <thead>
+ <row>
+ <entry>
+ <paragraph>
+ A
+ <entry>
+ <paragraph>
+ not A
+ <tbody>
+ <row>
+ <entry>
+ <paragraph>
+ False
+ <entry>
+ <paragraph>
+ True
+ <row>
+ <entry>
+ <paragraph>
+ True
+ <entry>
+ <paragraph>
+ False
+ <table align="center">
+ <title>
+ center-aligned table
+ <tgroup cols="2" colwidths="auto">
+ <colspec colwidth="5">
+ <colspec colwidth="5">
+ <thead>
+ <row>
+ <entry>
+ <paragraph>
+ A
+ <entry>
+ <paragraph>
+ not A
+ <tbody>
+ <row>
+ <entry>
+ <paragraph>
+ False
+ <entry>
+ <paragraph>
+ True
+ <row>
+ <entry>
+ <paragraph>
+ True
+ <entry>
+ <paragraph>
+ False
+ <table align="right">
+ <title>
+ right-aligned table
+ <tgroup cols="2" colwidths="auto">
+ <colspec colwidth="5">
+ <colspec colwidth="5">
+ <thead>
+ <row>
+ <entry>
+ <paragraph>
+ A
+ <entry>
+ <paragraph>
+ not A
+ <tbody>
+ <row>
+ <entry>
+ <paragraph>
+ False
+ <entry>
+ <paragraph>
+ True
+ <row>
+ <entry>
+ <paragraph>
+ True
+ <entry>
+ <paragraph>
+ False
<section ids="admonitions" names="admonitions">
<title auto="1" refid="id76">
<generated classes="sectnum">
@@ -2036,6 +2129,34 @@
<entry>
<paragraph>
On a stick!
+ <table align="center">
+ <title>
+ center aligned list table
+ <tgroup cols="2" colwidths="auto">
+ <colspec colwidth="50">
+ <colspec colwidth="50">
+ <tbody>
+ <row>
+ <entry>
+ <paragraph>
+ Albatross
+ <entry>
+ <paragraph>
+ 2.99
+ <row>
+ <entry>
+ <paragraph>
+ Crunchy Frog
+ <entry>
+ <paragraph>
+ 1.49
+ <row>
+ <entry>
+ <paragraph>
+ Gannet Ripple
+ <entry>
+ <paragraph>
+ 1.99
<section ids="error-handling" names="error\ handling">
<title auto="1" refid="id73">
<generated classes="sectnum">
@@ -2081,9 +2202,9 @@
<system_message level="1" line="475" source="functional/input/data/standard.txt" type="INFO">
<paragraph>
Hyperlink target "image-target-3" is not referenced.
- <system_message level="1" line="632" source="functional/input/data/standard.txt" type="INFO">
+ <system_message level="1" line="667" source="functional/input/data/standard.txt" type="INFO">
<paragraph>
Hyperlink target "docutils" is not referenced.
- <system_message level="1" line="753" source="functional/input/data/standard.txt" type="INFO">
+ <system_message level="1" line="788" source="functional/input/data/standard.txt" type="INFO">
<paragraph>
...
[truncated message content] |
|
From: <mi...@us...> - 2016-07-26 18:41:32
|
Revision: 7953
http://sourceforge.net/p/docutils/code/7953
Author: milde
Date: 2016-07-26 18:41:29 +0000 (Tue, 26 Jul 2016)
Log Message:
-----------
Apply [ 132 ] Add SOURCE_DATE_EPOCH support to date directive.
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/docutils/parsers/rst/directives/misc.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2016-07-26 18:15:59 UTC (rev 7952)
+++ trunk/docutils/HISTORY.txt 2016-07-26 18:41:29 UTC (rev 7953)
@@ -29,9 +29,13 @@
- Fix [ 233 ] Change the base URL for the :rfc: role.
+* docutils/parsers/rst/directives/misc.py
+
+ - Apply [ 132 ] Add SOURCE_DATE_EPOCH support to date directive.
+
* docutils/parsers/rst/directives/tables.py
- - Patch [ 120 ] tables accept option widths: list of relative widths, 'auto'
+ - Apply [ 120 ] tables accept option widths: list of relative widths, 'auto'
or 'grid'.
- Implement feature request [ 48 ]
Modified: trunk/docutils/docutils/parsers/rst/directives/misc.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/directives/misc.py 2016-07-26 18:15:59 UTC (rev 7952)
+++ trunk/docutils/docutils/parsers/rst/directives/misc.py 2016-07-26 18:41:29 UTC (rev 7953)
@@ -477,7 +477,10 @@
except UnicodeEncodeError:
raise self.warning(u'Cannot encode date format string '
u'with locale encoding "%s".' % locale_encoding)
- text = time.strftime(format_str)
+ text = time.strftime(
+ format_str,
+ time.gmtime(int(os.environ.get('SOURCE_DATE_EPOCH', time.time()))),
+ )
if sys.version_info< (3, 0):
# `text` is a byte string that may contain non-ASCII characters:
try:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2016-07-27 10:38:36
|
Revision: 7955
http://sourceforge.net/p/docutils/code/7955
Author: milde
Date: 2016-07-27 10:38:34 +0000 (Wed, 27 Jul 2016)
Log Message:
-----------
"use_source_date_epoch" config setting.
Use SOURCE_DATE_EPOCH timestamp only if "use_source_date_epoch" config setting
is enabled.
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/docs/user/config.txt
trunk/docutils/docutils/parsers/rst/__init__.py
trunk/docutils/docutils/parsers/rst/directives/misc.py
Added Paths:
-----------
trunk/docutils/test/test_parsers/test_rst/test_directives/test_date_source_date_epoch.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2016-07-26 23:17:34 UTC (rev 7954)
+++ trunk/docutils/HISTORY.txt 2016-07-27 10:38:34 UTC (rev 7955)
@@ -32,6 +32,7 @@
* docutils/parsers/rst/directives/misc.py
- Apply [ 132 ] Add SOURCE_DATE_EPOCH support to date directive.
+ Activate with the "use_source_date_epoch" config setting.
* docutils/parsers/rst/directives/tables.py
Modified: trunk/docutils/docs/user/config.txt
===================================================================
--- trunk/docutils/docs/user/config.txt 2016-07-26 23:17:34 UTC (rev 7954)
+++ trunk/docutils/docs/user/config.txt 2016-07-27 10:38:34 UTC (rev 7955)
@@ -588,6 +588,32 @@
[restructuredtext parser]
-------------------------
+character_level_inline_markup
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Experimental setting to relax the `inline markup recognition rules`_
+requiring whitespace or punctuation around inline markup.
+
+Allows character level inline markup without escaped whithespace and is
+especially suited for langauges that do not use whitespace to separate words
+(e.g. Japanese, Chinese).
+
+.. WARNING:: Potentially dangerous; use with caution.
+
+ When changing this setting to "True", inline markup charactes in
+ URLs, names and formulas must be escaped to prevent recognition and
+ possible errors. Examples::
+
+ http://rST_for_all.html (hyperlinks to rST_ and for_)
+ x_2, inline_markup (hyperlinks to x_ and inline_)
+ 2*x (starts emphasised text)
+ a|b (starts a substitution reference)
+
+Default: disabled (False).
+Options: ``--character-level-inline-markup, --word-level-inline-markup``.
+
+New in Docutils 0.13.
+
file_insertion_enabled
~~~~~~~~~~~~~~~~~~~~~~
@@ -649,33 +675,6 @@
Default: "http://www.faqs.org/rfcs/". Option: ``--rfc-base-url``.
-character_level_inline_markup
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Experimental setting to relax the `inline markup recognition rules`_
-requiring whitespace or punctuation around inline markup.
-
-Allows character level inline markup without escaped whithespace and is
-especially suited for langauges that do not use whitespace to separate words
-(e.g. Japanese, Chinese).
-
-.. WARNING:: Potentially dangerous; use with caution.
-
- When changing this setting to "True", inline markup charactes in
- URLs, names and formulas must be escaped to prevent recognition and
- possible errors. Examples::
-
- http://rST_for_all.html (hyperlinks to rST_ and for_)
- x_2, inline_markup (hyperlinks to x_ and inline_)
- 2*x (starts emphasised text)
- a|b (starts a substitution reference)
-
-Default: disabled (False).
-Options: ``--character-level-inline-markup, --word-level-inline-markup``.
-
-New in Docutils 0.13.
-
-
smart_quotes
~~~~~~~~~~~~
@@ -745,6 +744,27 @@
__ `footnote_references [latex2e writer]`_
+use_source_date_epoch
+~~~~~~~~~~~~~~~~~~~~~
+
+Use timestamp from the `SOURCE_DATE_EPOCH`_ environment variable for the
+`date directive`_.
+
+With this setting and environment variable, Docutils-generated documentation
+can be part of `reproducible software builds`_
+
+Default: disabled (False).
+Options: ``--use-source-date-epoch``.
+
+New in Docutils 0.13.
+
+.. _SOURCE_DATE_EPOCH:
+ https://reproducible-builds.org/specs/source-date-epoch/
+.. _reproducible software builds:
+ https://reproducible-builds.org/
+.. _date directive: ../ref/rst/directives.html#date
+
+
[readers]
=========
Modified: trunk/docutils/docutils/parsers/rst/__init__.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/__init__.py 2016-07-26 23:17:34 UTC (rev 7954)
+++ trunk/docutils/docutils/parsers/rst/__init__.py 2016-07-27 10:38:34 UTC (rev 7955)
@@ -155,6 +155,10 @@
['--character-level-inline-markup'],
{'action': 'store_true', 'default': False,
'dest': 'character_level_inline_markup'}),
+ ('Use timestamp from SOURCE_DATE_EPOCH environment variable '
+ 'for the "date" directive.',
+ ['--use-source-date-epoch'],
+ {'action': 'store_true', 'validator': frontend.validate_boolean}),
))
config_section = 'restructuredtext parser'
Modified: trunk/docutils/docutils/parsers/rst/directives/misc.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/directives/misc.py 2016-07-26 23:17:34 UTC (rev 7954)
+++ trunk/docutils/docutils/parsers/rst/directives/misc.py 2016-07-27 10:38:34 UTC (rev 7955)
@@ -231,7 +231,7 @@
raise self.severe(u'Problems with "%s" directive URL "%s":\n%s.'
% (self.name, self.options['url'], ErrorString(error)))
raw_file = io.StringInput(source=raw_text, source_path=source,
- encoding=encoding,
+ encoding=encoding,
error_handler=e_handler)
try:
text = raw_file.read()
@@ -477,8 +477,12 @@
except UnicodeEncodeError:
raise self.warning(u'Cannot encode date format string '
u'with locale encoding "%s".' % locale_encoding)
- source_date_epoch = os.environ.get('SOURCE_DATE_EPOCH')
- if source_date_epoch:
+ if self.state.document.settings.use_source_date_epoch:
+ try:
+ source_date_epoch = os.environ['SOURCE_DATE_EPOCH']
+ except KeyError:
+ raise self.warning(u'setting "use_source_date_epoch" enabled '
+ u'but SOURCE_DATE_EPOCH environment variable not set.')
text = time.strftime(format_str,
time.gmtime(int(source_date_epoch)))
else:
Added: trunk/docutils/test/test_parsers/test_rst/test_directives/test_date_source_date_epoch.py
===================================================================
--- trunk/docutils/test/test_parsers/test_rst/test_directives/test_date_source_date_epoch.py (rev 0)
+++ trunk/docutils/test/test_parsers/test_rst/test_directives/test_date_source_date_epoch.py 2016-07-27 10:38:34 UTC (rev 7955)
@@ -0,0 +1,53 @@
+#! /usr/bin/env python
+
+# $Id$
+# Author: David Goodger <go...@py...>
+# Copyright: This module has been placed in the public domain.
+
+"""
+Tests for the misc.py "date" directive.
+"""
+
+from __init__ import DocutilsTestSupport
+import time, os
+
+from docutils.utils.error_reporting import locale_encoding
+
+os.environ['SOURCE_DATE_EPOCH'] = '5000000'
+
+def suite():
+ s = DocutilsTestSupport.ParserTestSuite(suite_settings={'use_source_date_epoch':True})
+ s.generateTests(totest)
+ return s
+
+totest = {}
+
+totest['date'] = [
+["""\
+.. |date| date::
+
+Today's date is |date|.
+""",
+"""\
+<document source="test data">
+ <substitution_definition names="date">
+ 1970-02-27
+ <paragraph>
+ Today's date is \n\
+ <substitution_reference refname="date">
+ date
+ .
+"""],
+["""\
+.. |date| date:: %a, %d %b %Y %H:%M
+""",
+"""\
+<document source="test data">
+ <substitution_definition names="date">
+ Fri, 27 Feb 1970 20:53
+"""],
+]
+
+if __name__ == '__main__':
+ import unittest
+ unittest.main(defaultTest='suite')
Property changes on: trunk/docutils/test/test_parsers/test_rst/test_directives/test_date_source_date_epoch.py
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2016-07-28 20:59:17
|
Revision: 7957
http://sourceforge.net/p/docutils/code/7957
Author: milde
Date: 2016-07-28 20:59:14 +0000 (Thu, 28 Jul 2016)
Log Message:
-----------
Revert application of [ 132 ] (SOURCE_DATE_EPOCH for "date" directive).
The patch is incomplete and does not solve the single use case.
See https://sourceforge.net/p/docutils/patches/132/ for details.
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/docs/user/config.txt
trunk/docutils/docutils/transforms/universal.py
Removed Paths:
-------------
trunk/docutils/test/test_parsers/test_rst/test_directives/test_date_source_date_epoch.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2016-07-28 07:50:29 UTC (rev 7956)
+++ trunk/docutils/HISTORY.txt 2016-07-28 20:59:14 UTC (rev 7957)
@@ -29,11 +29,6 @@
- Fix [ 233 ] Change the base URL for the :rfc: role.
-* docutils/parsers/rst/directives/misc.py
-
- - Apply [ 132 ] Add SOURCE_DATE_EPOCH support to date directive.
- Activate with the "use_source_date_epoch" config setting.
-
* docutils/parsers/rst/directives/tables.py
- Apply [ 120 ] tables accept option widths: list of relative widths, 'auto'
Modified: trunk/docutils/docs/user/config.txt
===================================================================
--- trunk/docutils/docs/user/config.txt 2016-07-28 07:50:29 UTC (rev 7956)
+++ trunk/docutils/docs/user/config.txt 2016-07-28 20:59:14 UTC (rev 7957)
@@ -744,27 +744,29 @@
__ `footnote_references [latex2e writer]`_
-use_source_date_epoch
-~~~~~~~~~~~~~~~~~~~~~
+.. @@@ do we want a setting for considering/ignoring SOURCE_DATE_EPOCH ?
-Use timestamp from the `SOURCE_DATE_EPOCH`_ environment variable for the
-`date directive`_.
+ use_source_date_epoch
+ ~~~~~~~~~~~~~~~~~~~~~
-With this setting and environment variable, Docutils-generated documentation
-can be part of `reproducible software builds`_
+ Use timestamp from the `SOURCE_DATE_EPOCH`_ environment variable for the
+ `date directive`_.
-Default: disabled (False).
-Options: ``--use-source-date-epoch``.
+ With this setting and environment variable, Docutils-generated documentation
+ can be part of `reproducible software builds`_
-New in Docutils 0.13.
+ Default: disabled (False).
+ Options: ``--use-source-date-epoch``.
-.. _SOURCE_DATE_EPOCH:
- https://reproducible-builds.org/specs/source-date-epoch/
-.. _reproducible software builds:
- https://reproducible-builds.org/
-.. _date directive: ../ref/rst/directives.html#date
+ New in Docutils 0.13.
+ .. _SOURCE_DATE_EPOCH:
+ https://reproducible-builds.org/specs/source-date-epoch/
+ .. _reproducible software builds:
+ https://reproducible-builds.org/
+ .. _date directive: ../ref/rst/directives.html#date
+
[readers]
=========
Modified: trunk/docutils/docutils/transforms/universal.py
===================================================================
--- trunk/docutils/docutils/transforms/universal.py 2016-07-28 07:50:29 UTC (rev 7956)
+++ trunk/docutils/docutils/transforms/universal.py 2016-07-28 20:59:14 UTC (rev 7957)
@@ -49,6 +49,10 @@
def generate_footer(self):
# @@@ Text is hard-coded for now.
# Should be made dynamic (language-dependent).
+ # @@@ Use timestamp from the `SOURCE_DATE_EPOCH`_ environment variable
+ # for the datestamp?
+ # See https://sourceforge.net/p/docutils/patches/132/
+ # and https://reproducible-builds.org/specs/source-date-epoch/
settings = self.document.settings
if settings.generator or settings.datestamp or settings.source_link \
or settings.source_url:
Deleted: trunk/docutils/test/test_parsers/test_rst/test_directives/test_date_source_date_epoch.py
===================================================================
--- trunk/docutils/test/test_parsers/test_rst/test_directives/test_date_source_date_epoch.py 2016-07-28 07:50:29 UTC (rev 7956)
+++ trunk/docutils/test/test_parsers/test_rst/test_directives/test_date_source_date_epoch.py 2016-07-28 20:59:14 UTC (rev 7957)
@@ -1,53 +0,0 @@
-#! /usr/bin/env python
-
-# $Id$
-# Author: David Goodger <go...@py...>
-# Copyright: This module has been placed in the public domain.
-
-"""
-Tests for the misc.py "date" directive.
-"""
-
-from __init__ import DocutilsTestSupport
-import time, os
-
-from docutils.utils.error_reporting import locale_encoding
-
-os.environ['SOURCE_DATE_EPOCH'] = '5000000'
-
-def suite():
- s = DocutilsTestSupport.ParserTestSuite(suite_settings={'use_source_date_epoch':True})
- s.generateTests(totest)
- return s
-
-totest = {}
-
-totest['date'] = [
-["""\
-.. |date| date::
-
-Today's date is |date|.
-""",
-"""\
-<document source="test data">
- <substitution_definition names="date">
- 1970-02-27
- <paragraph>
- Today's date is \n\
- <substitution_reference refname="date">
- date
- .
-"""],
-["""\
-.. |date| date:: %a, %d %b %Y %H:%M
-""",
-"""\
-<document source="test data">
- <substitution_definition names="date">
- Fri, 27 Feb 1970 20:53
-"""],
-]
-
-if __name__ == '__main__':
- import unittest
- unittest.main(defaultTest='suite')
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2016-07-28 21:52:16
|
Revision: 7958
http://sourceforge.net/p/docutils/code/7958
Author: milde
Date: 2016-07-28 21:52:14 +0000 (Thu, 28 Jul 2016)
Log Message:
-----------
Clear up and document patch [ 120 ].
The colwidths argument for <tgroup> violates the docutils.dtd.
As the "auto"/"given" tags may be ignored by the writers, they may be
stored as classes instead.
The default case (grid for tables, equal widths for ListTable and CSVTable
does not need/get a tag. This way, writers can decide whether to leave
column width determination to the backend when the class "colwidths-auto" is
set (opt-in) or by default (opt-out with "colwidths-given").
Modified Paths:
--------------
trunk/docutils/docutils/parsers/rst/directives/tables.py
trunk/docutils/docutils/parsers/rst/states.py
trunk/docutils/docutils/writers/html_plain/__init__.py
trunk/docutils/test/functional/expected/math_output_mathml.xhtml
trunk/docutils/test/functional/expected/standalone_rst_html_plain.html
trunk/docutils/test/functional/input/data/math.txt
trunk/docutils/test/functional/input/standalone_rst_html_plain.txt
trunk/docutils/test/test_parsers/test_rst/test_directives/test_tables.py
Modified: trunk/docutils/docutils/parsers/rst/directives/tables.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/directives/tables.py 2016-07-28 20:59:14 UTC (rev 7957)
+++ trunk/docutils/docutils/parsers/rst/directives/tables.py 2016-07-28 21:52:14 UTC (rev 7958)
@@ -94,7 +94,7 @@
@property
def widths(self):
- return self.options.get('widths', 'auto')
+ return self.options.get('widths', '')
def get_column_widths(self, max_cols):
if type(self.widths) == list:
@@ -114,8 +114,10 @@
raise SystemMessagePropagation(error)
if self.widths == 'auto':
widths = 'auto'
+ elif self.widths: # "grid" or list of integers
+ widths = 'given'
else:
- widths = 'given'
+ widths = self.widths
return widths, col_widths
def extend_short_rows_with_empty_cells(self, columns, parts):
@@ -153,10 +155,13 @@
if child.tagname == 'colspec']
for colspec, col_width in zip(colspecs, self.widths):
colspec['colwidth'] = col_width
+ # @@@ the colwidths argument for <tgroup> is not part of the
+ # XML Exchange Table spec (https://www.oasis-open.org/specs/tm9901.htm)
+ # and hence violates the docutils.dtd.
if self.widths == 'auto':
- tgroup['colwidths'] = 'auto'
- else:
- tgroup['colwidths'] = 'given'
+ table_node['classes'] += ['colwidths-auto']
+ elif self.widths: # "grid" or list of integers
+ table_node['classes'] += ['colwidths-given']
self.add_name(table_node)
if title:
table_node.insert(0, title)
@@ -468,7 +473,9 @@
def build_table_from_list(self, table_data, widths, col_widths, header_rows,
stub_columns):
table = nodes.table()
- tgroup = nodes.tgroup(cols=len(col_widths), colwidths=widths)
+ if widths:
+ table['classes'] += ['colwidths-%s' % widths]
+ tgroup = nodes.tgroup(cols=len(col_widths))
table += tgroup
for col_width in col_widths:
colspec = nodes.colspec()
Modified: trunk/docutils/docutils/parsers/rst/states.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/states.py 2016-07-28 20:59:14 UTC (rev 7957)
+++ trunk/docutils/docutils/parsers/rst/states.py 2016-07-28 21:52:14 UTC (rev 7958)
@@ -1764,10 +1764,12 @@
line=startline+offset)
return [error]
- def build_table(self, tabledata, tableline, stub_columns=0, widths='auto'):
+ def build_table(self, tabledata, tableline, stub_columns=0, widths=None):
colwidths, headrows, bodyrows = tabledata
table = nodes.table()
- tgroup = nodes.tgroup(cols=len(colwidths), colwidths=widths)
+ if widths:
+ table['classes'] += ['colwidths-%s' % widths]
+ tgroup = nodes.tgroup(cols=len(colwidths))
table += tgroup
for colwidth in colwidths:
colspec = nodes.colspec(colwidth=colwidth)
Modified: trunk/docutils/docutils/writers/html_plain/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/html_plain/__init__.py 2016-07-28 20:59:14 UTC (rev 7957)
+++ trunk/docutils/docutils/writers/html_plain/__init__.py 2016-07-28 21:52:14 UTC (rev 7958)
@@ -634,11 +634,9 @@
pass
def write_colspecs(self):
- width = 0
+ total_width = sum(node['colwidth'] for node in self.colspecs)
for node in self.colspecs:
- width += node['colwidth']
- for node in self.colspecs:
- colwidth = int(node['colwidth'] * 100.0 / width + 0.5)
+ colwidth = int(node['colwidth'] * 100.0 / total_width + 0.5)
self.body.append(self.emptytag(node, 'col',
style='width: %i%%' % colwidth))
self.colspecs = []
Modified: trunk/docutils/test/functional/expected/math_output_mathml.xhtml
===================================================================
--- trunk/docutils/test/functional/expected/math_output_mathml.xhtml 2016-07-28 20:59:14 UTC (rev 7957)
+++ trunk/docutils/test/functional/expected/math_output_mathml.xhtml 2016-07-28 21:52:14 UTC (rev 7958)
@@ -95,7 +95,7 @@
physical system changes in time.</p>
<dl>
<dt>Math-Accents:</dt>
-<dd><table class="borderless">
+<dd><table class="colwidths-given borderless">
<colgroup>
<col style="width: 33%" />
<col style="width: 33%" />
@@ -205,7 +205,7 @@
<p>Cases with the <a class="reference external" href="ftp://ftp.ams.org/ams/doc/amsmath/short-math-guide.pdf">AMSmath</a> <span class="docutils literal">cases</span> environment (not (yet) supported by
HTML writers with <span class="docutils literal"><span class="pre">--math-output=MathML</span></span>):</p>
<div class="system-message">
-<p class="system-message-title">System Message: ERROR/3 (<span class="docutils literal">functional/input/data/math.txt</span>, line 107)</p>
+<p class="system-message-title">System Message: ERROR/3 (<span class="docutils literal">functional/input/data/math.txt</span>, line 108)</p>
<p>
Environment not supported! Supported environment: "matrix".</p>
<pre class="literal-block">
Modified: trunk/docutils/test/functional/expected/standalone_rst_html_plain.html
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_html_plain.html 2016-07-28 20:59:14 UTC (rev 7957)
+++ trunk/docutils/test/functional/expected/standalone_rst_html_plain.html 2016-07-28 21:52:14 UTC (rev 7958)
@@ -1057,7 +1057,7 @@
<div class="section" id="list-tables">
<h2><a class="toc-backref" href="#id76"><span class="sectnum">2.22</span> List Tables</a></h2>
<p>Here's a list table exercising all features:</p>
-<table class="test">
+<table class="colwidths-given test">
<caption>list table with integral header</caption>
<colgroup>
<col style="width: 17%" />
@@ -1416,33 +1416,6 @@
from the <a class="reference external" href="http://tug.ctan.org/tex-archive/macros/latex/contrib/booktabs/booktabs.pdf">booktabs</a> <a class="footnote-reference brackets" href="#id33" id="id34">8</a> LaTeX package.</p>
<table class="booktabs">
<colgroup>
-<col style="width: 31%" />
-<col style="width: 31%" />
-<col style="width: 38%" />
-</colgroup>
-<tbody>
-<tr><td><p>False</p></td>
-<td><p>False</p></td>
-<td><p>False</p></td>
-</tr>
-<tr><td><p>True</p></td>
-<td><p>False</p></td>
-<td><p>True</p></td>
-</tr>
-<tr><td><p>False</p></td>
-<td><p>True</p></td>
-<td><p>True</p></td>
-</tr>
-<tr><td><p>True</p></td>
-<td><p>True</p></td>
-<td><p>True</p></td>
-</tr>
-</tbody>
-</table>
-<p>This table also uses the "align-right" class argument, to right-align
-the table:</p>
-<table class="booktabs align-right">
-<colgroup>
<col style="width: 29%" />
<col style="width: 29%" />
<col style="width: 41%" />
Modified: trunk/docutils/test/functional/input/data/math.txt
===================================================================
--- trunk/docutils/test/functional/input/data/math.txt 2016-07-28 20:59:14 UTC (rev 7957)
+++ trunk/docutils/test/functional/input/data/math.txt 2016-07-28 21:52:14 UTC (rev 7958)
@@ -49,6 +49,7 @@
Math-Accents:
.. list-table::
:class: borderless
+ :widths: 26 26 26
* - :math:`\acute{a}` ``\acute{a}``
- :math:`\dot{t}` ``\dot{t}``
Modified: trunk/docutils/test/functional/input/standalone_rst_html_plain.txt
===================================================================
--- trunk/docutils/test/functional/input/standalone_rst_html_plain.txt 2016-07-28 20:59:14 UTC (rev 7957)
+++ trunk/docutils/test/functional/input/standalone_rst_html_plain.txt 2016-07-28 21:52:14 UTC (rev 7958)
@@ -167,18 +167,6 @@
.. class:: booktabs
-===== ===== ======
-False False False
-True False True
-False True True
-True True True
-===== ===== ======
-
-This table also uses the "align-right" class argument, to right-align
-the table:
-
-.. class:: booktabs align-right
-
===== ===== =======
A B A or B
===== ===== =======
@@ -188,7 +176,6 @@
True True True
===== ===== =======
-
"Booktabs" style table, numbered and centre-aligned:
.. table:: I/O values
Modified: trunk/docutils/test/test_parsers/test_rst/test_directives/test_tables.py
===================================================================
--- trunk/docutils/test/test_parsers/test_rst/test_directives/test_tables.py 2016-07-28 20:59:14 UTC (rev 7957)
+++ trunk/docutils/test/test_parsers/test_rst/test_directives/test_tables.py 2016-07-28 21:52:14 UTC (rev 7958)
@@ -71,7 +71,7 @@
<table classes="custom" ids="tab-truth-not" names="tab:truth.not">
<title>
Truth table for "not"
- <tgroup cols="2" colwidths="auto">
+ <tgroup cols="2">
<colspec colwidth="5">
<colspec colwidth="5">
<thead>
@@ -109,7 +109,7 @@
"""\
<document source="test data">
<table>
- <tgroup cols="2" colwidths="auto">
+ <tgroup cols="2">
<colspec colwidth="10">
<colspec colwidth="10">
<tbody>
@@ -143,7 +143,7 @@
<problematic ids="id2" refid="id1">
*
error
- <tgroup cols="2" colwidths="auto">
+ <tgroup cols="2">
<colspec colwidth="6">
<colspec colwidth="5">
<tbody>
@@ -194,8 +194,8 @@
""",
"""\
<document source="test data">
- <table>
- <tgroup cols="2" colwidths="given">
+ <table classes="colwidths-given">
+ <tgroup cols="2">
<colspec colwidth="15">
<colspec colwidth="25">
<tbody>
@@ -217,8 +217,8 @@
""",
"""\
<document source="test data">
- <table>
- <tgroup cols="2" colwidths="given">
+ <table classes="colwidths-given">
+ <tgroup cols="2">
<colspec colwidth="10">
<colspec colwidth="20">
<tbody>
@@ -240,8 +240,8 @@
""",
"""\
<document source="test data">
- <table>
- <tgroup cols="2" colwidths="auto">
+ <table classes="colwidths-auto">
+ <tgroup cols="2">
<colspec colwidth="14">
<colspec colwidth="19">
<tbody>
@@ -263,8 +263,8 @@
""",
"""\
<document source="test data">
- <table>
- <tgroup cols="2" colwidths="given">
+ <table classes="colwidths-given">
+ <tgroup cols="2">
<colspec colwidth="14">
<colspec colwidth="19">
<tbody>
@@ -287,7 +287,7 @@
"""\
<document source="test data">
<table align="center">
- <tgroup cols="2" colwidths="auto">
+ <tgroup cols="2">
<colspec colwidth="6">
<colspec colwidth="5">
<tbody>
@@ -316,10 +316,10 @@
""",
"""\
<document source="test data">
- <table>
+ <table classes="colwidths-given">
<title>
inline with integral header
- <tgroup cols="3" colwidths="given">
+ <tgroup cols="3">
<colspec colwidth="10" stub="1">
<colspec colwidth="20">
<colspec colwidth="30">
@@ -376,10 +376,10 @@
""",
"""\
<document source="test data">
- <table>
+ <table classes="colwidths-given">
<title>
inline with separate header
- <tgroup cols="3" colwidths="given">
+ <tgroup cols="3">
<colspec colwidth="10">
<colspec colwidth="20">
<colspec colwidth="30">
@@ -423,7 +423,7 @@
<table>
<title>
complex internal structure
- <tgroup cols="3" colwidths="auto">
+ <tgroup cols="3">
<colspec colwidth="33">
<colspec colwidth="33">
<colspec colwidth="33">
@@ -477,7 +477,7 @@
<table>
<title>
short rows
- <tgroup cols="3" colwidths="auto">
+ <tgroup cols="3">
<colspec colwidth="33">
<colspec colwidth="33">
<colspec colwidth="33">
@@ -514,7 +514,7 @@
<table>
<title>
short rows
- <tgroup cols="3" colwidths="auto">
+ <tgroup cols="3">
<colspec colwidth="33">
<colspec colwidth="33">
<colspec colwidth="33">
@@ -555,7 +555,7 @@
<table>
<title>
non-ASCII characters
- <tgroup cols="1" colwidths="auto">
+ <tgroup cols="1">
<colspec colwidth="100">
<tbody>
<row>
@@ -575,7 +575,7 @@
<table align="center">
<title>
center aligned
- <tgroup cols="2" colwidths="auto">
+ <tgroup cols="2">
<colspec colwidth="50">
<colspec colwidth="50">
<tbody>
@@ -684,7 +684,7 @@
<problematic ids="id2" refid="id1">
*
title
- <tgroup cols="3" colwidths="auto">
+ <tgroup cols="3">
<colspec colwidth="33">
<colspec colwidth="33">
<colspec colwidth="33">
@@ -809,7 +809,7 @@
<table>
<title>
good delimiter
- <tgroup cols="3" colwidths="auto">
+ <tgroup cols="3">
<colspec colwidth="33">
<colspec colwidth="33">
<colspec colwidth="33">
@@ -827,7 +827,7 @@
<table>
<title>
good delimiter
- <tgroup cols="3" colwidths="auto">
+ <tgroup cols="3">
<colspec colwidth="33">
<colspec colwidth="33">
<colspec colwidth="33">
@@ -845,7 +845,7 @@
<table>
<title>
good delimiter
- <tgroup cols="3" colwidths="auto">
+ <tgroup cols="3">
<colspec colwidth="33">
<colspec colwidth="33">
<colspec colwidth="33">
@@ -863,7 +863,7 @@
<table>
<title>
good delimiter
- <tgroup cols="3" colwidths="auto">
+ <tgroup cols="3">
<colspec colwidth="33">
<colspec colwidth="33">
<colspec colwidth="33">
@@ -970,7 +970,7 @@
<table>
<title>
good encoding
- <tgroup cols="3" colwidths="auto">
+ <tgroup cols="3">
<colspec colwidth="33">
<colspec colwidth="33">
<colspec colwidth="33">
@@ -1056,10 +1056,10 @@
""",
"""\
<document source="test data">
- <table>
+ <table classes="colwidths-given">
<title>
list table with integral header
- <tgroup cols="3" colwidths="given">
+ <tgroup cols="3">
<colspec colwidth="10" stub="1">
<colspec colwidth="20">
<colspec colwidth="30">
@@ -1122,10 +1122,10 @@
""",
"""\
<document source="test data">
- <table>
+ <table classes="colwidths-auto">
<title>
list table with integral header
- <tgroup cols="3" colwidths="auto">
+ <tgroup cols="3">
<colspec colwidth="33" stub="1">
<colspec colwidth="33">
<colspec colwidth="33">
@@ -1176,7 +1176,7 @@
<table>
<title>
list table with integral header
- <tgroup cols="3" colwidths="auto">
+ <tgroup cols="3">
<colspec colwidth="33" stub="1">
<colspec colwidth="33">
<colspec colwidth="33">
@@ -1238,7 +1238,7 @@
<table align="center">
<title>
center aligned
- <tgroup cols="2" colwidths="auto">
+ <tgroup cols="2">
<colspec colwidth="50">
<colspec colwidth="50">
<tbody>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2016-07-30 22:05:16
|
Revision: 7962
http://sourceforge.net/p/docutils/code/7962
Author: milde
Date: 2016-07-30 22:05:13 +0000 (Sat, 30 Jul 2016)
Log Message:
-----------
Support tables with auto-sized column widths in html_plain and latex2e writers.
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/docs/user/tools.txt
trunk/docutils/docutils/writers/__init__.py
trunk/docutils/docutils/writers/html_plain/__init__.py
trunk/docutils/docutils/writers/latex2e/__init__.py
trunk/docutils/test/functional/expected/standalone_rst_html_plain.html
trunk/docutils/test/functional/expected/standalone_rst_latex.tex
trunk/docutils/test/functional/input/data/tables_latex.txt
trunk/docutils/test/functional/input/standalone_rst_html_plain.txt
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2016-07-28 22:02:47 UTC (rev 7961)
+++ trunk/docutils/HISTORY.txt 2016-07-30 22:05:13 UTC (rev 7962)
@@ -96,6 +96,9 @@
- Fix [ 286 ] Empty column title cause invalid latex file.
- Fix [ 224 ] Fix rowspan support for tables.
+
+ - Let LaTeX determine the column widths in tables with "colwidths-auto".
+ Not suited for with multi-paragraph cells!
* docutils/writers/odf_odt/__init__.py
Modified: trunk/docutils/docs/user/tools.txt
===================================================================
--- trunk/docutils/docs/user/tools.txt 2016-07-28 22:02:47 UTC (rev 7961)
+++ trunk/docutils/docs/user/tools.txt 2016-07-30 22:05:13 UTC (rev 7962)
@@ -149,8 +149,7 @@
:Writer: html5 (html_plain_)
The ``rst2html5.py`` front end reads standalone reStructuredText source
-files and produces simple `HTML 5`_ output (compatible to `XHTML 1.0
-Transitional`_).
+files and produces `HTML 5`_ output.
Correct rendering of elements not directly supported by HTML depends on a
CSS style sheet. The provided style sheets ``minimal.css`` and ``plain.css``
define required and optional styling rules respectively.
Modified: trunk/docutils/docutils/writers/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/__init__.py 2016-07-28 22:02:47 UTC (rev 7961)
+++ trunk/docutils/docutils/writers/__init__.py 2016-07-30 22:05:13 UTC (rev 7962)
@@ -120,10 +120,9 @@
_writer_aliases = {
- 'html': 'html4css1', # may change to html_plain some day
+ 'html': 'html4css1', # may change to html5 some day
'html4': 'html4css1',
- 'html5': 'html_plain', # until a special HTML 5 writer is ready
- 'html4strict': 'xhtml11',
+ 'html5': 'html_plain', # may be replaced with a special HTML 5 writer
'html-plain': 'html_plain',
'latex': 'latex2e',
'pprint': 'pseudoxml',
Modified: trunk/docutils/docutils/writers/html_plain/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/html_plain/__init__.py 2016-07-28 22:02:47 UTC (rev 7961)
+++ trunk/docutils/docutils/writers/html_plain/__init__.py 2016-07-30 22:05:13 UTC (rev 7962)
@@ -631,15 +631,21 @@
node.parent.stubs.append(node.attributes.get('stub'))
def depart_colspec(self, node):
- pass
-
- def write_colspecs(self):
+ # write out <colgroup> when all colspecs are processed
+ if isinstance(node.next_node(descend=False, siblings=True),
+ nodes.colspec):
+ return
+ if 'colwidths-auto' in node.parent.parent['classes'] or (
+ 'colwidths-auto' in self.settings.table_style and
+ ('colwidths-given' not in node.parent.parent['classes'])):
+ return
total_width = sum(node['colwidth'] for node in self.colspecs)
+ self.body.append(self.starttag(node, 'colgroup'))
for node in self.colspecs:
colwidth = int(node['colwidth'] * 100.0 / total_width + 0.5)
self.body.append(self.emptytag(node, 'col',
style='width: %i%%' % colwidth))
- self.colspecs = []
+ self.body.append('</colgroup>\n')
def visit_comment(self, node,
sub=re.compile('-(?=-)').sub):
@@ -1531,11 +1537,8 @@
def depart_target(self, node):
self.body.append(self.context.pop())
- # no hard-coded vertical alignment in table body::
-
+ # no hard-coded vertical alignment in table body
def visit_tbody(self, node):
- self.write_colspecs()
- self.body.append(self.context.pop()) # '</colgroup>\n' or ''
self.body.append(self.starttag(node, 'tbody'))
def depart_tbody(self, node):
@@ -1552,20 +1555,13 @@
pass
def visit_tgroup(self, node):
- # Mozilla needs <colgroup>:
- self.body.append(self.starttag(node, 'colgroup'))
- # Appended by thead or tbody:
- self.context.append('</colgroup>\n')
+ self.colspecs = []
node.stubs = []
def depart_tgroup(self, node):
pass
def visit_thead(self, node):
- self.write_colspecs()
- self.body.append(self.context.pop()) # '</colgroup>\n'
- # There may or may not be a <thead>; this is for <tbody> to use:
- self.context.append('')
self.body.append(self.starttag(node, 'thead'))
def depart_thead(self, node):
Modified: trunk/docutils/docutils/writers/latex2e/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/latex2e/__init__.py 2016-07-28 22:02:47 UTC (rev 7961)
+++ trunk/docutils/docutils/writers/latex2e/__init__.py 2016-07-30 22:05:13 UTC (rev 7962)
@@ -933,7 +933,7 @@
return None
def get_vertical_bar(self):
- if self._table_style == 'standard':
+ if 'standard' in self._table_style:
return '|'
return ''
@@ -960,7 +960,7 @@
# "stubs" list is an attribute of the tgroup element:
self.stubs.append(node.attributes.get('stub'))
- def get_colspecs(self):
+ def get_colspecs(self, node):
"""Return column specification for longtable.
Assumes reST line length being 80 characters.
@@ -972,38 +972,47 @@
usually gets to narrow, therefore we add 1 (fiddlefactor).
"""
+ bar = self.get_vertical_bar()
+ self._rowspan= [0] * len(self._col_specs)
+ self._col_width = []
+ if 'colwidths-auto' in node.parent.parent['classes'] or (
+ 'colwidths-auto' in self._table_style and
+ ('colwidths-given' not in node.parent.parent['classes'])):
+ latex_table_spec = (bar+'l')*len(self._col_specs)
+ return latex_table_spec+bar
width = 80
-
total_width = 0.0
# first see if we get too wide.
for node in self._col_specs:
colwidth = float(node['colwidth']+1) / width
total_width += colwidth
- self._col_width = []
- self._rowspan = []
# donot make it full linewidth
factor = 0.93
if total_width > 1.0:
factor /= total_width
- bar = self.get_vertical_bar()
latex_table_spec = ''
for node in self._col_specs:
colwidth = factor * float(node['colwidth']+1) / width
self._col_width.append(colwidth+0.005)
- self._rowspan.append(0)
latex_table_spec += '%sp{%.3f\\DUtablewidth}' % (bar, colwidth+0.005)
return latex_table_spec+bar
def get_column_width(self):
"""Return columnwidth for current cell (not multicell)."""
- return '%.2f\\DUtablewidth' % self._col_width[self._cell_in_row]
+ try:
+ return '%.2f\\DUtablewidth' % self._col_width[self._cell_in_row]
+ except IndexError:
+ return '*'
def get_multicolumn_width(self, start, len_):
"""Return sum of columnwidths for multicell."""
- mc_width = sum([width
- for width in ([self._col_width[start + co]
- for co in range (len_)])])
- return '%.2f\\DUtablewidth' % mc_width
+ try:
+ mc_width = sum([width
+ for width in ([self._col_width[start + co]
+ for co in range (len_)])])
+ return 'p{%.2f\\DUtablewidth}' % mc_width
+ except IndexError:
+ return 'l'
def get_caption(self):
if not self.caption:
@@ -1958,7 +1967,9 @@
# multirow, multicolumn
if 'morerows' in node and 'morecols' in node:
raise NotImplementedError('Cells that '
- 'span multiple rows *and* columns are not supported, sorry.')
+ 'span multiple rows *and* columns currently not supported, sorry.')
+ # TODO: should be possible with LaTeX, see e.g.
+ # http://texblog.org/2012/12/21/multi-column-and-multi-row-cells-in-latex-tables/
# multirow in LaTeX simply will enlarge the cell over several rows
# (the following n if n is positive, the former if negative).
if 'morerows' in node:
@@ -1979,7 +1990,7 @@
else:
bar1 = ''
mcols = node['morecols'] + 1
- self.out.append('\\multicolumn{%d}{%sp{%s}%s}{' %
+ self.out.append('\\multicolumn{%d}{%s%s%s}{' %
(mcols, bar1,
self.active_table.get_multicolumn_width(
self.active_table.get_entry_number(),
@@ -2838,7 +2849,7 @@
# BUG write preamble if not yet done (colspecs not [])
# for tables without heads.
if not self.active_table.get('preamble written'):
- self.visit_thead(None)
+ self.visit_thead(node)
self.depart_thead(None)
def depart_tbody(self, node):
@@ -2870,7 +2881,7 @@
def visit_thead(self, node):
self._thead_depth += 1
if 1 == self.thead_depth():
- self.out.append('{%s}\n' % self.active_table.get_colspecs())
+ self.out.append('{%s}\n' % self.active_table.get_colspecs(node))
self.active_table.set('preamble written',1)
self.out.append(self.active_table.get_caption())
self.out.extend(self.active_table.visit_thead())
Modified: trunk/docutils/test/functional/expected/standalone_rst_html_plain.html
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_html_plain.html 2016-07-28 22:02:47 UTC (rev 7961)
+++ trunk/docutils/test/functional/expected/standalone_rst_html_plain.html 2016-07-30 22:05:13 UTC (rev 7962)
@@ -1235,8 +1235,8 @@
<h1><a class="toc-backref" href="#id80"><span class="sectnum">3</span> Changes to the html4css1 writer</a></h1>
<ul class="simple">
<li><p>Use only meta keywords recognized by HTML 5.</p></li>
-<li><p>Style table column widths with CSS rule, not "width" argument.</p></li>
-<li><p>Vertical alignment of table heads with CSS.</p></li>
+<li><p>Set table column widths with <style="width: ...">, not "width" argument.</p></li>
+<li><p>Horizontal alignment of table heads with CSS.</p></li>
<li><p>Field lists as styled definition lists.</p></li>
<li><p>Do not drop paragraph objects, use CSS rules to prevent unwanted vertical
space.</p></li>
@@ -1377,7 +1377,8 @@
<p>The following styles can be applied to individual tables via a class
argument or as document wide setting with the <a class="reference external" href="http://docutils.sourceforge.net/docs/user/config.html#table-style">table-style</a> <a class="footnote-reference brackets" href="#id31" id="id32">7</a> configuration
setting (or command line argument).</p>
-<p>Numbered tables can be achieved with the "numbered" class option</p>
+<ul>
+<li><p>Numbered tables can be achieved with the "numbered" class option:</p>
<table class="numbered">
<caption>truth values</caption>
<colgroup>
@@ -1412,14 +1413,10 @@
</table>
<p>Currently, referencing to the table by number is not supported. This is a
common request and already on the <cite>TODO list</cite>.</p>
-<p>A table with "booktabs" class argument, is rendered similar to the style
-from the <a class="reference external" href="http://tug.ctan.org/tex-archive/macros/latex/contrib/booktabs/booktabs.pdf">booktabs</a> <a class="footnote-reference brackets" href="#id33" id="id34">8</a> LaTeX package.</p>
-<table class="booktabs">
-<colgroup>
-<col style="width: 29%" />
-<col style="width: 29%" />
-<col style="width: 41%" />
-</colgroup>
+</li>
+<li><p>With the "widths" argument "auto" (or "class" value "colwidths-auto"),
+column widths are determined by the browser.</p>
+<table class="colwidths-auto">
<thead>
<tr><th class="head"><p>A</p></th>
<th class="head"><p>B</p></th>
@@ -1445,16 +1442,17 @@
</tr>
</tbody>
</table>
-<p>"Booktabs" style table, numbered and centre-aligned:</p>
-<table class="numbered booktabs align-center">
+</li>
+<li><p>A table with "booktabs" class value, is rendered similar to the style
+from the <a class="reference external" href="http://tug.ctan.org/tex-archive/macros/latex/contrib/booktabs/booktabs.pdf">booktabs</a> <a class="footnote-reference brackets" href="#id33" id="id34">8</a> LaTeX package.</p>
+</li>
+</ul>
+<p>"Booktabs" style table, numbered, centre-aligned, with auto-sized columns:</p>
+<blockquote>
+<table class="booktabs numbered colwidths-auto align-center">
<caption>I/O values</caption>
-<colgroup>
-<col style="width: 31%" />
-<col style="width: 31%" />
-<col style="width: 38%" />
-</colgroup>
<thead>
-<tr><th class="head" colspan="2"><p>Inputs</p></th>
+<tr><th class="head" colspan="2"><p>Input</p></th>
<th class="head"><p>Output</p></th>
</tr>
<tr><th class="head"><p>A</p></th>
@@ -1481,6 +1479,7 @@
</tr>
</tbody>
</table>
+</blockquote>
</div>
</div>
</div>
Modified: trunk/docutils/test/functional/expected/standalone_rst_latex.tex
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_latex.tex 2016-07-28 22:02:47 UTC (rev 7961)
+++ trunk/docutils/test/functional/expected/standalone_rst_latex.tex 2016-07-30 22:05:13 UTC (rev 7962)
@@ -1875,14 +1875,12 @@
Tables with multi-paragraph multirow cells currently fail due to a LaTeX
limitation (see \url{https://sourceforge.net/p/docutils/bugs/225/}).
-A table with multirow header:
-%
-\begin{quote}
+A table with multirow header and column-widths set by LaTeX:
\setlength{\DUtablewidth}{\linewidth}
-\begin{longtable*}[c]{|p{0.156\DUtablewidth}|p{0.238\DUtablewidth}|}
+\begin{longtable*}[c]{|l|l|}
\hline
-\multirow{2}{0.16\DUtablewidth}{%
+\multirow{2}{*}{%
\textbf{%
XXX
}} & \textbf{%
@@ -1895,7 +1893,7 @@
\hline
\endfirsthead
\hline
-\multirow{2}{0.16\DUtablewidth}{%
+\multirow{2}{*}{%
\textbf{%
XXX
}} & \textbf{%
@@ -1910,14 +1908,12 @@
\multicolumn{2}{c}{\hfill ... continued on next page} \\
\endfoot
\endlastfoot
-\multicolumn{2}{|p{0.39\DUtablewidth}|}{
+\multicolumn{2}{|l|}{
multicollumn cell
} \\
\hline
\end{longtable*}
-\end{quote}
-
% This file is used by the standalone_rst_latex test.
Modified: trunk/docutils/test/functional/input/data/tables_latex.txt
===================================================================
--- trunk/docutils/test/functional/input/data/tables_latex.txt 2016-07-28 22:02:47 UTC (rev 7961)
+++ trunk/docutils/test/functional/input/data/tables_latex.txt 2016-07-30 22:05:13 UTC (rev 7962)
@@ -22,8 +22,10 @@
Tables with multi-paragraph multirow cells currently fail due to a LaTeX
limitation (see https://sourceforge.net/p/docutils/bugs/225/).
-A table with multirow header:
+A table with multirow header and column-widths set by LaTeX:
+.. table::
+ :widths: auto
+------------+-------------------+
| XXX | Variable Summary |
Modified: trunk/docutils/test/functional/input/standalone_rst_html_plain.txt
===================================================================
--- trunk/docutils/test/functional/input/standalone_rst_html_plain.txt 2016-07-28 22:02:47 UTC (rev 7961)
+++ trunk/docutils/test/functional/input/standalone_rst_html_plain.txt 2016-07-30 22:05:13 UTC (rev 7962)
@@ -13,9 +13,9 @@
* Use only meta keywords recognized by HTML 5.
-* Style table column widths with CSS rule, not "width" argument.
+* Set table column widths with <style="width: ...">, not "width" argument.
-* Vertical alignment of table heads with CSS.
+* Horizontal alignment of table heads with CSS.
* Field lists as styled definition lists.
@@ -140,60 +140,65 @@
argument or as document wide setting with the table-style_ configuration
setting (or command line argument).
-Numbered tables can be achieved with the "numbered" class option
+* Numbered tables can be achieved with the "numbered" class option:
-.. table:: truth values
- :class: numbered
+ .. table:: truth values
+ :class: numbered
- ======= ======= ==========
- A B A or B
- ======= ======= ==========
- False False False
- True False True
- False True True
- True True True
- ======= ======= ==========
+ ======= ======= ==========
+ A B A or B
+ ======= ======= ==========
+ False False False
+ True False True
+ False True True
+ True True True
+ ======= ======= ==========
-Currently, referencing to the table by number is not supported. This is a
-common request and already on the `TODO list`.
+ Currently, referencing to the table by number is not supported. This is a
+ common request and already on the `TODO list`.
-A table with "booktabs" class argument, is rendered similar to the style
-from the booktabs_ LaTeX package.
+* With the "widths" argument "auto" (or "class" value "colwidths-auto"),
+ column widths are determined by the browser.
-.. _table-style:
- http://docutils.sourceforge.net/docs/user/config.html#table-style
-.. _booktabs:
- http://tug.ctan.org/tex-archive/macros/latex/contrib/booktabs/booktabs.pdf
+ .. table::
+ :widths: auto
-.. class:: booktabs
+ ======= ======= ==========
+ A B A or B
+ ======= ======= ==========
+ False False False
+ True False True
+ False True True
+ True True True
+ ======= ======= ==========
-===== ===== =======
- A B A or B
-===== ===== =======
-False False False
-True False True
-False True True
-True True True
-===== ===== =======
+* A table with "booktabs" class value, is rendered similar to the style
+ from the booktabs_ LaTeX package.
-"Booktabs" style table, numbered and centre-aligned:
+ .. _table-style:
+ http://docutils.sourceforge.net/docs/user/config.html#table-style
+ .. _booktabs:
+ http://tug.ctan.org/tex-archive/macros/latex/contrib/booktabs/booktabs.pdf
-.. table:: I/O values
- :align: center
- :class: numbered booktabs
+"Booktabs" style table, numbered, centre-aligned, with auto-sized columns:
- ===== ===== ======
- Inputs Output
- ------------ ------
- A B A or B
- ===== ===== ======
- False False False
- True False True
- False True True
- True True True
- ===== ===== ======
+ .. table:: I/O values
+ :class: booktabs numbered
+ :align: center
+ :widths: auto
+ ======= ======= ==========
+ Input Output
+ --------------- ----------
+ A B A or B
+ ======= ======= ==========
+ False False False
+ True False True
+ False True True
+ True True True
+ ======= ======= ==========
+
.. include:: data/errors.txt
.. footer:: |HTML 5| |validator| |valid-CSS2|
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2016-08-03 19:37:29
|
Revision: 7964
http://sourceforge.net/p/docutils/code/7964
Author: milde
Date: 2016-08-03 19:37:26 +0000 (Wed, 03 Aug 2016)
Log Message:
-----------
Documentation update.
Modified Paths:
--------------
trunk/docutils/docs/ref/rst/directives.txt
trunk/docutils/docs/user/config.txt
trunk/docutils/docs/user/html.txt
trunk/docutils/docs/user/latex.txt
trunk/docutils/docutils/writers/html_plain/__init__.py
Modified: trunk/docutils/docs/ref/rst/directives.txt
===================================================================
--- trunk/docutils/docs/ref/rst/directives.txt 2016-07-31 11:13:21 UTC (rev 7963)
+++ trunk/docutils/docs/ref/rst/directives.txt 2016-08-03 19:37:26 UTC (rev 7964)
@@ -757,10 +757,12 @@
(New in Docutils 0.3.1)
The "table" directive is used to associate a
-title with a table or specify options::
+title with a table or specify options, e.g.::
.. table:: Truth table for "not"
+ :widths: auto
+
===== =====
A not A
===== =====
@@ -775,17 +777,18 @@
(New in Docutils 0.13)
``widths`` : "auto", "grid" or a list of integers
+ A comma- or space-separated list of column widths.
+ The default is the width of the input columns (in characters).
- A comma- or space-separated list of relative column widths.
- The default is the width of the corresponding input columns
- (in characters).
-
The special values "auto" or "grid" may be used by writers to decide
whether to delegate the determination of column widths to the backend
(LaTeX, the HTML browser, ...).
+ See also the `table_style`_ configuration option.
and the common options `:class:`_ and `:name:`_.
+.. _table_style: ../../user/config.html#table-style-html4css1-writer
+
.. _csv-table:
CSV Table
Modified: trunk/docutils/docs/user/config.txt
===================================================================
--- trunk/docutils/docs/user/config.txt 2016-07-31 11:13:21 UTC (rev 7963)
+++ trunk/docutils/docs/user/config.txt 2016-08-03 19:37:26 UTC (rev 7964)
@@ -574,7 +574,7 @@
warning_stream
--------------
-Path to a file for the output of system messages (warnings) [#pwd]_.
+Path to a file for the output of system messages (warnings). [#pwd]_
Default: stderr (None). Options: ``--warnings``.
@@ -1128,23 +1128,41 @@
table_style
~~~~~~~~~~~
-Class value(s) added to tables_ to allow styling with CSS.
-The default sylesheet defines:
+Class value(s) added to all tables_.
+Also defined for the `LaTeX Writer`__.
+The default CSS sylesheet defines:
+
borderless
No borders around the table.
booktabs
Lines above and below the table and a thin line after the head.
+align-left, align-center, align-right
+ Align the tables
+
+.. note::
+
+ The html5 writer also supports:
+
+ colwidths-auto
+ Delegate the determination of table column widths to the backend
+ (Leave out the ``<colgroup>`` column specification.)
+
+ Cf. the `table directive`_.
+
Default: "". Option: ``--table-style``.
+__ `table_style [latex2e writer]`_
+.. _table directive: ../ref/rst/directives.html#table
+
.. _template [html4css1 writer]:
template
~~~~~~~~
-Path to template file, which must be encoded in UTF-8 [#pwd]_.
+Path to template file, which must be encoded in UTF-8. [#pwd]_
Also defined for the `LaTeX Writer`__.
Default: "template.txt" in the docutils/writers/html4css1/
@@ -1504,21 +1522,6 @@
Option: ``--latex-preamble``.
-
-.. _template [latex2e writer]:
-
-template
-~~~~~~~~
-
-Path to template file, which must be encoded in UTF-8 [#pwd]_.
-Also defined for the `HTML Writer`__.
-
-Default: "default.tex" in the docutils/writers/latex2e/
-directory (installed automatically; for the exact machine-specific
-path, use the ``--help`` option). Options: ``--template``.
-
-__ `template [html4css1 writer]`_
-
.. _footnote_references [latex2e writer]:
footnote_references
@@ -1598,18 +1601,53 @@
table_style
~~~~~~~~~~~
-Specify the drawing of separation lines in tables_
+Specify the default style for tables_
+Also defined for the `HTML Writer`__.
+
Supported values:
standard
- lines around and between cells.
+ Borders around all cells.
booktabs
- a line above and below the table and one after the head.
+ A line above and below the table and one after the head.
borderless
- no lines.
+ No borders.
+align-left, align-center, align-right
+ Align tables.
+
+colwidths-auto, colwidths-given
+ Default value for column width determination by
+ LaTeX or Docutils.
+ Override with the `table directive`_'s :widths: option.
+
+ .. warning::
+
+ ``colwidths-auto`` is only suited for tables with simple cell content.
+
+ LaTeX puts the content of auto-sized columns on one line (merging
+ paragraphs) and may fail with complex content.
+
Default: "standard". Option: ``--table-style``.
+__ `table_style [html4css1 writer]`_
+
+
+.. _template [latex2e writer]:
+
+template
+~~~~~~~~
+
+Path to template file, which must be encoded in UTF-8. [#pwd]_
+Also defined for the `HTML Writer`__.
+
+Default: "default.tex" in the docutils/writers/latex2e/
+directory (installed automatically; for the exact machine-specific
+path, use the ``--help`` option). Options: ``--template``.
+
+__ `template [html4css1 writer]`_
+
+
[xetex writer]
~~~~~~~~~~~~~~
@@ -1823,7 +1861,7 @@
config
~~~~~~
-Path to a configuration file to read (if it exists) [#pwd]_.
+Path to a configuration file to read (if it exists). [#pwd]_
Settings may override defaults and earlier settings. The config
file is processed immediately. Multiple ``--config`` options may
be specified; each will be processed in turn.
Modified: trunk/docutils/docs/user/html.txt
===================================================================
--- trunk/docutils/docs/user/html.txt 2016-07-31 11:13:21 UTC (rev 7963)
+++ trunk/docutils/docs/user/html.txt 2016-08-03 19:37:26 UTC (rev 7964)
@@ -21,7 +21,7 @@
.. html_ rst2html.py `XHTML 1 `CSS 1`_
Transitional`_
- html_plain_ html5_ rst2html5.py `HTML 5`_ `CSS 3`_
+ html_plain_ html5_ rst2html5.py `HTML5`_ `CSS 3`_
=========== ============== ============== ================= ===========
* `Special HTML writers`_
@@ -82,17 +82,6 @@
.. [#IE] Conformance to `CSS 2.1`_ has been added in IE 8 (2009), support
for XHTML in IE 9 (2011).
-.. TODO: How to name a specific alias/front-end pointing to html4css1?
-
- html4
- | +1 short form of html4css1,
- | -1 writer produces XHTML 1, not HTML 4
- xhtml1
- | +1 correct and short description of the output format.
- | -1 may be confused with xhtml11 or xhtml (aliases for the
- "new" XHTML 1.1. writer inheriting from html_plain).
-
-
.. _rst2html.py: tools.html#rst2html-py
.. _[html4css1 writer]: config.html#html4css1-writer
.. _html4css1.css: ../../docutils/writers/html4css1/html4css1.css
@@ -105,43 +94,19 @@
:front-end: rst2html5.py_
:config: `[html-plain writer]`_
-The `html_plain` module is both, basis for other HTML writers and a
-versatile writer for end-users or programmatic use.
+The ``html_plain`` writer generates `polyglot HTML`_ output, valid XML that
+is compatible with `HTML5`_.
+New features and elements will only be used if they are widely supported to
+make documents `viewable with any browser`_.
-The ``html_plain`` writer generates `polyglot HTML`_ output that is
-compatible with `HTML 5`_ and `XHTML 1 Transitional`_. New features and
-elements will only be used if they are widely supported to make documents
-`viewable with any browser`_. There is no hard-coded formatting information
-in the HTML document. Correct rendering of elements not directly supported
-by HTML depends on a CSS_ style sheet. The provided style sheets
-minimal.css_ and plain.css_ define required and optional styling rules
-respectively. Adaption of the layout is possible with `custom style
-sheets`_.
+There is no hard-coded formatting information in the HTML document. Correct
+rendering of elements not directly supported by HTML depends on a CSS_ style
+sheet. The provided style sheets minimal.css_ and plain.css_ define required
+and optional styling rules respectively. Adaption of the layout is possible
+with `custom style sheets`_.
New in Docutils 0.13
-.. TODO
-
- Find the right name for this writer. Suggestions:
-
- html-common
- ±0 common definitions for XHTML and HTML5
- html-plain
- ±0 simple, plain, unadorned.
- html-simple
- ±0 simple
- html-vanilla
- -0 too long, too colloquial
- html-basic
- -1 does not produce `XHTML Basic`_
- html-lcd
- `Lowest Common Denominator` -- supporting HTML 5, XHTML 1,
- and older (HTML 4 + CSS2) browsers.
-
- -1 cryptic
- html-base
- -1 not only base class but also suited for end-users
-
.. _rst2html5.py: tools.html#rst2html5-py
.. _[html-plain writer]: config.html#html-plain-writer
.. _minimal.css: ../../docutils/writers/html_plain/minimal.css
@@ -149,44 +114,25 @@
.. _custom style sheets: ../howto/html-stylesheets.html
.. _viewable with any browser: http://www.anybrowser.org/campaign
-Aliases
-~~~~~~~
html
-""""
+~~~~
-Currently, `html` is an alias for the html4css1_ writer.
+`html` is an alias for the recommended Docutils HTML writer.
+Currently, `html` is mapped to html4css1_.
-.. admonition:: Suggestion
+The target may change with the development of HTML, browsers, Docutils, and
+the web.
- Let the alias `html` point to the "recommended Docutils HTML writer".
- Its target may change with the development of HTML, browsers, Docutils, and
- the web.
+* Use `get_writer_by_name('html') or the ``rst2html.py`` front end, if you
+ want the output to be up-to-date automatically.
- * Use `get_writer_by_name('html') or the ``rst2html.py`` front end, if you
- want the output to be up-to-date automatically.
+* Use a specific writer name or front end, if you depend on stability of the
+ generated HTML code, e.g. because you use a custom style sheet or
+ post-processing that may break otherwise.
- * Use a specific writer name or front end, if you depend on stability of
- the generated HTML code, e.g. because you use a custom style sheet or
- post-processing that may break otherwise.
-html4
-"""""
-The alias `html4` provides a stable shortcut for the html4css1_ writer.
-
-New in Docutils 0.13
-
-html5
-"""""
-
-In Docutils 0.13, html5 is an alias to the html_plain_ writer.
-
-In future releases, `html5` may become a separate HTML writer that makes use
-of new features and objects defined in HTML5 but not (yet) fit for use in
-`html_plain`_ because of limited browser support (like <video>, <aside>, or
-<section>).
-
Special HTML writers
--------------------
@@ -229,37 +175,23 @@
There are two more HTML writers in the sandbox_:
+.. _sandbox: ../dev/policies.html#the-sandbox
+
xhtml11
~~~~~~~
:aliases: xhtml, html4strict
:front-end: rst2xhtml.py
:config: `[xhtml11 writer]`
-`XHTML 1.1`_ is the current version of the XML based `extensible Hypertext
-Markup Language`.
+`XHTML 1.1`_ is the latest version of the XML based `extensible
+Hypertext Markup Language` with an official DTD.
-The `xhtml11` writer inherits from html_plain_ and adds compatibility to the
-strict requirements of `XHTML 1.1`_:
+The `xhtml11 writer`_ lives in the Docutils sandbox_ since 2008. The output
+conforms to the strict requirements of `XHTML 1.1`_.
-* There is no attribute "lang" (only "xml:lang").
+.. _xhtml11 writer: ../../../sandbox/html4strict/README.html
-* Enumerated lists don't support the "start" attribute.
- The style sheet xhtml11.css_ adds support for a "start" value for
- enumerated lists via a CSS-counter. This allows also nested enumeration.
-
-* ``<sup>`` and ``<sub>`` tags are not allowed in preformatted blocks
- (``<pre>``).
-
-The `math-output` `config setting`_ defaults to "MathML".
-
-.. _sandbox: ../dev/policies.html#the-sandbox
-.. _rst2xhtml.py: tools.html#rst2html5-py
-.. _config setting:
-.. _[xhtml11 writer]: config.html#xhtml11-writer
-.. _xhtml11.css: ../../docutils/writers/xhtml11/xhtml11.css
-
-
html4trans
~~~~~~~~~~
@@ -281,7 +213,7 @@
HTML and CSS Versions
---------------------
-_`HTML 5`
+_`HTML5`
`HTML5, A vocabulary and associated APIs for HTML and XHTML`,
W3C Recommendation, 28 October 2014.
http://www.w3.org/TR/html5/
@@ -314,7 +246,7 @@
.. _`CSS 1`:
_`CSS Level 1`:
- The features defined in the CSS1 specification, but using the syntax
+ The features defined in the `CSS1 specification`_, but using the syntax
and definitions in the `CSS 2.1`_ specification.
_`CSS 2.1` `Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification`,
@@ -333,5 +265,88 @@
----------------
.. _HTML Compatibility Guidelines: http://www.w3.org/TR/xhtml1/#guidelines
+.. _CSS: http://www.w3.org/TR/CSS/
+.. _CSS1 specification: http://www.w3.org/TR/2008/REC-CSS1-20080411/
.. _polyglot HTML: http://www.w3.org/TR/html-polyglot/
-.. _CSS: http://www.w3.org/TR/CSS/
+
+ .. Beware. This specification is no longer in active maintenance and the
+ HTML Working Group does not intend to maintain it further.
+
+.. Appendix
+
+
+ On the question of Polyglot markup, there seems to be little
+ consensus. One line of argument suggests that, to the extent that it
+ is practical to obey the Robustness principle, it makes sense to do
+ so. That is, if you're generating HTML markup for the web, and you can
+ generate Polyglot markup that is also directly consumable as XML, you
+ should do so. Another line of argument suggests that even under the
+ most optimistic of projections, so tiny a fraction of the web will
+ ever be written in Polyglot that there's no practical benefit to
+ pursuing it as a general strategy for consuming documents from the
+ web. If you want to consume HTML content, use an HTML parser that
+ produces an XML-compatible DOM or event stream.
+
+ -- https://www.w3.org/TR/html-xml-tf-report/#conclusions
+
+ Further development
+
+ On 2016-05-25, David Goodger wrote:
+
+ > In addition, I'd actually like to see the HTML writer(s) with
+ > fully-parameterized classes, i.e. removing hard-coded *classes* as well as
+ > formatting. This way, any user who wants to (e.g.) write reST for use with
+ > Bootstrap can easily work around any naming conflicts.
+
+
+
+ Problems with html4css1 writer:
+
+ 1. Limiting ourself to CSS Level 1 requires use of hard-coded HTML
+ formatting to get all rST objects mapped to HTML.
+ Hard-coded HTML formatting is considered bad practice.
+
+ 2. Maths cannot be included in MathML format without rendering a
+ hmtl4css1-generated document invalid.
+
+ (XHTML 1.1. is the only member of the "HTML4 family" allowing embedding
+ of MathML. However, hard-coded HTML formatting prevents its use.)
+
+
+
+ Comparison of current HTML versions
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ XHTML1.1
+ """"""""
+
+ +2 XML-based with official DTD
+ +1 allows processing with XML-tool-chain
+ +1 allows validating against the DTD
+
+ +1 writer exists (in sandbox) and in active use since 2008
+
+ -1 "old" format
+ -1 requires to work around restrictions lifted in HTML5
+ ("start" argument for enumerated lists, some tags in parsed literal)
+ which makes code and documents more complicated
+
+ HTML5
+ """""
+ +1 more recent
+ +1 simpler to write, less restrictions
+
+ +1 writer exists and in active use since 2015
+
+ +1 new page structure elements such as <main>, <section>, <article>,
+ <header>, <footer>, <aside>, <nav> and <figure>
+ provide a better matches for the rst document model.
+
+ -1 new elements not yet supported by many browsers.
+
+ -2 no DTD, not SGML-based
+ - no proper validation possible (there is an experimental validator)
+ - no standard interface to post-processing XML-tools
+
+ -1 two concurring definitions:
+ W3C standard and WHATWG "HTML Living Standard".
Modified: trunk/docutils/docs/user/latex.txt
===================================================================
--- trunk/docutils/docs/user/latex.txt 2016-07-31 11:13:21 UTC (rev 7963)
+++ trunk/docutils/docs/user/latex.txt 2016-08-03 19:37:26 UTC (rev 7964)
@@ -28,46 +28,10 @@
.. _books on LaTeX and related topics:
http://www.latex-project.org/guides/books.html
-
-There are two approaches to typeset documents from reStructuredText
-sources via LaTeX:
-
-1. treat LaTeX as a document format (like HTML):
-
- Transform the internal markup into corresponding LaTeX markup.
- For example, a section title would be written with the LaTeX section
- command: ``\section{this section title}``.
-
- This keeps the document structure and semantic markup produing a readable
- LaTeX file, but may require hacking around Docutils — LaTeX
- incompatibilities.
-
- As with HTML, styling is mostly done via style sheets or
- `LaTeX packages`_.
-
- If you prefer this approach, try the `latex2e` or the `xetex`
- writer.
-
-2. treat LaTeX as a page description format (like Postscript):
-
- Use LaTeX as a typesetting system to produce the desired output
- without representing document structure in the LaTeX source. This
- will work around Docutils-incompatible features in LaTeX but
- produces a hard to read LaTeX file. Styling is done via options to
- the latex writer.
-
- The (orphaned) `newlatex` writer (``rst2newlatex.py``) uses LaTeX as
- a typesetter without caring about producing readable/stylable LaTeX
- files.
-
-This documents describes the first approach used by the `latex2e`
-and `xetex` writers.
-
-
LaTeX
=====
-Unlike HTML/CSS, LaTeX provides one common language for markup and
+Unlike HTML with CSS, LaTeX uses one common language for markup and
style definitions. Separation of content and style is realized by
collecting style definitions in the documentclass_, `LaTeX packages`_,
or the document preamble.
@@ -79,10 +43,9 @@
means to extend or modify the LaTeX language by redefining macros or
providing new ones. There is a *huge* selection of packages (standard
as well as user contributed) coming with your TeX distribution or
-available at CTAN_ (see the `TeX Catalogue`_).
+available at CTAN_.
.. _CTAN: http://www.ctan.org
-.. _TeX Catalogue: http://texcatalogue.sarovar.org/
.. _stylesheet:
config.html#stylesheet-latex2e-writer
.. _TeX input path:
@@ -149,10 +112,7 @@
The default length unit (added by Docutils to length specifications
without unit) is the "DTP point".
-For more on lengths in LaTeX, see e.g. `Hypertext Help with LaTeX: Lengths`__
-
.. _length units: ../ref/rst/restructuredtext.html#length-units
-__ http://www.giss.nasa.gov/tools/latex/ltx-86.html.
PDF generation
@@ -174,16 +134,17 @@
Produce a DVI file with ``latex``, postscript with ``dvips`` and PDF with
``ps2pdf``.
-_`xelatex`
- The `XeTeX`__ engine works with input files in UTF-8 encoding and system
- fonts. Export your document with the `xetex` writer (``rst2xetex``),
- if you want to go this route.
+_`xelatex` or _`lualatex`
+ The `XeTeX`_ and LuaTeX_ engines work with input files in UTF-8 encoding
+ and system fonts. Export your document with the `xetex` writer
+ (``rst2xetex``), if you want to go this route.
-You need to call latex (or pdflatex/xelatex) twice (or even three times) to
+You need to call latex (or pdflatex/xelatex/lualatex) twice (or even three times) to
get internal references correct.
.. _documentoptions: config.html#documentoptions
-__ http://tug.org/xetex/
+.. _xetex: http://tug.org/xetex/
+.. _luatex: http://luatex.org/
_`rubber`
@@ -192,7 +153,7 @@
This includes processing bibliographic references or indices, as well as
compilation or conversion of figures.
-__ http://iml.univ-mrs.fr/~beffara/soft/rubber/
+__ https://launchpad.net/rubber/
Configuration
@@ -552,7 +513,6 @@
There are hundreds of LaTeX document classes installed by modern
LaTeX distributions, provided by publishers, or available at CTAN_.
-The `TeX Catalogue`_ lists most of them.
Popular document classes:
* article, report, book: standard document classes
@@ -1904,7 +1864,7 @@
Docutils expects an URI as pointer to the image file. The latex writer
transforms this URI to a local path. By default, LaTeX does not accept
spaces and more than one dot in the filename. If using "traditional"
-filenames is not an option, the adding grffile_ to the `style sheets`_
+filenames is not an option, adding grffile_ to the `style sheets`_
can help.
__ ../ref/rst/directives.html#images
@@ -2044,18 +2004,14 @@
:Tablewidth: reST-documents line length is assumed to be 80 characters. The
tablewidth is set relative to this value. If someone produces
- documents with line length of 132 this will fail.
+ documents with line length of 132 this will lead to suboptimal
+ results.
- Table width is tried to fit in page even if it is wider than
- the assumed linewidth, still assumed linewidth is a hook.
+ You may use the `:width:` option to manually set the
+ table column widths.
* Table: multicol cells are always left aligned.
-* The contents of a rowspan cell do not influence table height.
- (multirow "feature", use a phantom or strut?)
-
-* Multirow cells might mix up the following table rows.
-
* Table cells with both multirow and multicolumn are currently not possible.
* literal-blocks in table cells:
Modified: trunk/docutils/docutils/writers/html_plain/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/html_plain/__init__.py 2016-07-31 11:13:21 UTC (rev 7963)
+++ trunk/docutils/docutils/writers/html_plain/__init__.py 2016-08-03 19:37:26 UTC (rev 7964)
@@ -129,7 +129,9 @@
['--no-compact-field-lists'],
{'dest': 'compact_field_lists', 'action': 'store_false'}),
('Added to standard table classes. '
- 'Defined styles: "borderless". Default: ""',
+ 'Defined styles: borderless, booktabs, '
+ 'align-left, align-center, align-right, colwidths-auto. '
+ 'Default: ""',
['--table-style'],
{'default': ''}),
('Math output format (one of "MathML", "HTML", "MathJax", '
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2016-08-03 20:06:18
|
Revision: 7965
http://sourceforge.net/p/docutils/code/7965
Author: milde
Date: 2016-08-03 20:06:16 +0000 (Wed, 03 Aug 2016)
Log Message:
-----------
Fixes for the latex2e writer table handling.
Modified Paths:
--------------
trunk/docutils/docutils/writers/latex2e/__init__.py
trunk/docutils/test/functional/expected/standalone_rst_latex.tex
trunk/docutils/test/functional/input/data/tables_latex.txt
trunk/docutils/test/test_writers/test_latex2e.py
Modified: trunk/docutils/docutils/writers/latex2e/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/latex2e/__init__.py 2016-08-03 19:37:26 UTC (rev 7964)
+++ trunk/docutils/docutils/writers/latex2e/__init__.py 2016-08-03 20:06:16 UTC (rev 7965)
@@ -35,11 +35,13 @@
default_template = 'default.tex'
default_template_path = os.path.dirname(os.path.abspath(__file__))
-
default_preamble = '\n'.join([r'% PDF Standard Fonts',
r'\usepackage{mathptmx} % Times',
r'\usepackage[scaled=.90]{helvet}',
r'\usepackage{courier}'])
+ table_style_values = ('standard', 'booktabs','nolines', 'borderless',
+ 'colwidths-auto', 'colwidths-given')
+
settings_spec = (
'LaTeX-Specific Options',
None,
@@ -182,9 +184,11 @@
'above and below the table and below the header or "borderless". '
'Default: "standard"',
['--table-style'],
- {'choices': ['standard', 'booktabs','nolines', 'borderless'],
- 'default': 'standard',
- 'metavar': '<format>'}),
+ {'default': ['standard'],
+ 'metavar': '<format>',
+ 'action': 'append',
+ 'validator': frontend.validate_comma_separated_list,
+ 'choices': table_style_values}),
('LaTeX graphicx package option. '
'Possible values are "dvips", "pdftex". "auto" includes LaTeX code '
'to use "pdftex" if processing with pdf(la)tex and dvips otherwise. '
@@ -886,17 +890,20 @@
:booktabs: only horizontal lines (requires "booktabs" LaTeX package)
:borderless: no borders around table cells
:nolines: alias for borderless
+
+ :colwidths-auto: column widths determined by LaTeX
+ :colwidths-given: use colum widths from rST source
"""
- def __init__(self,translator,latex_type,table_style):
+ def __init__(self, translator, latex_type):
self._translator = translator
self._latex_type = latex_type
- self._table_style = table_style
self._open = False
# miscellaneous attributes
self._attrs = {}
self._col_width = []
self._rowspan = []
self.stubs = []
+ self.colwidths_auto = False
self._in_thead = 0
def open(self):
@@ -911,13 +918,23 @@
self.caption = []
self._attrs = {}
self.stubs = []
+ self.colwidths_auto = False
+
def is_open(self):
return self._open
- def set_table_style(self, table_style):
- if not table_style in ('standard','booktabs','borderless','nolines'):
- return
- self._table_style = table_style
+ def set_table_style(self, table_style, classes):
+ borders = [cls.replace('nolines', 'borderless')
+ for cls in table_style+classes
+ if cls in ('standard','booktabs','borderless', 'nolines')]
+ try:
+ self.borders = borders[-1]
+ except IndexError:
+ self.borders = 'standard'
+ self.colwidths_auto = (('colwidths-auto' in classes
+ and 'colwidths-given' not in table_style)
+ or ('colwidths-auto' in table_style
+ and ('colwidths-given' not in classes)))
def get_latex_type(self):
if self._latex_type == 'longtable' and not self.caption:
@@ -933,7 +950,7 @@
return None
def get_vertical_bar(self):
- if 'standard' in self._table_style:
+ if self.borders == 'standard':
return '|'
return ''
@@ -943,14 +960,16 @@
'center': 'c',
'right': 'r'}
align = align_map.get(self.get('align') or 'center')
- return '\n'.join([r'\setlength{\DUtablewidth}{\linewidth}',
- r'\begin{%s}[%s]' % (self.get_latex_type(), align)])
+ opening = [r'\begin{%s}[%s]' % (self.get_latex_type(), align)]
+ if not self.colwidths_auto:
+ opening.insert(0, r'\setlength{\DUtablewidth}{\linewidth}')
+ return '\n'.join(opening)
def get_closing(self):
closing = []
- if self._table_style == 'booktabs':
+ if self.borders == 'booktabs':
closing.append(r'\bottomrule')
- # elif self._table_style == 'standard':
+ # elif self.borders == 'standard':
# closing.append(r'\hline')
closing.append(r'\end{%s}' % self.get_latex_type())
return '\n'.join(closing)
@@ -975,9 +994,7 @@
bar = self.get_vertical_bar()
self._rowspan= [0] * len(self._col_specs)
self._col_width = []
- if 'colwidths-auto' in node.parent.parent['classes'] or (
- 'colwidths-auto' in self._table_style and
- ('colwidths-given' not in node.parent.parent['classes'])):
+ if self.colwidths_auto:
latex_table_spec = (bar+'l')*len(self._col_specs)
return latex_table_spec+bar
width = 80
@@ -1029,17 +1046,17 @@
def visit_thead(self):
self._in_thead += 1
- if self._table_style == 'standard':
+ if self.borders == 'standard':
return ['\\hline\n']
- elif self._table_style == 'booktabs':
+ elif self.borders == 'booktabs':
return ['\\toprule\n']
return []
def depart_thead(self):
a = []
- #if self._table_style == 'standard':
+ #if self.borders == 'standard':
# a.append('\\hline\n')
- if self._table_style == 'booktabs':
+ if self.borders == 'booktabs':
a.append('\\midrule\n')
if self._latex_type == 'longtable':
if 1 == self._translator.thead_depth():
@@ -1063,7 +1080,7 @@
if (self._rowspan[i]>0):
self._rowspan[i] -= 1
- if self._table_style == 'standard':
+ if self.borders == 'standard':
rowspans = [i+1 for i in range(len(self._rowspan))
if (self._rowspan[i]<=0)]
if len(rowspans)==len(self._rowspan):
@@ -1101,7 +1118,7 @@
def is_stub_column(self):
if len(self.stubs) >= self._cell_in_row:
- return self.stubs[self._cell_in_row-1]
+ return self.stubs[self._cell_in_row]
return False
@@ -1208,6 +1225,10 @@
self.settings.graphicx_option)
# footnotes:
self.docutils_footnotes = settings.docutils_footnotes
+ # @@ table_style: list of values from fixed set: warn?
+ # for s in self.settings.table_style:
+ # if s not in Writer.table_style_values:
+ # self.warn('Ignoring value "%s" in "table-style" setting.' %s)
# Output collection stacks
# ~~~~~~~~~~~~~~~~~~~~~~~~
@@ -1265,7 +1286,7 @@
# object for a table while proccessing.
self.table_stack = []
- self.active_table = Table(self, 'longtable', settings.table_style)
+ self.active_table = Table(self, 'longtable')
# Where to collect the output of visitor methods (default: body)
self.out = self.body
@@ -1977,10 +1998,8 @@
mrows = node['morerows'] + 1
self.active_table.set_rowspan(
self.active_table.get_entry_number(), mrows)
- self.out.append('\\multirow{%d}{%s}{%%' %
- (mrows, self.active_table.get_column_width()))
- # (end line with "%" to mask the line break,
- # needs to be checked for below).
+ self.out.append('\\multirow{%d}{%s}{' %
+ (mrows, self.active_table.get_column_width()))
self.context.append('}')
elif 'morecols' in node:
# the vertical bar before column is missing if it is the first
@@ -2000,19 +2019,18 @@
else:
self.context.append('')
- # header / not header
- if len(node) and isinstance(node.parent.parent, nodes.thead):
- if self.out[-1].endswith("%"):
- self.out.append("\n")
- self.out.append('\\textbf{%')
- self.context.append('}')
- elif self.active_table.is_stub_column():
- if self.out[-1].endswith("%"):
- self.out.append("\n")
+ # bold header/stub-column
+ if len(node) and (isinstance(node.parent.parent, nodes.thead)
+ or self.active_table.is_stub_column()):
self.out.append('\\textbf{')
self.context.append('}')
else:
self.context.append('')
+
+ # if line ends with '{', mask line break to prevent spurious whitespace
+ if not self.active_table.colwidths_auto and self.out[-1].endswith("{"):
+ self.out.append("%")
+
self.active_table.visit_entry() # increment cell count
def depart_entry(self, node):
@@ -2583,8 +2601,10 @@
self.depart_docinfo_item(node)
def visit_paragraph(self, node):
- # insert blank line, if the paragraph is not first in a list item
- # nor follows a non-paragraph node in a compound
+ # insert blank line, unless
+ # * the paragraph is first in a list item,
+ # * follows a non-paragraph node in a compound,
+ # * is in a table with auto-width columns
index = node.parent.index(node)
if (index == 0 and (isinstance(node.parent, nodes.list_item) or
isinstance(node.parent, nodes.description))):
@@ -2593,6 +2613,12 @@
not isinstance(node.parent[index - 1], nodes.paragraph) and
not isinstance(node.parent[index - 1], nodes.compound)):
pass
+ elif self.active_table.colwidths_auto:
+ if index == 1: # second paragraph
+ self.warn('LaTeX merges paragraphs in tables '
+ 'with auto-sized columns!', base_node=node)
+ if index > 0:
+ self.out.append('\n')
else:
self.out.append('\n')
if node.get('ids'):
@@ -2603,7 +2629,8 @@
def depart_paragraph(self, node):
if node['classes']:
self.depart_inline(node)
- self.out.append('\n')
+ if not self.active_table.colwidths_auto:
+ self.out.append('\n')
def visit_problematic(self, node):
self.requirements['color'] = PreambleCmds.color
@@ -2794,7 +2821,7 @@
if self.active_table.is_open():
self.table_stack.append(self.active_table)
# nesting longtable does not work (e.g. 2007-04-18)
- self.active_table = Table(self,'tabular',self.settings.table_style)
+ self.active_table = Table(self,'tabular')
# A longtable moves before \paragraph and \subparagraph
# section titles if it immediately follows them:
if (self.active_table._latex_type == 'longtable' and
@@ -2803,11 +2830,11 @@
self.d_class.section(self.section_level).find('paragraph') != -1):
self.out.append('\\leavevmode')
self.active_table.open()
- for cls in node['classes']:
- self.active_table.set_table_style(cls)
+ self.active_table.set_table_style(self.settings.table_style,
+ node['classes'])
if 'align' in node:
self.active_table.set('align', node['align'])
- if self.active_table._table_style == 'booktabs':
+ if self.active_table.borders == 'booktabs':
self.requirements['booktabs'] = r'\usepackage{booktabs}'
self.push_output_collector([])
@@ -2821,8 +2848,6 @@
self.active_table.close()
if len(self.table_stack)>0:
self.active_table = self.table_stack.pop()
- else:
- self.active_table.set_table_style(self.settings.table_style)
# Insert hyperlabel after (long)table, as
# other places (beginning, caption) result in LaTeX errors.
if node.get('ids'):
Modified: trunk/docutils/test/functional/expected/standalone_rst_latex.tex
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_latex.tex 2016-08-03 19:37:26 UTC (rev 7964)
+++ trunk/docutils/test/functional/expected/standalone_rst_latex.tex 2016-08-03 20:06:16 UTC (rev 7965)
@@ -1824,7 +1824,7 @@
test
&
\textbf{bold hd}
- & \multicolumn{3}{p{0.41\DUtablewidth}|}{
+ & \multicolumn{3}{p{0.41\DUtablewidth}|}{%
multicolumn 1
With a second paragraph
@@ -1832,7 +1832,7 @@
\emph{emph hd}
\\
\hline
-\multicolumn{2}{|p{0.31\DUtablewidth}|}{
+\multicolumn{2}{|p{0.31\DUtablewidth}|}{%
multicolumn 2
With a second paragraph
@@ -1848,7 +1848,7 @@
\hline
cell
- & \multicolumn{2}{p{0.36\DUtablewidth}|}{
+ & \multicolumn{2}{p{0.36\DUtablewidth}|}{%
multicolumn 3 (one line,
but very very very very
very looooong)
@@ -1866,7 +1866,7 @@
cell
&
cell
- & \multicolumn{3}{p{0.38\DUtablewidth}|}{
+ & \multicolumn{3}{p{0.38\DUtablewidth}|}{%
Short multicolumn 4
} \\
\hline
@@ -1877,43 +1877,39 @@
A table with multirow header and column-widths set by LaTeX:
-\setlength{\DUtablewidth}{\linewidth}
\begin{longtable*}[c]{|l|l|}
\hline
-\multirow{2}{*}{%
-\textbf{%
-XXX
-}} & \textbf{%
-Variable Summary
-} \\
+\multirow{2}{*}{\textbf{XXX}} & \textbf{Variable Summary} \\
\cline{2-2}
- & \textbf{%
-Description
-} \\
+ & \textbf{Description} \\
\hline
\endfirsthead
\hline
-\multirow{2}{*}{%
-\textbf{%
-XXX
-}} & \textbf{%
-Variable Summary
-} \\
+\multirow{2}{*}{\textbf{XXX}} & \textbf{Variable Summary} \\
\cline{2-2}
- & \textbf{%
-Description
-} \\
+ & \textbf{Description} \\
\hline
\endhead
\multicolumn{2}{c}{\hfill ... continued on next page} \\
\endfoot
\endlastfoot
-\multicolumn{2}{|l|}{
-multicollumn cell
-} \\
+\multicolumn{2}{|l|}{multicollumn cell} \\
\hline
\end{longtable*}
+In a table with column-widths set by LaTeX, each cell has just one line.
+Paragraphs are merged (a warning is given).
+
+\begin{longtable*}[c]{|l|l|}
+\hline
+11 & first paragraph
+second paragraph
+third paragraph \\
+\hline
+21 & 22 \\
+\hline
+\end{longtable*}
+
% This file is used by the standalone_rst_latex test.
Modified: trunk/docutils/test/functional/input/data/tables_latex.txt
===================================================================
--- trunk/docutils/test/functional/input/data/tables_latex.txt 2016-08-03 19:37:26 UTC (rev 7964)
+++ trunk/docutils/test/functional/input/data/tables_latex.txt 2016-08-03 20:06:16 UTC (rev 7965)
@@ -25,12 +25,28 @@
A table with multirow header and column-widths set by LaTeX:
.. table::
- :widths: auto
+ :widths: auto
- +------------+-------------------+
- | XXX | Variable Summary |
- | +-------------------+
- | | Description |
- +============+===================+
- | multicollumn cell |
- +--------------------------------+
+ +------------+-------------------+
+ | XXX | Variable Summary |
+ | +-------------------+
+ | | Description |
+ +============+===================+
+ | multicollumn cell |
+ +--------------------------------+
+
+In a table with column-widths set by LaTeX, each cell has just one line.
+Paragraphs are merged (a warning is given).
+
+.. table::
+ :widths: auto
+
+ +------------+-------------------+
+ | 11 | first paragraph |
+ | | |
+ | | second paragraph |
+ | | |
+ | | third paragraph |
+ +------------+-------------------+
+ | 21 | 22 |
+ +------------+-------------------+
Modified: trunk/docutils/test/test_writers/test_latex2e.py
===================================================================
--- trunk/docutils/test/test_writers/test_latex2e.py 2016-08-03 19:37:26 UTC (rev 7964)
+++ trunk/docutils/test/test_writers/test_latex2e.py 2016-08-03 20:06:16 UTC (rev 7965)
@@ -24,6 +24,10 @@
settings['sectnum_xform'] = True
settings['use_latex_citations'] = True
s.generateTests(totest_latex_citations)
+ settings['table_style'] = ['colwidths-auto']
+ s.generateTests(totest_table_style_auto)
+ settings['table_style'] = ['booktabs']
+ s.generateTests(totest_table_style_booktabs)
settings['stylesheet_path'] = 'data/spam,data/ham.tex'
s.generateTests(totest_stylesheet)
settings['embed_stylesheet'] = True
@@ -59,6 +63,10 @@
\usepackage[scaled=.90]{helvet}
\usepackage{courier}
""",
+longtable = r"""\usepackage{longtable,ltcaption,array}
+\setlength{\extrarowheight}{2pt}
+\newlength{\DUtablewidth} % internal use in tables
+""",
stylesheet = '',
fallbacks = '',
fallbacks_highlight = r"""% basic code highlight:
@@ -94,12 +102,12 @@
head = head_template.substitute(parts)
head_table = head_template.substitute(
- dict(parts, requirements = parts['requirements'] +
-r"""\usepackage{longtable,ltcaption,array}
-\setlength{\extrarowheight}{2pt}
-\newlength{\DUtablewidth} % internal use in tables
-"""))
+ dict(parts, requirements = parts['requirements'] + parts['longtable']))
+head_booktabs = head_template.substitute(
+ dict(parts, requirements=parts['requirements']
+ + '\\usepackage{booktabs}\n' + parts['longtable']))
+
head_textcomp = head_template.substitute(
dict(parts, requirements = parts['requirements'] +
r"""\usepackage{textcomp} % text symbol macros
@@ -117,6 +125,8 @@
totest_latex_citations = {}
totest_stylesheet = {}
totest_stylesheet_embed = {}
+totest_table_style_auto = {}
+totest_table_style_booktabs = {}
totest['url_chars'] = [
["http://nowhere/url_with%28parens%29",
@@ -437,7 +447,7 @@
a) nothing.
b) or some other.
-3. Third is
+3. Third is
(I) having pre and postfixes
(II) in roman numerals.
@@ -511,8 +521,7 @@
"""],
]
-totest['table_class'] = [
-# input
+totest['table_styles'] = [
["""\
.. table::
:class: borderless
@@ -540,13 +549,91 @@
\end{document}
"""],
+["""\
+.. table::
+ :class: booktabs
+
+ +-----+-+
+ | 1 |2|
+ +-----+-+
+""",
+head_booktabs + r"""
+\setlength{\DUtablewidth}{\linewidth}
+\begin{longtable*}[c]{p{0.075\DUtablewidth}p{0.028\DUtablewidth}}
+\toprule
+
+1
+ &
+2
+ \\
+\bottomrule
+\end{longtable*}
+
+\end{document}
+"""],
+["""\
+.. table::
+ :class: colwidths-auto
+
+ +-----+-+
+ | 1 |2|
+ +-----+-+
+""",
+head_table + r"""
+\begin{longtable*}[c]{|l|l|}
+\hline
+1 & 2 \\
+\hline
+\end{longtable*}
+
+\end{document}
+"""],
+["""\
+.. table::
+ :widths: auto
+
+ +-----+-+
+ | 1 |2|
+ +-----+-+
+""",
+head_table + r"""
+\begin{longtable*}[c]{|l|l|}
+\hline
+1 & 2 \\
+\hline
+\end{longtable*}
+
+\end{document}
+"""],
+["""\
+.. table::
+ :widths: 15, 30
+
+ +-----+-----+
+ | 1 | 2 |
+ +-----+-----+
+""",
+head_table + r"""
+\setlength{\DUtablewidth}{\linewidth}
+\begin{longtable*}[c]{|p{0.191\DUtablewidth}|p{0.365\DUtablewidth}|}
+\hline
+
+1
+ &
+2
+ \\
+\hline
+\end{longtable*}
+
+\end{document}
+"""],
]
-totest['table_align'] = [
-# input
+totest_table_style_booktabs['table_styles'] = [
+# borderless overrides "booktabs" table_style
["""\
.. table::
- :align: right
+ :class: borderless
+-----+-----+
| 1 | 2 |
@@ -556,26 +643,148 @@
""",
head_table + r"""
\setlength{\DUtablewidth}{\linewidth}
-\begin{longtable*}[r]{|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|}
-\hline
+\begin{longtable*}[c]{p{0.075\DUtablewidth}p{0.075\DUtablewidth}}
1
&
2
\\
-\hline
3
&
4
\\
+\end{longtable*}
+
+\end{document}
+"""],
+["""\
+.. table::
+ :widths: auto
+
+ +-----+-+
+ | 1 |2|
+ +-----+-+
+""",
+head_booktabs + r"""
+\begin{longtable*}[c]{ll}
+\toprule
+1 & 2 \\
+\bottomrule
+\end{longtable*}
+
+\end{document}
+"""],
+["""\
+.. table::
+ :widths: 15, 30
+
+ +-----+-----+
+ | 1 | 2 |
+ +-----+-----+
+""",
+head_booktabs + r"""
+\setlength{\DUtablewidth}{\linewidth}
+\begin{longtable*}[c]{p{0.191\DUtablewidth}p{0.365\DUtablewidth}}
+\toprule
+
+1
+ &
+2
+ \\
+\bottomrule
+\end{longtable*}
+
+\end{document}
+"""],
+]
+totest_table_style_auto['table_styles'] = [
+["""\
+.. table::
+ :class: borderless
+
+ +-----+-----+
+ | 1 | 2 |
+ +-----+-----+
+ | 3 | 4 |
+ +-----+-----+
+""",
+head_table + r"""
+\begin{longtable*}[c]{ll}
+1 & 2 \\
+3 & 4 \\
+\end{longtable*}
+
+\end{document}
+"""],
+["""\
+.. table::
+ :class: booktabs
+
+ +-----+-+
+ | 1 |2|
+ +-----+-+
+""",
+head_booktabs + r"""
+\begin{longtable*}[c]{ll}
+\toprule
+1 & 2 \\
+\bottomrule
+\end{longtable*}
+
+\end{document}
+"""],
+# given width overrides "colwidth-auto"
+["""\
+.. table::
+ :widths: 15, 30
+
+ +-----+-----+
+ | 1 | 2 |
+ +-----+-----+
+""",
+head_table + r"""
+\setlength{\DUtablewidth}{\linewidth}
+\begin{longtable*}[c]{|p{0.191\DUtablewidth}|p{0.365\DUtablewidth}|}
\hline
+
+1
+ &
+2
+ \\
+\hline
\end{longtable*}
\end{document}
"""],
]
+totest['table_align'] = [
+# input
+["""\
+.. table::
+ :align: right
+
+ +-----+-----+
+ | 1 | 2 |
+ +-----+-----+
+""",
+head_table + r"""
+\setlength{\DUtablewidth}{\linewidth}
+\begin{longtable*}[r]{|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|}
+\hline
+
+1
+ &
+2
+ \\
+\hline
+\end{longtable*}
+
+\end{document}
+"""],
+]
+
totest['table_empty_thead_entry'] = [
# input
["""\
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2016-08-18 13:06:12
|
Revision: 7966
http://sourceforge.net/p/docutils/code/7966
Author: milde
Date: 2016-08-18 13:06:09 +0000 (Thu, 18 Aug 2016)
Log Message:
-----------
docutils-xml writer: Fix/improve output with "newlines and "indent".
xmllint says empty elements must not have linebreaks inbetween
(regards transition, image and cospec elements).
Indent text, unless it is FixedText (literal etc.).
Add a functional test for docutils-xml.
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/docutils/writers/docutils_xml.py
trunk/docutils/test/test_writers/test_docutils_xml.py
Added Paths:
-----------
trunk/docutils/test/functional/expected/standalone_rst_docutils_xml.xml
trunk/docutils/test/functional/input/standalone_rst_docutils_xml.txt
trunk/docutils/test/functional/tests/standalone_rst_docutils_xml.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2016-08-03 20:06:16 UTC (rev 7965)
+++ trunk/docutils/HISTORY.txt 2016-08-18 13:06:09 UTC (rev 7966)
@@ -289,6 +289,7 @@
* docutils/writers/s5_html/docutils_xml.py
- Fix [ 3552403 ] Prevent broken PyXML replacing stdlibs xml module.
+ - Fix/improve output with ``--indent`` option.
* setup.py
Modified: trunk/docutils/docutils/writers/docutils_xml.py
===================================================================
--- trunk/docutils/docutils/writers/docutils_xml.py 2016-08-03 20:06:16 UTC (rev 7965)
+++ trunk/docutils/docutils/writers/docutils_xml.py 2016-08-18 13:06:09 UTC (rev 7966)
@@ -46,7 +46,7 @@
['--newlines'],
{'action': 'store_true', 'validator': frontend.validate_boolean}),
('Generate XML with indents and newlines.',
- ['--indents'],
+ ['--indents'], #@ TODO use integer value for number of spaces?
{'action': 'store_true', 'validator': frontend.validate_boolean}),
('Omit the XML declaration. Use with caution.',
['--no-xml-declaration'],
@@ -105,9 +105,10 @@
self.newline = '\n'
if settings.indents:
self.newline = '\n'
- self.indent = ' '
+ self.indent = ' ' #@ TODO make this configurable?
self.level = 0 # indentation level
self.in_simple = 0 # level of nesting inside mixed-content elements
+ self.fixed_text = 0 # level of nesting inside FixedText elements
# Output
self.output = []
@@ -125,13 +126,19 @@
# generic visit and depart methods
# --------------------------------
+ simple_nodes = (nodes.TextElement,
+ nodes.image, nodes.colspec, nodes.transition) # empty elements
+
def default_visit(self, node):
"""Default node visit method."""
if not self.in_simple:
self.output.append(self.indent*self.level)
self.output.append(node.starttag(xml.sax.saxutils.quoteattr))
self.level += 1
- if isinstance(node, nodes.TextElement):
+ # @@ make nodes.literal an instance of FixedTextElement?
+ if isinstance(node, (nodes.FixedTextElement, nodes.literal)):
+ self.fixed_text += 1
+ if isinstance(node, self.simple_nodes):
self.in_simple += 1
if not self.in_simple:
self.output.append(self.newline)
@@ -142,7 +149,9 @@
if not self.in_simple:
self.output.append(self.indent*self.level)
self.output.append(node.endtag())
- if isinstance(node, nodes.TextElement):
+ if isinstance(node, (nodes.FixedTextElement, nodes.literal)):
+ self.fixed_text -= 1
+ if isinstance(node, self.simple_nodes):
self.in_simple -= 1
if not self.in_simple:
self.output.append(self.newline)
@@ -153,6 +162,9 @@
def visit_Text(self, node):
text = xml.sax.saxutils.escape(node.astext())
+ # indent text if we are not in a FixedText element:
+ if not self.fixed_text:
+ text = text.replace('\n', '\n'+self.indent*self.level)
self.output.append(text)
def depart_Text(self, node):
Added: trunk/docutils/test/functional/expected/standalone_rst_docutils_xml.xml
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_docutils_xml.xml (rev 0)
+++ trunk/docutils/test/functional/expected/standalone_rst_docutils_xml.xml 2016-08-18 13:06:09 UTC (rev 7966)
@@ -0,0 +1,1614 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE document PUBLIC "+//IDN docutils.sourceforge.net//DTD Docutils Generic//EN//XML" "http://docutils.sourceforge.net/docs/ref/docutils.dtd">
+<!-- Generated by Docutils 0.13 -->
+<document ids="restructuredtext-test-document doctitle" names="restructuredtext\ test\ document doctitle" source="functional/input/standalone_rst_docutils_xml.txt" title="reStructuredText Test Document">
+ <title>reStructuredText Test Document</title>
+ <subtitle ids="examples-of-syntax-constructs subtitle" names="examples\ of\ syntax\ constructs subtitle">Examples of Syntax Constructs</subtitle>
+ <decoration>
+ <header>
+ <paragraph>Document header</paragraph>
+ </header>
+ <footer>
+ <paragraph>Document footer</paragraph>
+ </footer>
+ </decoration>
+ <docinfo>
+ <author>David Goodger</author>
+ <address xml:space="preserve">123 Example Street
+Example, EX Canada
+A1B 2C3</address>
+ <contact><reference refuri="mailto:go...@py...">go...@py...</reference></contact>
+ <authors>
+ <author>Me</author>
+ <author>Myself</author>
+ <author>I</author>
+ </authors>
+ <organization>humankind</organization>
+ <date>Now, or yesterday. Or maybe even <emphasis>before</emphasis> yesterday.</date>
+ <status>This is a "work in progress"</status>
+ <revision>is managed by a version control system.</revision>
+ <version>1</version>
+ <copyright>This document has been placed in the public domain. You
+ may do with it as you wish. You may copy, modify,
+ redistribute, reattribute, sell, buy, rent, lease,
+ destroy, or improve it, quote it at length, excerpt,
+ incorporate, collate, fold, staple, or mutilate it, or do
+ anything else to it that your or anyone else's heart
+ desires.</copyright>
+ <field classes="field-name">
+ <field_name>field name</field_name>
+ <field_body>
+ <paragraph>This is a "generic bibliographic field".</paragraph>
+ </field_body>
+ </field>
+ <field classes="field-name-2">
+ <field_name>field name "2"</field_name>
+ <field_body>
+ <paragraph>Generic bibliographic fields may contain multiple body elements.</paragraph>
+ <paragraph>Like this.</paragraph>
+ </field_body>
+ </field>
+ </docinfo>
+ <topic classes="dedication">
+ <title>Dedication</title>
+ <paragraph>For Docutils users & co-developers.</paragraph>
+ </topic>
+ <topic classes="abstract">
+ <title>Abstract</title>
+ <paragraph>This is a test document, containing at least one example of each
+ reStructuredText construct.</paragraph>
+ </topic>
+ <comment xml:space="preserve">This is a comment. Note how any initial comments are moved by
+transforms to after the document title, subtitle, and docinfo.</comment>
+ <target refid="doctitle"></target>
+ <comment xml:space="preserve">Above is the document title, and below is the subtitle.
+They are transformed from section titles after parsing.</comment>
+ <target refid="subtitle"></target>
+ <comment xml:space="preserve">bibliographic fields (which also require a transform):</comment>
+ <raw format="latex" xml:space="preserve">\pagebreak[4] % start ToC on new page</raw>
+ <topic classes="contents" ids="table-of-contents" names="table\ of\ contents">
+ <title>Table of Contents</title>
+ <bullet_list classes="auto-toc">
+ <list_item>
+ <paragraph><reference ids="id34" refid="structural-elements"><generated classes="sectnum">1 </generated>Structural Elements</reference></paragraph>
+ <bullet_list classes="auto-toc">
+ <list_item>
+ <paragraph><reference ids="id35" refid="section-title"><generated classes="sectnum">1.1 </generated>Section Title</reference></paragraph>
+ </list_item>
+ <list_item>
+ <paragraph><reference ids="id36" refid="empty-section"><generated classes="sectnum">1.2 </generated>Empty Section</reference></paragraph>
+ </list_item>
+ <list_item>
+ <paragraph><reference ids="id37" refid="transitions"><generated classes="sectnum">1.3 </generated>Transitions</reference></paragraph>
+ </list_item>
+ </bullet_list>
+ </list_item>
+ <list_item>
+ <paragraph><reference ids="id38" refid="body-elements"><generated classes="sectnum">2 </generated>Body Elements</reference></paragraph>
+ <bullet_list classes="auto-toc">
+ <list_item>
+ <paragraph><reference ids="id39" refid="paragraphs"><generated classes="sectnum">2.1 </generated>Paragraphs</reference></paragraph>
+ <bullet_list classes="auto-toc">
+ <list_item>
+ <paragraph><reference ids="id40" refid="inline-markup"><generated classes="sectnum">2.1.1 </generated>Inline Markup</reference></paragraph>
+ </list_item>
+ </bullet_list>
+ </list_item>
+ <list_item>
+ <paragraph><reference ids="id41" refid="bullet-lists"><generated classes="sectnum">2.2 </generated>Bullet Lists</reference></paragraph>
+ </list_item>
+ <list_item>
+ <paragraph><reference ids="id42" refid="enumerated-lists"><generated classes="sectnum">2.3 </generated>Enumerated Lists</reference></paragraph>
+ </list_item>
+ <list_item>
+ <paragraph><reference ids="id43" refid="definition-lists"><generated classes="sectnum">2.4 </generated>Definition Lists</reference></paragraph>
+ </list_item>
+ <list_item>
+ <paragraph><reference ids="id44" refid="field-lists"><generated classes="sectnum">2.5 </generated>Field Lists</reference></paragraph>
+ </list_item>
+ <list_item>
+ <paragraph><reference ids="id45" refid="option-lists"><generated classes="sectnum">2.6 </generated>Option Lists</reference></paragraph>
+ </list_item>
+ <list_item>
+ <paragraph><reference ids="id46" refid="literal-blocks"><generated classes="sectnum">2.7 </generated>Literal Blocks</reference></paragraph>
+ </list_item>
+ <list_item>
+ <paragraph><reference ids="id47" refid="line-blocks"><generated classes="sectnum">2.8 </generated>Line Blocks</reference></paragraph>
+ </list_item>
+ <list_item>
+ <paragraph><reference ids="id48" refid="block-quotes"><generated classes="sectnum">2.9 </generated>Block Quotes</reference></paragraph>
+ </list_item>
+ <list_item>
+ <paragraph><reference ids="id49" refid="doctest-blocks"><generated classes="sectnum">2.10 </generated>Doctest Blocks</reference></paragraph>
+ </list_item>
+ <list_item>
+ <paragraph><reference ids="id50" refid="footnotes"><generated classes="sectnum">2.11 </generated>Footnotes</reference></paragraph>
+ </list_item>
+ <list_item>
+ <paragraph><reference ids="id51" refid="citations"><generated classes="sectnum">2.12 </generated>Citations</reference></paragraph>
+ </list_item>
+ <list_item>
+ <paragraph><reference ids="id52" refid="targets"><generated classes="sectnum">2.13 </generated>Targets</reference></paragraph>
+ <bullet_list classes="auto-toc">
+ <list_item>
+ <paragraph><reference ids="id53" refid="duplicate-target-names"><generated classes="sectnum">2.13.1 </generated>Duplicate Target Names</reference></paragraph>
+ </list_item>
+ <list_item>
+ <paragraph><reference ids="id54" refid="id21"><generated classes="sectnum">2.13.2 </generated>Duplicate Target Names</reference></paragraph>
+ </list_item>
+ </bullet_list>
+ </list_item>
+ <list_item>
+ <paragraph><reference ids="id55" refid="directives"><generated classes="sectnum">2.14 </generated>Directives</reference></paragraph>
+ <bullet_list classes="auto-toc">
+ <list_item>
+ <paragraph><reference ids="id56" refid="document-parts"><generated classes="sectnum">2.14.1 </generated>Document Parts</reference></paragraph>
+ </list_item>
+ <list_item>
+ <paragraph><reference ids="id57" refid="images-and-figures"><generated classes="sectnum">2.14.2 </generated>Images and Figures</reference></paragraph>
+ </list_item>
+ <list_item>
+ <paragraph><reference ids="id58" refid="admonitions"><generated classes="sectnum">2.14.3 </generated>Admonitions</reference></paragraph>
+ </list_item>
+ <list_item>
+ <paragraph><reference ids="id59" refid="topics-sidebars-and-rubrics"><generated classes="sectnum">2.14.4 </generated>Topics, Sidebars, and Rubrics</reference></paragraph>
+ </list_item>
+ <list_item>
+ <paragraph><reference ids="id60" refid="target-footnotes"><generated classes="sectnum">2.14.5 </generated>Target Footnotes</reference></paragraph>
+ </list_item>
+ <list_item>
+ <paragraph><reference ids="id61" refid="replacement-text"><generated classes="sectnum">2.14.6 </generated>Replacement Text</reference></paragraph>
+ </list_item>
+ <list_item>
+ <paragraph><reference ids="id62" refid="compound-paragraph"><generated classes="sectnum">2.14.7 </generated>Compound Paragraph</reference></paragraph>
+ </list_item>
+ <list_item>
+ <paragraph><reference ids="id63" refid="parsed-literal-blocks"><generated classes="sectnum">2.14.8 </generated>Parsed Literal Blocks</reference></paragraph>
+ </list_item>
+ <list_item>
+ <paragraph><reference ids="id64" refid="code"><generated classes="sectnum">2.14.9 </generated>Code</reference></paragraph>
+ </list_item>
+ </bullet_list>
+ </list_item>
+ <list_item>
+ <paragraph><reference ids="id65" refid="substitution-definitions"><generated classes="sectnum">2.15 </generated>Substitution Definitions</reference></paragraph>
+ </list_item>
+ <list_item>
+ <paragraph><reference ids="id66" refid="comments"><generated classes="sectnum">2.16 </generated>Comments</reference></paragraph>
+ </list_item>
+ <list_item>
+ <paragraph><reference ids="id67" refid="raw-text"><generated classes="sectnum">2.17 </generated>Raw text</reference></paragraph>
+ </list_item>
+ <list_item>
+ <paragraph><reference ids="id68" refid="container"><generated classes="sectnum">2.18 </generated>Container</reference></paragraph>
+ </list_item>
+ <list_item>
+ <paragraph><reference ids="id69" refid="colspanning-tables"><generated classes="sectnum">2.19 </generated>Colspanning tables</reference></paragraph>
+ </list_item>
+ <list_item>
+ <paragraph><reference ids="id70" refid="rowspanning-tables"><generated classes="sectnum">2.20 </generated>Rowspanning tables</reference></paragraph>
+ </list_item>
+ <list_item>
+ <paragraph><reference ids="id71" refid="complex-tables"><generated classes="sectnum">2.21 </generated>Complex tables</reference></paragraph>
+ </list_item>
+ <list_item>
+ <paragraph><reference ids="id72" refid="list-tables"><generated classes="sectnum">2.22 </generated>List Tables</reference></paragraph>
+ </list_item>
+ </bullet_list>
+ </list_item>
+ <list_item>
+ <paragraph><reference ids="id73" refid="error-handling"><generated classes="sectnum">3 </generated>Error Handling</reference></paragraph>
+ </list_item>
+ </bullet_list>
+ </topic>
+ <section ids="structural-elements" names="structural\ elements">
+ <title auto="1" refid="id34"><generated classes="sectnum">1 </generated>Structural Elements</title>
+ <section ids="section-title" names="section\ title">
+ <title auto="1" refid="id35"><generated classes="sectnum">1.1 </generated>Section Title</title>
+ <subtitle ids="section-subtitle" names="section\ subtitle">Section Subtitle</subtitle>
+ <paragraph>Lone subsections are converted to a section subtitle by a transform
+ activated with the <literal>--section-subtitles</literal> command line option or the
+ <literal>sectsubtitle-xform</literal> configuration value.</paragraph>
+ </section>
+ <section ids="empty-section" names="empty\ section">
+ <title auto="1" refid="id36"><generated classes="sectnum">1.2 </generated>Empty Section</title>
+ </section>
+ <section ids="transitions" names="transitions">
+ <title auto="1" refid="id37"><generated classes="sectnum">1.3 </generated>Transitions</title>
+ <paragraph>Here's a transition:</paragraph>
+ <transition></transition>
+ <paragraph>It divides the section. Transitions may also occur between sections:</paragraph>
+ </section>
+ </section>
+ <transition></transition>
+ <section ids="body-elements" names="body\ elements">
+ <title auto="1" refid="id38"><generated classes="sectnum">2 </generated>Body Elements</title>
+ <section ids="paragraphs" names="paragraphs">
+ <title auto="1" refid="id39"><generated classes="sectnum">2.1 </generated>Paragraphs</title>
+ <paragraph>A paragraph.</paragraph>
+ <section ids="inline-markup" names="inline\ markup">
+ <title auto="1" refid="id40"><generated classes="sectnum">2.1.1 </generated>Inline Markup</title>
+ <paragraph>Paragraphs contain text and may contain inline markup: <emphasis>emphasis</emphasis>,
+ <strong>strong emphasis</strong>, <literal>inline literals</literal>, standalone hyperlinks
+ (<reference refuri="http://www.python.org">http://www.python.org</reference>), external hyperlinks (<reference name="Python" refuri="http://www.python.org/">Python</reference> <footnote_reference auto="1" ids="id26" refid="id25">5</footnote_reference>), internal
+ cross-references (<reference name="example" refid="example">example</reference>), external hyperlinks with embedded URIs
+ (<reference name="Python web site" refuri="http://www.python.org">Python web site</reference>), <reference anonymous="1" name="anonymous hyperlink references" refuri="http://www.python.org/">anonymous hyperlink
+ references</reference> <footnote_reference auto="1" ids="id31" refid="id25">5</footnote_reference> (<reference anonymous="1" name="a second reference" refuri="http://docutils.sourceforge.net/">a second reference</reference> <footnote_reference auto="1" ids="id33" refid="id32">7</footnote_reference>), footnote references (manually
+ numbered <footnote_reference ids="id1" refid="id8">1</footnote_reference>, anonymous auto-numbered <footnote_reference auto="1" ids="id2" refid="id12">3</footnote_reference>, labeled auto-numbered
+ <footnote_reference auto="1" ids="id3" refid="label">2</footnote_reference>, or symbolic <footnote_reference auto="*" ids="id4" refid="id13">*</footnote_reference>), citation references (<citation_reference ids="id5" refid="cit2002">CIT2002</citation_reference>),
+ substitution references (<image alt="EXAMPLE" uri="../../../docs/user/rst/images/biohazard.png"></image>), and <target ids="inline-hyperlink-targets" names="inline\ hyperlink\ targets">inline hyperlink targets</target>
+ (see <reference name="Targets" refid="targets">Targets</reference> below for a reference back to here). Character-level
+ inline markup is also possible (although exceedingly ugly!) in <emphasis>re</emphasis><literal>Structured</literal><emphasis>Text</emphasis>. Problems are indicated by <problematic ids="id24" refid="id23">|problematic|</problematic> text
+ (generated by processing errors; this one is intentional). Here is a
+ reference to the <reference name="doctitle" refid="doctitle">doctitle</reference> and the <reference name="subtitle" refid="subtitle">subtitle</reference>.</paragraph>
+ <target anonymous="1" ids="id6" refuri="http://www.python.org/"></target>
+ <target anonymous="1" ids="id7" refuri="http://docutils.sourceforge.net/"></target>
+ <paragraph>The default role for interpreted text is <title_reference>Title Reference</title_reference>. Here are
+ some explicit interpreted text roles: a PEP reference (<reference refuri="http://www.python.org/dev/peps/pep-0287">PEP 287</reference>); an
+ RFC reference (<reference refuri="http://tools.ietf.org/html/rfc2822.html">RFC 2822</reference>); an abbreviation (<abbreviation>abb.</abbreviation>), an acronym
+ (<acronym>reST</acronym>), code (<literal classes="code">print "hello world"</literal>); a <subscript>subscript</subscript>;
+ a <superscript>superscript</superscript> and explicit roles for <title_reference>Docutils</title_reference>'
+ <emphasis>standard</emphasis> <strong>inline</strong> <literal>markup</literal>.</paragraph>
+ <comment xml:space="preserve">DO NOT RE-WRAP THE FOLLOWING PARAGRAPH!</comment>
+ <paragraph>Let's test wrapping and whitespace significance in inline literals:
+ <literal>This is an example of --inline-literal --text, --including some--
+strangely--hyphenated-words. Adjust-the-width-of-your-browser-window
+to see how the text is wrapped. -- ---- -------- Now note the
+spacing between the words of this sentence (words
+should be grouped in pairs).</literal></paragraph>
+ <paragraph>If the <literal>--pep-references</literal> option was supplied, there should be a
+ live link to PEP 258 here.</paragraph>
+ </section>
+ </section>
+ <section ids="bullet-lists" names="bullet\ lists">
+ <title auto="1" refid="id41"><generated classes="sectnum">2.2 </generated>Bullet Lists</title>
+ <bullet_list bullet="-">
+ <list_item>
+ <paragraph>A bullet list</paragraph>
+ <bullet_list bullet="+">
+ <list_item>
+ <paragraph>Nested bullet list.</paragraph>
+ </list_item>
+ <list_item>
+ <paragraph>Nested item 2.</paragraph>
+ </list_item>
+ </bullet_list>
+ </list_item>
+ <list_item>
+ <paragraph>Item 2.</paragraph>
+ <paragraph>Paragraph 2 of item 2.</paragraph>
+ <bullet_list bullet="*">
+ <list_item>
+ <paragraph>Nested bullet list.</paragraph>
+ </list_item>
+ <list_item>
+ <paragraph>Nested item 2.</paragraph>
+ <bullet_list bullet="-">
+ <list_item>
+ <paragraph>Third level.</paragraph>
+ </list_item>
+ <list_item>
+ <paragraph>Item 2.</paragraph>
+ </list_item>
+ </bullet_list>
+ </list_item>
+ <list_item>
+ <paragraph>Nested item 3.</paragraph>
+ </list_item>
+ <list_item>
+ <paragraph>This nested list should be compacted by the HTML writer.</paragraph>
+ <target ids="target" names="target"></target>
+ <comment xml:space="preserve">Even if this item contains a target and a comment.</comment>
+ </list_item>
+ </bullet_list>
+ </list_item>
+ </bullet_list>
+ </section>
+ <section ids="enumerated-lists" names="enumerated\ lists">
+ <title auto="1" refid="id42"><generated classes="sectnum">2.3 </generated>Enumerated Lists</title>
+ <enumerated_list enumtype="arabic" prefix="" suffix=".">
+ <list_item>
+ <paragraph>Arabic numerals.</paragraph>
+ <enumerated_list enumtype="loweralpha" prefix="" suffix=")">
+ <list_item>
+ <paragraph>lower alpha)</paragraph>
+ <enumerated_list enumtype="lowerroman" prefix="(" suffix=")">
+ <list_item>
+ <paragraph>(lower roman)</paragraph>
+ <enumerated_list enumtype="upperalpha" prefix="" suffix=".">
+ <list_item>
+ <paragraph>upper alpha.</paragraph>
+ <enumerated_list enumtype="upperroman" prefix="" suffix=")">
+ <list_item>
+ <paragraph>upper roman)</paragraph>
+ </list_item>
+ </enumerated_list>
+ </list_item>
+ </enumerated_list>
+ </list_item>
+ </enumerated_list>
+ </list_item>
+ </enumerated_list>
+ </list_item>
+ <list_item>
+ <paragraph>Lists that don't start at 1:</paragraph>
+ <enumerated_list enumtype="arabic" prefix="" start="3" suffix=".">
+ <list_item>
+ <paragraph>Three</paragraph>
+ </list_item>
+ <list_item>
+ <paragraph>Four</paragraph>
+ </list_item>
+ </enumerated_list>
+ <system_message level="1" line="8" source="functional/input/data/standard.txt" type="INFO">
+ <paragraph>Enumerated list start value not ordinal-1: "3" (ordinal 3)</paragraph>
+ </system_message>
+ <enumerated_list enumtype="upperalpha" prefix="" start="3" suffix=".">
+ <list_item>
+ <paragraph>C</paragraph>
+ </list_item>
+ <list_item>
+ <paragraph>D</paragraph>
+ </list_item>
+ </enumerated_list>
+ <system_message level="1" line="8" source="functional/input/data/standard.txt" type="INFO">
+ <paragraph>Enumerated list start value not ordinal-1: "C" (ordinal 3)</paragraph>
+ </system_message>
+ <enumerated_list enumtype="lowerroman" prefix="" start="3" suffix=".">
+ <list_item>
+ <paragraph>iii</paragraph>
+ </list_item>
+ <list_item>...
[truncated message content] |
|
From: <mi...@us...> - 2016-08-18 13:19:22
|
Revision: 7967
http://sourceforge.net/p/docutils/code/7967
Author: milde
Date: 2016-08-18 13:19:19 +0000 (Thu, 18 Aug 2016)
Log Message:
-----------
Apply [ 133 ] Persian mappings by Shahin Azad.
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
Added Paths:
-----------
trunk/docutils/docutils/languages/fa.py
trunk/docutils/docutils/parsers/rst/languages/fa.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2016-08-18 13:06:09 UTC (rev 7966)
+++ trunk/docutils/HISTORY.txt 2016-08-18 13:19:19 UTC (rev 7967)
@@ -16,6 +16,11 @@
Changes Since 0.12
==================
+* docutils/languages/fa.py
+ docutils/parsers/rst/languages/fa.py:
+
+ - Apply [ 133 ] Persian mappings by Shahin Azad.
+
* docutils/nodes.py
- Fix [ 253 ] Attribute key without value not allowed in XML.
Added: trunk/docutils/docutils/languages/fa.py
===================================================================
--- trunk/docutils/docutils/languages/fa.py (rev 0)
+++ trunk/docutils/docutils/languages/fa.py 2016-08-18 13:19:19 UTC (rev 7967)
@@ -0,0 +1,61 @@
+# -*- coding: utf-8 -*-
+# $Id: fa.py 4564 2016-08-10 11:48:42Z
+# Author: Shahin <me...@5h...>
+# Copyright: This module has been placed in the public domain.
+
+# New language mappings are welcome. Before doing a new translation, please
+# read <http://docutils.sf.net/docs/howto/i18n.html>. Two files must be
+# translated for each language: one in docutils/languages, the other in
+# docutils/parsers/rst/languages.
+
+"""
+Persian-language mappings for language-dependent features of Docutils.
+"""
+
+__docformat__ = 'reStructuredText'
+
+labels = {
+ # fixed: language-dependent
+ 'author': 'نویسنده',
+ 'authors': 'نویسندگان',
+ 'organization': 'سازمان',
+ 'address': 'آدرس',
+ 'contact': 'تماس',
+ 'version': 'نسخه',
+ 'revision': 'بازبینی',
+ 'status': 'وضعیت',
+ 'date': 'تاریخ',
+ 'copyright': 'کپیرایت',
+ 'dedication': 'تخصیص',
+ 'abstract': 'چکیده',
+ 'attention': 'توجه!',
+ 'caution': 'احتیاط!',
+ 'danger': 'خطر!',
+ 'error': 'خطا',
+ 'hint': 'راهنما',
+ 'important': 'مهم',
+ 'note': 'یادداشت',
+ 'tip': 'نکته',
+ 'warning': 'اخطار',
+ 'contents': 'محتوا'}
+"""Mapping of node class name to label text."""
+
+bibliographic_fields = {
+ # language-dependent: fixed
+ 'author': 'نویسنده',
+ 'authors': 'نویسندگان',
+ 'organization': 'سازمان',
+ 'address': 'آدرس',
+ 'contact': 'تماس',
+ 'version': 'نسخه',
+ 'revision': 'بازبینی',
+ 'status': 'وضعیت',
+ 'date': 'تاریخ',
+ 'copyright': 'کپیرایت',
+ 'dedication': 'تخصیص',
+ 'abstract': 'چکیده'}
+"""Persian (lowcased) to canonical name mapping for bibliographic fields."""
+
+author_separators = ['؛', '،']
+"""List of separator strings for the 'Authors' bibliographic field. Tried in
+order."""
Added: trunk/docutils/docutils/parsers/rst/languages/fa.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/languages/fa.py (rev 0)
+++ trunk/docutils/docutils/parsers/rst/languages/fa.py 2016-08-18 13:19:19 UTC (rev 7967)
@@ -0,0 +1,101 @@
+# -*- coding: utf-8 -*-
+# $Id: fa.py 4564 2016-08-10 11:48:42Z
+# Author: Shahin <me...@5h...>
+# Copyright: This module has been placed in the public domain.
+
+# New language mappings are welcome. Before doing a new translation, please
+# read <http://docutils.sf.net/docs/howto/i18n.html>. Two files must be
+# translated for each language: one in docutils/languages, the other in
+# docutils/parsers/rst/languages.
+
+"""
+Persian-language mappings for language-dependent features of
+reStructuredText.
+"""
+
+__docformat__ = 'reStructuredText'
+
+
+directives = {
+ # language-dependent: fixed
+ 'توجه': 'attention',
+ 'احتیاط': 'caution',
+ 'کد': 'code',
+ 'بلوک-کد': 'code',
+ 'کد-منبع': 'code',
+ 'خطر': 'danger',
+ 'خطا': 'error',
+ 'راهنما': 'hint',
+ 'مهم': 'important',
+ 'یادداشت': 'note',
+ 'نکته': 'tip',
+ 'اخطار': 'warning',
+ 'تذکر': 'admonition',
+ 'نوار-کناری': 'sidebar',
+ 'موضوع': 'topic',
+ 'بلوک-خط': 'line-block',
+ 'تلفظ-پردازش-شده': 'parsed-literal',
+ 'سر-فصل': 'rubric',
+ 'کتیبه': 'epigraph',
+ 'نکات-برجسته': 'highlights',
+ 'نقل-قول': 'pull-quote',
+ 'ترکیب': 'compound',
+ 'ظرف': 'container',
+ #'questions': 'questions',
+ 'جدول': 'table',
+ 'جدول-csv': 'csv-table',
+ 'جدول-لیست': 'list-table',
+ #'qa': 'questions',
+ #'faq': 'questions',
+ 'متا': 'meta',
+ 'ریاضی': 'math',
+ #'imagemap': 'imagemap',
+ 'تصویر': 'image',
+ 'شکل': 'figure',
+ 'شامل': 'include',
+ 'خام': 'raw',
+ 'جایگزین': 'replace',
+ 'یونیکد': 'unicode',
+ 'تاریخ': 'date',
+ 'کلاس': 'class',
+ 'قانون': 'role',
+ 'قانون-پیشفرض': 'default-role',
+ 'عنوان': 'title',
+ 'محتوا': 'contents',
+ 'شماره-فصل': 'sectnum',
+ 'شمارهگذاری-فصل': 'sectnum',
+ 'سرآیند': 'header',
+ 'پاصفحه': 'footer',
+ #'footnotes': 'footnotes',
+ #'citations': 'citations',
+ 'یادداشت-هدف': 'target-notes',
+ }
+"""Persian name to registered (in directives/__init__.py) directive name
+mapping."""
+
+roles = {
+ # language-dependent: fixed
+ 'مخفف': 'abbreviation',
+ 'سرنام': 'acronym',
+ 'کد': 'code',
+ 'شاخص': 'index',
+ 'زیرنویس': 'subscript',
+ 'بالانویس': 'superscript',
+ 'عنوان': 'title-reference',
+ 'نیرو': 'pep-reference',
+ 'تاکید': 'emphasis',
+ 'قوی': 'strong',
+ 'لفظی': 'literal',
+ 'ریاضی': 'math',
+ 'منبع-نامگذاری': 'named-reference',
+ 'منبع-ناشناس': 'anonymous-reference',
+ 'منبع-پانویس': 'footnote-reference',
+ 'منبع-نقلفول': 'citation-reference',
+ 'منبع-جایگزینی': 'substitution-reference',
+ 'هدف': 'target',
+ 'منبع-uri': 'uri-reference',
+ 'uri': 'uri-reference',
+ 'url': 'uri-reference',
+ 'خام': 'raw',}
+"""Mapping of Persian role names to canonical role names for interpreted text.
+"""
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2016-08-18 21:40:04
|
Revision: 7969
http://sourceforge.net/p/docutils/code/7969
Author: milde
Date: 2016-08-18 21:40:00 +0000 (Thu, 18 Aug 2016)
Log Message:
-----------
Rename html_plain writer to html5_polyglott.
Modified Paths:
--------------
trunk/docutils/docs/user/html.txt
trunk/docutils/docutils/writers/__init__.py
trunk/docutils/docutils/writers/html4css1/__init__.py
trunk/docutils/docutils/writers/html5_polyglot/__init__.py
trunk/docutils/setup.py
trunk/docutils/test/functional/input/data/math.css
trunk/docutils/test/functional/input/data/minimal.css
trunk/docutils/test/functional/input/data/plain.css
trunk/docutils/test/functional/tests/standalone_rst_html_plain.py
trunk/docutils/test/test_writers/test_html4css1_misc.py
Added Paths:
-----------
trunk/docutils/docutils/writers/html5_polyglot/
trunk/docutils/test/functional/expected/footnotes_html5_polyglot.html
trunk/docutils/test/functional/expected/standalone_rst_html5_polyglot.html
trunk/docutils/test/functional/input/standalone_rst_html5_polyglot.txt
trunk/docutils/test/functional/tests/footnotes_html5_polyglot.py
trunk/docutils/test/test_writers/test_html5_polyglot_misc.py
Removed Paths:
-------------
trunk/docutils/docutils/writers/html_plain/
trunk/docutils/test/functional/expected/footnotes_html_plain.html
trunk/docutils/test/functional/expected/standalone_rst_html_plain.html
trunk/docutils/test/functional/input/standalone_rst_html_plain.txt
trunk/docutils/test/functional/tests/footnotes_html_plain.py
trunk/docutils/test/test_writers/test_html_plain_misc.py
Modified: trunk/docutils/docs/user/html.txt
===================================================================
--- trunk/docutils/docs/user/html.txt 2016-08-18 21:21:58 UTC (rev 7968)
+++ trunk/docutils/docs/user/html.txt 2016-08-18 21:40:00 UTC (rev 7969)
@@ -12,17 +12,17 @@
* `Generic HTML writers`_
- =========== ============== ============== ================= ===========
- name alias(es) `front-end`_ HTML version CSS version
- =========== ============== ============== ================= ===========
- html4css1_ html4 rst2html4.py `XHTML 1 `CSS 1`_
+ =============== ========== ============== ================= ===========
+ name alias(es) `front-end`_ HTML version CSS version
+ =============== ========== ============== ================= ===========
+ html4css1_ html4 rst2html4.py `XHTML 1 `CSS 1`_
Transitional`_
- .. html_ rst2html.py `XHTML 1 `CSS 1`_
+ .. html_ rst2html.py `XHTML 1 `CSS 1`_
Transitional`_
- html_plain_ html5_ rst2html5.py `HTML5`_ `CSS 3`_
- =========== ============== ============== ================= ===========
+ html5_polyglot_ html5_ rst2html5.py `HTML5`_ `CSS 3`_
+ =============== ========== ============== ================= ===========
* `Special HTML writers`_
@@ -87,14 +87,14 @@
.. _html4css1.css: ../../docutils/writers/html4css1/html4css1.css
-html_plain
-~~~~~~~~~~
+html5_polyglot
+~~~~~~~~~~~~~~
:aliases: html5_
:front-end: rst2html5.py_
-:config: `[html-plain writer]`_
+:config: `[html-polyglot writer]`_
-The ``html_plain`` writer generates `polyglot HTML`_ output, valid XML that
+The ``html5_polyglot`` writer generates `polyglot HTML`_ output, valid XML that
is compatible with `HTML5`_.
New features and elements will only be used if they are widely supported to
make documents `viewable with any browser`_.
@@ -109,8 +109,8 @@
.. _rst2html5.py: tools.html#rst2html5-py
.. _[html-plain writer]: config.html#html-plain-writer
-.. _minimal.css: ../../docutils/writers/html_plain/minimal.css
-.. _plain.css: ../../docutils/writers/html_plain/plain.css
+.. _minimal.css: ../../docutils/writers/html5_polyglot/minimal.css
+.. _plain.css: ../../docutils/writers/html5_polyglot/plain.css
.. _custom style sheets: ../howto/html-stylesheets.html
.. _viewable with any browser: http://www.anybrowser.org/campaign
Modified: trunk/docutils/docutils/writers/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/__init__.py 2016-08-18 21:21:58 UTC (rev 7968)
+++ trunk/docutils/docutils/writers/__init__.py 2016-08-18 21:40:00 UTC (rev 7969)
@@ -122,15 +122,14 @@
_writer_aliases = {
'html': 'html4css1', # may change to html5 some day
'html4': 'html4css1',
- 'html5': 'html_plain', # may be replaced with a special HTML 5 writer
- 'html-plain': 'html_plain',
+ 'html5': 'html5_polyglot',
'latex': 'latex2e',
'pprint': 'pseudoxml',
'pformat': 'pseudoxml',
'pdf': 'rlpdf',
's5': 's5_html',
'xelatex': 'xetex',
- 'xhtml': 'html_plain',
+ 'xhtml': 'html5_polyglot',
'xhtml10': 'html4css1',
'xml': 'docutils_xml'}
Modified: trunk/docutils/docutils/writers/html4css1/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/html4css1/__init__.py 2016-08-18 21:21:58 UTC (rev 7968)
+++ trunk/docutils/docutils/writers/html4css1/__init__.py 2016-08-18 21:40:00 UTC (rev 7969)
@@ -47,7 +47,7 @@
os.path.abspath(os.path.dirname(__file__)),
# for math.css
os.path.abspath(os.path.join(
- os.path.dirname(os.path.dirname(__file__)), 'html_plain'))
+ os.path.dirname(os.path.dirname(__file__)), 'html5_polyglot'))
]
default_template = 'template.txt'
Modified: trunk/docutils/docutils/writers/html5_polyglot/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/html_plain/__init__.py 2016-08-18 21:21:58 UTC (rev 7968)
+++ trunk/docutils/docutils/writers/html5_polyglot/__init__.py 2016-08-18 21:40:00 UTC (rev 7969)
@@ -203,7 +203,7 @@
class HTMLTranslator(nodes.NodeVisitor):
"""
- This writer generates `polyglott markup`: HTML 5 that is also valid XML.
+ This writer generates `polyglot markup`: HTML 5 that is also valid XML.
"""
xml_declaration = '<?xml version="1.0" encoding="%s" ?>\n'
@@ -1255,7 +1255,7 @@
pass # never reached
# Meta tags: 'lang' attribute replaced by 'xml:lang' in XHTML 1.1
- # HTML5/polyglott recommends using both
+ # HTML5/polyglot recommends using both
def visit_meta(self, node):
if node.hasattr('lang'):
node['xml:lang'] = node['lang']
Modified: trunk/docutils/setup.py
===================================================================
--- trunk/docutils/setup.py 2016-08-18 21:21:58 UTC (rev 7968)
+++ trunk/docutils/setup.py 2016-08-18 21:40:00 UTC (rev 7969)
@@ -135,7 +135,7 @@
'docutils.utils.math',
'docutils.writers',
'docutils.writers.html4css1',
- 'docutils.writers.html_plain',
+ 'docutils.writers.html5_polyglot',
# 'docutils.writers.xhtml11', # moved to the sandbox
'docutils.writers.pep_html',
'docutils.writers.s5_html',
@@ -146,11 +146,11 @@
],
'data_files': ([('docutils/parsers/rst/include',
glob.glob('docutils/parsers/rst/include/*.txt')),
- ('docutils/writers/html_plain',
- ['docutils/writers/html_plain/minimal.css',
- 'docutils/writers/html_plain/plain.css',
- 'docutils/writers/html_plain/math.css',
- 'docutils/writers/html_plain/template.txt']),
+ ('docutils/writers/html5_polyglot',
+ ['docutils/writers/html5_polyglot/minimal.css',
+ 'docutils/writers/html5_polyglot/plain.css',
+ 'docutils/writers/html5_polyglot/math.css',
+ 'docutils/writers/html5_polyglot/template.txt']),
('docutils/writers/html4css1',
['docutils/writers/html4css1/html4css1.css',
'docutils/writers/html4css1/template.txt']),
Copied: trunk/docutils/test/functional/expected/footnotes_html5_polyglot.html (from rev 7968, trunk/docutils/test/functional/expected/footnotes_html_plain.html)
===================================================================
--- trunk/docutils/test/functional/expected/footnotes_html5_polyglot.html (rev 0)
+++ trunk/docutils/test/functional/expected/footnotes_html5_polyglot.html 2016-08-18 21:40:00 UTC (rev 7969)
@@ -0,0 +1,66 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+<meta charset="utf-8"/>
+<meta name="generator" content="Docutils 0.13: http://docutils.sourceforge.net/" />
+<title>Test footnote and citation rendering</title>
+<link rel="stylesheet" href="../input/data/minimal.css" type="text/css" />
+<link rel="stylesheet" href="../input/data/plain.css" type="text/css" />
+</head>
+<body>
+<div class="document" id="test-footnote-and-citation-rendering">
+<h1 class="title">Test footnote and citation rendering</h1>
+
+<p>Paragraphs may contain footnote references (manually numbered<a class="footnote-reference superscript" href="#id7" id="id1">1</a>, anonymous auto-numbered<a class="footnote-reference superscript" href="#id11" id="id2">3</a>, labeled auto-numbered<a class="footnote-reference superscript" href="#label" id="id3">2</a>, or
+symbolic<a class="footnote-reference superscript" href="#id12" id="id4">*</a>) or citation references (<a class="citation-reference" href="#cit2002" id="id5">[CIT2002]</a>, <a class="citation-reference" href="#du2015" id="id6">[DU2015]</a>).</p>
+<dl class="footnote superscript">
+<dt class="label" id="id7"><span class="superscript">1</span><span class="fn-backref">(<a href="#id1">1</a>,<a href="#id8">2</a>)</span></dt>
+<dd><p>A footnote contains body elements, consistently indented by at
+least 3 spaces.</p>
+<p>This is the footnote's second paragraph.</p>
+</dd>
+<dt class="label" id="label"><span class="superscript">2</span><span class="fn-backref">(<a href="#id3">1</a>,<a href="#id9">2</a>)</span></dt>
+<dd><p>Footnotes may be numbered, either manually (as in<a class="footnote-reference superscript" href="#id7" id="id8">1</a>) or
+automatically using a "#"-prefixed label. This footnote has a
+label so it can be referred to from multiple places, both as a
+footnote reference (<a class="footnote-reference superscript" href="#label" id="id9">2</a>) and as a <a class="reference internal" href="#label">hyperlink reference</a>.</p>
+</dd>
+<dt class="label" id="id11"><span class="superscript"><a class="fn-backref" href="#id2">3</a></span></dt>
+<dd><p>This footnote is numbered automatically and anonymously using a
+label of "#" only.</p>
+<p>This is the second paragraph.</p>
+<p>And this is the third paragraph.</p>
+</dd>
+<dt class="label" id="id12"><span class="superscript"><a class="fn-backref" href="#id4">*</a></span></dt>
+<dd><p>Footnotes may also use symbols, specified with a "*" label.
+Here's a reference to the next footnote:<a class="footnote-reference superscript" href="#id14" id="id13">†</a>.</p>
+</dd>
+<dt class="label" id="id14"><span class="superscript"><a class="fn-backref" href="#id13">†</a></span></dt>
+<dd><p>This footnote shows the next symbol in the sequence.</p>
+</dd>
+<dt class="label" id="id15"><span class="superscript">4</span></dt>
+<dd><p>Here's an unreferenced footnote, with a reference to a
+nonexistent footnote:<a class="footnote-reference superscript" href="#id18" id="id16">5</a>.</p>
+</dd>
+</dl>
+<div class="section" id="citations">
+<h1>Citations</h1>
+<dl class="citation">
+<dt class="label" id="cit2002"><span class="brackets">CIT2002</span><span class="fn-backref">(<a href="#id5">1</a>,<a href="#id17">2</a>)</span></dt>
+<dd><p>Citations are text-labeled footnotes. They may be
+rendered separately and differently from footnotes.</p>
+</dd>
+<dt class="label" id="du2015"><span class="brackets"><a class="fn-backref" href="#id6">DU2015</a></span></dt>
+<dd><p><cite>Example document</cite>, Hometown: 2015.</p>
+</dd>
+</dl>
+<p>Here's a reference to the above, <a class="citation-reference" href="#cit2002" id="id17">[CIT2002]</a>.</p>
+<dl class="footnote superscript">
+<dt class="label" id="id18"><span class="superscript"><a class="fn-backref" href="#id16">5</a></span></dt>
+<dd><p>this footnote is missing in the standard example document.</p>
+</dd>
+</dl>
+</div>
+</div>
+</body>
+</html>
Deleted: trunk/docutils/test/functional/expected/footnotes_html_plain.html
===================================================================
--- trunk/docutils/test/functional/expected/footnotes_html_plain.html 2016-08-18 21:21:58 UTC (rev 7968)
+++ trunk/docutils/test/functional/expected/footnotes_html_plain.html 2016-08-18 21:40:00 UTC (rev 7969)
@@ -1,66 +0,0 @@
-<!DOCTYPE html>
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta charset="utf-8"/>
-<meta name="generator" content="Docutils 0.13: http://docutils.sourceforge.net/" />
-<title>Test footnote and citation rendering</title>
-<link rel="stylesheet" href="../input/data/minimal.css" type="text/css" />
-<link rel="stylesheet" href="../input/data/plain.css" type="text/css" />
-</head>
-<body>
-<div class="document" id="test-footnote-and-citation-rendering">
-<h1 class="title">Test footnote and citation rendering</h1>
-
-<p>Paragraphs may contain footnote references (manually numbered<a class="footnote-reference superscript" href="#id7" id="id1">1</a>, anonymous auto-numbered<a class="footnote-reference superscript" href="#id11" id="id2">3</a>, labeled auto-numbered<a class="footnote-reference superscript" href="#label" id="id3">2</a>, or
-symbolic<a class="footnote-reference superscript" href="#id12" id="id4">*</a>) or citation references (<a class="citation-reference" href="#cit2002" id="id5">[CIT2002]</a>, <a class="citation-reference" href="#du2015" id="id6">[DU2015]</a>).</p>
-<dl class="footnote superscript">
-<dt class="label" id="id7"><span class="superscript">1</span><span class="fn-backref">(<a href="#id1">1</a>,<a href="#id8">2</a>)</span></dt>
-<dd><p>A footnote contains body elements, consistently indented by at
-least 3 spaces.</p>
-<p>This is the footnote's second paragraph.</p>
-</dd>
-<dt class="label" id="label"><span class="superscript">2</span><span class="fn-backref">(<a href="#id3">1</a>,<a href="#id9">2</a>)</span></dt>
-<dd><p>Footnotes may be numbered, either manually (as in<a class="footnote-reference superscript" href="#id7" id="id8">1</a>) or
-automatically using a "#"-prefixed label. This footnote has a
-label so it can be referred to from multiple places, both as a
-footnote reference (<a class="footnote-reference superscript" href="#label" id="id9">2</a>) and as a <a class="reference internal" href="#label">hyperlink reference</a>.</p>
-</dd>
-<dt class="label" id="id11"><span class="superscript"><a class="fn-backref" href="#id2">3</a></span></dt>
-<dd><p>This footnote is numbered automatically and anonymously using a
-label of "#" only.</p>
-<p>This is the second paragraph.</p>
-<p>And this is the third paragraph.</p>
-</dd>
-<dt class="label" id="id12"><span class="superscript"><a class="fn-backref" href="#id4">*</a></span></dt>
-<dd><p>Footnotes may also use symbols, specified with a "*" label.
-Here's a reference to the next footnote:<a class="footnote-reference superscript" href="#id14" id="id13">†</a>.</p>
-</dd>
-<dt class="label" id="id14"><span class="superscript"><a class="fn-backref" href="#id13">†</a></span></dt>
-<dd><p>This footnote shows the next symbol in the sequence.</p>
-</dd>
-<dt class="label" id="id15"><span class="superscript">4</span></dt>
-<dd><p>Here's an unreferenced footnote, with a reference to a
-nonexistent footnote:<a class="footnote-reference superscript" href="#id18" id="id16">5</a>.</p>
-</dd>
-</dl>
-<div class="section" id="citations">
-<h1>Citations</h1>
-<dl class="citation">
-<dt class="label" id="cit2002"><span class="brackets">CIT2002</span><span class="fn-backref">(<a href="#id5">1</a>,<a href="#id17">2</a>)</span></dt>
-<dd><p>Citations are text-labeled footnotes. They may be
-rendered separately and differently from footnotes.</p>
-</dd>
-<dt class="label" id="du2015"><span class="brackets"><a class="fn-backref" href="#id6">DU2015</a></span></dt>
-<dd><p><cite>Example document</cite>, Hometown: 2015.</p>
-</dd>
-</dl>
-<p>Here's a reference to the above, <a class="citation-reference" href="#cit2002" id="id17">[CIT2002]</a>.</p>
-<dl class="footnote superscript">
-<dt class="label" id="id18"><span class="superscript"><a class="fn-backref" href="#id16">5</a></span></dt>
-<dd><p>this footnote is missing in the standard example document.</p>
-</dd>
-</dl>
-</div>
-</div>
-</body>
-</html>
Copied: trunk/docutils/test/functional/expected/standalone_rst_html5_polyglot.html (from rev 7968, trunk/docutils/test/functional/expected/standalone_rst_html_plain.html)
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_html5_polyglot.html (rev 0)
+++ trunk/docutils/test/functional/expected/standalone_rst_html5_polyglot.html 2016-08-18 21:40:00 UTC (rev 7969)
@@ -0,0 +1,1524 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+<meta charset="utf-8"/>
+<meta name="generator" content="Docutils 0.13: http://docutils.sourceforge.net/" />
+<title>reStructuredText Test Document</title>
+<meta name="author" content="David Goodger" />
+<meta content="reStructuredText, test, parser" name="keywords" />
+<meta content="A test document, containing at least one example of each reStructuredText construct." lang="en" name="description" xml:lang="en" />
+<link rel="stylesheet" href="../input/data/minimal.css" type="text/css" />
+<link rel="stylesheet" href="../input/data/plain.css" type="text/css" />
+<link rel="stylesheet" href="../input/data/math.css" type="text/css" />
+</head>
+<body>
+<div class="header">
+<p>Document header</p>
+
+<hr class="header"/>
+</div>
+<div class="document" id="restructuredtext-test-document">
+<span id="doctitle"></span>
+<h1 class="title">reStructuredText Test Document</h1>
+
+<p class="subtitle" id="examples-of-syntax-constructs"><span id="subtitle"></span>Examples of Syntax Constructs</p>
+<dl class="docinfo">
+<dt class="author">Author</dt>
+<dd class="author"><p>David Goodger</p></dd>
+<dt class="address">Address</dt>
+<dd class="address"><pre class="address">123 Example Street
+Example, EX Canada
+A1B 2C3
+</pre>
+</dd>
+<dt class="contact">Contact</dt>
+<dd class="contact"><a class="reference external" href="mailto:goodger@python.org">goodger@python.org</a></dd>
+<dt class="authors">Authors</dt>
+<dd class="authors"><p>Me</p>
+<p>Myself</p>
+<p>I</p>
+</dd>
+<dt class="organization">Organization</dt>
+<dd class="organization">humankind</dd>
+<dt class="date">Date</dt>
+<dd class="date">Now, or yesterday. Or maybe even <em>before</em> yesterday.</dd>
+<dt class="status">Status</dt>
+<dd class="status">This is a "work in progress"</dd>
+<dt class="revision">Revision</dt>
+<dd class="revision">is managed by a version control system.</dd>
+<dt class="version">Version</dt>
+<dd class="version">1</dd>
+<dt class="copyright">Copyright</dt>
+<dd class="copyright">This document has been placed in the public domain. You
+may do with it as you wish. You may copy, modify,
+redistribute, reattribute, sell, buy, rent, lease,
+destroy, or improve it, quote it at length, excerpt,
+incorporate, collate, fold, staple, or mutilate it, or do
+anything else to it that your or anyone else's heart
+desires.</dd>
+<dt class="field-name">field name</dt>
+<dd class="field-name"><p>This is a "generic bibliographic field".</p>
+</dd>
+<dt class="field-name-2">field name "2"</dt>
+<dd class="field-name-2"><p>Generic bibliographic fields may contain multiple body elements.</p>
+<p>Like this.</p>
+</dd>
+</dl>
+<div class="dedication topic">
+<p class="topic-title first">Dedication</p>
+<p>For Docutils users & co-developers.</p>
+</div>
+<div class="abstract topic">
+<p class="topic-title first">Abstract</p>
+<p>This is a test document, containing at least one example of each
+reStructuredText construct.</p>
+</div>
+<!-- This is a comment. Note how any initial comments are moved by
+transforms to after the document title, subtitle, and docinfo. -->
+<!-- Above is the document title, and below is the subtitle.
+They are transformed from section titles after parsing. -->
+<!-- bibliographic fields (which also require a transform): -->
+<div class="contents topic" id="table-of-contents">
+<p class="topic-title first">Table of Contents</p>
+<ul class="auto-toc simple">
+<li><p><a class="reference internal" href="#structural-elements" id="id38"><span class="sectnum">1</span> Structural Elements</a></p>
+<ul class="auto-toc">
+<li><p><a class="reference internal" href="#section-title" id="id39"><span class="sectnum">1.1</span> Section Title</a></p></li>
+<li><p><a class="reference internal" href="#empty-section" id="id40"><span class="sectnum">1.2</span> Empty Section</a></p></li>
+<li><p><a class="reference internal" href="#transitions" id="id41"><span class="sectnum">1.3</span> Transitions</a></p></li>
+</ul>
+</li>
+<li><p><a class="reference internal" href="#body-elements" id="id42"><span class="sectnum">2</span> Body Elements</a></p>
+<ul class="auto-toc">
+<li><p><a class="reference internal" href="#paragraphs" id="id43"><span class="sectnum">2.1</span> Paragraphs</a></p>
+<ul class="auto-toc">
+<li><p><a class="reference internal" href="#inline-markup" id="id44"><span class="sectnum">2.1.1</span> Inline Markup</a></p></li>
+</ul>
+</li>
+<li><p><a class="reference internal" href="#bullet-lists" id="id45"><span class="sectnum">2.2</span> Bullet Lists</a></p></li>
+<li><p><a class="reference internal" href="#enumerated-lists" id="id46"><span class="sectnum">2.3</span> Enumerated Lists</a></p></li>
+<li><p><a class="reference internal" href="#definition-lists" id="id47"><span class="sectnum">2.4</span> Definition Lists</a></p></li>
+<li><p><a class="reference internal" href="#field-lists" id="id48"><span class="sectnum">2.5</span> Field Lists</a></p></li>
+<li><p><a class="reference internal" href="#option-lists" id="id49"><span class="sectnum">2.6</span> Option Lists</a></p></li>
+<li><p><a class="reference internal" href="#literal-blocks" id="id50"><span class="sectnum">2.7</span> Literal Blocks</a></p></li>
+<li><p><a class="reference internal" href="#line-blocks" id="id51"><span class="sectnum">2.8</span> Line Blocks</a></p></li>
+<li><p><a class="reference internal" href="#block-quotes" id="id52"><span class="sectnum">2.9</span> Block Quotes</a></p></li>
+<li><p><a class="reference internal" href="#doctest-blocks" id="id53"><span class="sectnum">2.10</span> Doctest Blocks</a></p></li>
+<li><p><a class="reference internal" href="#footnotes" id="id54"><span class="sectnum">2.11</span> Footnotes</a></p></li>
+<li><p><a class="reference internal" href="#citations" id="id55"><span class="sectnum">2.12</span> Citations</a></p></li>
+<li><p><a class="reference internal" href="#targets" id="id56"><span class="sectnum">2.13</span> Targets</a></p>
+<ul class="auto-toc">
+<li><p><a class="reference internal" href="#duplicate-target-names" id="id57"><span class="sectnum">2.13.1</span> Duplicate Target Names</a></p></li>
+<li><p><a class="reference internal" href="#id21" id="id58"><span class="sectnum">2.13.2</span> Duplicate Target Names</a></p></li>
+</ul>
+</li>
+<li><p><a class="reference internal" href="#directives" id="id59"><span class="sectnum">2.14</span> Directives</a></p>
+<ul class="auto-toc">
+<li><p><a class="reference internal" href="#document-parts" id="id60"><span class="sectnum">2.14.1</span> Document Parts</a></p></li>
+<li><p><a class="reference internal" href="#images-and-figures" id="id61"><span class="sectnum">2.14.2</span> Images and Figures</a></p></li>
+<li><p><a class="reference internal" href="#admonitions" id="id62"><span class="sectnum">2.14.3</span> Admonitions</a></p></li>
+<li><p><a class="reference internal" href="#topics-sidebars-and-rubrics" id="id63"><span class="sectnum">2.14.4</span> Topics, Sidebars, and Rubrics</a></p></li>
+<li><p><a class="reference internal" href="#target-footnotes" id="id64"><span class="sectnum">2.14.5</span> Target Footnotes</a></p></li>
+<li><p><a class="reference internal" href="#replacement-text" id="id65"><span class="sectnum">2.14.6</span> Replacement Text</a></p></li>
+<li><p><a class="reference internal" href="#compound-paragraph" id="id66"><span class="sectnum">2.14.7</span> Compound Paragraph</a></p></li>
+<li><p><a class="reference internal" href="#parsed-literal-blocks" id="id67"><span class="sectnum">2.14.8</span> Parsed Literal Blocks</a></p></li>
+<li><p><a class="reference internal" href="#code" id="id68"><span class="sectnum">2.14.9</span> Code</a></p></li>
+</ul>
+</li>
+<li><p><a class="reference internal" href="#substitution-definitions" id="id69"><span class="sectnum">2.15</span> Substitution Definitions</a></p></li>
+<li><p><a class="reference internal" href="#comments" id="id70"><span class="sectnum">2.16</span> Comments</a></p></li>
+<li><p><a class="reference internal" href="#raw-text" id="id71"><span class="sectnum">2.17</span> Raw text</a></p></li>
+<li><p><a class="reference internal" href="#container" id="id72"><span class="sectnum">2.18</span> Container</a></p></li>
+<li><p><a class="reference internal" href="#colspanning-tables" id="id73"><span class="sectnum">2.19</span> Colspanning tables</a></p></li>
+<li><p><a class="reference internal" href="#rowspanning-tables" id="id74"><span class="sectnum">2.20</span> Rowspanning tables</a></p></li>
+<li><p><a class="reference internal" href="#complex-tables" id="id75"><span class="sectnum">2.21</span> Complex tables</a></p></li>
+<li><p><a class="reference internal" href="#list-tables" id="id76"><span class="sectnum">2.22</span> List Tables</a></p></li>
+<li><p><a class="reference internal" href="#custom-roles" id="id77"><span class="sectnum">2.23</span> Custom Roles</a></p></li>
+<li><p><a class="reference internal" href="#svg-images" id="id78"><span class="sectnum">2.24</span> SVG Images</a></p></li>
+<li><p><a class="reference internal" href="#swf-images" id="id79"><span class="sectnum">2.25</span> SWF Images</a></p></li>
+</ul>
+</li>
+<li><p><a class="reference internal" href="#changes-to-the-html4css1-writer" id="id80"><span class="sectnum">3</span> Changes to the html4css1 writer</a></p>
+<ul class="auto-toc">
+<li><p><a class="reference internal" href="#field-list-handling" id="id81"><span class="sectnum">3.1</span> Field list handling</a></p></li>
+<li><p><a class="reference internal" href="#styling-with-class-arguments" id="id82"><span class="sectnum">3.2</span> Styling with class arguments</a></p>
+<ul class="auto-toc">
+<li><p><a class="reference internal" href="#description-lists" id="id83"><span class="sectnum">3.2.1</span> Description lists</a></p></li>
+<li><p><a class="reference internal" href="#field-list-variants" id="id84"><span class="sectnum">3.2.2</span> Field list variants</a></p></li>
+<li><p><a class="reference internal" href="#table-variants" id="id85"><span class="sectnum">3.2.3</span> Table variants</a></p></li>
+</ul>
+</li>
+</ul>
+</li>
+<li><p><a class="reference internal" href="#error-handling" id="id86"><span class="sectnum">4</span> Error Handling</a></p></li>
+</ul>
+</div>
+<div class="section" id="structural-elements">
+<h1><a class="toc-backref" href="#id38"><span class="sectnum">1</span> Structural Elements</a></h1>
+<div class="section" id="section-title">
+<h2 class="with-subtitle"><a class="toc-backref" href="#id39"><span class="sectnum">1.1</span> Section Title</a></h2>
+<p class="section-subtitle" id="section-subtitle">Section Subtitle</p>
+<p>Lone subsections are converted to a section subtitle by a transform
+activated with the <span class="docutils literal"><span class="pre">--section-subtitles</span></span> command line option or the
+<span class="docutils literal"><span class="pre">sectsubtitle-xform</span></span> configuration value.</p>
+</div>
+<div class="section" id="empty-section">
+<h2><a class="toc-backref" href="#id40"><span class="sectnum">1.2</span> Empty Section</a></h2>
+</div>
+<div class="section" id="transitions">
+<h2><a class="toc-backref" href="#id41"><span class="sectnum">1.3</span> Transitions</a></h2>
+<p>Here's a transition:</p>
+<hr class="docutils" />
+<p>It divides the section. Transitions may also occur between sections:</p>
+</div>
+</div>
+<hr class="docutils" />
+<div class="section" id="body-elements">
+<h1><a class="toc-backref" href="#id42"><span class="sectnum">2</span> Body Elements</a></h1>
+<div class="section" id="paragraphs">
+<h2><a class="toc-backref" href="#id43"><span class="sectnum">2.1</span> Paragraphs</a></h2>
+<p>A paragraph.</p>
+<div class="section" id="inline-markup">
+<h3><a class="toc-backref" href="#id44"><span class="sectnum">2.1.1</span> Inline Markup</a></h3>
+<p>Paragraphs contain text and may contain inline markup: <em>emphasis</em>,
+<strong>strong emphasis</strong>, <span class="docutils literal">inline literals</span>, standalone hyperlinks
+(<a class="reference external" href="http://www.python.org">http://www.python.org</a>), external hyperlinks (<a class="reference external" href="http://www.python.org/">Python</a> <a class="footnote-reference brackets" href="#id25" id="id26">5</a>), internal
+cross-references (<a class="reference internal" href="#example">example</a>), external hyperlinks with embedded URIs
+(<a class="reference external" href="http://www.python.org">Python web site</a>), <a class="reference external" href="http://www.python.org/">anonymous hyperlink
+references</a> <a class="footnote-reference brackets" href="#id25" id="id35"...
[truncated message content] |
|
From: <mi...@us...> - 2016-08-19 10:21:28
|
Revision: 7970
http://sourceforge.net/p/docutils/code/7970
Author: milde
Date: 2016-08-19 10:21:24 +0000 (Fri, 19 Aug 2016)
Log Message:
-----------
Fix tests after renaming html5 writer.
Modified Paths:
--------------
trunk/docutils/docs/user/config.txt
trunk/docutils/docs/user/tools.txt
trunk/docutils/test/functional/tests/math_output_mathml.py
Added Paths:
-----------
trunk/docutils/test/functional/expected/footnotes_html5.html
trunk/docutils/test/functional/expected/standalone_rst_html5.html
trunk/docutils/test/functional/input/standalone_rst_html5.txt
trunk/docutils/test/functional/tests/footnotes_html5.py
trunk/docutils/test/functional/tests/standalone_rst_html5.py
Removed Paths:
-------------
trunk/docutils/test/functional/expected/footnotes_html5_polyglot.html
trunk/docutils/test/functional/expected/standalone_rst_html5_polyglot.html
trunk/docutils/test/functional/input/standalone_rst_html5_polyglot.txt
trunk/docutils/test/functional/tests/footnotes_html5_polyglot.py
trunk/docutils/test/functional/tests/standalone_rst_html_plain.py
Modified: trunk/docutils/docs/user/config.txt
===================================================================
--- trunk/docutils/docs/user/config.txt 2016-08-18 21:40:00 UTC (rev 7969)
+++ trunk/docutils/docs/user/config.txt 2016-08-19 10:21:24 UTC (rev 7970)
@@ -1302,10 +1302,10 @@
Default: "slidewhow". Option: ``--view-mode``.
-[html-plain writer]
--------------------
+[html5 writer]
+--------------
-The `html-plain` writer uses the settings described in the `[html4css1
+The `html5` writer uses the settings described in the `[html4css1
writer]`_ section with the following exceptions:
Removed options:
Modified: trunk/docutils/docs/user/tools.txt
===================================================================
--- trunk/docutils/docs/user/tools.txt 2016-08-18 21:40:00 UTC (rev 7969)
+++ trunk/docutils/docs/user/tools.txt 2016-08-19 10:21:24 UTC (rev 7970)
@@ -146,7 +146,7 @@
:Reader: Standalone
:Parser: reStructuredText
-:Writer: html5 (html_plain_)
+:Writer: html5 (html5_polyglot_)
The ``rst2html5.py`` front end reads standalone reStructuredText source
files and produces `HTML 5`_ output.
@@ -154,7 +154,7 @@
CSS style sheet. The provided style sheets ``minimal.css`` and ``plain.css``
define required and optional styling rules respectively.
-.. _html_plain: html.html#html-plain
+.. _html5_polyglot: html.html#html5-polyglot
rstpep2html.py
--------------
Copied: trunk/docutils/test/functional/expected/footnotes_html5.html (from rev 7969, trunk/docutils/test/functional/expected/footnotes_html5_polyglot.html)
===================================================================
--- trunk/docutils/test/functional/expected/footnotes_html5.html (rev 0)
+++ trunk/docutils/test/functional/expected/footnotes_html5.html 2016-08-19 10:21:24 UTC (rev 7970)
@@ -0,0 +1,66 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+<meta charset="utf-8"/>
+<meta name="generator" content="Docutils 0.13: http://docutils.sourceforge.net/" />
+<title>Test footnote and citation rendering</title>
+<link rel="stylesheet" href="../input/data/minimal.css" type="text/css" />
+<link rel="stylesheet" href="../input/data/plain.css" type="text/css" />
+</head>
+<body>
+<div class="document" id="test-footnote-and-citation-rendering">
+<h1 class="title">Test footnote and citation rendering</h1>
+
+<p>Paragraphs may contain footnote references (manually numbered<a class="footnote-reference superscript" href="#id7" id="id1">1</a>, anonymous auto-numbered<a class="footnote-reference superscript" href="#id11" id="id2">3</a>, labeled auto-numbered<a class="footnote-reference superscript" href="#label" id="id3">2</a>, or
+symbolic<a class="footnote-reference superscript" href="#id12" id="id4">*</a>) or citation references (<a class="citation-reference" href="#cit2002" id="id5">[CIT2002]</a>, <a class="citation-reference" href="#du2015" id="id6">[DU2015]</a>).</p>
+<dl class="footnote superscript">
+<dt class="label" id="id7"><span class="superscript">1</span><span class="fn-backref">(<a href="#id1">1</a>,<a href="#id8">2</a>)</span></dt>
+<dd><p>A footnote contains body elements, consistently indented by at
+least 3 spaces.</p>
+<p>This is the footnote's second paragraph.</p>
+</dd>
+<dt class="label" id="label"><span class="superscript">2</span><span class="fn-backref">(<a href="#id3">1</a>,<a href="#id9">2</a>)</span></dt>
+<dd><p>Footnotes may be numbered, either manually (as in<a class="footnote-reference superscript" href="#id7" id="id8">1</a>) or
+automatically using a "#"-prefixed label. This footnote has a
+label so it can be referred to from multiple places, both as a
+footnote reference (<a class="footnote-reference superscript" href="#label" id="id9">2</a>) and as a <a class="reference internal" href="#label">hyperlink reference</a>.</p>
+</dd>
+<dt class="label" id="id11"><span class="superscript"><a class="fn-backref" href="#id2">3</a></span></dt>
+<dd><p>This footnote is numbered automatically and anonymously using a
+label of "#" only.</p>
+<p>This is the second paragraph.</p>
+<p>And this is the third paragraph.</p>
+</dd>
+<dt class="label" id="id12"><span class="superscript"><a class="fn-backref" href="#id4">*</a></span></dt>
+<dd><p>Footnotes may also use symbols, specified with a "*" label.
+Here's a reference to the next footnote:<a class="footnote-reference superscript" href="#id14" id="id13">†</a>.</p>
+</dd>
+<dt class="label" id="id14"><span class="superscript"><a class="fn-backref" href="#id13">†</a></span></dt>
+<dd><p>This footnote shows the next symbol in the sequence.</p>
+</dd>
+<dt class="label" id="id15"><span class="superscript">4</span></dt>
+<dd><p>Here's an unreferenced footnote, with a reference to a
+nonexistent footnote:<a class="footnote-reference superscript" href="#id18" id="id16">5</a>.</p>
+</dd>
+</dl>
+<div class="section" id="citations">
+<h1>Citations</h1>
+<dl class="citation">
+<dt class="label" id="cit2002"><span class="brackets">CIT2002</span><span class="fn-backref">(<a href="#id5">1</a>,<a href="#id17">2</a>)</span></dt>
+<dd><p>Citations are text-labeled footnotes. They may be
+rendered separately and differently from footnotes.</p>
+</dd>
+<dt class="label" id="du2015"><span class="brackets"><a class="fn-backref" href="#id6">DU2015</a></span></dt>
+<dd><p><cite>Example document</cite>, Hometown: 2015.</p>
+</dd>
+</dl>
+<p>Here's a reference to the above, <a class="citation-reference" href="#cit2002" id="id17">[CIT2002]</a>.</p>
+<dl class="footnote superscript">
+<dt class="label" id="id18"><span class="superscript"><a class="fn-backref" href="#id16">5</a></span></dt>
+<dd><p>this footnote is missing in the standard example document.</p>
+</dd>
+</dl>
+</div>
+</div>
+</body>
+</html>
Deleted: trunk/docutils/test/functional/expected/footnotes_html5_polyglot.html
===================================================================
--- trunk/docutils/test/functional/expected/footnotes_html5_polyglot.html 2016-08-18 21:40:00 UTC (rev 7969)
+++ trunk/docutils/test/functional/expected/footnotes_html5_polyglot.html 2016-08-19 10:21:24 UTC (rev 7970)
@@ -1,66 +0,0 @@
-<!DOCTYPE html>
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta charset="utf-8"/>
-<meta name="generator" content="Docutils 0.13: http://docutils.sourceforge.net/" />
-<title>Test footnote and citation rendering</title>
-<link rel="stylesheet" href="../input/data/minimal.css" type="text/css" />
-<link rel="stylesheet" href="../input/data/plain.css" type="text/css" />
-</head>
-<body>
-<div class="document" id="test-footnote-and-citation-rendering">
-<h1 class="title">Test footnote and citation rendering</h1>
-
-<p>Paragraphs may contain footnote references (manually numbered<a class="footnote-reference superscript" href="#id7" id="id1">1</a>, anonymous auto-numbered<a class="footnote-reference superscript" href="#id11" id="id2">3</a>, labeled auto-numbered<a class="footnote-reference superscript" href="#label" id="id3">2</a>, or
-symbolic<a class="footnote-reference superscript" href="#id12" id="id4">*</a>) or citation references (<a class="citation-reference" href="#cit2002" id="id5">[CIT2002]</a>, <a class="citation-reference" href="#du2015" id="id6">[DU2015]</a>).</p>
-<dl class="footnote superscript">
-<dt class="label" id="id7"><span class="superscript">1</span><span class="fn-backref">(<a href="#id1">1</a>,<a href="#id8">2</a>)</span></dt>
-<dd><p>A footnote contains body elements, consistently indented by at
-least 3 spaces.</p>
-<p>This is the footnote's second paragraph.</p>
-</dd>
-<dt class="label" id="label"><span class="superscript">2</span><span class="fn-backref">(<a href="#id3">1</a>,<a href="#id9">2</a>)</span></dt>
-<dd><p>Footnotes may be numbered, either manually (as in<a class="footnote-reference superscript" href="#id7" id="id8">1</a>) or
-automatically using a "#"-prefixed label. This footnote has a
-label so it can be referred to from multiple places, both as a
-footnote reference (<a class="footnote-reference superscript" href="#label" id="id9">2</a>) and as a <a class="reference internal" href="#label">hyperlink reference</a>.</p>
-</dd>
-<dt class="label" id="id11"><span class="superscript"><a class="fn-backref" href="#id2">3</a></span></dt>
-<dd><p>This footnote is numbered automatically and anonymously using a
-label of "#" only.</p>
-<p>This is the second paragraph.</p>
-<p>And this is the third paragraph.</p>
-</dd>
-<dt class="label" id="id12"><span class="superscript"><a class="fn-backref" href="#id4">*</a></span></dt>
-<dd><p>Footnotes may also use symbols, specified with a "*" label.
-Here's a reference to the next footnote:<a class="footnote-reference superscript" href="#id14" id="id13">†</a>.</p>
-</dd>
-<dt class="label" id="id14"><span class="superscript"><a class="fn-backref" href="#id13">†</a></span></dt>
-<dd><p>This footnote shows the next symbol in the sequence.</p>
-</dd>
-<dt class="label" id="id15"><span class="superscript">4</span></dt>
-<dd><p>Here's an unreferenced footnote, with a reference to a
-nonexistent footnote:<a class="footnote-reference superscript" href="#id18" id="id16">5</a>.</p>
-</dd>
-</dl>
-<div class="section" id="citations">
-<h1>Citations</h1>
-<dl class="citation">
-<dt class="label" id="cit2002"><span class="brackets">CIT2002</span><span class="fn-backref">(<a href="#id5">1</a>,<a href="#id17">2</a>)</span></dt>
-<dd><p>Citations are text-labeled footnotes. They may be
-rendered separately and differently from footnotes.</p>
-</dd>
-<dt class="label" id="du2015"><span class="brackets"><a class="fn-backref" href="#id6">DU2015</a></span></dt>
-<dd><p><cite>Example document</cite>, Hometown: 2015.</p>
-</dd>
-</dl>
-<p>Here's a reference to the above, <a class="citation-reference" href="#cit2002" id="id17">[CIT2002]</a>.</p>
-<dl class="footnote superscript">
-<dt class="label" id="id18"><span class="superscript"><a class="fn-backref" href="#id16">5</a></span></dt>
-<dd><p>this footnote is missing in the standard example document.</p>
-</dd>
-</dl>
-</div>
-</div>
-</body>
-</html>
Copied: trunk/docutils/test/functional/expected/standalone_rst_html5.html (from rev 7969, trunk/docutils/test/functional/expected/standalone_rst_html5_polyglot.html)
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_html5.html (rev 0)
+++ trunk/docutils/test/functional/expected/standalone_rst_html5.html 2016-08-19 10:21:24 UTC (rev 7970)
@@ -0,0 +1,1524 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+<meta charset="utf-8"/>
+<meta name="generator" content="Docutils 0.13: http://docutils.sourceforge.net/" />
+<title>reStructuredText Test Document</title>
+<meta name="author" content="David Goodger" />
+<meta content="reStructuredText, test, parser" name="keywords" />
+<meta content="A test document, containing at least one example of each reStructuredText construct." lang="en" name="description" xml:lang="en" />
+<link rel="stylesheet" href="../input/data/minimal.css" type="text/css" />
+<link rel="stylesheet" href="../input/data/plain.css" type="text/css" />
+<link rel="stylesheet" href="../input/data/math.css" type="text/css" />
+</head>
+<body>
+<div class="header">
+<p>Document header</p>
+
+<hr class="header"/>
+</div>
+<div class="document" id="restructuredtext-test-document">
+<span id="doctitle"></span>
+<h1 class="title">reStructuredText Test Document</h1>
+
+<p class="subtitle" id="examples-of-syntax-constructs"><span id="subtitle"></span>Examples of Syntax Constructs</p>
+<dl class="docinfo">
+<dt class="author">Author</dt>
+<dd class="author"><p>David Goodger</p></dd>
+<dt class="address">Address</dt>
+<dd class="address"><pre class="address">123 Example Street
+Example, EX Canada
+A1B 2C3
+</pre>
+</dd>
+<dt class="contact">Contact</dt>
+<dd class="contact"><a class="reference external" href="mailto:goodger@python.org">goodger@python.org</a></dd>
+<dt class="authors">Authors</dt>
+<dd class="authors"><p>Me</p>
+<p>Myself</p>
+<p>I</p>
+</dd>
+<dt class="organization">Organization</dt>
+<dd class="organization">humankind</dd>
+<dt class="date">Date</dt>
+<dd class="date">Now, or yesterday. Or maybe even <em>before</em> yesterday.</dd>
+<dt class="status">Status</dt>
+<dd class="status">This is a "work in progress"</dd>
+<dt class="revision">Revision</dt>
+<dd class="revision">is managed by a version control system.</dd>
+<dt class="version">Version</dt>
+<dd class="version">1</dd>
+<dt class="copyright">Copyright</dt>
+<dd class="copyright">This document has been placed in the public domain. You
+may do with it as you wish. You may copy, modify,
+redistribute, reattribute, sell, buy, rent, lease,
+destroy, or improve it, quote it at length, excerpt,
+incorporate, collate, fold, staple, or mutilate it, or do
+anything else to it that your or anyone else's heart
+desires.</dd>
+<dt class="field-name">field name</dt>
+<dd class="field-name"><p>This is a "generic bibliographic field".</p>
+</dd>
+<dt class="field-name-2">field name "2"</dt>
+<dd class="field-name-2"><p>Generic bibliographic fields may contain multiple body elements.</p>
+<p>Like this.</p>
+</dd>
+</dl>
+<div class="dedication topic">
+<p class="topic-title first">Dedication</p>
+<p>For Docutils users & co-developers.</p>
+</div>
+<div class="abstract topic">
+<p class="topic-title first">Abstract</p>
+<p>This is a test document, containing at least one example of each
+reStructuredText construct.</p>
+</div>
+<!-- This is a comment. Note how any initial comments are moved by
+transforms to after the document title, subtitle, and docinfo. -->
+<!-- Above is the document title, and below is the subtitle.
+They are transformed from section titles after parsing. -->
+<!-- bibliographic fields (which also require a transform): -->
+<div class="contents topic" id="table-of-contents">
+<p class="topic-title first">Table of Contents</p>
+<ul class="auto-toc simple">
+<li><p><a class="reference internal" href="#structural-elements" id="id38"><span class="sectnum">1</span> Structural Elements</a></p>
+<ul class="auto-toc">
+<li><p><a class="reference internal" href="#section-title" id="id39"><span class="sectnum">1.1</span> Section Title</a></p></li>
+<li><p><a class="reference internal" href="#empty-section" id="id40"><span class="sectnum">1.2</span> Empty Section</a></p></li>
+<li><p><a class="reference internal" href="#transitions" id="id41"><span class="sectnum">1.3</span> Transitions</a></p></li>
+</ul>
+</li>
+<li><p><a class="reference internal" href="#body-elements" id="id42"><span class="sectnum">2</span> Body Elements</a></p>
+<ul class="auto-toc">
+<li><p><a class="reference internal" href="#paragraphs" id="id43"><span class="sectnum">2.1</span> Paragraphs</a></p>
+<ul class="auto-toc">
+<li><p><a class="reference internal" href="#inline-markup" id="id44"><span class="sectnum">2.1.1</span> Inline Markup</a></p></li>
+</ul>
+</li>
+<li><p><a class="reference internal" href="#bullet-lists" id="id45"><span class="sectnum">2.2</span> Bullet Lists</a></p></li>
+<li><p><a class="reference internal" href="#enumerated-lists" id="id46"><span class="sectnum">2.3</span> Enumerated Lists</a></p></li>
+<li><p><a class="reference internal" href="#definition-lists" id="id47"><span class="sectnum">2.4</span> Definition Lists</a></p></li>
+<li><p><a class="reference internal" href="#field-lists" id="id48"><span class="sectnum">2.5</span> Field Lists</a></p></li>
+<li><p><a class="reference internal" href="#option-lists" id="id49"><span class="sectnum">2.6</span> Option Lists</a></p></li>
+<li><p><a class="reference internal" href="#literal-blocks" id="id50"><span class="sectnum">2.7</span> Literal Blocks</a></p></li>
+<li><p><a class="reference internal" href="#line-blocks" id="id51"><span class="sectnum">2.8</span> Line Blocks</a></p></li>
+<li><p><a class="reference internal" href="#block-quotes" id="id52"><span class="sectnum">2.9</span> Block Quotes</a></p></li>
+<li><p><a class="reference internal" href="#doctest-blocks" id="id53"><span class="sectnum">2.10</span> Doctest Blocks</a></p></li>
+<li><p><a class="reference internal" href="#footnotes" id="id54"><span class="sectnum">2.11</span> Footnotes</a></p></li>
+<li><p><a class="reference internal" href="#citations" id="id55"><span class="sectnum">2.12</span> Citations</a></p></li>
+<li><p><a class="reference internal" href="#targets" id="id56"><span class="sectnum">2.13</span> Targets</a></p>
+<ul class="auto-toc">
+<li><p><a class="reference internal" href="#duplicate-target-names" id="id57"><span class="sectnum">2.13.1</span> Duplicate Target Names</a></p></li>
+<li><p><a class="reference internal" href="#id21" id="id58"><span class="sectnum">2.13.2</span> Duplicate Target Names</a></p></li>
+</ul>
+</li>
+<li><p><a class="reference internal" href="#directives" id="id59"><span class="sectnum">2.14</span> Directives</a></p>
+<ul class="auto-toc">
+<li><p><a class="reference internal" href="#document-parts" id="id60"><span class="sectnum">2.14.1</span> Document Parts</a></p></li>
+<li><p><a class="reference internal" href="#images-and-figures" id="id61"><span class="sectnum">2.14.2</span> Images and Figures</a></p></li>
+<li><p><a class="reference internal" href="#admonitions" id="id62"><span class="sectnum">2.14.3</span> Admonitions</a></p></li>
+<li><p><a class="reference internal" href="#topics-sidebars-and-rubrics" id="id63"><span class="sectnum">2.14.4</span> Topics, Sidebars, and Rubrics</a></p></li>
+<li><p><a class="reference internal" href="#target-footnotes" id="id64"><span class="sectnum">2.14.5</span> Target Footnotes</a></p></li>
+<li><p><a class="reference internal" href="#replacement-text" id="id65"><span class="sectnum">2.14.6</span> Replacement Text</a></p></li>
+<li><p><a class="reference internal" href="#compound-paragraph" id="id66"><span class="sectnum">2.14.7</span> Compound Paragraph</a></p></li>
+<li><p><a class="reference internal" href="#parsed-literal-blocks" id="id67"><span class="sectnum">2.14.8</span> Parsed Literal Blocks</a></p></li>
+<li><p><a class="reference internal" href="#code" id="id68"><span class="sectnum">2.14.9</span> Code</a></p></li>
+</ul>
+</li>
+<li><p><a class="reference internal" href="#substitution-definitions" id="id69"><span class="sectnum">2.15</span> Substitution Definitions</a></p></li>
+<li><p><a class="reference internal" href="#comments" id="id70"><span class="sectnum">2.16</span> Comments</a></p></li>
+<li><p><a class="reference internal" href="#raw-text" id="id71"><span class="sectnum">2.17</span> Raw text</a></p></li>
+<li><p><a class="reference internal" href="#container" id="id72"><span class="sectnum">2.18</span> Container</a></p></li>
+<li><p><a class="reference internal" href="#colspanning-tables" id="id73"><span class="sectnum">2.19</span> Colspanning tables</a></p></li>
+<li><p><a class="reference internal" href="#rowspanning-tables" id="id74"><span class="sectnum">2.20</span> Rowspanning tables</a></p></li>
+<li><p><a class="reference internal" href="#complex-tables" id="id75"><span class="sectnum">2.21</span> Complex tables</a></p></li>
+<li><p><a class="reference internal" href="#list-tables" id="id76"><span class="sectnum">2.22</span> List Tables</a></p></li>
+<li><p><a class="reference internal" href="#custom-roles" id="id77"><span class="sectnum">2.23</span> Custom Roles</a></p></li>
+<li><p><a class="reference internal" href="#svg-images" id="id78"><span class="sectnum">2.24</span> SVG Images</a></p></li>
+<li><p><a class="reference internal" href="#swf-images" id="id79"><span class="sectnum">2.25</span> SWF Images</a></p></li>
+</ul>
+</li>
+<li><p><a class="reference internal" href="#changes-to-the-html4css1-writer" id="id80"><span class="sectnum">3</span> Changes to the html4css1 writer</a></p>
+<ul class="auto-toc">
+<li><p><a class="reference internal" href="#field-list-handling" id="id81"><span class="sectnum">3.1</span> Field list handling</a></p></li>
+<li><p><a class="reference internal" href="#styling-with-class-arguments" id="id82"><span class="sectnum">3.2</span> Styling with class arguments</a></p>
+<ul class="auto-toc">
+<li><p><a class="reference internal" href="#description-lists" id="id83"><span class="sectnum">3.2.1</span> Description lists</a></p></li>
+<li><p><a class="reference internal" href="#field-list-variants" id="id84"><span class="sectnum">3.2.2</span> Field list variants</a></p></li>
+<li><p><a class="reference internal" href="#table-variants" id="id85"><span class="sectnum">3.2.3</span> Table variants</a></p></li>
+</ul>
+</li>
+</ul>
+</li>
+<li><p><a class="reference internal" href="#error-handling" id="id86"><span class="sectnum">4</span> Error Handling</a></p></li>
+</ul>
+</div>
+<div class="section" id="structural-elements">
+<h1><a class="toc-backref" href="#id38"><span class="sectnum">1</span> Structural Elements</a></h1>
+<div class="section" id="section-title">
+<h2 class="with-subtitle"><a class="toc-backref" href="#id39"><span class="sectnum">1.1</span> Section Title</a></h2>
+<p class="section-subtitle" id="section-subtitle">Section Subtitle</p>
+<p>Lone subsections are converted to a section subtitle by a transform
+activated with the <span class="docutils literal"><span class="pre">--section-subtitles</span></span> command line option or the
+<span class="docutils literal"><span class="pre">sectsubtitle-xform</span></span> configuration value.</p>
+</div>
+<div class="section" id="empty-section">
+<h2><a class="toc-backref" href="#id40"><span class="sectnum">1.2</span> Empty Section</a></h2>
+</div>
+<div class="section" id="transitions">
+<h2><a class="toc-backref" href="#id41"><span class="sectnum">1.3</span> Transitions</a></h2>
+<p>Here's a transition:</p>
+<hr class="docutils" />
+<p>It divides the section. Transitions may also occur between sections:</p>
+</div>
+</div>
+<hr class="docutils" />
+<div class="section" id="body-elements">
+<h1><a class="toc-backref" href="#id42"><span class="sectnum">2</span> Body Elements</a></h1>
+<div class="section" id="paragraphs">
+<h2><a class="toc-backref" href="#id43"><span class="sectnum">2.1</span> Paragraphs</a></h2>
+<p>A paragraph.</p>
+<div class="section" id="inline-markup">
+<h3><a class="toc-backref" href="#id44"><span class="sectnum">2.1.1</span> Inline Markup</a></h3>
+<p>Paragraphs contain text and may contain inline markup: <em>emphasis</em>,
+<strong>strong emphasis</strong>, <span class="docutils literal">inline literals</span>, standalone hyperlinks
+(<a class="reference external" href="http://www.python.org">http://www.python.org</a>), external hyperlinks (<a class="reference external" href="http://www.python.org/">Python</a> <a class="footnote-reference brackets" href="#id25" id="id26">5</a>), internal
+cross-references (<a class="reference internal" href="#example">example</a>), external hyperlinks with embedded URIs
+(<a class="reference external" href="http://www.python.org">Python web site</a>), <a class="reference external" href="http://www.python.org/">anonymous hyperlink
+references</a> <a class="footnote-reference brackets" href="#id25" id="id35">5</a> (<a class="reference external" href="http://docutils.sourceforge.net/">a second reference</a> <a class="footnote-reference brackets" href="#id36" id="id37">9</a>), footnote references (manually
+numbered <a class="footnote-reference brackets" href="#id8" id="id1">1</a>, anonymous auto-numbered <a class="footnote-reference brackets" href="#id12" id="id2">3</a>, labeled auto-numbered
+<a class="footnote-reference brackets" href="#label" id="id3">2</a>, or symbolic <a class="footnote-reference brackets" href="#id13" id="id4">*</a>), citation references (<a class="citation-reference" href="#cit2002" id="id5">[CIT2002]</a>),
+substitution references (<img alt="EXAMPLE" src="../../../docs/user/rst/images/biohazard.png" />), and <span class="target" id="inline-hyperlink-targets">inline hyperlink targets</span>
+(see <a class="reference internal" href="#targets">Targets</a> below for a reference back to here). Character-level
+inline markup is also possible (although exceedingly ugly!) in <em>re</em><span class="docutils literal">Structured</span><em>Text</em>. Problems are indicated by <a href="#id23"><span class="problematic" id="id24">|problematic|</span></a> text
+(generated by processing errors; this one is intentional). Here is a
+reference to the <a class="reference internal" href="#doctitle">doctitle</a> and the <a class="reference internal" href="#subtitle">subtitle</a>.</p>
+<p>The default role for interpreted text is <cite>Title Reference</cite>. Here are
+some explicit interpreted text roles: a PEP reference (<a class="reference external" href="http://www.python.org/dev/peps/pep-0287">PEP 287</a>); an
+RFC reference (<a class="reference external" href="http://tools.ietf.org/html/rfc2822.html">RFC 2822</a>); an abbreviation (<abbr>abb.</abbr>), an acronym
+(<abbr>reST</abbr>), code (<code>print "hello world"</code>); a <sub>subscript</sub>;
+a <sup>superscript</sup> and explicit roles for <cite>Docutils</cite>'
+<em>standard</em> <strong>inline</strong> <span class="docutils literal">markup</span>.</p>
+<!-- DO NOT RE-WRAP THE FOLLOWING PARAGRAPH! -->
+<p>Let's test wrapping and whitespace significance in inline literals:
+<span class="docutils literal">This is an example of <span class="pre">--inline-literal</span> <span class="pre">--text,</span> <span class="pre">--including</span> <span class="pre">some--</span> <span class="pre">strangely--hyphenated-words.</span> <span class="pre">Adjust-the-width-of-your-browser-window</span> to see how the text is wrapped. <span class="pre">--</span> <span class="pre">----</span> <span class="pre">--------</span> Now note the spacing between the words of this sentence (words should be grouped in pairs).</span></p>
+<p>If the <span class="docutils literal"><span class="pre">--pep-references</span></span> option was supplied, there should be a
+live link to PEP 258 here.</p>
+</div>
+</div>
+<div class="section" id="bullet-lists">
+<h2><a class="toc-backref" href="#id45"><span class="sectnum">2.2</span> Bullet Lists</a></h2>
+<ul>
+<li><p>A bullet list</p>
+<ul class="simple">
+<li><p>Nested bullet list.</p></li>
+<li><p>Nested item 2.</p></li>
+</ul>
+</li>
+<li><p>Item 2.</p>
+<p>Paragraph 2 of item 2.</p>
+<ul class="simple">
+<li><p>Nested bullet list.</p></li>
+<li><p>Nested item 2.</p>
+<ul>
+<li><p>Third level.</p></li>
+<li><p>Item 2.</p></li>
+</ul>
+</li>
+<li><p>Nested item 3.</p></li>
+<li><p>This nested list should be compacted by the HTML writer.</p>
+<span class="target" id="target"></span><!-- Even if this item contains a target and a comment. -->
+</li>
+</ul>
+</li>
+</ul>
+</div>
+<div class="section" id="enumerated-lists">
+<h2><a class="toc-backref" href="#id46"><span class="sectnum">2.3</span> Enumerated Lists</a></h2>
+<ol class="arabic">
+<li><p>Arabic numerals.</p>
+<ol class="loweralpha simple">
+<li><p>lower alpha)</p>
+<ol class="lowerroman simple">
+<li><p>(lower roman)</p>
+<ol class="upperalpha simple">
+<li><p>upper alpha.</p>
+<ol class="upperroman simple">
+<li><p>upper roman)</p></li>
+</ol>
+</li>
+</ol>
+</li>
+</ol>
+</li>
+</ol>
+</li>
+<li><p>Lists that don't start at 1:</p>
+<ol class="arabic simple" start="3">
+<li><p>Three</p></li>
+<li><p>Four</p></li>
+</ol>
+<ol class="upperalpha simple" start="3">
+<li><p>C</p></li>
+<li><p>D</p></li>
+</ol>
+<ol class="lowerroman simple" start="3">
+<li><p>iii</p></li>
+<li><p>iv</p></li>
+</ol>
+</li>
+</ol>
+</div>
+<div class="section" id="definition-lists">
+<h2><a class="toc-backref" href="#id47"><span class="sectnum">2.4</span> Definition Lists</a></h2>
+<dl>
+<dt>Term</dt>
+<dd><p>Definition</p>
+</dd>
+<dt>Term<span class="classifier">classifier</span></dt>
+<dd><p>Definition paragraph 1.</p>
+<p>Definition paragraph 2.</p>
+</dd>
+<dt>Term</dt>
+<dd><p>Definition</p>
+</dd>
+<dt>Term<span class="classifier">classifier one</span><span class="classifier">classifier two</span></dt>
+<dd><p>Definition</p>
+</dd>
+</dl>
+</div>
+<div class="section" id="field-lists">
+<h2><a class="toc-backref" href="#id48"><span class="sectnum">2.5</span> Field Lists</a></h2>
+<dl class="field-list">
+<dt>what</dt>
+<dd><p>Field lists map field names to field bodies, like database
+records. They are often part of an extension syntax. They are
+an unambiguous variant of RFC 2822 fields.</p>
+</dd>
+<dt>how arg1 arg2</dt>
+<dd><p>The field marker is a colon, the field name, and a colon.</p>
+<p>The field body may contain one or more body elements, indented
+relative to the field marker.</p>
+</dd>
+<dt>credits</dt>
+<dd><p class="credits">This paragraph has the <cite>credits</cite> class set. (This is actually not
+about credits but just for ensuring that the class attribute
+doesn't get stripped away.)</p>
+</dd>
+</dl>
+</div>
+<div class="section" id="op...
[truncated message content] |
|
From: <mi...@us...> - 2016-10-20 20:00:22
|
Revision: 7975
http://sourceforge.net/p/docutils/code/7975
Author: milde
Date: 2016-10-20 20:00:19 +0000 (Thu, 20 Oct 2016)
Log Message:
-----------
Apply [ 135 ] Language modules for Latvian by Alexander Smishlajev
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
Added Paths:
-----------
trunk/docutils/docutils/languages/lv.py
trunk/docutils/docutils/parsers/rst/languages/lv.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2016-10-20 19:57:08 UTC (rev 7974)
+++ trunk/docutils/HISTORY.txt 2016-10-20 20:00:19 UTC (rev 7975)
@@ -17,10 +17,13 @@
==================
* docutils/languages/fa.py
- docutils/parsers/rst/languages/fa.py:
+ docutils/parsers/rst/languages/fa.py
+ docutils/languages/la.py
+ docutils/parsers/rst/languages/la.py:
- Apply [ 133 ] Persian mappings by Shahin Azad.
-
+ - Apply [ 135 ] Language modules for Latvian by Alexander Smishlajev
+
* docutils/nodes.py
- Fix [ 253 ] Attribute key without value not allowed in XML.
Added: trunk/docutils/docutils/languages/lv.py
===================================================================
--- trunk/docutils/docutils/languages/lv.py (rev 0)
+++ trunk/docutils/docutils/languages/lv.py 2016-10-20 20:00:19 UTC (rev 7975)
@@ -0,0 +1,60 @@
+# -*- coding: utf-8 -*-
+# $Id$
+# Copyright: This module has been placed in the public domain.
+
+# New language mappings are welcome. Before doing a new translation, please
+# read <http://docutils.sf.net/docs/howto/i18n.html>. Two files must be
+# translated for each language: one in docutils/languages, the other in
+# docutils/parsers/rst/languages.
+
+"""
+Latvian-language mappings for language-dependent features of Docutils.
+"""
+
+__docformat__ = 'reStructuredText'
+
+labels = {
+ # fixed: language-dependent
+ 'author': 'Autors',
+ 'authors': 'Autori',
+ 'organization': 'Organizācija',
+ 'address': 'Adrese',
+ 'contact': 'Kontakti',
+ 'version': 'Versija',
+ 'revision': 'Revīzija',
+ 'status': 'Statuss',
+ 'date': 'Datums',
+ 'copyright': 'Copyright',
+ 'dedication': 'Veltījums',
+ 'abstract': 'Atreferējums',
+ 'attention': 'Uzmanību!',
+ 'caution': 'Piesardzību!',
+ 'danger': '!BĪSTAMI!',
+ 'error': 'Kļūda',
+ 'hint': 'Ieteikums',
+ 'important': 'Svarīgi',
+ 'note': 'Piezīme',
+ 'tip': 'Padoms',
+ 'warning': 'Brīdinājums',
+ 'contents': 'Saturs'}
+"""Mapping of node class name to label text."""
+
+bibliographic_fields = {
+ # language-dependent: fixed
+ 'autors': 'author',
+ 'autori': 'authors',
+ 'organizācija': 'organization',
+ 'adrese': 'address',
+ 'kontakti': 'contact',
+ 'versija': 'version',
+ 'revīzija': 'revision',
+ 'statuss': 'status',
+ 'datums': 'date',
+ 'copyright': 'copyright',
+ 'veltījums': 'dedication',
+ 'atreferējums': 'abstract'}
+"""English (lowcased) to canonical name mapping for bibliographic fields."""
+
+author_separators = [';', ',']
+"""List of separator strings for the 'Authors' bibliographic field. Tried in
+order."""
Property changes on: trunk/docutils/docutils/languages/lv.py
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/docutils/docutils/parsers/rst/languages/lv.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/languages/lv.py (rev 0)
+++ trunk/docutils/docutils/parsers/rst/languages/lv.py 2016-10-20 20:00:19 UTC (rev 7975)
@@ -0,0 +1,108 @@
+# -*- coding: utf-8 -*-
+# $Id$
+# Copyright: This module has been placed in the public domain.
+
+# New language mappings are welcome. Before doing a new translation, please
+# read <http://docutils.sf.net/docs/howto/i18n.html>. Two files must be
+# translated for each language: one in docutils/languages, the other in
+# docutils/parsers/rst/languages.
+
+"""
+Latvian-language mappings for language-dependent features of
+reStructuredText.
+"""
+
+__docformat__ = 'reStructuredText'
+
+
+directives = {
+ # language-dependent: fixed
+ 'uzmanību': 'attention',
+ 'piesardzību': 'caution',
+ 'kods': 'code',
+ 'koda-bloks': 'code',
+ 'pirmkods': 'code',
+ 'bīstami': 'danger',
+ 'kļūda': 'error',
+ 'ieteikums': 'hint',
+ 'svarīgi': 'important',
+ 'piezīme': 'note',
+ 'padoms': 'tip',
+ 'brīdinājums': 'warning',
+ 'aizrādījums': 'admonition',
+ 'sānjosla': 'sidebar',
+ 'tēma': 'topic',
+ 'rindu-bloks': 'line-block',
+ 'parsēts-literālis': 'parsed-literal',
+ 'rubrika': 'rubric',
+ 'epigrāfs': 'epigraph',
+ 'apskats': 'highlights',
+ 'izvilkuma-citāts': 'pull-quote',
+ 'savienojums': 'compound',
+ 'konteiners': 'container',
+ #'questions': 'questions',
+ 'tabula': 'table',
+ 'csv-tabula': 'csv-table',
+ 'sarakstveida-tabula': 'list-table',
+ #'qa': 'questions',
+ #'faq': 'questions',
+ 'meta': 'meta',
+ 'matemātika': 'math',
+ #'imagemap': 'imagemap',
+ 'attēls': 'image',
+ 'figūra': 'figure',
+ 'ietvert': 'include',
+ 'burtiski': 'raw',
+ 'aizvieto': 'replace',
+ 'unicode': 'unicode',
+ 'datums': 'date',
+ 'klase': 'class',
+ 'role': 'role',
+ 'noklusējuma-role': 'default-role',
+ 'virsraksts': 'title',
+ 'saturs': 'contents',
+ 'numurēt-sekcijas': 'sectnum',
+ 'galvene': 'header',
+ 'kājene': 'footer',
+ #'footnotes': 'footnotes',
+ #'citations': 'citations',
+ 'atsauces-apakšā': 'target-notes',
+ 'restructuredtext-testa-direktīva': 'restructuredtext-test-directive'}
+"""English name to registered (in directives/__init__.py) directive name
+mapping."""
+
+roles = {
+ # language-dependent: fixed
+ 'saīsinājums': 'abbreviation',
+ 'īsi': 'abbreviation',
+ 'akronīms': 'acronym',
+ 'kods': 'code',
+ 'indekss': 'index',
+ 'i': 'index',
+ 'apakšraksts': 'subscript',
+ 'apakšā': 'subscript',
+ 'augšraksts': 'superscript',
+ 'augšā': 'superscript',
+ 'virsraksta-atsauce': 'title-reference',
+ 'virsraksts': 'title-reference',
+ 'v': 'title-reference',
+ 'atsauce-uz-pep': 'pep-reference',
+ 'pep': 'pep-reference',
+ 'atsauce-uz-rfc': 'rfc-reference',
+ 'rfc': 'rfc-reference',
+ 'izcēlums': 'emphasis',
+ 'blīvs': 'strong',
+ 'literālis': 'literal',
+ 'matemātika': 'math',
+ 'nosaukta-atsauce': 'named-reference',
+ 'nenosaukta-atsauce': 'anonymous-reference',
+ 'kājenes-atsauce': 'footnote-reference',
+ 'citātā-atsauce': 'citation-reference',
+ 'aizvietojuma-atsauce': 'substitution-reference',
+ 'mēr''kis': 'target',
+ 'atsauce-uz-uri': 'uri-reference',
+ 'uri': 'uri-reference',
+ 'url': 'uri-reference',
+ 'burtiski': 'raw',}
+"""Mapping of English role names to canonical role names for interpreted text.
+"""
Property changes on: trunk/docutils/docutils/parsers/rst/languages/lv.py
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2016-11-29 12:00:42
|
Revision: 7977
http://sourceforge.net/p/docutils/code/7977
Author: milde
Date: 2016-11-29 12:00:39 +0000 (Tue, 29 Nov 2016)
Log Message:
-----------
HTML writers: Outsourcing of common code to _html_base.py.
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/docs/howto/html-stylesheets.txt
trunk/docutils/docs/user/html.txt
trunk/docutils/docs/user/tools.txt
trunk/docutils/docutils/writers/html4css1/__init__.py
trunk/docutils/docutils/writers/html5_polyglot/__init__.py
Added Paths:
-----------
trunk/docutils/docutils/writers/_html_base.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2016-11-24 11:14:39 UTC (rev 7976)
+++ trunk/docutils/HISTORY.txt 2016-11-29 12:00:39 UTC (rev 7977)
@@ -68,8 +68,12 @@
- Add ``\colon`` macro, fix spacing around colons. Fixes [ 246 ].
- New upstream version (additional macros, piecewise integrals and sums).
-* docutils/writers/html_plain/
+* docutils/writers/_html_base.py
+ - New auxiliary module for definitions common to all HTML writers.
+
+* docutils/writers/html5_polyglot/
+
- New HTML writer generating clean, polyglot_ markup conforming to
`HTML 5`_.
@@ -85,6 +89,7 @@
- Do not use <sup> and <sub> tags inside <pre> (parsed-literal blocks).
- Fix footnotes with content that does not start with a paragraph.
- Use https in default MathJax URL (report Alan G Isaac).
+ - Outsourcing of common code to _html_base.py.
* docutils/writers/latex2e/__init__.py
Modified: trunk/docutils/docs/howto/html-stylesheets.txt
===================================================================
--- trunk/docutils/docs/howto/html-stylesheets.txt 2016-11-24 11:14:39 UTC (rev 7976)
+++ trunk/docutils/docs/howto/html-stylesheets.txt 2016-11-29 12:00:39 UTC (rev 7977)
@@ -15,7 +15,7 @@
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
+command (``rst2html.py`` or ``rst2html5.py``) with the
``--help`` option and look at the description of the ``--stylesheet-path``
command-line option for the exact machine-specific location.
Modified: trunk/docutils/docs/user/html.txt
===================================================================
--- trunk/docutils/docs/user/html.txt 2016-11-24 11:14:39 UTC (rev 7976)
+++ trunk/docutils/docs/user/html.txt 2016-11-29 12:00:39 UTC (rev 7977)
@@ -2,60 +2,27 @@
Docutils HTML writers
=====================
-.. note:: This document is a working draft. Naming of writers, aliases, and
- front-ends may change before the release of Docutils 0.13.
-
.. contents::
-Overview
---------
+html
+----
-* `Generic HTML writers`_
+`html` is an alias for the default Docutils HTML writer.
+Currently, `html` is mapped to html4css1_.
- =============== ========== ============== ================= ===========
- name alias(es) `front-end`_ HTML version CSS version
- =============== ========== ============== ================= ===========
- html4css1_ html4 rst2html4.py `XHTML 1 `CSS 1`_
- Transitional`_
+The target may change with the development of HTML, browsers, Docutils, and
+the web.
- .. html_ rst2html.py `XHTML 1 `CSS 1`_
- Transitional`_
+* Use `get_writer_by_name('html')` or the rst2html.py_ front end, if you
+ want the output to be up-to-date automatically.
- html5_polyglot_ html5 rst2html5.py `HTML5`_ `CSS 3`_
- =============== ========== ============== ================= ===========
+* Use a specific writer name or front end, if you depend on stability of the
+ generated HTML code, e.g. because you use a custom style sheet or
+ post-processing that may break otherwise.
-* `Special HTML writers`_
- =========== ============== ============== ================= ===========
- name alias(es) `front-end`_ HTML version CSS version
- =========== ============== ============== ================= ===========
- pep_html_ .. rstpep2html.py `XHTML 1 `CSS 1`_
- Transitional`_
-
- s5_html_ s5 rst2s5.py `XHTML 1 `CSS 1`_
- Transitional`_
- =========== ============== ============== ================= ===========
-
-* `HTML writers in the sandbox`_
-
- =========== ============== ============== ================= ===========
- name alias(es) `front-end`_ HTML version CSS version
- =========== ============== ============== ================= ===========
- xhtml11_ xhtml, rst2xhtml.py `XHTML 1.1`_ `CSS 3`_
- html4strict
-
- html4trans_ .. rst2html_trans `XHTML 1 no CSS
- Transitional`_ required
- =========== ============== ============== ================= ===========
-
-
-.. _front-end: tools.html
-
-Generic HTML writers
---------------------
-
html4css1
-~~~~~~~~~
+---------
:aliases: html4, html_
:front-ends: rst2html4.py, rst2html.py_
@@ -86,56 +53,6 @@
.. _[html4css1 writer]: config.html#html4css1-writer
.. _html4css1.css: ../../docutils/writers/html4css1/html4css1.css
-
-html5_polyglot
-~~~~~~~~~~~~~~
-
-:aliases: html5
-:front-end: rst2html5.py_
-:config: `[html5 writer]`_
-
-The ``html5_polyglot`` writer generates `polyglot HTML`_ output, valid XML that
-is compatible with `HTML5`_.
-New features and elements will only be used if they are widely supported to
-make documents `viewable with any browser`_.
-
-There is no hard-coded formatting information in the HTML document. Correct
-rendering of elements not directly supported by HTML depends on a CSS_ style
-sheet. The provided style sheets minimal.css_ and plain.css_ define required
-and optional styling rules respectively. Adaption of the layout is possible
-with `custom style sheets`_.
-
-New in Docutils 0.13
-
-.. _rst2html5.py: tools.html#rst2html5-py
-.. _[html5 writer]: config.html#html5-writer
-.. _minimal.css: ../../docutils/writers/html5_polyglot/minimal.css
-.. _plain.css: ../../docutils/writers/html5_polyglot/plain.css
-.. _custom style sheets: ../howto/html-stylesheets.html
-.. _viewable with any browser: http://www.anybrowser.org/campaign
-
-
-html
-~~~~
-
-`html` is an alias for the recommended Docutils HTML writer.
-Currently, `html` is mapped to html4css1_.
-
-The target may change with the development of HTML, browsers, Docutils, and
-the web.
-
-* Use `get_writer_by_name('html') or the ``rst2html.py`` front end, if you
- want the output to be up-to-date automatically.
-
-* Use a specific writer name or front end, if you depend on stability of the
- generated HTML code, e.g. because you use a custom style sheet or
- post-processing that may break otherwise.
-
-
-
-Special HTML writers
---------------------
-
pep_html
~~~~~~~~
@@ -170,6 +87,34 @@
.. _theme: tools.html#themes
+html5_polyglot
+--------------
+
+:aliases: html5
+:front-end: rst2html5.py_
+:config: `[html5 writer]`_
+
+The ``html5_polyglot`` writer generates `polyglot HTML`_ output, valid XML that
+is compatible with `HTML5`_.
+New features and elements will only be used if they are widely supported to
+make documents `viewable with any browser`_.
+
+There is no hard-coded formatting information in the HTML document. Correct
+rendering of elements not directly supported by HTML depends on a CSS_ style
+sheet. The provided style sheets minimal.css_ and plain.css_ define required
+and optional styling rules respectively. Adaption of the layout is possible
+with `custom style sheets`_.
+
+New in Docutils 0.13
+
+.. _rst2html5.py: tools.html#rst2html5-py
+.. _[html5 writer]: config.html#html5-writer
+.. _minimal.css: ../../docutils/writers/html5_polyglot/minimal.css
+.. _plain.css: ../../docutils/writers/html5_polyglot/plain.css
+.. _custom style sheets: ../howto/html-stylesheets.html
+.. _viewable with any browser: http://www.anybrowser.org/campaign
+
+
HTML writers in the sandbox
---------------------------
@@ -210,9 +155,34 @@
.. _rst2html_trans.py: ../../../sandbox/html4trans/tools/rst2html_trans.py
-HTML and CSS Versions
----------------------
+Overview
+--------
+=============== =========== ============== ================= ===========
+name alias(es) `front-end`_ HTML version CSS version
+=============== =========== ============== ================= ===========
+html4css1_ html4, rst2html4.py `XHTML 1 `CSS 1`_
+ html_ Transitional`_
+
+pep_html_ .. rstpep2html.py `XHTML 1 `CSS 1`_
+ Transitional`_
+
+s5_html_ s5 rst2s5.py `XHTML 1 `CSS 1`_
+ Transitional`_
+
+html5_polyglot_ html5 rst2html5.py `HTML5`_ `CSS 3`_
+
+xhtml11_ xhtml, rst2xhtml.py `XHTML 1.1`_ `CSS 3`_
+ html4strict
+
+html4trans_ .. rst2html_trans `XHTML 1 no CSS
+ Transitional`_ required
+=============== =========== ============== ================= ===========
+
+
+References
+----------
+
_`HTML5`
`HTML5, A vocabulary and associated APIs for HTML and XHTML`,
W3C Recommendation, 28 October 2014.
@@ -350,3 +320,5 @@
-1 two concurring definitions:
W3C standard and WHATWG "HTML Living Standard".
+
+.. _front-end: tools.html
Modified: trunk/docutils/docs/user/tools.txt
===================================================================
--- trunk/docutils/docs/user/tools.txt 2016-11-24 11:14:39 UTC (rev 7976)
+++ trunk/docutils/docs/user/tools.txt 2016-11-29 12:00:39 UTC (rev 7977)
@@ -64,7 +64,7 @@
:Readers: Standalone, PEP
:Parser: reStructuredText
-:Writers: HTML, PEP/HTML
+:Writers: html_, pep_html_
Use ``buildhtml.py`` to generate ``*.html`` from all the ``*.txt`` files
(including PEPs) in each <directory> given, and their subdirectories
@@ -101,8 +101,26 @@
:Reader: Standalone
:Parser: reStructuredText
-:Writer: html_ (html4css1_)
+:Writer: html_
+`rst2html.py` is the front-end for the default Docutils HTML writer.
+The default writer may change with the development of HTML, browsers,
+Docutils, and the web. Currently, it is html4css1_.
+
+* Use `rst2html.py`, if you want the output to be up-to-date automatically.
+
+* Use a specific front end, if you depend on stability of the
+ generated HTML code, e.g. because you use a custom style sheet or
+ post-processing that may break otherwise.
+
+
+rst2html4.py
+------------
+
+:Reader: Standalone
+:Parser: reStructuredText
+:Writer: html4css1_
+
The ``rst2html.py`` front end reads standalone reStructuredText source
files and produces `XHTML 1.0 Transitional`_ output.
A CSS stylesheet is required for proper rendering; a simple but
@@ -161,7 +179,7 @@
:Reader: PEP
:Parser: reStructuredText
-:Writer: PEP/HTML
+:Writer: pep_html_
``rstpep2html.py`` reads a new-style PEP (marked up with reStructuredText)
and produces `XHTML 1.0 Transitional`_. It requires a template file and a
@@ -175,13 +193,14 @@
cd <path-to-docutils>/docs/peps
rstpep2html.py pep-0287.txt pep-0287.html
+.. _pep_html: html.html#pep-html
rst2s5.py
---------
:Reader: Standalone
:Parser: reStructuredText
-:Writer: S5/HTML
+:Writer: s5_html_
The ``rst2s5.py`` front end reads standalone reStructuredText source
files and produces (X)HTML output compatible with S5_, the "Simple
@@ -198,8 +217,8 @@
to full-screen mode, and enjoy the results.
.. _S5: http://meyerweb.com/eric/tools/s5/
+.. _s5_html: html.html#s5-html
-
Themes
``````
Added: trunk/docutils/docutils/writers/_html_base.py
===================================================================
--- trunk/docutils/docutils/writers/_html_base.py (rev 0)
+++ trunk/docutils/docutils/writers/_html_base.py 2016-11-29 12:00:39 UTC (rev 7977)
@@ -0,0 +1,1598 @@
+#!/usr/bin/env python
+# -*- coding: utf8 -*-
+# :Author: David Goodger, Günter Milde
+# Based on the html4css1 writer by David Goodger.
+# :Maintainer: doc...@li...
+# :Revision: $Revision$
+# :Date: $Date: 2005-06-28$
+# :Copyright: © 2016 David Goodger, 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
+
+
+# _html_base.py: common definitions for Docutils HTML writers
+# ============================================================
+
+import sys
+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 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, latex2mathml, tex2mathml_extern)
+
+
+class Writer(writers.Writer):
+
+ supported = ('html', 'xhtml') # update in subclass
+ """Formats this writer supports."""
+
+ # default_stylesheets = [] # set in subclass!
+ # default_stylesheet_dirs = ['.'] # set in subclass!
+ default_template = 'template.txt'
+ # default_template_path = ... # set in subclass!
+ # settings_spec = ... # set in subclass!
+
+ settings_defaults = {'output_encoding_error_handler': 'xmlcharrefreplace'}
+
+ # config_section = ... # set in subclass!
+ 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 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):
+
+ """Generic Docutils to HTML translator.
+
+ See the html4css1 and html5_polyglott for writers for full featured HTML
+ writers. """
+
+ 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 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/
+ # may be overwritten by custom URL appended to "mathjax"
+ mathjax_url = ('https://cdn.mathjax.org/mathjax/latest/MathJax.js?'
+ 'config=TeX-AMS_CHTML')
+
+ 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
+
+ special_characters = {ord('&'): u'&',
+ ord('<'): u'<',
+ ord('"'): u'"',
+ ord('>'): u'>',
+ ord('@'): u'@', # may thwart address harvesters
+ }
+ """Character references for characters with a special meaning in HTML."""
+
+ 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)
+ # self.content_type = ""
+ # 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 # for html4css1
+ 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."""
+ # Use only named entities known in both XML and HTML
+ # other characters are automatically encoded "by number" if required.
+ # @@@ A codec to do these and all other HTML entities would be nice.
+ text = unicode(text)
+ return text.translate(self.special_characters)
+
+ 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 or isinstance(node,
+ (nodes.bullet_list, nodes.enumerated_list,
+ nodes.definition_list, nodes.field_list,
+ nodes.option_list, nodes.docinfo)):
+ # 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 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, 'acronym', ''))
+
+ def depart_acronym(self, node):
+ self.body.append('</acronym>')
+
+ def visit_address(self, node):
+ self.visit_docinfo_item(node, 'address', meta=False)
+ self.body.append(self.starttag(node, 'pre',
+ suffix= '', 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'))
+
+ def depart_admonition(self, node=None):
+ self.body.append('</div>\n')
+
+ attribution_formats = {'dash': (u'\u2014', ''),
+ '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')
+
+ 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()
+
+ 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 False
+ else:
+ return True
+
+ # 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']:
+ return True
+ if 'open' in node['classes']:
+ return False
+ # check config setting:
+ if (isinstance(node, (nodes.field_list, nodes.definition_list))
+ and n...
[truncated message content] |
|
From: <gr...@us...> - 2016-12-09 09:48:29
|
Revision: 7984
http://sourceforge.net/p/docutils/code/7984
Author: grubert
Date: 2016-12-09 09:48:27 +0000 (Fri, 09 Dec 2016)
Log Message:
-----------
Release 0.13.1: set version number to 0.13.1
Modified Paths:
--------------
trunk/docutils/docutils/__init__.py
trunk/docutils/setup.py
trunk/docutils/test/functional/expected/compact_lists.html
trunk/docutils/test/functional/expected/dangerous.html
trunk/docutils/test/functional/expected/field_name_limit.html
trunk/docutils/test/functional/expected/footnotes_html5.html
trunk/docutils/test/functional/expected/math_output_html.html
trunk/docutils/test/functional/expected/math_output_latex.html
trunk/docutils/test/functional/expected/math_output_mathjax.html
trunk/docutils/test/functional/expected/math_output_mathml.xhtml
trunk/docutils/test/functional/expected/misc_rst_html4css1.html
trunk/docutils/test/functional/expected/pep_html.html
trunk/docutils/test/functional/expected/standalone_rst_docutils_xml.xml
trunk/docutils/test/functional/expected/standalone_rst_html4css1.html
trunk/docutils/test/functional/expected/standalone_rst_html5.html
trunk/docutils/test/functional/expected/standalone_rst_s5_html_1.html
trunk/docutils/test/functional/expected/standalone_rst_s5_html_2.html
Modified: trunk/docutils/docutils/__init__.py
===================================================================
--- trunk/docutils/docutils/__init__.py 2016-12-09 09:42:40 UTC (rev 7983)
+++ trunk/docutils/docutils/__init__.py 2016-12-09 09:48:27 UTC (rev 7984)
@@ -52,14 +52,14 @@
__docformat__ = 'reStructuredText'
-__version__ = '0.13'
+__version__ = '0.13.1'
"""``major.minor.micro`` version number. The micro number is bumped for API
changes, for new functionality, and for interim project releases. The minor
number is bumped whenever there is a significant project release. The major
number will be bumped when the project is feature-complete, and perhaps if
there is a major change in the design."""
-__version_details__ = 'repository'
+__version_details__ = 'release'
"""Extra version details (e.g. 'snapshot 2005-05-29, r3410', 'repository',
'release'), modified automatically & manually."""
Modified: trunk/docutils/setup.py
===================================================================
--- trunk/docutils/setup.py 2016-12-09 09:42:40 UTC (rev 7983)
+++ trunk/docutils/setup.py 2016-12-09 09:48:27 UTC (rev 7984)
@@ -113,7 +113,7 @@
input Docutils supports reStructuredText, an easy-to-read,
what-you-see-is-what-you-get plaintext markup syntax.""", # wrap at col 60
'url': 'http://docutils.sourceforge.net/',
- 'version': '0.13',
+ 'version': '0.13.1',
'author': 'David Goodger',
'author_email': 'go...@py...',
'maintainer': 'docutils-develop list',
Modified: trunk/docutils/test/functional/expected/compact_lists.html
===================================================================
--- trunk/docutils/test/functional/expected/compact_lists.html 2016-12-09 09:42:40 UTC (rev 7983)
+++ trunk/docutils/test/functional/expected/compact_lists.html 2016-12-09 09:48:27 UTC (rev 7984)
@@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<meta name="generator" content="Docutils 0.13: http://docutils.sourceforge.net/" />
+<meta name="generator" content="Docutils 0.13.1: http://docutils.sourceforge.net/" />
<title></title>
<link rel="stylesheet" href="../input/data/html4css1.css" type="text/css" />
</head>
Modified: trunk/docutils/test/functional/expected/dangerous.html
===================================================================
--- trunk/docutils/test/functional/expected/dangerous.html 2016-12-09 09:42:40 UTC (rev 7983)
+++ trunk/docutils/test/functional/expected/dangerous.html 2016-12-09 09:48:27 UTC (rev 7984)
@@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<meta name="generator" content="Docutils 0.13: http://docutils.sourceforge.net/" />
+<meta name="generator" content="Docutils 0.13.1: http://docutils.sourceforge.net/" />
<title></title>
<link rel="stylesheet" href="../input/data/html4css1.css" type="text/css" />
</head>
Modified: trunk/docutils/test/functional/expected/field_name_limit.html
===================================================================
--- trunk/docutils/test/functional/expected/field_name_limit.html 2016-12-09 09:42:40 UTC (rev 7983)
+++ trunk/docutils/test/functional/expected/field_name_limit.html 2016-12-09 09:48:27 UTC (rev 7984)
@@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<meta name="generator" content="Docutils 0.13: http://docutils.sourceforge.net/" />
+<meta name="generator" content="Docutils 0.13.1: http://docutils.sourceforge.net/" />
<title></title>
<link rel="stylesheet" href="../input/data/html4css1.css" type="text/css" />
</head>
Modified: trunk/docutils/test/functional/expected/footnotes_html5.html
===================================================================
--- trunk/docutils/test/functional/expected/footnotes_html5.html 2016-12-09 09:42:40 UTC (rev 7983)
+++ trunk/docutils/test/functional/expected/footnotes_html5.html 2016-12-09 09:48:27 UTC (rev 7984)
@@ -2,7 +2,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta charset="utf-8"/>
-<meta name="generator" content="Docutils 0.13: http://docutils.sourceforge.net/" />
+<meta name="generator" content="Docutils 0.13.1: http://docutils.sourceforge.net/" />
<title>Test footnote and citation rendering</title>
<link rel="stylesheet" href="../input/data/minimal.css" type="text/css" />
<link rel="stylesheet" href="../input/data/plain.css" type="text/css" />
Modified: trunk/docutils/test/functional/expected/math_output_html.html
===================================================================
--- trunk/docutils/test/functional/expected/math_output_html.html 2016-12-09 09:42:40 UTC (rev 7983)
+++ trunk/docutils/test/functional/expected/math_output_html.html 2016-12-09 09:48:27 UTC (rev 7984)
@@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<meta name="generator" content="Docutils 0.13: http://docutils.sourceforge.net/" />
+<meta name="generator" content="Docutils 0.13.1: http://docutils.sourceforge.net/" />
<title>Mathematics</title>
<link rel="stylesheet" href="../input/data/html4css1.css" type="text/css" />
<link rel="stylesheet" href="../input/data/math.css" type="text/css" />
Modified: trunk/docutils/test/functional/expected/math_output_latex.html
===================================================================
--- trunk/docutils/test/functional/expected/math_output_latex.html 2016-12-09 09:42:40 UTC (rev 7983)
+++ trunk/docutils/test/functional/expected/math_output_latex.html 2016-12-09 09:48:27 UTC (rev 7984)
@@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<meta name="generator" content="Docutils 0.13: http://docutils.sourceforge.net/" />
+<meta name="generator" content="Docutils 0.13.1: http://docutils.sourceforge.net/" />
<title>Mathematics</title>
<link rel="stylesheet" href="../input/data/html4css1.css" type="text/css" />
</head>
Modified: trunk/docutils/test/functional/expected/math_output_mathjax.html
===================================================================
--- trunk/docutils/test/functional/expected/math_output_mathjax.html 2016-12-09 09:42:40 UTC (rev 7983)
+++ trunk/docutils/test/functional/expected/math_output_mathjax.html 2016-12-09 09:48:27 UTC (rev 7984)
@@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<meta name="generator" content="Docutils 0.13: http://docutils.sourceforge.net/" />
+<meta name="generator" content="Docutils 0.13.1: http://docutils.sourceforge.net/" />
<title>Mathematics</title>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_CHTML"></script>
<link rel="stylesheet" href="../input/data/html4css1.css" type="text/css" />
Modified: trunk/docutils/test/functional/expected/math_output_mathml.xhtml
===================================================================
--- trunk/docutils/test/functional/expected/math_output_mathml.xhtml 2016-12-09 09:42:40 UTC (rev 7983)
+++ trunk/docutils/test/functional/expected/math_output_mathml.xhtml 2016-12-09 09:48:27 UTC (rev 7984)
@@ -2,7 +2,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta charset="utf-8"/>
-<meta name="generator" content="Docutils 0.13: http://docutils.sourceforge.net/" />
+<meta name="generator" content="Docutils 0.13.1: http://docutils.sourceforge.net/" />
<title>Mathematics</title>
<link rel="stylesheet" href="../input/data/minimal.css" type="text/css" />
<link rel="stylesheet" href="../input/data/plain.css" type="text/css" />
Modified: trunk/docutils/test/functional/expected/misc_rst_html4css1.html
===================================================================
--- trunk/docutils/test/functional/expected/misc_rst_html4css1.html 2016-12-09 09:42:40 UTC (rev 7983)
+++ trunk/docutils/test/functional/expected/misc_rst_html4css1.html 2016-12-09 09:48:27 UTC (rev 7984)
@@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<meta name="generator" content="Docutils 0.13: http://docutils.sourceforge.net/" />
+<meta name="generator" content="Docutils 0.13.1: http://docutils.sourceforge.net/" />
<title></title>
<link rel="stylesheet" href="foo&bar.css" type="text/css" />
</head>
Modified: trunk/docutils/test/functional/expected/pep_html.html
===================================================================
--- trunk/docutils/test/functional/expected/pep_html.html 2016-12-09 09:42:40 UTC (rev 7983)
+++ trunk/docutils/test/functional/expected/pep_html.html 2016-12-09 09:48:27 UTC (rev 7984)
@@ -8,7 +8,7 @@
-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <meta name="generator" content="Docutils 0.13: http://docutils.sourceforge.net/" />
+ <meta name="generator" content="Docutils 0.13.1: http://docutils.sourceforge.net/" />
<title>PEP 100 -- Test PEP</title>
<link rel="stylesheet" href="../input/data/html4css1.css" type="text/css" />
</head>
Modified: trunk/docutils/test/functional/expected/standalone_rst_docutils_xml.xml
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_docutils_xml.xml 2016-12-09 09:42:40 UTC (rev 7983)
+++ trunk/docutils/test/functional/expected/standalone_rst_docutils_xml.xml 2016-12-09 09:48:27 UTC (rev 7984)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE document PUBLIC "+//IDN docutils.sourceforge.net//DTD Docutils Generic//EN//XML" "http://docutils.sourceforge.net/docs/ref/docutils.dtd">
-<!-- Generated by Docutils 0.13 -->
+<!-- Generated by Docutils 0.13.1 -->
<document ids="restructuredtext-test-document doctitle" names="restructuredtext\ test\ document doctitle" source="functional/input/standalone_rst_docutils_xml.txt" title="reStructuredText Test Document">
<title>reStructuredText Test Document</title>
<subtitle ids="examples-of-syntax-constructs subtitle" names="examples\ of\ syntax\ constructs subtitle">Examples of Syntax Constructs</subtitle>
Modified: trunk/docutils/test/functional/expected/standalone_rst_html4css1.html
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_html4css1.html 2016-12-09 09:42:40 UTC (rev 7983)
+++ trunk/docutils/test/functional/expected/standalone_rst_html4css1.html 2016-12-09 09:48:27 UTC (rev 7984)
@@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<meta name="generator" content="Docutils 0.13: http://docutils.sourceforge.net/" />
+<meta name="generator" content="Docutils 0.13.1: http://docutils.sourceforge.net/" />
<title>reStructuredText Test Document</title>
<meta name="author" content="David Goodger" />
<meta name="authors" content="Me Myself I" />
Modified: trunk/docutils/test/functional/expected/standalone_rst_html5.html
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_html5.html 2016-12-09 09:42:40 UTC (rev 7983)
+++ trunk/docutils/test/functional/expected/standalone_rst_html5.html 2016-12-09 09:48:27 UTC (rev 7984)
@@ -2,7 +2,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta charset="utf-8"/>
-<meta name="generator" content="Docutils 0.13: http://docutils.sourceforge.net/" />
+<meta name="generator" content="Docutils 0.13.1: http://docutils.sourceforge.net/" />
<title>reStructuredText Test Document</title>
<meta name="author" content="David Goodger" />
<meta content="reStructuredText, test, parser" name="keywords" />
Modified: trunk/docutils/test/functional/expected/standalone_rst_s5_html_1.html
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_s5_html_1.html 2016-12-09 09:42:40 UTC (rev 7983)
+++ trunk/docutils/test/functional/expected/standalone_rst_s5_html_1.html 2016-12-09 09:48:27 UTC (rev 7984)
@@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<meta name="generator" content="Docutils 0.13: http://docutils.sourceforge.net/" />
+<meta name="generator" content="Docutils 0.13.1: http://docutils.sourceforge.net/" />
<meta name="version" content="S5 1.1" />
<title>Slide Shows</title>
<meta name="author" content="David Goodger" />
Modified: trunk/docutils/test/functional/expected/standalone_rst_s5_html_2.html
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_s5_html_2.html 2016-12-09 09:42:40 UTC (rev 7983)
+++ trunk/docutils/test/functional/expected/standalone_rst_s5_html_2.html 2016-12-09 09:48:27 UTC (rev 7984)
@@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<meta name="generator" content="Docutils 0.13: http://docutils.sourceforge.net/" />
+<meta name="generator" content="Docutils 0.13.1: http://docutils.sourceforge.net/" />
<meta name="version" content="S5 1.1" />
<title>Slide Shows</title>
<meta name="author" content="David Goodger" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gr...@us...> - 2016-12-09 09:49:01
|
Revision: 7985
http://sourceforge.net/p/docutils/code/7985
Author: grubert
Date: 2016-12-09 09:48:58 +0000 (Fri, 09 Dec 2016)
Log Message:
-----------
Release 0.13.1: closed "Changes Since ..." section
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/RELEASE-NOTES.txt
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2016-12-09 09:48:27 UTC (rev 7984)
+++ trunk/docutils/HISTORY.txt 2016-12-09 09:48:58 UTC (rev 7985)
@@ -13,8 +13,8 @@
.. contents::
-Changes Since 0.12
-==================
+Release 0.13.1 (2016-12-09)
+===========================
* docutils/languages/fa.py
docutils/parsers/rst/languages/fa.py
Modified: trunk/docutils/RELEASE-NOTES.txt
===================================================================
--- trunk/docutils/RELEASE-NOTES.txt 2016-12-09 09:48:27 UTC (rev 7984)
+++ trunk/docutils/RELEASE-NOTES.txt 2016-12-09 09:48:58 UTC (rev 7985)
@@ -34,8 +34,8 @@
* Drop support for python 2.4 after release 0.13.
-Changes Since 0.12
-==================
+Release 0.13.1 (2016-12-09)
+===========================
* docutils/writers/html_plain
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gr...@us...> - 2016-12-09 13:11:10
|
Revision: 7990
http://sourceforge.net/p/docutils/code/7990
Author: grubert
Date: 2016-12-09 13:11:07 +0000 (Fri, 09 Dec 2016)
Log Message:
-----------
Release 0.13.1: added empty "Changes Since 0.13.1" section
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/RELEASE-NOTES.txt
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2016-12-09 13:10:55 UTC (rev 7989)
+++ trunk/docutils/HISTORY.txt 2016-12-09 13:11:07 UTC (rev 7990)
@@ -13,6 +13,10 @@
.. contents::
+Changes Since 0.13.1
+====================
+
+
Release 0.13.1 (2016-12-09)
===========================
Modified: trunk/docutils/RELEASE-NOTES.txt
===================================================================
--- trunk/docutils/RELEASE-NOTES.txt 2016-12-09 13:10:55 UTC (rev 7989)
+++ trunk/docutils/RELEASE-NOTES.txt 2016-12-09 13:11:07 UTC (rev 7990)
@@ -34,6 +34,10 @@
* Drop support for python 2.4 after release 0.13.
+Changes Since 0.13.1
+====================
+
+
Release 0.13.1 (2016-12-09)
===========================
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gr...@us...> - 2016-12-09 13:11:55
|
Revision: 7991
http://sourceforge.net/p/docutils/code/7991
Author: grubert
Date: 2016-12-09 13:11:53 +0000 (Fri, 09 Dec 2016)
Log Message:
-----------
Release 0.13.1: set version number to 0.13.2a
Modified Paths:
--------------
trunk/docutils/docutils/__init__.py
trunk/docutils/setup.py
trunk/docutils/test/functional/expected/compact_lists.html
trunk/docutils/test/functional/expected/dangerous.html
trunk/docutils/test/functional/expected/field_name_limit.html
trunk/docutils/test/functional/expected/footnotes_html5.html
trunk/docutils/test/functional/expected/math_output_html.html
trunk/docutils/test/functional/expected/math_output_latex.html
trunk/docutils/test/functional/expected/math_output_mathjax.html
trunk/docutils/test/functional/expected/math_output_mathml.xhtml
trunk/docutils/test/functional/expected/misc_rst_html4css1.html
trunk/docutils/test/functional/expected/pep_html.html
trunk/docutils/test/functional/expected/standalone_rst_docutils_xml.xml
trunk/docutils/test/functional/expected/standalone_rst_html4css1.html
trunk/docutils/test/functional/expected/standalone_rst_html5.html
trunk/docutils/test/functional/expected/standalone_rst_s5_html_1.html
trunk/docutils/test/functional/expected/standalone_rst_s5_html_2.html
Modified: trunk/docutils/docutils/__init__.py
===================================================================
--- trunk/docutils/docutils/__init__.py 2016-12-09 13:11:07 UTC (rev 7990)
+++ trunk/docutils/docutils/__init__.py 2016-12-09 13:11:53 UTC (rev 7991)
@@ -52,7 +52,7 @@
__docformat__ = 'reStructuredText'
-__version__ = '0.13.1'
+__version__ = '0.13.2a'
"""``major.minor.micro`` version number. The micro number is bumped for API
changes, for new functionality, and for interim project releases. The minor
number is bumped whenever there is a significant project release. The major
Modified: trunk/docutils/setup.py
===================================================================
--- trunk/docutils/setup.py 2016-12-09 13:11:07 UTC (rev 7990)
+++ trunk/docutils/setup.py 2016-12-09 13:11:53 UTC (rev 7991)
@@ -113,7 +113,7 @@
input Docutils supports reStructuredText, an easy-to-read,
what-you-see-is-what-you-get plaintext markup syntax.""", # wrap at col 60
'url': 'http://docutils.sourceforge.net/',
- 'version': '0.13.1',
+ 'version': '0.13.2a',
'author': 'David Goodger',
'author_email': 'go...@py...',
'maintainer': 'docutils-develop list',
Modified: trunk/docutils/test/functional/expected/compact_lists.html
===================================================================
--- trunk/docutils/test/functional/expected/compact_lists.html 2016-12-09 13:11:07 UTC (rev 7990)
+++ trunk/docutils/test/functional/expected/compact_lists.html 2016-12-09 13:11:53 UTC (rev 7991)
@@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<meta name="generator" content="Docutils 0.13.1: http://docutils.sourceforge.net/" />
+<meta name="generator" content="Docutils 0.13.2a: http://docutils.sourceforge.net/" />
<title></title>
<link rel="stylesheet" href="../input/data/html4css1.css" type="text/css" />
</head>
Modified: trunk/docutils/test/functional/expected/dangerous.html
===================================================================
--- trunk/docutils/test/functional/expected/dangerous.html 2016-12-09 13:11:07 UTC (rev 7990)
+++ trunk/docutils/test/functional/expected/dangerous.html 2016-12-09 13:11:53 UTC (rev 7991)
@@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<meta name="generator" content="Docutils 0.13.1: http://docutils.sourceforge.net/" />
+<meta name="generator" content="Docutils 0.13.2a: http://docutils.sourceforge.net/" />
<title></title>
<link rel="stylesheet" href="../input/data/html4css1.css" type="text/css" />
</head>
Modified: trunk/docutils/test/functional/expected/field_name_limit.html
===================================================================
--- trunk/docutils/test/functional/expected/field_name_limit.html 2016-12-09 13:11:07 UTC (rev 7990)
+++ trunk/docutils/test/functional/expected/field_name_limit.html 2016-12-09 13:11:53 UTC (rev 7991)
@@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<meta name="generator" content="Docutils 0.13.1: http://docutils.sourceforge.net/" />
+<meta name="generator" content="Docutils 0.13.2a: http://docutils.sourceforge.net/" />
<title></title>
<link rel="stylesheet" href="../input/data/html4css1.css" type="text/css" />
</head>
Modified: trunk/docutils/test/functional/expected/footnotes_html5.html
===================================================================
--- trunk/docutils/test/functional/expected/footnotes_html5.html 2016-12-09 13:11:07 UTC (rev 7990)
+++ trunk/docutils/test/functional/expected/footnotes_html5.html 2016-12-09 13:11:53 UTC (rev 7991)
@@ -2,7 +2,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta charset="utf-8"/>
-<meta name="generator" content="Docutils 0.13.1: http://docutils.sourceforge.net/" />
+<meta name="generator" content="Docutils 0.13.2a: http://docutils.sourceforge.net/" />
<title>Test footnote and citation rendering</title>
<link rel="stylesheet" href="../input/data/minimal.css" type="text/css" />
<link rel="stylesheet" href="../input/data/plain.css" type="text/css" />
Modified: trunk/docutils/test/functional/expected/math_output_html.html
===================================================================
--- trunk/docutils/test/functional/expected/math_output_html.html 2016-12-09 13:11:07 UTC (rev 7990)
+++ trunk/docutils/test/functional/expected/math_output_html.html 2016-12-09 13:11:53 UTC (rev 7991)
@@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<meta name="generator" content="Docutils 0.13.1: http://docutils.sourceforge.net/" />
+<meta name="generator" content="Docutils 0.13.2a: http://docutils.sourceforge.net/" />
<title>Mathematics</title>
<link rel="stylesheet" href="../input/data/html4css1.css" type="text/css" />
<link rel="stylesheet" href="../input/data/math.css" type="text/css" />
Modified: trunk/docutils/test/functional/expected/math_output_latex.html
===================================================================
--- trunk/docutils/test/functional/expected/math_output_latex.html 2016-12-09 13:11:07 UTC (rev 7990)
+++ trunk/docutils/test/functional/expected/math_output_latex.html 2016-12-09 13:11:53 UTC (rev 7991)
@@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<meta name="generator" content="Docutils 0.13.1: http://docutils.sourceforge.net/" />
+<meta name="generator" content="Docutils 0.13.2a: http://docutils.sourceforge.net/" />
<title>Mathematics</title>
<link rel="stylesheet" href="../input/data/html4css1.css" type="text/css" />
</head>
Modified: trunk/docutils/test/functional/expected/math_output_mathjax.html
===================================================================
--- trunk/docutils/test/functional/expected/math_output_mathjax.html 2016-12-09 13:11:07 UTC (rev 7990)
+++ trunk/docutils/test/functional/expected/math_output_mathjax.html 2016-12-09 13:11:53 UTC (rev 7991)
@@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<meta name="generator" content="Docutils 0.13.1: http://docutils.sourceforge.net/" />
+<meta name="generator" content="Docutils 0.13.2a: http://docutils.sourceforge.net/" />
<title>Mathematics</title>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_CHTML"></script>
<link rel="stylesheet" href="../input/data/html4css1.css" type="text/css" />
Modified: trunk/docutils/test/functional/expected/math_output_mathml.xhtml
===================================================================
--- trunk/docutils/test/functional/expected/math_output_mathml.xhtml 2016-12-09 13:11:07 UTC (rev 7990)
+++ trunk/docutils/test/functional/expected/math_output_mathml.xhtml 2016-12-09 13:11:53 UTC (rev 7991)
@@ -2,7 +2,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta charset="utf-8"/>
-<meta name="generator" content="Docutils 0.13.1: http://docutils.sourceforge.net/" />
+<meta name="generator" content="Docutils 0.13.2a: http://docutils.sourceforge.net/" />
<title>Mathematics</title>
<link rel="stylesheet" href="../input/data/minimal.css" type="text/css" />
<link rel="stylesheet" href="../input/data/plain.css" type="text/css" />
Modified: trunk/docutils/test/functional/expected/misc_rst_html4css1.html
===================================================================
--- trunk/docutils/test/functional/expected/misc_rst_html4css1.html 2016-12-09 13:11:07 UTC (rev 7990)
+++ trunk/docutils/test/functional/expected/misc_rst_html4css1.html 2016-12-09 13:11:53 UTC (rev 7991)
@@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<meta name="generator" content="Docutils 0.13.1: http://docutils.sourceforge.net/" />
+<meta name="generator" content="Docutils 0.13.2a: http://docutils.sourceforge.net/" />
<title></title>
<link rel="stylesheet" href="foo&bar.css" type="text/css" />
</head>
Modified: trunk/docutils/test/functional/expected/pep_html.html
===================================================================
--- trunk/docutils/test/functional/expected/pep_html.html 2016-12-09 13:11:07 UTC (rev 7990)
+++ trunk/docutils/test/functional/expected/pep_html.html 2016-12-09 13:11:53 UTC (rev 7991)
@@ -8,7 +8,7 @@
-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <meta name="generator" content="Docutils 0.13.1: http://docutils.sourceforge.net/" />
+ <meta name="generator" content="Docutils 0.13.2a: http://docutils.sourceforge.net/" />
<title>PEP 100 -- Test PEP</title>
<link rel="stylesheet" href="../input/data/html4css1.css" type="text/css" />
</head>
Modified: trunk/docutils/test/functional/expected/standalone_rst_docutils_xml.xml
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_docutils_xml.xml 2016-12-09 13:11:07 UTC (rev 7990)
+++ trunk/docutils/test/functional/expected/standalone_rst_docutils_xml.xml 2016-12-09 13:11:53 UTC (rev 7991)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE document PUBLIC "+//IDN docutils.sourceforge.net//DTD Docutils Generic//EN//XML" "http://docutils.sourceforge.net/docs/ref/docutils.dtd">
-<!-- Generated by Docutils 0.13.1 -->
+<!-- Generated by Docutils 0.13.2a -->
<document ids="restructuredtext-test-document doctitle" names="restructuredtext\ test\ document doctitle" source="functional/input/standalone_rst_docutils_xml.txt" title="reStructuredText Test Document">
<title>reStructuredText Test Document</title>
<subtitle ids="examples-of-syntax-constructs subtitle" names="examples\ of\ syntax\ constructs subtitle">Examples of Syntax Constructs</subtitle>
Modified: trunk/docutils/test/functional/expected/standalone_rst_html4css1.html
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_html4css1.html 2016-12-09 13:11:07 UTC (rev 7990)
+++ trunk/docutils/test/functional/expected/standalone_rst_html4css1.html 2016-12-09 13:11:53 UTC (rev 7991)
@@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<meta name="generator" content="Docutils 0.13.1: http://docutils.sourceforge.net/" />
+<meta name="generator" content="Docutils 0.13.2a: http://docutils.sourceforge.net/" />
<title>reStructuredText Test Document</title>
<meta name="author" content="David Goodger" />
<meta name="authors" content="Me Myself I" />
Modified: trunk/docutils/test/functional/expected/standalone_rst_html5.html
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_html5.html 2016-12-09 13:11:07 UTC (rev 7990)
+++ trunk/docutils/test/functional/expected/standalone_rst_html5.html 2016-12-09 13:11:53 UTC (rev 7991)
@@ -2,7 +2,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta charset="utf-8"/>
-<meta name="generator" content="Docutils 0.13.1: http://docutils.sourceforge.net/" />
+<meta name="generator" content="Docutils 0.13.2a: http://docutils.sourceforge.net/" />
<title>reStructuredText Test Document</title>
<meta name="author" content="David Goodger" />
<meta content="reStructuredText, test, parser" name="keywords" />
Modified: trunk/docutils/test/functional/expected/standalone_rst_s5_html_1.html
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_s5_html_1.html 2016-12-09 13:11:07 UTC (rev 7990)
+++ trunk/docutils/test/functional/expected/standalone_rst_s5_html_1.html 2016-12-09 13:11:53 UTC (rev 7991)
@@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<meta name="generator" content="Docutils 0.13.1: http://docutils.sourceforge.net/" />
+<meta name="generator" content="Docutils 0.13.2a: http://docutils.sourceforge.net/" />
<meta name="version" content="S5 1.1" />
<title>Slide Shows</title>
<meta name="author" content="David Goodger" />
Modified: trunk/docutils/test/functional/expected/standalone_rst_s5_html_2.html
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_s5_html_2.html 2016-12-09 13:11:07 UTC (rev 7990)
+++ trunk/docutils/test/functional/expected/standalone_rst_s5_html_2.html 2016-12-09 13:11:53 UTC (rev 7991)
@@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<meta name="generator" content="Docutils 0.13.1: http://docutils.sourceforge.net/" />
+<meta name="generator" content="Docutils 0.13.2a: http://docutils.sourceforge.net/" />
<meta name="version" content="S5 1.1" />
<title>Slide Shows</title>
<meta name="author" content="David Goodger" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mi...@us...> - 2016-12-10 17:41:47
|
Revision: 7994
http://sourceforge.net/p/docutils/code/7994
Author: milde
Date: 2016-12-10 17:41:45 +0000 (Sat, 10 Dec 2016)
Log Message:
-----------
Add rst2html4 front end. Update docs.
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/RELEASE-NOTES.txt
trunk/docutils/docs/user/html.txt
trunk/docutils/setup.py
Added Paths:
-----------
trunk/docutils/tools/rst2html4.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2016-12-10 17:19:12 UTC (rev 7993)
+++ trunk/docutils/HISTORY.txt 2016-12-10 17:41:45 UTC (rev 7994)
@@ -16,6 +16,7 @@
Changes Since 0.13.1
====================
+ - New front-end ``rst2html4.py``.
Release 0.13.1 (2016-12-09)
===========================
Modified: trunk/docutils/RELEASE-NOTES.txt
===================================================================
--- trunk/docutils/RELEASE-NOTES.txt 2016-12-10 17:19:12 UTC (rev 7993)
+++ trunk/docutils/RELEASE-NOTES.txt 2016-12-10 17:41:45 UTC (rev 7994)
@@ -34,10 +34,23 @@
* Drop support for python 2.4 after release 0.13.
+* The default HTML writer may eventually become "html" with frontend
+ ``rst2html.py``.
+
+ Use `get_writer_by_name('html')` or the rst2html.py_ front end, if you
+ want the output to be up-to-date automatically.
+
+ Use a specific writer name or front end, if you depend on stability of the
+ generated HTML code, e.g. because you use a custom style sheet or
+ post-processing that may break otherwise.
+
+
Changes Since 0.13.1
====================
+ - New front-end ``rst2html4.py``.
+
Release 0.13.1 (2016-12-09)
===========================
@@ -52,13 +65,14 @@
.. _HTML 5: http://www.w3.org/TR/html5/
-* languages: persian/farsi and latvian/la mappings.
+* languages: persian/farsi (fa) and latvian (la) mappings.
-* change default base url for :rfc: to http://tools.ietf.org/html/
+* change default base url for :rfc: to http://tools.ietf.org/html/
-* tables accept widths, a list and align
+* tables accept widths, a list and align
-* latex2e: Fix admonition width, remove deprecated options, better tablewidth auto, ...
+* latex2e: Fix admonition width, remove deprecated options,
+ better tablewidth auto, ...
* rst.el : The problem with ``electric-indent-mode`` has been fixed.
Modified: trunk/docutils/docs/user/html.txt
===================================================================
--- trunk/docutils/docs/user/html.txt 2016-12-10 17:19:12 UTC (rev 7993)
+++ trunk/docutils/docs/user/html.txt 2016-12-10 17:41:45 UTC (rev 7994)
@@ -95,7 +95,7 @@
:config: `[html5 writer]`_
The ``html5_polyglot`` writer generates `polyglot HTML`_ output, valid XML that
-is compatible with `HTML5`_.
+is compatible with `HTML5`_ (cf. `Benefits of polyglot XHTML5`_).
New features and elements will only be used if they are widely supported to
make documents `viewable with any browser`_.
@@ -113,8 +113,8 @@
.. _plain.css: ../../docutils/writers/html5_polyglot/plain.css
.. _custom style sheets: ../howto/html-stylesheets.html
.. _viewable with any browser: http://www.anybrowser.org/campaign
+.. _Benefits of polyglot XHTML5: http://xmlplease.com/xhtml/xhtml5polyglot/
-
HTML writers in the sandbox
---------------------------
Modified: trunk/docutils/setup.py
===================================================================
--- trunk/docutils/setup.py 2016-12-10 17:19:12 UTC (rev 7993)
+++ trunk/docutils/setup.py 2016-12-10 17:41:45 UTC (rev 7994)
@@ -168,6 +168,7 @@
]
+ s5_theme_files),
'scripts' : ['tools/rst2html.py',
+ 'tools/rst2html4.py',
'tools/rst2html5.py',
'tools/rst2s5.py',
'tools/rst2latex.py',
Added: trunk/docutils/tools/rst2html4.py
===================================================================
--- trunk/docutils/tools/rst2html4.py (rev 0)
+++ trunk/docutils/tools/rst2html4.py 2016-12-10 17:41:45 UTC (rev 7994)
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+
+# $Id$
+# Author: David Goodger <go...@py...>
+# Copyright: This module has been placed in the public domain.
+
+"""
+A minimal front end to the Docutils Publisher, producing (X)HTML.
+
+The output conforms to XHTML 1.0 transitional
+and almost to HTML 4.01 transitional (except for closing empty tags).
+"""
+
+try:
+ import locale
+ locale.setlocale(locale.LC_ALL, '')
+except:
+ pass
+
+from docutils.core import publish_cmdline, default_description
+
+
+description = ('Generates (X)HTML documents from standalone reStructuredText '
+ 'sources. ' + default_description)
+
+publish_cmdline(writer_name='html4', description=description)
Property changes on: trunk/docutils/tools/rst2html4.py
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|