summaryrefslogtreecommitdiff
path: root/docutils/test/functional
diff options
context:
space:
mode:
authorwiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2004-11-26 16:51:46 +0000
committerwiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2004-11-26 16:51:46 +0000
commitd031e95f85c0bec006dfb505dc67153f1adb8fe1 (patch)
tree577000b7f5f4e5760c9a985cc482e9ccf131a160 /docutils/test/functional
parent28502503f158e26be8ec3e759944cd4fb5001420 (diff)
downloaddocutils-d031e95f85c0bec006dfb505dc67153f1adb8fe1.tar.gz
added test for ``raw`` role and directive
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@2874 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'docutils/test/functional')
-rw-r--r--docutils/test/functional/expected/standalone_rst_html4css1.html75
-rw-r--r--docutils/test/functional/expected/standalone_rst_latex.tex21
-rw-r--r--docutils/test/functional/input/data/standard.txt35
3 files changed, 94 insertions, 37 deletions
diff --git a/docutils/test/functional/expected/standalone_rst_html4css1.html b/docutils/test/functional/expected/standalone_rst_html4css1.html
index 1e8140686..009a8f482 100644
--- a/docutils/test/functional/expected/standalone_rst_html4css1.html
+++ b/docutils/test/functional/expected/standalone_rst_html4css1.html
@@ -123,12 +123,13 @@ They are transformed from section titles after parsing. -->
</li>
<li><a class="reference" href="#substitution-definitions" id="id54" name="id54">2.15&nbsp;&nbsp;&nbsp;Substitution Definitions</a></li>
<li><a class="reference" href="#comments" id="id55" name="id55">2.16&nbsp;&nbsp;&nbsp;Comments</a></li>
-<li><a class="reference" href="#colspanning-tables" id="id56" name="id56">2.17&nbsp;&nbsp;&nbsp;Colspanning tables</a></li>
-<li><a class="reference" href="#rowspanning-tables" id="id57" name="id57">2.18&nbsp;&nbsp;&nbsp;Rowspanning tables</a></li>
-<li><a class="reference" href="#complex-tables" id="id58" name="id58">2.19&nbsp;&nbsp;&nbsp;Complex tables</a></li>
+<li><a class="reference" href="#raw-text" id="id56" name="id56">2.17&nbsp;&nbsp;&nbsp;Raw text</a></li>
+<li><a class="reference" href="#colspanning-tables" id="id57" name="id57">2.18&nbsp;&nbsp;&nbsp;Colspanning tables</a></li>
+<li><a class="reference" href="#rowspanning-tables" id="id58" name="id58">2.19&nbsp;&nbsp;&nbsp;Rowspanning tables</a></li>
+<li><a class="reference" href="#complex-tables" id="id59" name="id59">2.20&nbsp;&nbsp;&nbsp;Complex tables</a></li>
</ul>
</li>
-<li><a class="reference" href="#error-handling" id="id59" name="id59">3&nbsp;&nbsp;&nbsp;Error Handling</a></li>
+<li><a class="reference" href="#error-handling" id="id60" name="id60">3&nbsp;&nbsp;&nbsp;Error Handling</a></li>
</ul>
</div>
<div class="section" id="structural-elements">
@@ -471,7 +472,7 @@ Here's a reference to the next footnote: <a class="footnote-reference" href="#id
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a name="id13">[4]</a></td><td>Here's an unreferenced footnote, with a reference to a
-nonexistent footnote: <a href="#id67" name="id68"><span class="problematic" id="id68">[5]_</span></a>.</td></tr>
+nonexistent footnote: <a href="#id68" name="id69"><span class="problematic" id="id69">[5]_</span></a>.</td></tr>
</tbody>
</table>
</div>
@@ -484,7 +485,7 @@ nonexistent footnote: <a href="#id67" name="id68"><span class="problematic" id="
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="id15" name="id15">[CIT2002]</a>, and a <a href="#id69" name="id70"><span class="problematic" id="id70">[nonexistent]_</span></a>
+<p>Here's a reference to the above, <a class="citation-reference" href="#cit2002" id="id15" name="id15">[CIT2002]</a>, and a <a href="#id70" name="id71"><span class="problematic" id="id71">[nonexistent]_</span></a>
citation.</p>
</div>
<div class="section" id="targets">
@@ -498,7 +499,7 @@ hyperlink targets</a> are also possible.</p>
&quot;<a class="reference" href="http://www.python.org/">Python</a> <a class="footnote-reference" href="#id21" id="id23" name="id23">[5]</a>&quot;.</p>
<p>Targets may be indirect and anonymous. Thus <a class="reference" href="#targets">this phrase</a> may also
refer to the <a class="reference" href="#targets">Targets</a> section.</p>
-<p>Here's a <a href="#id71" name="id72"><span class="problematic" id="id72">`hyperlink reference without a target`_</span></a>, which generates an
+<p>Here's a <a href="#id72" name="id73"><span class="problematic" id="id73">`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="#id44" name="duplicate-target-names">2.13.1&nbsp;&nbsp;&nbsp;Duplicate Target Names</a></h3>
@@ -510,33 +511,33 @@ explicit targets will generate &quot;warning&quot; (level-2) system messages.</p
<h3><a class="toc-backref" href="#id45" name="id18">2.13.2&nbsp;&nbsp;&nbsp;Duplicate Target Names</a></h3>
<p>Since there are two &quot;Duplicate Target Names&quot; section headers, we
cannot uniquely refer to either of them by name. If we try to (like
-this: <a href="#id73" name="id74"><span class="problematic" id="id74">`Duplicate Target Names`_</span></a>), an error is generated.</p>
+this: <a href="#id74" name="id75"><span class="problematic" id="id75">`Duplicate Target Names`_</span></a>), an error is generated.</p>
</div>
</div>
<div class="section" id="directives">
<h2><a class="toc-backref" href="#id46" name="directives">2.14&nbsp;&nbsp;&nbsp;Directives</a></h2>
<div class="contents topic" id="contents">
<ul class="auto-toc simple">
-<li><a class="reference" href="#document-parts" id="id60" name="id60">2.14.1&nbsp;&nbsp;&nbsp;Document Parts</a></li>
-<li><a class="reference" href="#images" id="id61" name="id61">2.14.2&nbsp;&nbsp;&nbsp;Images</a></li>
-<li><a class="reference" href="#admonitions" id="id62" name="id62">2.14.3&nbsp;&nbsp;&nbsp;Admonitions</a></li>
-<li><a class="reference" href="#topics-sidebars-and-rubrics" id="id63" name="id63">2.14.4&nbsp;&nbsp;&nbsp;Topics, Sidebars, and Rubrics</a></li>
-<li><a class="reference" href="#target-footnotes" id="id64" name="id64">2.14.5&nbsp;&nbsp;&nbsp;Target Footnotes</a></li>
-<li><a class="reference" href="#replacement-text" id="id65" name="id65">2.14.6&nbsp;&nbsp;&nbsp;Replacement Text</a></li>
-<li><a class="reference" href="#compound-paragraph" id="id66" name="id66">2.14.7&nbsp;&nbsp;&nbsp;Compound Paragraph</a></li>
+<li><a class="reference" href="#document-parts" id="id61" name="id61">2.14.1&nbsp;&nbsp;&nbsp;Document Parts</a></li>
+<li><a class="reference" href="#images" id="id62" name="id62">2.14.2&nbsp;&nbsp;&nbsp;Images</a></li>
+<li><a class="reference" href="#admonitions" id="id63" name="id63">2.14.3&nbsp;&nbsp;&nbsp;Admonitions</a></li>
+<li><a class="reference" href="#topics-sidebars-and-rubrics" id="id64" name="id64">2.14.4&nbsp;&nbsp;&nbsp;Topics, Sidebars, and Rubrics</a></li>
+<li><a class="reference" href="#target-footnotes" id="id65" name="id65">2.14.5&nbsp;&nbsp;&nbsp;Target Footnotes</a></li>
+<li><a class="reference" href="#replacement-text" id="id66" name="id66">2.14.6&nbsp;&nbsp;&nbsp;Replacement Text</a></li>
+<li><a class="reference" href="#compound-paragraph" id="id67" name="id67">2.14.7&nbsp;&nbsp;&nbsp;Compound Paragraph</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" id="document-parts">
-<h3><a class="toc-backref" href="#id60" name="document-parts">2.14.1&nbsp;&nbsp;&nbsp;Document Parts</a></h3>
+<h3><a class="toc-backref" href="#id61" name="document-parts">2.14.1&nbsp;&nbsp;&nbsp;Document Parts</a></h3>
<p>An example of the &quot;contents&quot; 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" id="images">
-<h3><a class="toc-backref" href="#id61" name="images">2.14.2&nbsp;&nbsp;&nbsp;Images</a></h3>
+<h3><a class="toc-backref" href="#id62" name="images">2.14.2&nbsp;&nbsp;&nbsp;Images</a></h3>
<p>An image directive (also clickable -- a hyperlink reference):</p>
<p><a class="reference" href="#directives"><img alt="../../../docs/user/rst/images/title.png" src="../../../docs/user/rst/images/title.png" /></a></p>
<p>A figure directive:</p>
@@ -566,7 +567,7 @@ document (a document-wide <a class="reference" href="#table-of-contents">table o
</div>
</div>
<div class="section" id="admonitions">
-<h3><a class="toc-backref" href="#id62" name="admonitions">2.14.3&nbsp;&nbsp;&nbsp;Admonitions</a></h3>
+<h3><a class="toc-backref" href="#id63" name="admonitions">2.14.3&nbsp;&nbsp;&nbsp;Admonitions</a></h3>
<div class="attention">
<p class="first admonition-title">Attention!</p>
<p class="last">Directives at large.</p>
@@ -615,7 +616,7 @@ Reader discretion is strongly advised.</p>
</div>
</div>
<div class="section" id="topics-sidebars-and-rubrics">
-<h3><a class="toc-backref" href="#id63" name="topics-sidebars-and-rubrics">2.14.4&nbsp;&nbsp;&nbsp;Topics, Sidebars, and Rubrics</a></h3>
+<h3><a class="toc-backref" href="#id64" name="topics-sidebars-and-rubrics">2.14.4&nbsp;&nbsp;&nbsp;Topics, Sidebars, and Rubrics</a></h3>
<div class="sidebar">
<p class="first sidebar-title">Sidebar Title</p>
<p class="sidebar-subtitle">Optional Subtitle</p>
@@ -632,7 +633,7 @@ background color.</p>
<p class="rubric">This is a rubric</p>
</div>
<div class="section" id="target-footnotes">
-<h3><a class="toc-backref" href="#id64" name="target-footnotes">2.14.5&nbsp;&nbsp;&nbsp;Target Footnotes</a></h3>
+<h3><a class="toc-backref" href="#id65" name="target-footnotes">2.14.5&nbsp;&nbsp;&nbsp;Target Footnotes</a></h3>
<table class="docutils footnote" frame="void" id="id21" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
@@ -641,11 +642,11 @@ background color.</p>
</table>
</div>
<div class="section" id="replacement-text">
-<h3><a class="toc-backref" href="#id65" name="replacement-text">2.14.6&nbsp;&nbsp;&nbsp;Replacement Text</a></h3>
+<h3><a class="toc-backref" href="#id66" name="replacement-text">2.14.6&nbsp;&nbsp;&nbsp;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="#id21" id="id24" name="id24">[5]</a>.</p>
</div>
<div class="section" id="compound-paragraph">
-<h3><a class="toc-backref" href="#id66" name="compound-paragraph">2.14.7&nbsp;&nbsp;&nbsp;Compound Paragraph</a></h3>
+<h3><a class="toc-backref" href="#id67" name="compound-paragraph">2.14.7&nbsp;&nbsp;&nbsp;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>
@@ -727,8 +728,14 @@ targets, directives, or substitution definitions.
Double-dashes - - "- -" - - must be escaped somehow in HTML output. -->
<p>(View the HTML source to see the comment.)</p>
</div>
+<div class="section" id="raw-text">
+<h2><a class="toc-backref" href="#id56" name="raw-text">2.17&nbsp;&nbsp;&nbsp;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" id="colspanning-tables">
-<h2><a class="toc-backref" href="#id56" name="colspanning-tables">2.17&nbsp;&nbsp;&nbsp;Colspanning tables</a></h2>
+<h2><a class="toc-backref" href="#id57" name="colspanning-tables">2.18&nbsp;&nbsp;&nbsp;Colspanning tables</a></h2>
<p>This table has a cell spanning two columns:</p>
<table border="1" class="docutils">
<colgroup>
@@ -766,7 +773,7 @@ Double-dashes - - "- -" - - must be escaped somehow in HTML output. -->
</table>
</div>
<div class="section" id="rowspanning-tables">
-<h2><a class="toc-backref" href="#id57" name="rowspanning-tables">2.18&nbsp;&nbsp;&nbsp;Rowspanning tables</a></h2>
+<h2><a class="toc-backref" href="#id58" name="rowspanning-tables">2.19&nbsp;&nbsp;&nbsp;Rowspanning tables</a></h2>
<p>Here's a table with cells spanning several rows:</p>
<table border="1" class="docutils">
<colgroup>
@@ -802,7 +809,7 @@ span rows.</td>
</table>
</div>
<div class="section" id="complex-tables">
-<h2><a class="toc-backref" href="#id58" name="complex-tables">2.19&nbsp;&nbsp;&nbsp;Complex tables</a></h2>
+<h2><a class="toc-backref" href="#id59" name="complex-tables">2.20&nbsp;&nbsp;&nbsp;Complex tables</a></h2>
<p>Here's a complex table, which should test all features.</p>
<table border="1" class="docutils">
<colgroup>
@@ -852,7 +859,7 @@ empty: <tt class="docutils literal"><span class="pre">--&gt;</span></tt></td>
</div>
</div>
<div class="section" id="error-handling">
-<h1><a class="toc-backref" href="#id59" name="error-handling">3&nbsp;&nbsp;&nbsp;Error Handling</a></h1>
+<h1><a class="toc-backref" href="#id60" name="error-handling">3&nbsp;&nbsp;&nbsp;Error Handling</a></h1>
<p>Any errors caught during processing will generate system messages.</p>
<p>There should be five messages in the following, auto-generated
section, &quot;Docutils System Messages&quot;:</p>
@@ -863,17 +870,17 @@ section, &quot;Docutils System Messages&quot;:</p>
<div class="system-message" id="id19">
<p class="system-message-title">System Message: <a name="id19">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 94); <em><a href="#id20">backlink</a></em></p>
Undefined substitution referenced: &quot;problematic&quot;.</div>
-<div class="system-message" id="id67">
-<p class="system-message-title">System Message: <a name="id67">ERROR/3</a> (<tt class="docutils">functional/input/standalone_rst_html4css1.txt</tt>, line 348); <em><a href="#id68">backlink</a></em></p>
+<div class="system-message" id="id68">
+<p class="system-message-title">System Message: <a name="id68">ERROR/3</a> (<tt class="docutils">functional/input/standalone_rst_html4css1.txt</tt>, line 348); <em><a href="#id69">backlink</a></em></p>
Unknown target name: &quot;5&quot;.</div>
-<div class="system-message" id="id69">
-<p class="system-message-title">System Message: <a name="id69">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 357); <em><a href="#id70">backlink</a></em></p>
+<div class="system-message" id="id70">
+<p class="system-message-title">System Message: <a name="id70">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 357); <em><a href="#id71">backlink</a></em></p>
Unknown target name: &quot;nonexistent&quot;.</div>
-<div class="system-message" id="id71">
-<p class="system-message-title">System Message: <a name="id71">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 382); <em><a href="#id72">backlink</a></em></p>
+<div class="system-message" id="id72">
+<p class="system-message-title">System Message: <a name="id72">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 382); <em><a href="#id73">backlink</a></em></p>
Unknown target name: &quot;hyperlink reference without a target&quot;.</div>
-<div class="system-message" id="id73">
-<p class="system-message-title">System Message: <a name="id73">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 395); <em><a href="#id74">backlink</a></em></p>
+<div class="system-message" id="id74">
+<p class="system-message-title">System Message: <a name="id74">ERROR/3</a> (<tt class="docutils">functional/input/data/standard.txt</tt>, line 395); <em><a href="#id75">backlink</a></em></p>
Duplicate target name, cannot be used as a unique reference: &quot;duplicate target names&quot;.</div>
</div>
</div>
diff --git a/docutils/test/functional/expected/standalone_rst_latex.tex b/docutils/test/functional/expected/standalone_rst_latex.tex
index ed51f30ea..19f52406f 100644
--- a/docutils/test/functional/expected/standalone_rst_latex.tex
+++ b/docutils/test/functional/expected/standalone_rst_latex.tex
@@ -204,7 +204,9 @@ reStructuredText construct.
\item {} \href{\#comments}{2.16~~~Comments}
-\item {} \href{\#colspanning-tables}{2.17~~~Colspanning tables}
+\item {} \href{\#raw-text}{2.17~~~Raw text}
+
+\item {} \href{\#colspanning-tables}{2.18~~~Colspanning tables}
\end{list}
@@ -1153,9 +1155,22 @@ Here's one:
%___________________________________________________________________________
+\hypertarget{raw-text}{}
+\pdfbookmark[1]{2.17~~~Raw text}{raw-text}
+\subsection*{2.17~~~Raw text}
+
+This does not necessarily look nice, because there may be missing white space.
+
+It's just there to freeze the behavior.
+A test.Second test.Another test with myclass set.
+This is the fourth test with myrawroleclass set.
+Fifth test in LaTeX.\\Line two.
+
+%___________________________________________________________________________
+
\hypertarget{colspanning-tables}{}
-\pdfbookmark[1]{2.17~~~Colspanning tables}{colspanning-tables}
-\subsection*{2.17~~~Colspanning tables}
+\pdfbookmark[1]{2.18~~~Colspanning tables}{colspanning-tables}
+\subsection*{2.18~~~Colspanning tables}
This table has a cell spanning two columns:
diff --git a/docutils/test/functional/input/data/standard.txt b/docutils/test/functional/input/data/standard.txt
index a8d773242..69afbbc67 100644
--- a/docutils/test/functional/input/data/standard.txt
+++ b/docutils/test/functional/input/data/standard.txt
@@ -588,3 +588,38 @@ Here's one:
Double-dashes -- "--" -- must be escaped somehow in HTML output.
(View the HTML source to see the comment.)
+
+Raw text
+--------
+
+This does not necessarily look nice, because there may be missing white space.
+
+It's just there to freeze the behavior.
+
+.. raw:: html latex
+
+ A test.
+
+.. raw:: html latex
+
+ Second test.
+
+.. class:: myclass
+
+.. raw:: html latex
+
+ Another test with myclass set.
+
+.. role:: raw-role(raw)
+ :format: html latex
+ :class: myrawroleclass
+
+This is the :raw-role:`fourth test` with myrawroleclass set.
+
+.. raw:: html
+
+ Fifth test in HTML.<br />Line two.
+
+.. raw:: latex
+
+ Fifth test in LaTeX.\\Line two.