From: <mi...@us...> - 2007-06-28 15:42:16
|
Author: milde Date: 2007-06-28 17:42:01 +0200 (Thu, 28 Jun 2007) New Revision: 5304 Added: trunk/sandbox/html4trans/tools/check_html4trans.py trunk/sandbox/html4trans/tools/rst2html_trans.py trunk/sandbox/html4trans/tools/textsamples.py Removed: trunk/sandbox/html4trans/check_html4trans.py trunk/sandbox/html4trans/data/sample-text.txt trunk/sandbox/html4trans/data/standalone_rst_html4trans.html trunk/sandbox/html4trans/rst2html_trans.py trunk/sandbox/html4trans/tools/fix_image_links.py Modified: trunk/sandbox/html4trans/data/html4trans-sample.html Log: Set up recommended directory structure, moving tools to 'tools/' Merged the complete syntax sample test into check_html4trans.py Deleted: trunk/sandbox/html4trans/check_html4trans.py Modified: trunk/sandbox/html4trans/data/html4trans-sample.html =================================================================== --- trunk/sandbox/html4trans/data/html4trans-sample.html 2007-06-28 15:12:53 UTC (rev 5303) +++ trunk/sandbox/html4trans/data/html4trans-sample.html 2007-06-28 15:42:01 UTC (rev 5304) @@ -4,89 +4,1027 @@ <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta name="generator" content="Docutils 0.4.1: http://docutils.sourceforge.net/" /> -<title>Title of the Document</title> -<link rel="stylesheet" href="../../../../lib/python2.4/site-packages/docutils/writers/html4css1/html4css1.css" type="text/css" /> +<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." lang="en" name="description" /> +<link rel="stylesheet" href="/usr/lib/python2.4/site-packages/docutils/writers/html4css1/html4css1.css" type="text/css" /> </head> <body> -<div class="document" id="title-of-the-document"> -<h1 align="center" class="title">Title of the Document</h1> +<div class="header"> +Document header +<hr class="header"/> +</div> +<div class="document" id="restructuredtext-test-document"> +<span id="doctitle"></span><h1 align="center" class="title">reStructuredText Test Document</h1> +<h2 align="center" class="subtitle" id="examples-of-syntax-constructs"><span id="subtitle"></span>Examples of Syntax Constructs</h2> +<table class="docinfo" frame="void" rules="none"> +<col class="docinfo-name" /> +<col class="docinfo-content" /> +<tbody valign="top"> +<tr><th class="docinfo-name">Author:</th> +<td>David Goodger</td></tr> +<tr><th class="docinfo-name">Address:</th> +<td><pre class="address"> +123 Example Street +Example, EX Canada +A1B 2C3 +</pre> +</td></tr> +<tr><th class="docinfo-name">Contact:</th> +<td><a class="first last reference" href="mailto:goodger@python.org">goodger@python.org</a></td></tr> +<tr><th class="docinfo-name">Authors:</th> +<td>Me +<br />Myself +<br />I</td></tr> +<tr><th class="docinfo-name">Organization:</th> +<td>humankind</td></tr> +<tr><th class="docinfo-name">Date:</th> +<td>Now, or yesterday. Or maybe even <em>before</em> yesterday.</td></tr> +<tr><th class="docinfo-name">Status:</th> +<td>This is a "work in progress"</td></tr> +<tr><th class="docinfo-name">Revision:</th> +<td>is managed by a version control system.</td></tr> +<tr><th class="docinfo-name">Version:</th> +<td>1</td></tr> +<tr><th class="docinfo-name">Copyright:</th> +<td>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.</td></tr> +<tr class="field" valign="top"><th align="left" class="docinfo-name">field name:</th><td class="field-body">This is a "generic bibliographic field".</td> +</tr> +<tr class="field" valign="top"><th align="left" class="docinfo-name">field name "2":</th><td class="field-body"><p class="first">Generic bibliographic fields may contain multiple body elements.</p> +<p class="last">Like this.</p> +</td> +</tr> +</tbody> +</table> +<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"> +<p class="topic-title first"><a id="table-of-contents" name="table-of-contents">Table of Contents</a></p> +<ul class="auto-toc simple"> +<li><a class="reference" href="#structural-elements" id="id32" name="id32">1 Structural Elements</a><ul class="auto-toc"> +<li><a class="reference" href="#section-title" id="id33" name="id33">1.1 Section Title</a><ul class="auto-toc"> +<li><a class="reference" href="#section-subtitle" id="id34" name="id34">1.1.1 Section Subtitle</a></li> +</ul> +</li> +<li><a class="reference" href="#empty-section" id="id35" name="id35">1.2 Empty Section</a></li> +<li><a class="reference" href="#transitions" id="id36" name="id36">1.3 Transitions</a></li> +</ul> +</li> +<li><a class="reference" href="#body-elements" id="id37" name="id37">2 Body Elements</a><ul class="auto-toc"> +<li><a class="reference" href="#paragraphs" id="id38" name="id38">2.1 Paragraphs</a><ul class="auto-toc"> +<li><a class="reference" href="#inline-markup" id="id39" name="id39">2.1.1 Inline Markup</a></li> +</ul> +</li> +<li><a class="reference" href="#bullet-lists" id="id40" name="id40">2.2 Bullet Lists</a></li> +<li><a class="reference" href="#enumerated-lists" id="id41" name="id41">2.3 Enumerated Lists</a></li> +<li><a class="reference" href="#definition-lists" id="id42" name="id42">2.4 Definition Lists</a></li> +<li><a class="reference" href="#field-lists" id="id43" name="id43">2.5 Field Lists</a></li> +<li><a class="reference" href="#option-lists" id="id44" name="id44">2.6 Option Lists</a></li> +<li><a class="reference" href="#literal-blocks" id="id45" name="id45">2.7 Literal Blocks</a></li> +<li><a class="reference" href="#line-blocks" id="id46" name="id46">2.8 Line Blocks</a></li> +<li><a class="reference" href="#block-quotes" id="id47" name="id47">2.9 Block Quotes</a></li> +<li><a class="reference" href="#doctest-blocks" id="id48" name="id48">2.10 Doctest Blocks</a></li> +<li><a class="reference" href="#footnotes" id="id49" name="id49">2.11 Footnotes</a></li> +<li><a class="reference" href="#citations" id="id50" name="id50">2.12 Citations</a></li> +<li><a class="reference" href="#targets" id="id51" name="id51">2.13 Targets</a><ul class="auto-toc"> +<li><a class="reference" href="#duplicate-target-names" id="id52" name="id52">2.13.1 Duplicate Target Names</a></li> +<li><a class="reference" href="#id20" id="id53" name="id53">2.13.2 Duplicate Target Names</a></li> +</ul> +</li> +<li><a class="reference" href="#directives" id="id54" name="id54">2.14 Directives</a><ul class="auto-toc"> +<li><a class="reference" href="#document-parts" id="id55" name="id55">2.14.1 Document Parts</a></li> +<li><a class="reference" href="#images" id="id56" name="id56">2.14.2 Images</a></li> +<li><a class="reference" href="#admonitions" id="id57" name="id57">2.14.3 Admonitions</a></li> +<li><a class="reference" href="#topics-sidebars-and-rubrics" id="id58" name="id58">2.14.4 Topics, Sidebars, and Rubrics</a></li> +<li><a class="reference" href="#target-footnotes" id="id59" name="id59">2.14.5 Target Footnotes</a></li> +<li><a class="reference" href="#replacement-text" id="id60" name="id60">2.14.6 Replacement Text</a></li> +<li><a class="reference" href="#compound-paragraph" id="id61" name="id61">2.14.7 Compound Paragraph</a></li> +<li><a class="reference" href="#parsed-literal-blocks" id="id62" name="id62">2.14.8 Parsed Literal Blocks</a></li> +</ul> +</li> +<li><a class="reference" href="#substitution-definitions" id="id63" name="id63">2.15 Substitution Definitions</a></li> +<li><a class="reference" href="#comments" id="id64" name="id64">2.16 Comments</a></li> +<li><a class="reference" href="#raw-text" id="id65" name="id65">2.17 Raw text</a></li> +<li><a class="reference" href="#container" id="id66" name="id66">2.18 Container</a></li> +<li><a class="reference" href="#colspanning-tables" id="id67" name="id67">2.19 Colspanning tables</a></li> +<li><a class="reference" href="#rowspanning-tables" id="id68" name="id68">2.20 Rowspanning tables</a></li> +<li><a class="reference" href="#complex-tables" id="id69" name="id69">2.21 Complex tables</a></li> +<li><a class="reference" href="#list-tables" id="id70" name="id70">2.22 List Tables</a></li> +<li><a class="reference" href="#custom-roles" id="id71" name="id71">2.23 Custom Roles</a></li> +</ul> +</li> +</ul> +</div> <div class="section"> -<h1><a id="subtitle" name="subtitle">Subtitle</a></h1> +<h1><a class="toc-backref" href="#id32" id="structural-elements" name="structural-elements">1 Structural Elements</a></h1> <div class="section"> -<h2><a id="first-section" name="first-section">First section</a></h2> +<h2><a class="toc-backref" href="#id33" id="section-title" name="section-title">1.1 Section Title</a></h2> +<div class="section"> +<h3><a class="toc-backref" href="#id34" id="section-subtitle" name="section-subtitle">1.1.1 Section Subtitle</a></h3> +<p>That's it, the text just above this line.</p> +</div> +</div> +<div class="section"> +<h2><a class="toc-backref" href="#id35" id="empty-section" name="empty-section">1.2 Empty Section</a></h2> +</div> +<div class="section"> +<h2><a class="toc-backref" href="#id36" id="transitions" name="transitions">1.3 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"> +<h1><a class="toc-backref" href="#id37" id="body-elements" name="body-elements">2 Body Elements</a></h1> +<div class="section"> +<h2><a class="toc-backref" href="#id38" id="paragraphs" name="paragraphs">2.1 Paragraphs</a></h2> +<p>A paragraph.</p> +<div class="section"> +<h3><a class="toc-backref" href="#id39" id="inline-markup" name="inline-markup">2.1.1 Inline Markup</a></h3> +<p>Paragraphs contain text and may contain inline markup: <em>emphasis</em>, +<strong>strong emphasis</strong>, <tt class="docutils literal"><span class="pre">inline</span> <span class="pre">literals</span></tt>, standalone hyperlinks +(<a class="reference" href="http://www.python.org">http://www.python.org</a>), external hyperlinks (<a class="reference" href="http://www.python.org/">Python</a> <a class="footnote-reference" href="#id25" id="id26" name="id26">[5]</a>), internal +cross-references (<a class="reference" href="#example">example</a>), external hyperlinks with embedded URIs +(<a class="reference" href="http://www.python.org">Python web site</a>), <a class="reference" href="http://www.python.org/">anonymous hyperlink +references</a> <a class="footnote-reference" href="#id25" id="id29" name="id29">[5]</a> (<a class="reference" href="http://docutils.sourceforge.net/">a second reference</a> <a class="footnote-reference" href="#id30" id="id31" name="id31">[6]</a>), footnote references (manually +numbered <a class="footnote-reference" href="#id8" id="id1" name="id1">[1]</a>, anonymous auto-numbered <a class="footnote-reference" href="#id11" id="id2" name="id2">[3]</a>, labeled auto-numbered +<a class="footnote-reference" href="#label" id="id3" name="id3">[2]</a>, or symbolic <a class="footnote-reference" href="#id12" id="id4" name="id4">[*]</a>), citation references (<a class="citation-reference" href="#cit2002" id="id5" name="id5">[CIT2002]</a>), +substitution references (<img alt="EXAMPLE" src="../../../docutils/docs/user/rst/images/biohazard.png" />), and <span class="target" id="inline-hyperlink-targets">inline hyperlink targets</span> +(see <a class="reference" href="#id22">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="docutils literal"><span class="pre">Structured</span></tt><em>Text</em>. Problems are indicated by <font class="problematic" color="red" id="id24"><a href="#id23">|problematic|</a></font> text +(generated by processing errors; this one is intentional). Here is a +reference to the <a class="reference" href="#doctitle">doctitle</a> and the <a class="reference" 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" href="http://www.python.org/peps/pep-0287.html">PEP 287</a>); an +RFC reference (<a class="reference" href="http://www.faqs.org/rfcs/rfc2822.html">RFC 2822</a>); a <sub>subscript</sub>; a <sup>superscript</sup>; +and explicit roles for <em>standard</em> <strong>inline</strong> +<tt class="docutils literal"><span class="pre">markup</span></tt>.</p> +<!-- DO NOT RE-WRAP THE FOLLOWING PARAGRAPH! --> +<p>Let's test wrapping and whitespace significance in inline literals: +<tt class="docutils literal"><span class="pre">This</span> <span class="pre">is</span> <span class="pre">an</span> <span class="pre">example</span> <span class="pre">of</span> <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> +<span class="pre">to</span> <span class="pre">see</span> <span class="pre">how</span> <span class="pre">the</span> <span class="pre">text</span> <span class="pre">is</span> <span class="pre">wrapped.</span> <span class="pre">--</span> <span class="pre">----</span> <span class="pre">--------</span> <span class="pre">Now</span> <span class="pre">note</span> <span class="pre">the</span> +<span class="pre">spacing</span> <span class="pre">between</span> <span class="pre">the</span> <span class="pre">words</span> <span class="pre">of</span> <span class="pre">this</span> <span class="pre">sentence</span> <span class="pre">(words</span> +<span class="pre">should</span> <span class="pre">be</span> <span class="pre">grouped</span> <span class="pre">in</span> <span class="pre">pairs).</span></tt></p> +<p>If the <tt class="docutils 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"> +<h2><a class="toc-backref" href="#id40" id="bullet-lists" name="bullet-lists">2.2 Bullet Lists</a></h2> +<ul> +<li><p class="first">A bullet list</p> +<ul class="simple"> +<li>Nested bullet list.</li> +<li>Nested item 2.</li> +</ul> +</li> +<li><p class="first">Item 2.</p> +<p>Paragraph 2 of item 2.</p> +<ul class="simple"> +<li>Nested bullet list.</li> +<li>Nested item 2.<ul> +<li>Third level.</li> +<li>Item 2.</li> +</ul> +</li> +<li>Nested item 3.</li> +<li>This nested list should be compacted by the HTML writer.<span class="target" id="target"></span><!-- Even if this item contains a target and a comment. --> +</li> +</ul> +</li> +</ul> +</div> +<div class="section"> +<h2><a class="toc-backref" href="#id41" id="enumerated-lists" name="enumerated-lists">2.3 Enumerated Lists</a></h2> +<ol class="arabic"> +<li><p class="first">Arabic numerals.</p> +<ol class="loweralpha simple"> +<li>lower alpha)<ol class="lowerroman"> +<li>(lower roman)<ol class="upperalpha"> +<li>upper alpha.<ol class="upperroman"> +<li>upper roman)</li> +</ol> +</li> +</ol> +</li> +</ol> +</li> +</ol> +</li> +<li><p class="first">Lists that don't start at 1:</p> +<ol class="arabic simple" start="3"> +<li>Three</li> +<li>Four</li> +</ol> +<ol class="upperalpha simple" start="3"> +<li>C</li> +<li>D</li> +</ol> +<ol class="lowerroman simple" start="3"> +<li>iii</li> +<li>iv</li> +</ol> +</li> +</ol> +</div> +<div class="section"> +<h2><a class="toc-backref" href="#id42" id="definition-lists" name="definition-lists">2.4 Definition Lists</a></h2> +<dl class="docutils"> +<dt>Term</dt> +<dd>Definition</dd> +<dt>Term <span class="classifier-delimiter">:</span> <span class="classifier">classifier</span></dt> +<dd><p class="first">Definition paragraph 1.</p> +<p class="last">Definition paragraph 2.</p> +</dd> +<dt>Term</dt> +<dd>Definition</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>Definition</dd> +</dl> +</div> +<div class="section"> +<h2><a class="toc-backref" href="#id43" id="field-lists" name="field-lists">2.5 Field Lists</a></h2> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field" valign="top"><th align="left" class="field-name">Author:</th><td class="field-body"><p class="first">G. E. Milde # escape fullstop to prevent recognision as enumeration</p> +<tr class="field" valign="top"><th align="left" class="field-name">what:</th><td class="field-body"><p class="first">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> </td> </tr> -<tr class="field" valign="top"><th align="left" class="field-name">Status:</th><td class="field-body"><p class="first">Work in progress</p> +<tr class="field" valign="top"><th align="left" class="field-name">how arg1 arg2:</th><td class="field-body"><p class="first">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> </td> </tr> -<tr class="field" valign="top"><th align="left" class="field-name">field name:</th><td class="field-body"><p class="first">genric content</p> -<p>in several paragraphs</p> +<tr class="field" valign="top"><th align="left" class="field-name">credits:</th><td class="field-body"><p class="credits first last">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> </td> </tr> -<tr class="field" valign="top"><th align="left" class="field-name">Dedication:</th><td class="field-body"><p class="first">For impatient owners of slow computers.</p> -</td> +</tbody> +</table> +</div> +<div class="section"> +<h2><a class="toc-backref" href="#id44" id="option-lists" name="option-lists">2.6 Option Lists</a></h2> +<p>For listing command-line options:</p> +<table class="docutils option-list" frame="void" rules="none"> +<col class="option" /> +<col class="description" /> +<tbody valign="top"> +<tr><td class="option-group"> +<kbd><span class="option">-a</span></kbd></td> +<td>command-line option "a"</td></tr> +<tr><td class="option-group"> +<kbd><span class="option">-b <var>file</var></span></kbd></td> +<td>options can have arguments +and long descriptions</td></tr> +<tr><td class="option-group"> +<kbd><span class="option">--long</span></kbd></td> +<td>options can be long also</td></tr> +<tr><td class="option-group"> +<kbd><span class="option">--input=<var>file</var></span></kbd></td> +<td>long options can also have +arguments</td></tr> +<tr><td class="option-group" colspan="2"> +<kbd><span class="option">--very-long-option</span></kbd></td> </tr> -<tr class="field" valign="top"><th align="left" class="field-name">abstract:</th><td class="field-body"><p class="first last">This is a test document, containing at least one example of each -reStructuredText construct.</p> -</td> +<tr><td> </td><td><p class="first">The description can also start on the next line.</p> +<p class="last">The description may contain multiple body elements, +regardless of where it starts.</p> +</td></tr> +<tr><td class="option-group"> +<kbd><span class="option">-x</span>, <span class="option">-y</span>, <span class="option">-z</span></kbd></td> +<td>Multiple options are an "option group".</td></tr> +<tr><td class="option-group"> +<kbd><span class="option">-v</span>, <span class="option">--verbose</span></kbd></td> +<td>Commonly-seen: short & long options.</td></tr> +<tr><td class="option-group" colspan="2"> +<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></td> </tr> +<tr><td> </td><td>Multiple options with arguments.</td></tr> +<tr><td class="option-group"> +<kbd><span class="option">/V</span></kbd></td> +<td>DOS/VMS-style options too</td></tr> </tbody> </table> +<p>There must be at least two spaces between the option and the +description.</p> </div> +<div class="section"> +<h2><a class="toc-backref" href="#id45" id="literal-blocks" name="literal-blocks">2.7 Literal Blocks</a></h2> +<p>Literal blocks are indicated with a double-colon ("::") at the end of +the preceding paragraph (over there <tt class="docutils literal"><span class="pre">--></span></tt>). They can be indented:</p> +<blockquote><pre class="literal-block"> +if literal_block: + text = 'is left as-is' + spaces_and_linebreaks = 'are preserved' + markup_processing = None +</pre></blockquote> +<p>Or they can be quoted without indentation:</p> +<blockquote><pre class="literal-block"> +>> Great idea! +> +> Why didn't I think of that? +</pre></blockquote> </div> <div class="section"> -<h1><a id="admonitions" name="admonitions">Admonitions</a></h1> -<blockquote class="admonition-testme admonition"><table border="1" class="admonition-testme admonition" width="100%"><tr><td> -<p class="admonition-title"><b>testme</b></p> -<p>Admonition text,</p> -<p>in two paragraphs.</p> +<h2><a class="toc-backref" href="#id46" id="line-blocks" name="line-blocks">2.8 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> +</div> +<div class="section"> +<h2><a class="toc-backref" href="#id47" id="block-quotes" name="block-quotes">2.9 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> +</div> +<div class="section"> +<h2><a class="toc-backref" href="#id48" id="doctest-blocks" name="doctest-blocks">2.10 Doctest Blocks</a></h2> +<blockquote><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></blockquote> +</div> +<div class="section"> +<h2><a class="toc-backref" href="#id49" id="footnotes" name="footnotes">2.11 Footnotes</a></h2> +<table class="docutils footnote" frame="void" id="id8" rules="none"> +<colgroup><col class="label" /><col /></colgroup> +<tbody> +<tr valign="top"><td class="label"><a name="id8">[1]</a></td><td><em>(<a class="fn-backref" href="#id1">1</a>, <a class="fn-backref" href="#id9">2</a>, <a class="fn-backref" href="#id21">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> </td></tr> +</tbody> +</table> +<table class="docutils footnote" frame="void" id="label" rules="none"> +<colgroup><col class="label" /><col /></colgroup> +<tbody> +<tr valign="top"><td class="label"><a name="label">[2]</a></td><td><em>(<a class="fn-backref" href="#id3">1</a>, <a class="fn-backref" href="#id10">2</a>)</em> Footnotes may be numbered, either manually (as in <a class="footnote-reference" href="#id8" id="id9" name="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" name="id10">[2]</a>) and as a hyperlink reference +(<a class="reference" href="#label">label</a>).</td></tr> +</tbody> +</table> +<table class="docutils footnote" frame="void" id="id11" rules="none"> +<colgroup><col class="label" /><col /></colgroup> +<tbody> +<tr valign="top"><td class="label"><a class="fn-backref" href="#id2" name="id11">[3]</a></td><td><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> +</td></tr> +</tbody> +</table> +<table class="docutils footnote" frame="void" id="id12" rules="none"> +<colgroup><col class="label" /><col /></colgroup> +<tbody> +<tr valign="top"><td class="label"><a class="fn-backref" href="#id4" name="id12">[*]</a></td><td>Footnotes may also use symbols, specified with a "*" label. +Here's a reference to the next footnote: <a class="footnote-reference" href="#id14" id="id13" name="id13">[†]</a>.</td></tr> +</tbody> +</table> +<table class="docutils footnote" frame="void" id="id14" rules="none"> +<colgroup><col class="label" /><col /></colgroup> +<tbody> +<tr valign="top"><td class="label"><a class="fn-backref" href="#id13" name="id14">[†]</a></td><td>This footnote shows the next symbol in the sequence.</td></tr> +</tbody> +</table> +<table class="docutils footnote" frame="void" id="id15" rules="none"> +<colgroup><col class="label" /><col /></colgroup> +<tbody> +<tr valign="top"><td class="label"><a name="id15">[4]</a></td><td>Here's an unreferenced footnote, with a reference to a +nonexistent footnote: <font class="problematic" color="red" id="id81"><span id="id16"></span><a href="#id80">[5]_</a></font>.</td></tr> +</tbody> +</table> +</div> +<div class="section"> +<h2><a class="toc-backref" href="#id50" id="citations" name="citations">2.12 Citations</a></h2> +<table class="docutils citation" frame="void" id="cit2002" rules="none"> +<colgroup><col class="label" /><col /></colgroup> +<tbody> +<tr valign="top"><td class="label"><a name="cit2002">[CIT2002]</a></td><td><em>(<a class="fn-backref" href="#id5">1</a>, <a class="fn-backref" href="#id17">2</a>)</em> Citations are text-labeled footnotes. They may be +rendered separately and differently from footnotes.</td></tr> +</tbody> +</table> +<p>Here's a reference to the above, <a class="citation-reference" href="#cit2002" id="id17" name="id17">[CIT2002]</a>, and a <font class="problematic" color="red" id="id83"><span id="id18"></span><a href="#id82">[nonexistent]_</a></font> +citation.</p> +</div> +<div class="section"> +<h2><a class="toc-backref" href="#id51" id="targets" name="targets"><span id="another-target"></span>2.13 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" href="#inline-markup">Inline Markup</a>, above. <a class="reference" 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" href="#id22">Targets</a>, which is a subsection of <a class="reference" href="#body-elements">Body Elements</a>.</p> +<p>Explicit external targets are interpolated into references such as +"<a class="reference" href="http://www.python.org/">Python</a> <a class="footnote-reference" href="#id25" id="id27" name="id27">[5]</a>".</p> +<p>Targets may be indirect and anonymous. Thus <a class="reference" href="#id22">this phrase</a> may also +refer to the <a class="reference" href="#id22">Targets</a> section.</p> +<p>Here's a <font class="problematic" color="red" id="id85"><a href="#id84">`hyperlink reference without a target`_</a></font>, which generates an +error.</p> +<div class="section"> +<h3><a class="toc-backref" href="#id52" id="duplicate-target-names" name="duplicate-target-names">2.13.1 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"> +<h3><a class="toc-backref" href="#id53" id="id20" name="id20">2.13.2 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: <font class="problematic" color="red" id="id87"><a href="#id86">`Duplicate Target Names`_</a></font>), an error is generated.</p> +</div> +</div> +<div class="section"> +<h2><a class="toc-backref" href="#id54" id="directives" name="directives">2.14 Directives</a></h2> +<div class="contents local topic"> +<ul class="auto-toc simple"> +<li><a class="reference" href="#document-parts" id="id72" name="id72">2.14.1 Document Parts</a></li> +<li><a class="reference" href="#images" id="id73" name="id73">2.14.2 Images</a></li> +<li><a class="reference" href="#admonitions" id="id74" name="id74">2.14.3 Admonitions</a></li> +<li><a class="reference" href="#topics-sidebars-and-rubrics" id="id75" name="id75">2.14.4 Topics, Sidebars, and Rubrics</a></li> +<li><a class="reference" href="#target-footnotes" id="id76" name="id76">2.14.5 Target Footnotes</a></li> +<li><a class="reference" href="#replacement-text" id="id77" name="id77">2.14.6 Replacement Text</a></li> +<li><a class="reference" href="#compound-paragraph" id="id78" name="id78">2.14.7 Compound Paragraph</a></li> +<li><a class="reference" href="#parsed-literal-blocks" id="id79" name="id79">2.14.8 Parsed Literal Blocks</a></li> +</ul> +</div> +<p>These are just a sample of the many reStructuredText Directives. For +others, please see +<a class="reference" href="http://docutils.sourceforge.net/docs/ref/rst/directives.html">http://docutils.sourceforge.net/docs/ref/rst/directives.html</a>.</p> +<div class="section"> +<h3><a class="toc-backref" href="#id72" id="document-parts" name="document-parts">2.14.1 Document Parts</a></h3> +<p>An example of the "contents" directive can be seen above this section +(a local, untitled table of <a class="reference" href="#contents">contents</a>) and at the beginning of the +document (a document-wide <a class="reference" href="#table-of-contents">table of contents</a>).</p> +</div> +<div class="section"> +<h3><a class="toc-backref" href="#id73" id="images" name="images">2.14.2 Images</a></h3> +<p>An image directive (also clickable -- a hyperlink reference):</p> +<a class="reference image-reference" href="#directives"><img alt="../../../docutils/docs/user/rst/images/title.png" class="class1 class2" src="../../../docutils/docs/user/rst/images/title.png" /></a> +<p>Image with multiple IDs:</p> +<span id="image-target-2"></span><span id="image-target-1"></span><img alt="../../../docutils/docs/user/rst/images/title.png" id="image-target-3" name="image-target-3" src="../../../docutils/docs/user/rst/images/title.png" /> +<p>A centered image:</p> +<div align="center" class="align-center"><img alt="../../../docutils/docs/user/rst/images/biohazard.png" class="align-center" src="../../../docutils/docs/user/rst/images/biohazard.png" /></div> +<p>A left-aligned image:</p> +<img align="left" alt="../../../docutils/docs/user/rst/images/biohazard.png" class="align-left" src="../../../docutils/docs/user/rst/images/biohazard.png" /> +<p>A right-aligned image:</p> +<img align="right" alt="../../../docutils/docs/user/rst/images/biohazard.png" class="align-right" src="../../../docutils/docs/user/rst/images/biohazard.png" /> +<p>A figure directive:</p> +<div align="right" class="figclass1 figclass2 figure"> +<img alt="reStructuredText, the markup syntax" class="class1 class2" src="../../../docutils/docs/user/rst/images/biohazard.png" style="width: 50px;" /> +<p class="caption">A figure is an image with a caption and/or a legend:</p> +<div class="legend"> +<table border="1" class="docutils"> +<colgroup> +<col width="20%" /> +<col width="80%" /> +</colgroup> +<tbody valign="top"> +<tr><td>re</td> +<td>Revised, revisited, based on 're' module.</td> +</tr> +<tr><td>Structured</td> +<td>Structure-enhanced text, structuredtext.</td> +</tr> +<tr><td>Text</td> +<td>Well it is, isn't it?</td> +</tr> +</tbody> +</table> +<p>This paragraph is also part of the legend.</p> +</div> +</div> +<div align="left" class="figclass1 figclass2 figure"> +<img alt="reStructuredText, the markup syntax" class="class1 class2" src="../../../docutils/docs/user/rst/images/biohazard.png" style="width: 50px;" /> +<p class="caption">A left-aligned figure.</p> +<div class="legend"> +This is the legend.</div> +</div> +<p>This paragraph might flow around the figure...</p> +<p>A centered figure:</p> +<div align="center" class="figure"> +<img alt="../../../docutils/docs/user/rst/images/biohazard.png" src="../../../docutils/docs/user/rst/images/biohazard.png" style="width: 50px;" /> +<p class="caption">This is the caption.</p> +<div class="legend"> +<p>This is the legend.</p> +<p>The legend may consist of several paragraphs.</p> +</div> +</div> +<p>This paragraph might flow around the figure...</p> +<p>A left-aligned figure:</p> +<div align="left" class="figure"> +<img alt="../../../docutils/docs/user/rst/images/biohazard.png" src="../../../docutils/docs/user/rst/images/biohazard.png" style="width: 50px;" /> +<p class="caption">This is the caption.</p> +<div class="legend"> +<p>This is the legend.</p> +<p>The legend may consist of several paragraphs.</p> +</div> +</div> +<p>This paragraph might flow around the figure...</p> +<p>Now widths:</p> +<p>An image 2 em wide:</p> +<img alt="../../../docutils/docs/user/rst/images/biohazard.png" src="../../../docutils/docs/user/rst/images/biohazard.png" style="width: 2em;" /> +<p>An image 2 em wide and 30 pixel high:</p> +<img alt="../../../docutils/docs/user/rst/images/biohazard.png" src="../../../docutils/docs/user/rst/images/biohazard.png" style="width: 2em; height: 30px;" /> +<p>An image occupying 70% of the line width:</p> +<img alt="../../../docutils/docs/user/rst/images/biohazard.png" src="../../../docutils/docs/user/rst/images/biohazard.png" style="width: 70%;" /> +<p>An image 3 cm high:</p> +<img alt="../../../docutils/docs/user/rst/images/biohazard.png" src="../../../docutils/docs/user/rst/images/biohazard.png" style="height: 3cm;" /> +</div> +<div class="section"> +<h3><a class="toc-backref" href="#id74" id="admonitions" name="admonitions">2.14.3 Admonitions</a></h3> +<blockquote class="attention"><table border="1" class="attention" width="100%"><tr><td> +<p class="admonition-title"><b><font color="red">Attention!</font></b></p> +<p>Directives at large.</p> +</td></tr> </table></blockquote> +<blockquote class="caution"><table border="1" class="caution" width="100%"><tr><td> +<p class="admonition-title"><b><font color="red">Caution!</font></b></p> +<p>Don't take any wooden nickels.</p> +</td></tr> +</table></blockquote> +<blockquote class="danger"><table border="1" class="danger" width="100%"><tr><td> +<p class="admonition-title"><b><font color="red">!DANGER!</font></b></p> +<p>Mad scientist at work!</p> +</td></tr> +</table></blockquote> +<blockquote class="error"><table border="1" class="error" width="100%"><tr><td> +<p class="admonition-title"><b><font color="red">Error</font></b></p> +<p>Does not compute.</p> +</td></tr> +</table></blockquote> +<blockquote class="hint"><table border="1" class="hint" width="100%"><tr><td> +<p class="admonition-title"><b>Hint</b></p> +<p>It's bigger than a bread box.</p> +</td></tr> +</table></blockquote> +<blockquote class="important"><table border="1" class="important" width="100%"><tr><td> +<p class="admonition-title"><b>Important</b></p> +<ul class="simple"> +<li>Wash behind your ears.</li> +<li>Clean up your room.</li> +<li>Call your mother.</li> +<li>Back up your data.</li> +</ul> +</td></tr> +</table></blockquote> <blockquote class="note"><table border="1" class="note" width="100%"><tr><td> <p class="admonition-title"><b>Note</b></p> -<p>This is a note</p> +<p>This is a note.</p> </td></tr> </table></blockquote> +<blockquote class="tip"><table border="1" class="tip" width="100%"><tr><td> +<p class="admonition-title"><b>Tip</b></p> +<p>15% if the service is good.</p> +</td></tr> +</table></blockquote> <blockquote class="warning"><table border="1" class="warning" width="100%"><tr><td> <p class="admonition-title"><b><font color="red">Warning</font></b></p> -<p>Beware of red tape.</p> +<p>Strong prose may provoke extreme mental exertion. +Reader discretion is strongly advised.</p> </td></tr> </table></blockquote> +<blockquote class="admonition-and-by-the-way admonition"><table border="1" class="admonition-and-by-the-way admonition" width="100%"><tr><td> +<p class="admonition-title"><b>And, by the way...</b></p> +<p>You can make up your own admonition too.</p> +</td></tr> +</table></blockquote> </div> <div class="section"> -<h1><a id="literal-blocks" name="literal-blocks">Literal Blocks</a></h1> -<p>Literal blocks are indicated with a double-colon ("::") at the end of -the preceding paragraph (over there <tt class="docutils literal"><span class="pre">--></span></tt>). They can be indented:</p> -<blockquote><pre class="literal-block"> -if literal_block: - text = 'is left as-is' - spaces_and_linebreaks = 'are preserved' - markup_processing = None +<h3><a class="toc-backref" href="#id75" id="topics-sidebars-and-rubrics" name="topics-sidebars-and-rubrics">2.14.4 Topics, Sidebars, and Rubrics</a></h3> +<div class="sidebar"> +<p class="first sidebar-title">Sidebar Title</p> +<p class="sidebar-subtitle">Optional Subtitle</p> +<p>This is a sidebar. It is for text outside the flow of the main +text.</p> +<p class="rubric">This is a rubric inside a sidebar</p> +<p class="last">Sidebars often appears beside the main text with a border and +background color.</p> +</div> +<div class="topic"> +<p class="topic-title first">Topic Title</p> +<p>This is a topic.</p> +</div> +<p class="rubric">This is a rubric</p> +</div> +<div class="section"> +<h3><a class="toc-backref" href="#id76" id="target-footnotes" name="target-footnotes">2.14.5 Target Footnotes</a></h3> +<table class="docutils footnote" frame="void" id="id25" rules="none"> +<colgroup><col class="label" /><col /></colgroup> +<tbody> +<tr valign="top"><td class="label"><a name="id25">[5]</a></td><td><em>(<a class="fn-backref" href="#id26">1</a>, <a class="fn-backref" href="#id27">2</a>, <a class="fn-backref" href="#id28">3</a>, <a class="fn-backref" href="#id29">4</a>)</em> <a class="reference" href="http://www.python.org/">http://www.python.org/</a></td></tr> +</tbody> +</table> +<table class="docutils footnote" frame="void" id="id30" rules="none"> +<colgroup><col class="label" /><col /></colgroup> +<tbody> +<tr valign="top"><td class="label"><a class="fn-backref" href="#id31" name="id30">[6]</a></td><td><a class="reference" href="http://docutils.sourceforge.net/">http://docutils.sourceforge.net/</a></td></tr> +</tbody> +</table> +</div> +<div class="section"> +<h3><a class="toc-backref" href="#id77" id="replacement-text" name="replacement-text">2.14.6 Replacement Text</a></h3> +<p>I recommend you try <a class="reference" href="http://www.python.org/">Python, <em>the</em> best language around</a> <a class="footnote-reference" href="#id25" id="id28" name="id28">[5]</a>.</p> +</div> +<div class="section"> +<h3><a class="toc-backref" href="#id78" id="compound-paragraph" name="compound-paragraph">2.14.7 Compound Paragraph</a></h3> +<div class="some-class compound"> +<p class="compound-first">Compound 1, paragraph 1.</p> +<p class="compound-middle">Compound 1, paragraph 2.</p> +<ul class="compound-last simple"> +<li>Compound 1, list item one.</li> +<li>Compound 1, list item two.</li> +</ul> +</div> +<p>Another compound statement:</p> +<div class="compound"> +<p class="compound-first">Compound 2, a literal block:</p> +<blockquote class="compound-middle"><pre class="compound-middle literal-block"> +Compound 2, literal. </pre></blockquote> -<p>Or they can be quoted without indentation:</p> +<p class="compound-last">Compound 2, this is a test.</p> +</div> +<div class="compound"> +<p>Compound 3, only consisting of one paragraph.</p> +</div> +<div class="compound"> +<blockquote class="compound-first"><pre class="compound-first literal-block"> +Compound 4. +This one starts with a literal block. +</pre></blockquote> +<p class="compound-last">Compound 4, a paragraph.</p> +</div> +<p>Now something <em>really</em> perverted -- a nested compound block. This is +just to test that it works at all; the results don't have to be +meaningful.</p> +<div class="compound"> +<p class="compound-first">Compound 5, block 1 (a paragraph).</p> +<div class="compound-middle compound"> +<p class="compound-first">Compound 6, block 2 in compound 5.</p> +<p class="compound-last">Compound 6, another paragraph.</p> +</div> +<p class="compound-last">Compound 5, block 3 (a paragraph).</p> +</div> +<div class="compound"> +<p class="compound-first">Compound 7, with a table inside:</p> +<table border="1" class="compound-middle docutils"> +<colgroup> +<col width="33%" /> +<col width="33%" /> +<col width="33%" /> +</colgroup> +<tbody valign="top"> +<tr><td><p class="first">Left cell, first +paragraph.</p> +<p class="last">Left cell, second +paragraph.</p> +</td> +<td>Middle cell, +consisting of +exactly one +paragraph.</td> +<td><p class="first">Right cell.</p> +<p>Paragraph 2.</p> +<p class="last">Paragraph 3.</p> +</td> +</tr> +</tbody> +</table> +<p class="compound-middle">Compound 7, a paragraph after the table.</p> +<p class="compound-last">Compound 7, another paragraph.</p> +</div> +</div> +<div class="section"> +<h3><a class="toc-backref" href="#id79" id="parsed-literal-blocks" name="parsed-literal-blocks">2.14.8 Parsed Literal Blocks</a></h3> <blockquote><pre class="literal-block"> ->> Great idea! -> -> Why didn't I think of that? +This is a parsed literal block. + This line is indented. The next line is blank. + +Inline markup is supported, e.g. <em>emphasis</em>, <strong>strong</strong>, <tt class="docutils literal"><span class="pre">literal</span> +<span class="pre">text</span></tt>, footnotes <a class="footnote-reference" href="#id8" id="id21" name="id21">[1]</a>, <span class="target" id="id22">targets</span>, and <a class="reference" href="http://www.python.org/">references</a>. </pre></blockquote> -<p>this link should <font class="problematic" color="red" id="id2"><a href="#id1">`trigger a system message`_</a></font> as it has no defined target.</p> </div> +</div> +<div class="section"> +<h2><a class="toc-backref" href="#id63" id="substitution-definitions" name="substitution-definitions">2.15 Substitution Definitions</a></h2> +<p>An inline image (<img alt="EXAMPLE" src="../../../docutils/docs/user/rst/images/biohazard.png" />) example:</p> +<p>(Substitution definitions are not visible in the HTML source.)</p> +</div> +<div class="section"> +<h2><a class="toc-backref" href="#id64" id="comments" name="comments">2.16 Comments</a></h2> +<p>Here's one:</p> +<!-- Comments begin with two dots and a space. Anything may +follow, except for the syntax of footnotes, hyperlink +targets, directives, or substitution definitions. + +Double-dashes - - "- -" - - must be escaped somehow in HTML output. + +Comments may contain non-ASCII characters: ä ö ü æ ø å --> +<p>(View the HTML source to see the comment.)</p> +</div> +<div class="section"> +<h2><a class="toc-backref" href="#id65" id="raw-text" name="raw-text">2.17 Raw text</a></h2> +<p>This does not necessarily look nice, because there may be missing white space.</p> +<p>It's just there to freeze the behavior.</p> +A test.Second test.<div class="myclass">Another test with myclass set.</div><p>This is the <span class="myrawroleclass">fourth test</span> with myrawroleclass set.</p> +Fifth test in HTML.<br />Line two.</div> +<div class="section"> +<h2><a class="toc-backref" href="#id66" id="container" name="container">2.18 Container</a></h2> +<div class="custom container"> +<p>paragraph 1</p> +<p>paragraph 2</p> +</div> +</div> +<div class="section"> +<h2><a class="toc-backref" href="#id67" id="colspanning-tables" name="colspanning-tables">2.19 Colspanning tables</a></h2> +<p>This table has a cell spanning two columns:</p> +<table border="1" class="docutils"> +<colgroup> +<col width="31%" /> +<col width="31%" /> +<col width="38%" /> +</colgroup> +<thead valign="bottom"> +<tr><th class="head" colspan="2">Inputs</th> +<th class="head">Output</th> +</tr> +<tr><th class="head">A</th> +<th class="head">B</th> +<th class="head">A or B</th> +</tr> +</thead> +<tbody valign="top"> +<tr><td>False</td> +<td>False</td> +<td>False</td> +</tr> +<tr><td>True</td> +<td>False</td> +<td>True</td> +</tr> +<tr><td>False</td> +<td>True</td> +<td>True</td> +</tr> +<tr><td>True</td> +<td>True</td> +<td>True</td> +</tr> +</tbody> +</table> +</div> +<div class="section"> +<h2><a class="toc-backref" href="#id68" id="rowspanning-tables" name="rowspanning-tables">2.20 Rowspanning tables</a></h2> +<p>Here's a table with cells spanning several rows:</p> +<table border="1" class="docutils"> +<colgroup> +<col width="44%" /> +<col width="22%" /> +<col width="33%" /> +</colgroup> +<thead valign="bottom"> +<tr><th class="head">Header row, column 1 +(header rows optional)</th> +<th class="head">Header 2</th> +<th class="head">Header 3</th> +</tr> +</thead> +<tbody valign="top"> +<tr><td>body row 1, column 1</td> +<td>column 2</td> +<td>column 3</td> +</tr> +<tr><td>body row 2</td> +<td rowspan="2">Cells may +span rows.</td> +<td rowspan="2">Another +rowspanning +cell.</td> +</tr> +<tr><td>body row 3</td> +</tr> +</tbody> +</table> +</div> +<div class="section"> +<h2><a class="toc-backref" href="#id69" id="complex-tables" name="complex-tables">2.21 Complex tables</a></h2> +<p>Here's a complex table, which should test all features.</p> +<table border="1" class="docutils"> +<colgroup> +<col width="43%" /> +<col width="21%" /> +<col width="18%" /> +<col width="18%" /> +</colgroup> +<thead valign="bottom"> +<tr><th class="head">Header row, column 1 +(header rows optional)</th> +<th class="head">Header 2</th> +<th class="head">Header 3</th> +<th class="head">Header 4</th> +</tr> +</thead> +<tbody valign="top"> +<tr><td>body row 1, column 1</td> +<td>column 2</td> +<td>column 3</td> +<td>column 4</td> +</tr> +<tr><td>body row 2</td> +<td colspan="3">Cells may span columns.</td> +</tr> +<tr><td>body row 3</td> +<td rowspan="2"><p class="first">Cells may +span rows.</p> +<p class="last">Paragraph.</p> +</td> +<td colspan="2" rowspan="2"><ul class="first last simple"> +<li>Table cells</li> +<li>contain</li> +<li>body elements.</li> +</ul> +</td> +</tr> +<tr><td>body row 4</td> +</tr> +<tr><td>body row 5</td> +<td colspan="2">Cells may also be +empty: <tt class="docutils literal"><span class="pre">--></span></tt></td> +<td> </td> +</tr> +</tbody> +</table> +</div> +<div class="section"> +<h2><a class="toc-backref" href="#id70" id="list-tables" name="list-tables">2.22 List Tables</a></h2> +<p>Here's a list table exercising all features:</p> +<table border="1" class="test docutils"> +<caption>list table with integral header</caption> +<colgroup> +<col width="17%" /> +<col width="33%" /> +<col width="50%" /> +</colgroup> +<thead valign="bottom"> +<tr><th class="head stub">Treat</th> +<th class="head">Quantity</th> +<th class="head">Description</th> +</tr> +</thead> +<tbody valign="top"> +<tr><th class="stub">Albatross</th> +<td>2.99</td> +<td>On a stick!</td> +</tr> +<tr><th class="stub">Crunchy Frog</th> +<td>1.49</td> +<td>If we took the bones out, it wouldn't be +crunchy, now would it?</td> +</tr> +<tr><th class="stub">Gannet Ripple</th> +<td>1.99</td> +<td>On a stick!</td> +</tr> +</tbody> +</table> +</div> +<div class="section"> +<h2><a class="toc-backref" href="#id71" id="custom-roles" name="custom-roles">2.23 Custom Roles</a></h2> +<ul> +<li><p class="first">A role based on an existing role.</p> +<p><tt class="custom docutils literal"><span class="pre">one</span></tt> <tt class="custom docutils literal"><span class="pre">two</span></tt> <tt class="custom docutils literal"><span class="pre">three</span></tt></p> +</li> +<li><p class="first">A new role.</p> +<p><span class="customnew">one two three</span></p> +</li> +<li><p class="first">A role with class attribute.</p> +<p><span class="special">interpreted text</span></p> +</li> +<li><p class="first">A role with class attribute.</p> +<p><span class="very special">interpreted text</span></p> +</li> +</ul> +</div> +</div> <div class="system-messages section"> <h1 align="center" class="system-messages"><font color="red">Docutils System Messages</font></h1> -<blockquote class="admonition" id="id1"><table border="1" class="admonition" id="id1" width="100%"><tr><td> -<p class="system-message-title"><font color=red> System Message: ERROR/3 (<tt class="docutils"><string></tt>, line 65); <em><a href="#id2">backlink</a></em></font></p> -Unknown target name: "trigger a system message".</td></tr> +<blockquote class="admonition" id="id23"><table border="1" class="admonition" id="id23" width="100%"><tr><td> +<p class="system-message-title"><font color=red> System Message: ERROR/3 (<tt class="docutils"><string></tt>, line 98); <em><a href="#id24">backlink</a></em></font></p> +Undefined substitution referenced: "problematic".</td></tr> </table></blockquote> +<blockquote class="admonition" id="id80"><table border="1" class="admonition" id="id80" width="100%"><tr><td> +<p class="system-message-title"><font color=red> System Message: ERROR/3 (<tt class="docutils"><string></tt>, line 356); <em><a href="#id81">backlink</a></em></font></p> +Unknown target name: "5".</td></tr> +</table></blockquote> +<blockquote class="admonition" id="id82"><table border="1" class="admonition" id="id82" width="100%"><tr><td> +<p class="system-message-title"><font color=red> System Message: ERROR/3 (<tt class="docutils"><string></tt>, line 365); <em><a href="#id83">backlink</a></em></font></p> +Unknown target name: "nonexistent".</td></tr> +</table></blockquote> +<blockquote class="admonition" id="id84"><table border="1" class="admonition" id="id84" width="100%"><tr><td> +<p class="system-message-title"><font color=red> System Message: ERROR/3 (<tt class="docutils"><string></tt>, line 392); <em><a href="#id85">backlink</a></em></font></p> +Unknown target name: "hyperlink reference without a target".</td></tr> +</table></blockquote> +<blockquote class="admonition" id="id86"><table border="1" class="admonition" id="id86" width="100%"><tr><td> +<p class="system-message-title"><font color=red> System Message: ERROR/3 (<tt class="docutils"><string></tt>, line 405); <em><a href="#id87">backlink</a></em></font></p> +Duplicate target name, cannot be used as a unique reference: "duplicate target names".</td></tr> +</table></blockquote> </div> </div> <div class="footer"> <hr class="footer" /> -Generated on: 2007-06-18. +<p>Document footer</p> +<p>Generated on: 2007-06-28. +</p> </div> </body> Deleted: trunk/sandbox/html4trans/data/sample-text.txt Deleted: trunk/sandbox/html4trans/data/standalone_rst_html4trans.html Deleted: trunk/sandbox/html4trans/rst2html_trans.py Added: trunk/sandbox/html4trans/tools/check_html4trans.py =================================================================== --- trunk/sandbox/html4trans/tools/check_html4trans.py 2007-06-28 15:12:53 UTC (rev 5303) +++ trunk/sandbox/html4trans/tools/check_html4trans.py 2007-06-28 15:42:01 UTC (rev 5304) @@ -0,0 +1,125 @@ +#!/usr/bin/env python + +# :Author: Guenter Milde +# :Contact: milde users.berlios.de +# :Revision: $Revision$ +# :Date: $Date$ +# :Copyright: Licensed under the Academic Free License version 1.2 +# +# :: + +""" +Test script for the "html4trans" writer + +This is no unit test but a script for interactive checking and modifying +to get a picture of the working +""" + +import sys, os.path + +from docutils.core import publish_string, publish_file + +# Prepend parent dir to the PYTHONPATH and import writer module:: + +sys.path.insert(0, os.path.dirname(os.path.dirname(__file__))) +from html4trans import Writer + +# Import some rst syntax samples +import textsamples + + +# Customisable Settings +# ===================== +# +# Customise by (un)commenting appropriate lines + +# Quick test samples +# ------------------ +# :: + +internal_samples = [ + textsamples.title, + textsamples.bibliographic_list, + textsamples.table_of_contents, + #textsamples.admonitions, + textsamples.literal_block, + textsamples.line_block, + textsamples.table, + #textsamples.system_message + ] + +# Samples from the docutils svn data +# ---------------------------------- +# :: + +syntax_samples_dir = '../../../docutils/test/functional/input/' + +syntax_sample_files = ['data/standard.txt', + 'data/header_footer.txt', + 'data/table_colspan.txt', + 'data/table_rowspan.txt', + 'data/table_complex.txt', + 'data/list_table.txt', + 'data/custom_roles.txt', + #'data/errors.txt' + ] + +# read coice of syntax samples +syntax_samples = [open(syntax_samples_dir+samplefile).read() + for samplefile in syntax_sample_files] + + +# Quick test or full text +# ----------------------- +# :: + +#samples = internal_samples # quick test of some selected samples +samples = syntax_samples # (takes longer, includes intended errors) + +# Configuration settings +# ---------------------- + +# no CSS stylesheet needed, so do not include (referencing does not harm) +# :: + +overrides = {'embed_stylesheet': False} + +# Path of output file +# ------------------- +# :: + +outpath = "../data/html4trans-sample.html" + +# Convert and Print +# ================= + +# Join samples to string:: + +sample_string = '\n'.join(samples) + +# Document tree (as pseudoxml rendering) for comparision:: + +## Uncomment to activate: +# doctree = publish_string(sample_string, writer_name="pseudoxml") +# print doctree + +# Convert to LaTeX:: + +output = publish_string(sample_string, + settings_overrides=overrides, + writer=Writer()) + +# Replace image links:: + +output = output.replace('../../../docs/user/rst/images/', + '../../../docutils/docs/user/rst/images/') + +# Print and save:: + +print output + +outfile = open(outpath, 'w') +outfile.write(output) + + + Property changes on: trunk/sandbox/html4trans/tools/check_html4trans.py ___________________________________________________________________ Name: svn:executable + * Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Deleted: trunk/sandbox/html4trans/tools/fix_image_links.py Added: trunk/sandbox/html4trans/tools/rst2html_trans.py =================================================================== --- trunk/sandbox/html4trans/tools/rst2html_trans.py 2007-06-28 15:12:5... [truncated message content] |