From: <mi...@us...> - 2015-02-21 16:59:32
|
Revision: 7798 http://sourceforge.net/p/docutils/code/7798 Author: milde Date: 2015-02-21 16:59:18 +0000 (Sat, 21 Feb 2015) Log Message: ----------- New HTML writer generating `XHTML1.1`_ styled with CSS2. Moved to the docutils core from sandbox/html4strict. .. _XHTML1.1: http://www.w3.org/TR/xhtml11/ Modified Paths: -------------- trunk/docutils/HISTORY.txt trunk/docutils/RELEASE-NOTES.txt trunk/docutils/docutils/writers/html4css1/__init__.py trunk/docutils/docutils/writers/xhtml11/__init__.py trunk/docutils/setup.py trunk/sandbox/html4strict/README.txt Added Paths: ----------- trunk/docutils/docutils/writers/xhtml11/ trunk/docutils/docutils/writers/xhtml11/xhtml11.css trunk/docutils/test/functional/expected/standalone_rst_xhtml11.xhtml trunk/docutils/test/functional/input/data/xhtml11.css trunk/docutils/test/functional/input/standalone_rst_xhtml11.txt trunk/docutils/test/functional/tests/standalone_rst_xhtml11.py trunk/docutils/tools/rst2xhtml11.py Removed Paths: ------------- trunk/docutils/docutils/writers/xhtml11/html4css2.css trunk/sandbox/html4strict/data/standalone_rst_html4strict.txt trunk/sandbox/html4strict/data/standalone_rst_html4strict.xhtml trunk/sandbox/html4strict/html4strict/ trunk/sandbox/html4strict/tools/ Modified: trunk/docutils/HISTORY.txt =================================================================== --- trunk/docutils/HISTORY.txt 2015-02-19 18:31:56 UTC (rev 7797) +++ trunk/docutils/HISTORY.txt 2015-02-21 16:59:18 UTC (rev 7798) @@ -26,24 +26,32 @@ * docutils/parsers/rst/directives/tables.py - - patch [ 120 ] tables accept option widths: list of relative widths, 'auto' + - patch [ 120 ] tables accept option widths: list of relative widths, 'auto' or 'grid'. * docutils/utils/math/math2html.py - add ``\colon`` macro, fix spacing around colons. Fixes [ 246 ]. - -* docutils/writers/html4css1/__init__.py +* docutils/writers/html4css1/__init__.py + - Add "docutils" to class values for "container" object to address [ 267 ]. - Apply patch [ 119 ] by Anatoly Techtonik: use absolute paths for ``default_stylesheet_path`` and ``default_template_path``. -* docutils/writers/latex2e/__init__.py +* docutils/writers/xhtml11/ + - New HTML writer generating `XHTML1.1`_ styled with CSS2. + + Moved to the docutils core from sandbox/html4strict. + + .. _XHTML1.1: http://www.w3.org/TR/xhtml11/ + +* docutils/writers/latex2e/__init__.py + - use absolute path for ``default_template_path``. -* docutils/writers/odf_odt/__init__.py +* docutils/writers/odf_odt/__init__.py - remove decode.encode of filename stored in zip. @@ -62,7 +70,7 @@ * docutils/parsers/rst/directives/images.py - Fix [ 258 ] figwidth="image" generates unitless width value. - + * docutils/parsers/rst/states.py - Improve error report when a non-ASCII character is specified as Modified: trunk/docutils/RELEASE-NOTES.txt =================================================================== --- trunk/docutils/RELEASE-NOTES.txt 2015-02-19 18:31:56 UTC (rev 7797) +++ trunk/docutils/RELEASE-NOTES.txt 2015-02-21 16:59:18 UTC (rev 7798) @@ -22,6 +22,11 @@ * remove the `handle_io_errors` option from io.FileInput/Output. +* remove deprecated options from the latex2e writer: + + --use-latex-footnotes Alias for --docutils-footnotes (deprecated) + --figure-footnotes Use figure floats for footnote text (deprecated) + * »Prune« the doctree (no change to the reST input syntax): - "doctest" element -> literal block with class argument, @@ -29,7 +34,7 @@ element with class attribute and auto-generated title. * Move to single source for Python 2 and Python 3, slowly. - See `Porting Python 2 Code to Python 3`_ and + See `Porting Python 2 Code to Python 3`_ and `future: clean single-source support for Python 2/3`_ - Drop support for python 2.4 probably after 0.12 release. Modified: trunk/docutils/docutils/writers/html4css1/__init__.py =================================================================== --- trunk/docutils/docutils/writers/html4css1/__init__.py 2015-02-19 18:31:56 UTC (rev 7797) +++ trunk/docutils/docutils/writers/html4css1/__init__.py 2015-02-21 16:59:18 UTC (rev 7798) @@ -42,7 +42,7 @@ supported = ('html', 'html4css1', 'xhtml') """Formats this writer supports.""" - default_stylesheet = 'html4css1.css' + default_stylesheets = ['html4css1.css'] default_stylesheet_dirs = ['.', os.path.abspath(os.path.dirname(__file__))] default_template = 'template.txt' @@ -65,11 +65,11 @@ 'Relative paths are expanded if a matching file is found in ' 'the --stylesheet-dirs. With --link-stylesheet, ' 'the path is rewritten relative to the output HTML file. ' - 'Default: "%s"' % default_stylesheet, + 'Default: "%s"' % ','.join(default_stylesheets), ['--stylesheet-path'], {'metavar': '<file[,file,...]>', 'overrides': 'stylesheet', 'validator': frontend.validate_comma_separated_list, - 'default': [default_stylesheet]}), + 'default': default_stylesheets}), ('Embed the stylesheet(s) in the output HTML file. The stylesheet ' 'files must be accessible during processing. This is the default.', ['--embed-stylesheet'], Modified: trunk/docutils/docutils/writers/xhtml11/__init__.py =================================================================== --- trunk/sandbox/html4strict/html4strict/__init__.py 2015-02-11 12:45:33 UTC (rev 7786) +++ trunk/docutils/docutils/writers/xhtml11/__init__.py 2015-02-21 16:59:18 UTC (rev 7798) @@ -37,29 +37,41 @@ supported = ('html', 'xhtml', 'xhtml1', 'html4strict', 'xhtml1strict', - 'html4css2', 'xhtml1css2') + 'xhtml11', 'xhtml1css2') """Formats this writer supports.""" - default_stylesheets = ['html4css1.css', 'html4css2.css'] + default_stylesheets = ['html4css1.css', 'xhtml11.css'] + default_stylesheet_dirs = ['.', + os.path.abspath(os.path.dirname(__file__)), + os.path.abspath(os.path.join( + os.path.dirname(os.path.dirname(__file__)), 'html4css1')) + ] - default_stylesheet_path = ','.join( - [os.path.join(os.path.dirname(__file__), stylesheet) - for stylesheet in default_stylesheets]) - - config_section = 'html4strict writer' + config_section = 'xhtml11 writer' config_section_dependencies = ('writers', 'html4css1 writer') settings_spec = frontend.filter_settings_spec( html4css1.Writer.settings_spec, - 'field_name_limit', 'option_limit', + 'field_name_limit', 'option_limit', # removed options stylesheet_path = ( - 'Specify comma separated list of stylesheet paths. ' - 'With --link-stylesheet, ' - 'the path is rewritten relative to the output HTML file. ' - 'Default: "%s"' % default_stylesheet_path, - ['--stylesheet-path'], - {'metavar': '<file>', 'overrides': 'stylesheet', - 'default': default_stylesheet_path}), + 'Comma separated list of stylesheet paths. ' + 'Relative paths are expanded if a matching file is found in ' + 'the --stylesheet-dirs. With --link-stylesheet, ' + 'the path is rewritten relative to the output HTML file. ' + 'Default: "%s"' % ','.join(default_stylesheets), + ['--stylesheet-path'], + {'metavar': '<file[,file,...]>', 'overrides': 'stylesheet', + 'validator': frontend.validate_comma_separated_list, + 'default': default_stylesheets}), + + stylesheet_dirs = ( + 'Comma-separated list of directories where stylesheets are found. ' + 'Used by --stylesheet-path when expanding relative path arguments. ' + 'Default: "%s"' % default_stylesheet_dirs, + ['--stylesheet-dirs'], + {'metavar': '<dir[,dir,...]>', + 'validator': frontend.validate_comma_separated_list, + 'default': default_stylesheet_dirs}), math_output = ('Math output format, one of "MathML", "HTML", ' '"MathJax" or "LaTeX". Default: "MathML"', ['--math-output'], @@ -73,7 +85,7 @@ class HTMLTranslator(html4css1.HTMLTranslator): """ This writer generates XHTML 1.1 - without formatting hints that interfere with a CSS stylesheet. + without formatting that interferes with a CSS stylesheet. """ doctype = ('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" ' '"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\n') Deleted: trunk/docutils/docutils/writers/xhtml11/html4css2.css =================================================================== --- trunk/sandbox/html4strict/html4strict/html4css2.css 2015-02-11 12:45:33 UTC (rev 7786) +++ trunk/docutils/docutils/writers/xhtml11/html4css2.css 2015-02-21 16:59:18 UTC (rev 7798) @@ -1,371 +0,0 @@ -/* html4css2.css: Cascading style sheet for Docutils' html4strict writer. */ -/* */ -/* :Author: Günter Milde */ -/* :Copyright: © 2009 Günter Milde. */ -/* Released without warranties or conditions of any kind */ -/* under the terms of the Apache License, Version 2.0 */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* This stylesheet supplements the Docutils standard style 'html4css1.css'. */ -/* It uses CSS 2.1 elements (supported by up-to-date versions of popular */ -/* browsers). */ - -/* General rules */ -/* ============= */ - -body { - padding: 0 5%; - margin: 8px 0; - line-height:1.3; - /* http://ilovetypography.com/2008/02/28/a-guide-to-web-typography/ - recommends "line-spacing that’s at least 140% of your text size" */ - counter-reset: table; - /* counter-reset: figure; */ -} - -/* avoid long lines --> better reading */ -/* OTOH: lines should not be too short because of missing hyphenation, */ -div.document { - max-width: 45em; - margin: auto; -} - -/* separate items except for compact lists */ -dl > dd { - margin-bottom: 1em; -} -.compact li, .compact p, .compact ul, .compact ol -dl.simple > dd, .simple li, .simple p, .simple ul, .simple ol { - margin-top: 0; - margin-bottom: 0; -/* background: magenta; */ -} -dl.simple, dl.compact, dl.simple > dd, dl.compact > dd { - margin-top: 0; - margin-bottom: 0; -/* background: lightgreen; */ -} - -/* space around paragraphs */ -dl > dd p:first-child, td > p { - margin: 0; -} - -/* Sidebar */ -/* ------- */ - -div.sidebar { - margin-right: -5%; -} - -/* Special definition lists */ -/* ======================== */ - -/* bold definition term on the same line as the label */ -dl.field-list > dt, dl.option-list > dt, dl.docinfo > dt, -dl.footnote > dt, dl.citation > dt, dl.description > dt { - clear: left; - float: left; - margin: 0; - padding: 0; - padding-right: 0.5em; - font-weight: bold; -} -/* except for these */ -dl.option-list > dt, dl.footnote > dt { - font-weight: normal; -} - - - -/* Field Lists */ -/* ----------- */ - -/* field names followed by a colon */ -dl.field-list > dt:after, dl.docinfo > dt:after { - content: ":"; -} - -/* Offset for field content (corresponds to the --field-name-limit option) */ -dl.field-list > dd { - margin-left: 9em; /* ca. 14 chars in the test examples */ - padding-left: 0.5em; -} - -/* start field-body on a new line after long field names */ -dl.field-list > dd p { - width: 100%; -/* display: inline-block; */ -/* background: yellow; */ -} - -dl.field-list > dd > p:first-child, -/* dl.field-list > dd > ol:first-child, */ -/* dl.field-list > dd > ul:first-child, */ -dl.field-list > dd > dl:first-child { - display: inline-block; -} - -/* field-list variants:: */ - -/* example for custom field-name width */ -dl.field-list.narrow > dd { - margin-left: 5em; -} - -/* start field-body on same line after long field names */ -dl.field-list.run-in > dd p { - display: block; -} - -/* wrap or truncate long field names */ -dl.field-list.fix-labelwidth > dt { - width: 8em; /* set to dl.field-list > dd margin-left - padding-left */ - overflow: hidden; -} -dl.field-list.fix-labelwidth > dd:after { - /* a "stopper" to prevent next dd floating up too far */ - content: ''; - display: block; - clear: left; -} - -/* docinfo */ - -dl.docinfo > dd { - margin-left: 8em; -/* margin-bottom: 0.5em; */ -} - - -/* option list */ - -dl.option-list { - margin-left: 1em; - padding-left: 0; -} - -dl.option-list > dd { - margin-left: 8em; - /* margin-bottom: 0.5em; */ -} - -/* start description on a new line after long options */ -dl.option-list > dd p { - width: 100%; - display: inline-block; -} - -/* footnotes */ - -a.footnote-reference, a.fn-backref { - text-decoration: inherit; /* do not underline footnote links */ -} - -dl.footnote { - /* line on the left */ - padding-left: 1ex; - border-left: solid; - border-left-width: thin; - /* border-color: black; */ -} - -/* paragraph on same line as backrefs */ -dd > em { -/* background: green; */ - float: left; - margin-right: 1ex -} - - -/* -Ordered List (Enumeration) --------------------------- - -Use counters to replace the deprecated start attribute. Make sure the -resulting list resembles the list-style 'outside' with a hanging indent. -*/ - -/* New ordered list: reset counter, suppress the default label */ -ol, ol.arabic, ol.loweralpha, ol.upperalpha, -ol.lowerroman, ol.upperroman { - counter-reset: item; - list-style: none -} - -/* Set the negative indent of the list label as feature of the list item */ -ol > li { - text-indent: -40px; /* Mozillas default indent */ -} -/* reset for child elements */ -ol > li > * { - text-indent: 0px; - text-indent: 0; - margin-top: 0; - /* background: lightgreen; */ -} - -/* Label */ -ol > li:before { - /* increment and typeset counter(s), */ - counter-increment: item; - content: counter(item) "."; - /* display next to the content (aligned top-right), */ - display: inline-block; - text-align: right; - vertical-align: top; - /* sum must match ol>li {text-indent:} (40px is Mozillas default) */ - width: 35px; - padding-right: 5px; -/* background: yellow; */ -} - -/* The list item's first line starts next to the label, without indent */ -ol > li > p:first-child, -ol > li > ol:first-child, -ol > li > ul:first-child, -ol > li > dl:first-child { - display: inline-block; - /* background: lightblue; */ -} - -/* default separator variants */ -ol.loweralpha > li:before { - content: counter(item, lower-alpha) ")"; -} -ol.upperalpha > li:before { - content: counter(item, upper-alpha) "."; -} -ol.lowerroman > li:before { - content: "(" counter(item, lower-roman) ")"; -} -ol.upperroman > li:before { - content: counter(item, upper-roman) ")"; -} -/* nested counters (1, 1.1, 1.1.1, etc) */ -/* nested enumerated lists "inherit" the class attribute, other lists not */ -ol.nested > li:before, ol.nested ol > li:before { - content: counters(item, ".") " "; -} - -/* lists nested in definition list */ - -dd > ul, dd > ol { - padding-left: 0pt; -} - -/* TODO: prefix, suffix? */ - -/* smaller font for super- and subscripts */ -/* sub, sup {font-size: 70%;} */ /* Mozilla default is `smaller` */ - - -/* Tables */ -/* ====== */ - -/* margins and borders for "normal" tables */ -table { -/* background: magenta; */ - margin-top: 1em ; - margin-bottom: 1em; -/* border-style: outset; */ - border-style: solid; - border-color: silver; - border-width: thin; - border-collapse: collapse; -} -blockquote > table { - margin-top: 0em ; - margin-bottom: 0em; -} - -td, th { - border-style: solid; - border-width: thin; - border-color: silver; - /* text-align: left; */ - padding: 0 1ex; -} - -td > p:first-child, th > p:first-child { - margin-top: 0; -} -td > p, th > p { - margin-bottom: 0; -} - -/* no borders for "borderless" tables */ -table.borderless, table.borderless * { - border-style: none; -} - -/* "booktabs" style (no vertical lines) */ -table.booktabs { - border: 0; - border-top: 2px solid; - border-bottom: 2px solid; - border-collapse: collapse; -} - -table.booktabs * { - border: 0; -} -table.booktabs th { - border-bottom: thin solid; - text-align: left; -} - -table > caption { - text-align: left; - margin-bottom: 0.25em -/* padding: 2em 0 1em 0; */ -} - -/* numbered tables*/ -table.numbered > caption:before { - counter-increment: table; /* defined/re-set in body */ - content: "Table " counter(table) ": "; - font-weight: bold; -} - - -/* literal text - ------------ -*/ -/* whitespace and wrapping in inline literals */ -/* possible values: normal, nowrap, pre, pre-wrap, pre-line */ -tt.literal { - white-space: pre-wrap; -} - -/* /* compensate for initial line-break (which is literal with XHTML 1.1) */ */ -/* pre.literal-block, pre.doctest-block { */ -/* margin-top: 0em ; */ -/* } */ - -/* Table of Contents */ - -/* don't indent like a topic */ -div.topic.contents { - margin: 0; -} -/* div.topic.contents ul { */ -/* list-style: none; */ -/* } */ - -div.topic.contents a { - text-decoration: none; /* no underline for links */ -} - -/* section numbers */ - -span.sectnum { - padding-right: 1ex; -} - -/* admonitions */ - -/* no padding for top and bottom */ -div.admonition, div.attention, div.caution, div.danger, div.error, -div.hint, div.important, div.note, div.tip, div.warning { - padding: 0px 1em } Copied: trunk/docutils/docutils/writers/xhtml11/xhtml11.css (from rev 7786, trunk/sandbox/html4strict/html4strict/html4css2.css) =================================================================== --- trunk/docutils/docutils/writers/xhtml11/xhtml11.css (rev 0) +++ trunk/docutils/docutils/writers/xhtml11/xhtml11.css 2015-02-21 16:59:18 UTC (rev 7798) @@ -0,0 +1,371 @@ +/* html4css2.css: Cascading style sheet for Docutils' html4strict writer. */ +/* */ +/* :Author: Günter Milde */ +/* :Copyright: © 2009 Günter Milde. */ +/* Released without warranties or conditions of any kind */ +/* under the terms of the Apache License, Version 2.0 */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* This stylesheet supplements the Docutils standard style 'html4css1.css'. */ +/* It uses CSS 2.1 elements (supported by up-to-date versions of popular */ +/* browsers). */ + +/* General rules */ +/* ============= */ + +body { + padding: 0 5%; + margin: 8px 0; + line-height:1.3; + /* http://ilovetypography.com/2008/02/28/a-guide-to-web-typography/ + recommends "line-spacing that’s at least 140% of your text size" */ + counter-reset: table; + /* counter-reset: figure; */ +} + +/* avoid long lines --> better reading */ +/* OTOH: lines should not be too short because of missing hyphenation, */ +div.document { + max-width: 45em; + margin: auto; +} + +/* separate items except for compact lists */ +dl > dd { + margin-bottom: 1em; +} +.compact li, .compact p, .compact ul, .compact ol +dl.simple > dd, .simple li, .simple p, .simple ul, .simple ol { + margin-top: 0; + margin-bottom: 0; +/* background: magenta; */ +} +dl.simple, dl.compact, dl.simple > dd, dl.compact > dd { + margin-top: 0; + margin-bottom: 0; +/* background: lightgreen; */ +} + +/* space around paragraphs */ +dl > dd p:first-child, td > p { + margin: 0; +} + +/* Sidebar */ +/* ------- */ + +div.sidebar { + margin-right: -5%; +} + +/* Special definition lists */ +/* ======================== */ + +/* bold definition term on the same line as the label */ +dl.field-list > dt, dl.option-list > dt, dl.docinfo > dt, +dl.footnote > dt, dl.citation > dt, dl.description > dt { + clear: left; + float: left; + margin: 0; + padding: 0; + padding-right: 0.5em; + font-weight: bold; +} +/* except for these */ +dl.option-list > dt, dl.footnote > dt { + font-weight: normal; +} + + + +/* Field Lists */ +/* ----------- */ + +/* field names followed by a colon */ +dl.field-list > dt:after, dl.docinfo > dt:after { + content: ":"; +} + +/* Offset for field content (corresponds to the --field-name-limit option) */ +dl.field-list > dd { + margin-left: 9em; /* ca. 14 chars in the test examples */ + padding-left: 0.5em; +} + +/* start field-body on a new line after long field names */ +dl.field-list > dd p { + width: 100%; +/* display: inline-block; */ +/* background: yellow; */ +} + +dl.field-list > dd > p:first-child, +/* dl.field-list > dd > ol:first-child, */ +/* dl.field-list > dd > ul:first-child, */ +dl.field-list > dd > dl:first-child { + display: inline-block; +} + +/* field-list variants:: */ + +/* example for custom field-name width */ +dl.field-list.narrow > dd { + margin-left: 5em; +} + +/* start field-body on same line after long field names */ +dl.field-list.run-in > dd p { + display: block; +} + +/* wrap or truncate long field names */ +dl.field-list.fix-labelwidth > dt { + width: 8em; /* set to dl.field-list > dd margin-left - padding-left */ + overflow: hidden; +} +dl.field-list.fix-labelwidth > dd:after { + /* a "stopper" to prevent next dd floating up too far */ + content: ''; + display: block; + clear: left; +} + +/* docinfo */ + +dl.docinfo > dd { + margin-left: 8em; +/* margin-bottom: 0.5em; */ +} + + +/* option list */ + +dl.option-list { + margin-left: 1em; + padding-left: 0; +} + +dl.option-list > dd { + margin-left: 8em; + /* margin-bottom: 0.5em; */ +} + +/* start description on a new line after long options */ +dl.option-list > dd p { + width: 100%; + display: inline-block; +} + +/* footnotes */ + +a.footnote-reference, a.fn-backref { + text-decoration: inherit; /* do not underline footnote links */ +} + +dl.footnote { + /* line on the left */ + padding-left: 1ex; + border-left: solid; + border-left-width: thin; + /* border-color: black; */ +} + +/* paragraph on same line as backrefs */ +dd > em { +/* background: green; */ + float: left; + margin-right: 1ex +} + + +/* +Ordered List (Enumeration) +-------------------------- + +Use counters to replace the deprecated start attribute. Make sure the +resulting list resembles the list-style 'outside' with a hanging indent. +*/ + +/* New ordered list: reset counter, suppress the default label */ +ol, ol.arabic, ol.loweralpha, ol.upperalpha, +ol.lowerroman, ol.upperroman { + counter-reset: item; + list-style: none +} + +/* Set the negative indent of the list label as feature of the list item */ +ol > li { + text-indent: -40px; /* Mozillas default indent */ +} +/* reset for child elements */ +ol > li > * { + text-indent: 0px; + text-indent: 0; + margin-top: 0; + /* background: lightgreen; */ +} + +/* Label */ +ol > li:before { + /* increment and typeset counter(s), */ + counter-increment: item; + content: counter(item) "."; + /* display next to the content (aligned top-right), */ + display: inline-block; + text-align: right; + vertical-align: top; + /* sum must match ol>li {text-indent:} (40px is Mozillas default) */ + width: 35px; + padding-right: 5px; +/* background: yellow; */ +} + +/* The list item's first line starts next to the label, without indent */ +ol > li > p:first-child, +ol > li > ol:first-child, +ol > li > ul:first-child, +ol > li > dl:first-child { + display: inline-block; + /* background: lightblue; */ +} + +/* default separator variants */ +ol.loweralpha > li:before { + content: counter(item, lower-alpha) ")"; +} +ol.upperalpha > li:before { + content: counter(item, upper-alpha) "."; +} +ol.lowerroman > li:before { + content: "(" counter(item, lower-roman) ")"; +} +ol.upperroman > li:before { + content: counter(item, upper-roman) ")"; +} +/* nested counters (1, 1.1, 1.1.1, etc) */ +/* nested enumerated lists "inherit" the class attribute, other lists not */ +ol.nested > li:before, ol.nested ol > li:before { + content: counters(item, ".") " "; +} + +/* lists nested in definition list */ + +dd > ul, dd > ol { + padding-left: 0pt; +} + +/* TODO: prefix, suffix? */ + +/* smaller font for super- and subscripts */ +/* sub, sup {font-size: 70%;} */ /* Mozilla default is `smaller` */ + + +/* Tables */ +/* ====== */ + +/* margins and borders for "normal" tables */ +table { +/* background: magenta; */ + margin-top: 1em ; + margin-bottom: 1em; +/* border-style: outset; */ + border-style: solid; + border-color: silver; + border-width: thin; + border-collapse: collapse; +} +blockquote > table { + margin-top: 0em ; + margin-bottom: 0em; +} + +td, th { + border-style: solid; + border-width: thin; + border-color: silver; + /* text-align: left; */ + padding: 0 1ex; +} + +td > p:first-child, th > p:first-child { + margin-top: 0; +} +td > p, th > p { + margin-bottom: 0; +} + +/* no borders for "borderless" tables */ +table.borderless, table.borderless * { + border-style: none; +} + +/* "booktabs" style (no vertical lines) */ +table.booktabs { + border: 0; + border-top: 2px solid; + border-bottom: 2px solid; + border-collapse: collapse; +} + +table.booktabs * { + border: 0; +} +table.booktabs th { + border-bottom: thin solid; + text-align: left; +} + +table > caption { + text-align: left; + margin-bottom: 0.25em +/* padding: 2em 0 1em 0; */ +} + +/* numbered tables*/ +table.numbered > caption:before { + counter-increment: table; /* defined/re-set in body */ + content: "Table " counter(table) ": "; + font-weight: bold; +} + + +/* literal text + ------------ +*/ +/* whitespace and wrapping in inline literals */ +/* possible values: normal, nowrap, pre, pre-wrap, pre-line */ +tt.literal { + white-space: pre-wrap; +} + +/* /* compensate for initial line-break (which is literal with XHTML 1.1) */ */ +/* pre.literal-block, pre.doctest-block { */ +/* margin-top: 0em ; */ +/* } */ + +/* Table of Contents */ + +/* don't indent like a topic */ +div.topic.contents { + margin: 0; +} +/* div.topic.contents ul { */ +/* list-style: none; */ +/* } */ + +div.topic.contents a { + text-decoration: none; /* no underline for links */ +} + +/* section numbers */ + +span.sectnum { + padding-right: 1ex; +} + +/* admonitions */ + +/* no padding for top and bottom */ +div.admonition, div.attention, div.caution, div.danger, div.error, +div.hint, div.important, div.note, div.tip, div.warning { + padding: 0px 1em } Modified: trunk/docutils/setup.py =================================================================== --- trunk/docutils/setup.py 2015-02-19 18:31:56 UTC (rev 7797) +++ trunk/docutils/setup.py 2015-02-21 16:59:18 UTC (rev 7798) @@ -135,7 +135,7 @@ 'docutils.utils.math', 'docutils.writers', 'docutils.writers.html4css1', - # 'docutils.writers.html4strict', # in the sandbox! + 'docutils.writers.xhtml11', 'docutils.writers.pep_html', 'docutils.writers.s5_html', 'docutils.writers.latex2e', Copied: trunk/docutils/test/functional/expected/standalone_rst_xhtml11.xhtml (from rev 7786, trunk/sandbox/html4strict/data/standalone_rst_html4strict.xhtml) =================================================================== --- trunk/docutils/test/functional/expected/standalone_rst_xhtml11.xhtml (rev 0) +++ trunk/docutils/test/functional/expected/standalone_rst_xhtml11.xhtml 2015-02-21 16:59:18 UTC (rev 7798) @@ -0,0 +1,1504 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN" "http://www.w3.org/Math/DTD/mathml2/xhtml-math11-f.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> +<head> +<meta http-equiv="Content-Type" content="application/xhtml+xml; 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 name="authors" content="Me Myself I" /> +<meta name="organization" content="humankind" /> +<meta name="date" content="Now, or yesterday. Or maybe even before yesterday." /> +<meta name="copyright" content="This document has been placed in the public domain. You may do with it as you wish. You may copy, modify, redistribute, reattribute, sell, buy, rent, lease, destroy, or improve it, quote it at length, excerpt, incorporate, collate, fold, staple, or mutilate it, or do anything else to it that your or anyone else's heart desires." /> +<meta content="reStructuredText, test, parser" name="keywords" /> +<meta content="A test document, containing at least one example of each reStructuredText construct." name="description" xml:lang="en" /> +<link rel="stylesheet" href="../input/data/html4css1.css" type="text/css" /> +<link rel="stylesheet" href="../input/data/xhtml11.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> +<h2 class="subtitle" id="examples-of-syntax-constructs"><span id="subtitle"></span>Examples of Syntax Constructs</h2> + +<dl class="docinfo"> +<dt class="author">Author</dt> +<dd class="author">David Goodger</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">Me +<br />Myself +<br />I</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>field name</dt> +<dd><p>This is a "generic bibliographic field".</p> +</dd> +<dt>field name "2"</dt> +<dd><p>Generic bibliographic fields may contain multiple body elements.</p> +<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="#additional-html4css2-features" id="id80"><span class="sectnum">3</span> Additional html4css2 features</a></p> +<ul class="auto-toc"> +<li><p><a class="reference internal" href="#enumerated-lists-with-nested-counters" id="id81"><span class="sectnum">3.1</span> Enumerated lists with nested counters</a></p></li> +<li><p><a class="reference internal" href="#description-list" id="id82"><span class="sectnum">3.2</span> Description list</a></p></li> +<li><p><a class="reference internal" href="#field-list-handling" id="id83"><span class="sectnum">3.3</span> Field list handling</a></p> +<ul class="auto-toc"> +<li><p><a class="reference internal" href="#styling-with-class-arguments" id="id84"><span class="sectnum">3.3.1</span> Styling with class arguments</a></p></li> +</ul> +</li> +<li><p><a class="reference internal" href="#table-styling-with-class-arguments" id="id85"><span class="sectnum">3.4</span> Table styling with class arguments</a></p></li> +<li><p><a class="reference internal" href="#math" id="id86"><span class="sectnum">3.5</span> Math</a></p></li> +</ul> +</li> +<li><p><a class="reference internal" href="#error-handling" id="id87"><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> +<h2 class="section-subtitle" id="section-subtitle"><span class="section-subtitle">Section Subtitle</span></h2> +<p>Lone subsections are converted to a section subtitle by a transform +activated with the <tt class="literal"><span class="pre">--section-subtitles</span></tt> command line option or the +<tt class="literal"><span class="pre">sectsubtitle-xform</span></tt> 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>, <tt class="literal">inline literals</tt>, standalone hyperlinks +(<a class="reference external" href="http://www.python.org">http://www.python.org</a>), external hyperlinks (<a class="reference external" href="http://www.python.org/">Python</a> <a class="footnote-reference" href="#id25" id="id26">[5]</a>), internal +cross-references (<a class="reference internal" href="#example">example</a>), external hyperlinks with embedded URIs +(<a class="reference external" href="http://www.python.org">Python web site</a>), <a class="reference external" href="http://www.python.org/">anonymous hyperlink +references</a> <a class="footnote-reference" href="#id25" id="id35">[5]</a> (<a class="reference external" href="http://docutils.sourceforge.net/">a second reference</a> <a class="footnote-reference" href="#id36" id="id37">[9]</a>), footnote references (manually +numbered <a class="footnote-reference" href="#id8" id="id1">[1]</a>, anonymous auto-numbered <a class="footnote-reference" href="#id12" id="id2">[3]</a>, labeled auto-numbered +<a class="footnote-reference" href="#label" id="id3">[2]</a>, or symbolic <a class="footnote-reference" href="#id13" id="id4">[*]</a>), citation references (<a class="citation-reference" href="#cit2002" id="id5">[CIT2002]</a>), +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><tt class="literal">Structured</tt><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 +(<acronym>reST</acronym>), 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> <tt class="literal">markup</tt>.</p> +<!-- DO NOT RE-WRAP THE FOLLOWING PARAGRAPH! --> +<p>Let's test wrapping and whitespace significance in inline literals: +<tt class="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).</tt></p> +<p>If the <tt class="literal"><span class="pre">--pep-references</span></tt> 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" style="counter-reset: item 2;"> +<li><p>Three</p></li> +<li><p>Four</p></li> +</ol> +<ol class="upperalpha simple" style="counter-reset: item 2;"> +<li><p>C</p></li> +<li><p>D</p></li> +</ol> +<ol class="lowerroman simple" style="counter-reset: item 2;"> +<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 class="docutils"> +<dt>Term</dt> +<dd><p>Definition</p> +</dd> +<dt>Term <span class="classifier-delimiter">:</span> <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-delimiter">:</span> <span class="classifier">classifier one</span> <span class="classifier-delimiter">:</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="option-lists"> +<h2><a class="toc-backref" href="#id49"><span class="sectnum">2.6</span> Option Lists</a></h2> +<p>For listing command-line options:</p> +<dl class="option-list"> +<dt><kbd><span class="option">-a</span></kbd></dt> +<dd><p>command-line option "a"</p> +</dd> +<dt><kbd><span class="option">-b <var>file</var></span></kbd></dt> +<dd><p>options can have arguments +and long descriptions</p> +</dd> +<dt><kbd><span class="option">--long</span></kbd></dt> +<dd><p>options can be long also</p> +</dd> +<dt><kbd><span class="option">--input=<var>file</var></span></kbd></dt> +<dd><p>long options can also have +arguments</p> +</dd> +<dt><kbd><span class="option">--very-long-option</span></kbd></dt> +<dd><p>The description can also start on the next line.</p> +<p>The description may contain multiple body elements, +regardless of where it starts.</p> +</dd> +<dt><kbd><span class="option">-x</span>, <span class="option">-y</span>, <span class="option">-z</span></kbd></dt> +<dd><p>Multiple options are an "option group".</p> +</dd> +<dt><kbd><span class="option">-v</span>, <span class="option">--verbose</span></kbd></dt> +<dd><p>Commonly-seen: short & long options.</p> +</dd> +<dt><kbd><span class="option">-1 <var>file</var></span>, <span class="option">--one=<var>file</var></span>, <span class="option">--two <var>file</var></span></kbd></dt> +<dd><p>Multiple options with arguments.</p> +</dd> +<dt><kbd><span class="option">/V</span></kbd></dt> +<dd><p>DOS/VMS-style options too</p> +</dd> +</dl> +<p>There must be at least two spaces between the option and the +description.</p> +</div> +<div class="section" id="literal-blocks"> +<h2><a class="toc-backref" href="#id50"><span class="sectnum">2.7</span> Literal Blocks</a></h2> +<p>Literal blocks are indicated with a double-colon ("::") at the end of +the preceding paragraph (over there <tt class="literal"><span class="pre">--></span></tt>). They can be indented:</p> +<pre class="literal-block">if literal_block: + text = 'is left as-is' + spaces_and_linebreaks = 'are preserved' + markup_processing = None +</pre> +<p>Or they can be quoted without indentation:</p> +<pre class="literal-block">>> Great idea! +> +> Why didn't I think of that? +</pre> +</div> +<div class="section" id="line-blocks"> +<h2><a class="toc-backref" href="#id51"><span class="sectnum">2.8</span> Line Blocks</a></h2> +<p>This section tests line blocks. Line blocks are body elements which +consist of lines and other line blocks. Nested line blocks cause +indentation.</p> +<div class="line-block"> +<div class="line">This is a line block. It ends with a blank line.</div> +<div class="line-block"> +<div class="line">New lines begin with a vertical bar ("|").</div> +<div class="line">Line breaks and initial indent are significant, and preserved.</div> +<div class="line-block"> +<div class="line">Continuation lines are also possible. A long line that is intended +to wrap should begin with a space in place of the vertical bar.</div> +</div> +<div class="line">The left edge of a continuation line need not be aligned with +the left edge of the text above it.</div> +</div> +</div> +<div class="line-block"> +<div class="line">This is a second line block.</div> +<div class="line"><br /></div> +<div class="line">Blank lines are permitted internally, but they must begin with a "|".</div> +</div> +<p>Another line block, surrounded by paragraphs:</p> +<div class="line-block"> +<div class="line">And it's no good waiting by the window</div> +<div class="line">It's no good waiting for the sun</div> +<div class="line">Please believe me, the things you dream of</div> +<div class="line">They don't fall in the lap of no-one</div> +</div> +<p>Take it away, Eric the Orchestra Leader!</p> +<blockquote> +<div class="line-block"> +<div class="line">A one, two, a one two three four</div> +<div class="line"><br /></div> +<div class="line">Half a bee, philosophically,</div> +<div class="line-block"> +<div class="line">must, <em>ipso facto</em>, half not be.</div> +</div> +<div class="line">But half the bee has got to be,</div> +<div class="line-block"> +<div class="line"><em>vis a vis</em> its entity. D'you see?</div> +<div class="line"><br /></div> +</div> +<div class="line">But can a bee be said to be</div> +<div class="line-block"> +<div class="line">or not to be an entire bee,</div> +<div class="line-block"> +<div class="line">when half the bee is not a bee,</div> +<div class="line-block"> +<div class="line">due to some ancient injury?</div> +<div class="line"><br /></div> +</div> +</div> +</div> +<div class="line">Singing...</div> +</div> +</blockquote> +<p>A line block, like the following poem by Christian Morgenstern, can +also be centre-aligned:</p> +<div class="align-center line-block" xml:lang="de"> +<div class="line"><strong>Die Trichter</strong></div> +<div class="line"><br /></div> +<div class="line">Zwei Trichter wandeln durch die Nacht.</div> +<div class="line">Durch ihres Rumpfs verengten Schacht</div> +<div class="line">fließt weißes Mondlicht</div> +<div class="line">still und heiter</div> +<div class="line">auf ihren</div> +<div class="line">Waldweg</div> +<div class="line">u. s.</div> +<div class="line">w.</div> +<div class="line"><br /></div> +</div> +</div> +<div class="section" id="block-quotes"> +<h2><a class="toc-backref" href="#id52"><span class="sectnum">2.9</span> Block Quotes</a></h2> +<p>Block quotes consist of indented body elements:</p> +<blockquote> +<p>My theory by A. Elk. Brackets Miss, brackets. This theory goes +as follows and begins now. All brontosauruses are thin at one +end, much much thicker in the middle and then thin again at the +far end. That is my theory, it is mine, and belongs to me and I +own it, and what it is too.</p> +<p class="attribution">—Anne Elk (Miss)</p> +</blockquote> +<p>The language of a quote (like any other object) can be specified by +a class attribute:</p> +<!-- --> +<blockquote xml:lang="fr"> +<p>ReStructuredText est un langage de balisage léger utilisé +notamment dans la documentation du langage Python.</p> +</blockquote> +</div> +<div class="section" id="doctest-blocks"> +<h2><a class="toc-backref" href="#id53"><span class="sectnum">2.10</span> Doctest Blocks</a></h2> +<pre class="doctest-block">>>> print 'Python-specific usage examples; begun with ">>>"' +Python-specific usage examples; begun with ">>>" +>>> print '(cut and pasted from interactive Python sessions)' +(cut and pasted from interactive Python sessions) +</pre> +</div> +<div class="section" id="footnotes"> +<h2><a class="toc-backref" href="#id54"><span class="sectnum">2.11</span> Footnotes</a></h2> +<dl class="footnote"><dt class="label">[1]</dt> +<dd id="id8"> +<em>(<a class="fn-backref" href="#id1">1</a>, <a class="fn-backref" href="#id9">2</a>, <a class="fn-backref" href="#id22">3</a>)</em> <p>A footnote contains body elements, consistently indented by at +least 3 spaces.</p> +<p class="last">This is the footnote's second paragraph.</p> +</dd> +<dt class="label">[2]</dt> +<dd id="label"> +<em>(<a class="fn-backref" href="#id3">1</a>, <a class="fn-backref" href="#id10">2</a>)</em> <p>Footnotes may be numbered, either manually (as in <a class="footnote-reference" href="#id8" id="id9">[1]</a>) or +automatically using a "#"-prefixed label. This footnote has a +label so it can be referred to from multiple places, both as a +footnote reference (<a class="footnote-reference" href="#label" id="id10">[2]</a>) and as a <a class="reference internal" href="#label">hyperlink reference</a>.</p> +</dd> +<dt class="label"><a class="fn-backref" href="#id2">[3]</a></dt> +<dd id="id12"> +<p class="first">This footnote is numbered automatically and anonymously using a +label of "#" only.</p> +<p>This is the second paragraph.</p> +<p class="last">And this is the third paragraph.</p> +</dd> +<dt class="label"><a class="fn-backref" href="#id4">[*]</a></dt> +<dd id="id13"> +<p class="first last">Footnotes may also use symbols, specified with a "*" label. +Here's a reference to the next footnote: <a class="footnote-reference" href="#id15" id="id14">[†]</a>.</p> +</dd> +<dt class="label"><a class="fn-backref" href="#id14">[†]</a></dt> +<dd id="id15"> +<p class="first last">This footnote shows the next symbol in the sequence.</p> +</dd> +<dt class="label">[4]</dt> +<dd id="id16"> +<p class="first last">Here's an unreferenced footnote, with a reference to a +nonexistent footnote: <a href="#id97"><span class="problematic" id="id98"><span id="id17"></span>[5]_</span></a>.</p> +</dd> +</dl> +</div> +<div class="section" id="citations"> +<h2><a class="toc-backref" href="#id55"><span class="sectnum">2.12</span> Citations</a></h2> +<dl class="citation"><dt class="label">[CIT2002]</dt> +<dd id="cit2002"> +<em>(<a class="fn-backref" href="#id5">1</a>, <a class="fn-backref" href="#id18">2</a>)</em> <p class="last">Citations are text-labeled footnotes. They may be +rendered separately and differently from footnotes.</p> +</dd> +</dl> +<p>Here's a reference to the above, <a class="citation-reference" href="#cit2002" id="id18">[CIT2002]</a>, and a <a href="#id99"><span class="problematic" id="id100"><span id="id19"></span>[nonexistent]_</span></a> +citation.</p> +</div> +<div class="section" id="targets"> +<span id="another-target"></span><h2><a class="toc-backref" href="#id56"><span class="sectnum">2.13</span> Targets</a></h2> +<p id="example">This paragraph is pointed to by the explicit "example" target. A +reference can be found under <a class="reference internal" href="#inline-markup">Inline Markup</a>, above. <a class="reference internal" href="#inline-hyperlink-targets">Inline +hyperlink targets</a> are also possible.</p> +<p>Section headers are implicit targets, referred to by name. See +<a class="reference internal" href="#targets">Targets</a>, which is a subsection of <a class="reference internal" href="#body-elements">Body Elements</a>.</p> +<p>Explicit external targets are interpolated into references such as +"<a class="reference external" href="http://www.python.org/">Python</a> <a class="footnote-reference" href="#id25" id="id27">[5]</a>".</p> +<p>Targets may be indirect and anonymous. Thus <a class="reference internal" href="#targets">this phrase</a> may also +refer to the <a class="reference internal" href="#targets">Targets</a> section.</p> +<p>Here's a <a href="#id101"><span class="problematic" id="id102">`hyperlink reference without a target`_</span></a>, which generates an +error.</p> +<div class="section" id="duplicate-target-names"> +<h3><a class="toc-backref" href="#id57"><span class="sectnum">2.13.1</span> Duplicate Target Names</a></h3> +<p>Duplicate names in section headers or other implicit targets will +generate "info" (level-1) system messages. Duplicate names in +explicit targets will generate "warning" (level-2) system messages.</p> +</div> +<div class="section" id="id21"> +<h3><a class="toc-backref" href="#id58"><span class="sectnum">2.13.2</span> Duplicate Target Names</a></h3> +<p>Since there are two "Duplicate Target Names" section headers, we +cannot uniquely refer to either of them by name. If we try to (like +this: <a href="#id103"><span class="problematic" id="id104">`Duplicate Target Names`_</span></a>), an error is generated.</p> +</div> +</div> +<div class="section" id="directives"> +<h2><a class="toc-backref" href="#id59"><span class="sectnum">2.14</span> Directives</a></h2> +<div class="contents local topic" id="contents"> +<ul class="auto-toc simple"> +<li><p><a class="reference internal" href="#document-parts" id="id88"><span class="sectnum">2.14.1</span> Document Parts</a></p></li> +<li><p><a class="reference internal" href="#images-and-figures" id="id89"><span class="sectnum">2.14.2</span> Images and Figures</a></p></li> +<li><p><a class="reference internal" href="#admonitions" id="id90"><span class="sectnum">2.14.3</span> Admonitions</a></p></li> +<li><p><a class="reference internal" href="#topics-sidebars-and-rubrics" id="id91"><span class="sectnum">2.14.4</span> Topics, Sidebars, and Rubrics</a></p></li> +<li><p><a class="reference internal" href="#target-footnotes" id="id92"><span class="sectnum">2.14.5</span> Target Footnotes</a></p></li> +<li><p><a class="reference internal" href="#replacement-text" id="id93"><span class="sectnum">2.14.6</span> Replacement Text</a></p></li> +<li><p><a class="reference internal" href="#compound-paragraph" id="id94"><span class="sectnum">2.14.7</span> Compound Paragraph</a></p></li> +<li><p><a class="reference internal" href="#parsed-literal-blocks" id="id95"><span class="sectnum">2.14.8</span> Parsed Literal Blocks</a></p></li> +<li><p><a class="reference internal" href="#code" id="id96"><span class="sectnum">2.14.9</span> Code</a></p></li> +</ul> +</div> +<p>These are just a samp... [truncated message content] |