summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgoodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2017-10-20 20:53:47 +0000
committergoodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2017-10-20 20:53:47 +0000
commitf3b2eab157e28d304906a4b5b48ff4b6a02342f2 (patch)
tree13a350cd98159556a86ba97c6584c16db03b278c
parent457192bad92591e965f0ebf8918a4fac9a350998 (diff)
downloaddocutils-f3b2eab157e28d304906a4b5b48ff4b6a02342f2.tar.gz
Fix bug #331: fixed the "trim" options of the "unicode" directive.
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@8188 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
-rw-r--r--docutils/HISTORY.txt4
-rw-r--r--docutils/RELEASE-NOTES.txt2
-rw-r--r--docutils/docutils/transforms/references.py6
-rw-r--r--docutils/test/functional/expected/standalone_rst_docutils_xml.xml33
-rw-r--r--docutils/test/functional/expected/standalone_rst_html4css1.html12
-rw-r--r--docutils/test/functional/expected/standalone_rst_html5.html12
-rw-r--r--docutils/test/functional/expected/standalone_rst_latex.tex13
-rw-r--r--docutils/test/functional/expected/standalone_rst_pseudoxml.txt40
-rw-r--r--docutils/test/functional/expected/standalone_rst_xetex.tex13
-rw-r--r--docutils/test/functional/input/data/standard.txt8
10 files changed, 89 insertions, 54 deletions
diff --git a/docutils/HISTORY.txt b/docutils/HISTORY.txt
index 171eb17ba..81ba6d332 100644
--- a/docutils/HISTORY.txt
+++ b/docutils/HISTORY.txt
@@ -42,6 +42,10 @@ Changes Since 0.14
- Add field name as class argument to generic docinfo fields unconditionally.
+* docutils/transforms/references.py
+
+ - Fix bug #331: fixed the "trim" options of the "unicode" directive.
+
* docutils/writers/html5_polyglot/
- automatically add HTML5-compatible meta tags for docinfo items
diff --git a/docutils/RELEASE-NOTES.txt b/docutils/RELEASE-NOTES.txt
index c851c7ede..f2cf3b122 100644
--- a/docutils/RELEASE-NOTES.txt
+++ b/docutils/RELEASE-NOTES.txt
@@ -54,6 +54,8 @@ Release 0.15b.dev
- Allow embedded colons in field list field names (before, tokens like
``:this:example:`` were considered ordinary text).
+ - Fixed a bug with the "trim" options of the "unicode" directive.
+
Release 0.14 (2017-08-03)
=========================
diff --git a/docutils/docutils/transforms/references.py b/docutils/docutils/transforms/references.py
index 5e9ea9686..cadf9d6da 100644
--- a/docutils/docutils/transforms/references.py
+++ b/docutils/docutils/transforms/references.py
@@ -692,14 +692,12 @@ class Substitutions(Transform):
or 'trim' in subdef.attributes):
if index > 0 and isinstance(parent[index - 1],
nodes.Text):
- parent.replace(parent[index - 1],
- parent[index - 1].rstrip())
+ parent[index - 1] = parent[index - 1].rstrip()
if ('rtrim' in subdef.attributes
or 'trim' in subdef.attributes):
if (len(parent) > index + 1
and isinstance(parent[index + 1], nodes.Text)):
- parent.replace(parent[index + 1],
- parent[index + 1].lstrip())
+ parent[index + 1] = parent[index + 1].lstrip()
subdef_copy = subdef.deepcopy()
try:
# Take care of nested substitution references:
diff --git a/docutils/test/functional/expected/standalone_rst_docutils_xml.xml b/docutils/test/functional/expected/standalone_rst_docutils_xml.xml
index 3d33fc95f..80cca7929 100644
--- a/docutils/test/functional/expected/standalone_rst_docutils_xml.xml
+++ b/docutils/test/functional/expected/standalone_rst_docutils_xml.xml
@@ -236,7 +236,8 @@ They are transformed from section titles after parsing.</comment>
references</reference> <footnote_reference auto="1" ids="id31" refid="id25">5</footnote_reference> (<reference anonymous="1" name="a second reference" refuri="http://docutils.sourceforge.net/">a second reference</reference> <footnote_reference auto="1" ids="id33" refid="id32">7</footnote_reference>), footnote references (manually
numbered <footnote_reference ids="id1" refid="id8">1</footnote_reference>, anonymous auto-numbered <footnote_reference auto="1" ids="id2" refid="id12">3</footnote_reference>, labeled auto-numbered
<footnote_reference auto="1" ids="id3" refid="label">2</footnote_reference>, or symbolic <footnote_reference auto="*" ids="id4" refid="id13">*</footnote_reference>), citation references (<citation_reference ids="id5" refid="cit2002">CIT2002</citation_reference>),
- substitution references (<image alt="EXAMPLE" uri="../../../docs/user/rst/images/biohazard.png"></image>), and <target ids="inline-hyperlink-targets" names="inline\ hyperlink\ targets">inline hyperlink targets</target>
+ substitution references (<image alt="EXAMPLE" uri="../../../docs/user/rst/images/biohazard.png"></image> &amp;
+ a <emphasis>trimmed heart</emphasis> <literal>(U+2665):</literal>♥), and <target ids="inline-hyperlink-targets" names="inline\ hyperlink\ targets">inline hyperlink targets</target>
(see <reference name="Targets" refid="targets">Targets</reference> below for a reference back to here). Character-level
inline markup is also possible (although exceedingly ugly!) in <emphasis>re</emphasis><literal>Structured</literal><emphasis>Text</emphasis>. Problems are indicated by <problematic ids="id24" refid="id23">|problematic|</problematic> text
(generated by processing errors; this one is intentional). Here is a
@@ -738,7 +739,7 @@ Python-specific usage examples; begun with "&gt;&gt;&gt;"
</section>
<section dupnames="duplicate\ target\ names" ids="id21">
<title auto="1" refid="id54"><generated classes="sectnum">2.13.2   </generated>Duplicate Target Names</title>
- <system_message backrefs="id21" level="1" line="438" source="functional/input/data/standard.txt" type="INFO">
+ <system_message backrefs="id21" level="1" line="439" source="functional/input/data/standard.txt" type="INFO">
<paragraph>Duplicate implicit target name: "duplicate target names".</paragraph>
</system_message>
<paragraph>Since there are two "Duplicate Target Names" section headers, we
@@ -1343,6 +1344,8 @@ footnotes <footnote_reference ids="id22" refid="id8">1</footnote_reference>, <ta
<title auto="1" refid="id65"><generated classes="sectnum">2.15   </generated>Substitution Definitions</title>
<paragraph>An inline image (<image alt="EXAMPLE" uri="../../../docs/user/rst/images/biohazard.png"></image>) example:</paragraph>
<substitution_definition names="EXAMPLE"><image alt="EXAMPLE" uri="../../../docs/user/rst/images/biohazard.png"></image></substitution_definition>
+ <paragraph>A Unicode example:</paragraph>
+ <substitution_definition ltrim="1" names="heart" rtrim="1">♥</substitution_definition>
<paragraph>(Substitution definitions are not visible in the HTML source.)</paragraph>
</section>
<section ids="comments" names="comments">
@@ -1709,43 +1712,43 @@ Comments may contain non-ASCII characters: ä ö ü æ ø å</comment>
<system_message backrefs="id24" ids="id23" level="3" line="104" source="functional/input/data/standard.txt" type="ERROR">
<paragraph>Undefined substitution referenced: "problematic".</paragraph>
</system_message>
- <system_message backrefs="id17" ids="id83" level="3" line="391" source="functional/input/data/standard.txt" type="ERROR">
+ <system_message backrefs="id17" ids="id83" level="3" line="392" source="functional/input/data/standard.txt" type="ERROR">
<paragraph>Unknown target name: "5".</paragraph>
</system_message>
- <system_message backrefs="id19" ids="id84" level="3" line="400" source="functional/input/data/standard.txt" type="ERROR">
+ <system_message backrefs="id19" ids="id84" level="3" line="401" source="functional/input/data/standard.txt" type="ERROR">
<paragraph>Unknown target name: "nonexistent".</paragraph>
</system_message>
- <system_message backrefs="id86" ids="id85" level="3" line="427" source="functional/input/data/standard.txt" type="ERROR">
+ <system_message backrefs="id86" ids="id85" level="3" line="428" source="functional/input/data/standard.txt" type="ERROR">
<paragraph>Unknown target name: "hyperlink reference without a target".</paragraph>
</system_message>
- <system_message backrefs="id88" ids="id87" level="3" line="440" source="functional/input/data/standard.txt" type="ERROR">
+ <system_message backrefs="id88" ids="id87" level="3" line="441" source="functional/input/data/standard.txt" type="ERROR">
<paragraph>Duplicate target name, cannot be used as a unique reference: "duplicate target names".</paragraph>
</system_message>
- <system_message level="1" line="163" source="functional/input/data/standard.txt" type="INFO">
+ <system_message level="1" line="164" source="functional/input/data/standard.txt" type="INFO">
<paragraph>Hyperlink target "target" is not referenced.</paragraph>
</system_message>
- <system_message level="1" line="405" source="functional/input/data/standard.txt" type="INFO">
+ <system_message level="1" line="406" source="functional/input/data/standard.txt" type="INFO">
<paragraph>Hyperlink target "another-target" is not referenced.</paragraph>
</system_message>
- <system_message level="1" line="473" source="functional/input/data/standard.txt" type="INFO">
+ <system_message level="1" line="474" source="functional/input/data/standard.txt" type="INFO">
<paragraph>Hyperlink target "image-target-1" is not referenced.</paragraph>
</system_message>
- <system_message level="1" line="474" source="functional/input/data/standard.txt" type="INFO">
+ <system_message level="1" line="475" source="functional/input/data/standard.txt" type="INFO">
<paragraph>Hyperlink target "image-target-2" is not referenced.</paragraph>
</system_message>
- <system_message level="1" line="475" source="functional/input/data/standard.txt" type="INFO">
+ <system_message level="1" line="476" source="functional/input/data/standard.txt" type="INFO">
<paragraph>Hyperlink target "image-target-3" is not referenced.</paragraph>
</system_message>
- <system_message level="1" line="639" source="functional/input/data/standard.txt" type="INFO">
+ <system_message level="1" line="640" source="functional/input/data/standard.txt" type="INFO">
<paragraph>Hyperlink target "target1" is not referenced.</paragraph>
</system_message>
- <system_message level="1" line="640" source="functional/input/data/standard.txt" type="INFO">
+ <system_message level="1" line="641" source="functional/input/data/standard.txt" type="INFO">
<paragraph>Hyperlink target "target2" is not referenced.</paragraph>
</system_message>
- <system_message level="1" line="685" source="functional/input/data/standard.txt" type="INFO">
+ <system_message level="1" line="686" source="functional/input/data/standard.txt" type="INFO">
<paragraph>Hyperlink target "docutils" is not referenced.</paragraph>
</system_message>
- <system_message level="1" line="851" source="functional/input/data/standard.txt" type="INFO">
+ <system_message level="1" line="852" source="functional/input/data/standard.txt" type="INFO">
<paragraph>Hyperlink target "hyperlink targets" is not referenced.</paragraph>
</system_message>
</section>
diff --git a/docutils/test/functional/expected/standalone_rst_html4css1.html b/docutils/test/functional/expected/standalone_rst_html4css1.html
index 4d66cff28..8e1229b98 100644
--- a/docutils/test/functional/expected/standalone_rst_html4css1.html
+++ b/docutils/test/functional/expected/standalone_rst_html4css1.html
@@ -176,7 +176,8 @@ cross-references (<a class="reference internal" href="#example">example</a>), ex
references</a> <a class="footnote-reference" href="#id25" id="id31">[5]</a> (<a class="reference external" href="http://docutils.sourceforge.net/">a second reference</a> <a class="footnote-reference" href="#id32" id="id33">[7]</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>
+substitution references (<img alt="EXAMPLE" src="../../../docs/user/rst/images/biohazard.png" /> &amp;
+a <em>trimmed heart</em> <tt class="docutils literal">(U+2665):</tt>♥), 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="docutils 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
@@ -1019,6 +1020,7 @@ as a code block, here the rst file <tt class="docutils literal">header_footer.tx
<div class="section" id="substitution-definitions">
<h2><a class="toc-backref" href="#id65">2.15&nbsp;&nbsp;&nbsp;Substitution Definitions</a></h2>
<p>An inline image (<img alt="EXAMPLE" src="../../../docs/user/rst/images/biohazard.png" />) example:</p>
+<p>A Unicode example:</p>
<p>(Substitution definitions are not visible in the HTML source.)</p>
</div>
<div class="section" id="comments">
@@ -1365,16 +1367,16 @@ section, &quot;Docutils System Messages&quot;:</p>
<p class="system-message-title">System Message: ERROR/3 (<tt class="docutils">functional/input/data/standard.txt</tt>, line 104); <em><a href="#id24">backlink</a></em></p>
Undefined substitution referenced: &quot;problematic&quot;.</div>
<div class="system-message" id="id86">
-<p class="system-message-title">System Message: ERROR/3 (<tt class="docutils">functional/input/data/standard.txt</tt>, line 391); <em><a href="#id17">backlink</a></em></p>
+<p class="system-message-title">System Message: ERROR/3 (<tt class="docutils">functional/input/data/standard.txt</tt>, line 392); <em><a href="#id17">backlink</a></em></p>
Unknown target name: &quot;5&quot;.</div>
<div class="system-message" id="id87">
-<p class="system-message-title">System Message: ERROR/3 (<tt class="docutils">functional/input/data/standard.txt</tt>, line 400); <em><a href="#id19">backlink</a></em></p>
+<p class="system-message-title">System Message: ERROR/3 (<tt class="docutils">functional/input/data/standard.txt</tt>, line 401); <em><a href="#id19">backlink</a></em></p>
Unknown target name: &quot;nonexistent&quot;.</div>
<div class="system-message" id="id88">
-<p class="system-message-title">System Message: ERROR/3 (<tt class="docutils">functional/input/data/standard.txt</tt>, line 427); <em><a href="#id89">backlink</a></em></p>
+<p class="system-message-title">System Message: ERROR/3 (<tt class="docutils">functional/input/data/standard.txt</tt>, line 428); <em><a href="#id89">backlink</a></em></p>
Unknown target name: &quot;hyperlink reference without a target&quot;.</div>
<div class="system-message" id="id90">
-<p class="system-message-title">System Message: ERROR/3 (<tt class="docutils">functional/input/data/standard.txt</tt>, line 440); <em><a href="#id91">backlink</a></em></p>
+<p class="system-message-title">System Message: ERROR/3 (<tt class="docutils">functional/input/data/standard.txt</tt>, line 441); <em><a href="#id91">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_html5.html b/docutils/test/functional/expected/standalone_rst_html5.html
index 2419ab67f..a3dd7a08e 100644
--- a/docutils/test/functional/expected/standalone_rst_html5.html
+++ b/docutils/test/functional/expected/standalone_rst_html5.html
@@ -194,7 +194,8 @@ cross-references (<a class="reference internal" href="#example">example</a>), ex
references</a> <a class="footnote-reference brackets" href="#id25" id="id35">5</a> (<a class="reference external" href="http://docutils.sourceforge.net/">a second reference</a> <a class="footnote-reference brackets" href="#id36" id="id37">9</a>), footnote references (manually
numbered <a class="footnote-reference brackets" href="#id8" id="id1">1</a>, anonymous auto-numbered <a class="footnote-reference brackets" href="#id12" id="id2">3</a>, labeled auto-numbered
<a class="footnote-reference brackets" href="#label" id="id3">2</a>, or symbolic <a class="footnote-reference brackets" href="#id13" id="id4">*</a>), citation references (<a class="citation-reference" href="#cit2002" id="id5">[CIT2002]</a>),
-substitution references (<img alt="EXAMPLE" src="../../../docs/user/rst/images/biohazard.png" />), and <span class="target" id="inline-hyperlink-targets">inline hyperlink targets</span>
+substitution references (<img alt="EXAMPLE" src="../../../docs/user/rst/images/biohazard.png" /> &amp;
+a <em>trimmed heart</em> <span class="docutils literal">(U+2665):</span>♥), and <span class="target" id="inline-hyperlink-targets">inline hyperlink targets</span>
(see <a class="reference internal" href="#targets">Targets</a> below for a reference back to here). Character-level
inline markup is also possible (although exceedingly ugly!) in <em>re</em><span class="docutils literal">Structured</span><em>Text</em>. Problems are indicated by <a href="#id23"><span class="problematic" id="id24">|problematic|</span></a> text
(generated by processing errors; this one is intentional). Here is a
@@ -989,6 +990,7 @@ as a code block, here the rst file <span class="docutils literal">header_footer.
<div class="section" id="substitution-definitions">
<h2><a class="toc-backref" href="#id69"><span class="sectnum">2.15</span> Substitution Definitions</a></h2>
<p>An inline image (<img alt="EXAMPLE" src="../../../docs/user/rst/images/biohazard.png" />) example:</p>
+<p>A Unicode example:</p>
<p>(Substitution definitions are not visible in the HTML source.)</p>
</div>
<div class="section" id="comments">
@@ -1546,19 +1548,19 @@ section, &quot;Docutils System Messages&quot;:</p>
<p>Undefined substitution referenced: &quot;problematic&quot;.</p>
</div>
<div class="system-message" id="id96">
-<p class="system-message-title">System Message: ERROR/3 (<span class="docutils literal">functional/input/data/standard.txt</span>, line 391); <em><a href="#id17">backlink</a></em></p>
+<p class="system-message-title">System Message: ERROR/3 (<span class="docutils literal">functional/input/data/standard.txt</span>, line 392); <em><a href="#id17">backlink</a></em></p>
<p>Unknown target name: &quot;5&quot;.</p>
</div>
<div class="system-message" id="id97">
-<p class="system-message-title">System Message: ERROR/3 (<span class="docutils literal">functional/input/data/standard.txt</span>, line 400); <em><a href="#id19">backlink</a></em></p>
+<p class="system-message-title">System Message: ERROR/3 (<span class="docutils literal">functional/input/data/standard.txt</span>, line 401); <em><a href="#id19">backlink</a></em></p>
<p>Unknown target name: &quot;nonexistent&quot;.</p>
</div>
<div class="system-message" id="id98">
-<p class="system-message-title">System Message: ERROR/3 (<span class="docutils literal">functional/input/data/standard.txt</span>, line 427); <em><a href="#id99">backlink</a></em></p>
+<p class="system-message-title">System Message: ERROR/3 (<span class="docutils literal">functional/input/data/standard.txt</span>, line 428); <em><a href="#id99">backlink</a></em></p>
<p>Unknown target name: &quot;hyperlink reference without a target&quot;.</p>
</div>
<div class="system-message" id="id100">
-<p class="system-message-title">System Message: ERROR/3 (<span class="docutils literal">functional/input/data/standard.txt</span>, line 440); <em><a href="#id101">backlink</a></em></p>
+<p class="system-message-title">System Message: ERROR/3 (<span class="docutils literal">functional/input/data/standard.txt</span>, line 441); <em><a href="#id101">backlink</a></em></p>
<p>Duplicate target name, cannot be used as a unique reference: &quot;duplicate target names&quot;.</p>
</div>
</div>
diff --git a/docutils/test/functional/expected/standalone_rst_latex.tex b/docutils/test/functional/expected/standalone_rst_latex.tex
index b35b5f04f..46467fe48 100644
--- a/docutils/test/functional/expected/standalone_rst_latex.tex
+++ b/docutils/test/functional/expected/standalone_rst_latex.tex
@@ -347,7 +347,8 @@ cross-references (\hyperref[example]{example}), external hyperlinks with embedde
(\href{http://www.python.org}{Python web site}), \href{http://www.python.org/}{anonymous hyperlink
references}\DUfootnotemark{id38}{id29}{5} (\href{http://docutils.sourceforge.net/}{a second reference}\DUfootnotemark{id40}{id39}{8}), footnote references (manually
numbered\DUfootnotemark{id1}{id8}{1}, anonymous auto-numbered\DUfootnotemark{id2}{id12}{3}, labeled auto-numbered\DUfootnotemark{id3}{label}{2}, or symbolic\DUfootnotemark{id4}{id13}{*}), citation references (\hyperlink{cit2002}{[CIT2002]}),
-substitution references (\includegraphics{../../../docs/user/rst/images/biohazard.png}), and %
+substitution references (\includegraphics{../../../docs/user/rst/images/biohazard.png} \&
+a \emph{trimmed heart} \texttt{(U+2665):}\ding{170}), and %
\phantomsection\label{inline-hyperlink-targets}inline hyperlink targets
(see \hyperref[targets]{Targets} below for a reference back to here). Character-level
inline markup is also possible (although exceedingly ugly!) in \emph{re}\texttt{Structured}\emph{Text}. Problems are indicated by %
@@ -1480,6 +1481,8 @@ as a code block, here the rst file \texttt{header\_footer.txt} with line numbers
An inline image (\includegraphics{../../../docs/user/rst/images/biohazard.png}) example:
+A Unicode example:
+
(Substitution definitions are not visible in the HTML source.)
@@ -2876,7 +2879,7 @@ Undefined substitution referenced: \textquotedbl{}problematic\textquotedbl{}.
\DUtitle[system-message]{system-message}
\raisebox{1em}{\hypertarget{id45}{}}
-{\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~391
+{\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~392
\hyperlink{id17}{
Unknown target name: \textquotedbl{}5\textquotedbl{}.
@@ -2886,7 +2889,7 @@ Unknown target name: \textquotedbl{}5\textquotedbl{}.
\DUtitle[system-message]{system-message}
\raisebox{1em}{\hypertarget{id46}{}}
-{\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~400
+{\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~401
\hyperlink{id19}{
Unknown target name: \textquotedbl{}nonexistent\textquotedbl{}.
@@ -2896,7 +2899,7 @@ Unknown target name: \textquotedbl{}nonexistent\textquotedbl{}.
\DUtitle[system-message]{system-message}
\raisebox{1em}{\hypertarget{id47}{}}
-{\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~427
+{\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~428
\hyperlink{id48}{
Unknown target name: \textquotedbl{}hyperlink reference without a target\textquotedbl{}.
@@ -2906,7 +2909,7 @@ Unknown target name: \textquotedbl{}hyperlink reference without a target\textquo
\DUtitle[system-message]{system-message}
\raisebox{1em}{\hypertarget{id49}{}}
-{\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~440
+{\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~441
\hyperlink{id50}{
Duplicate target name, cannot be used as a unique reference: \textquotedbl{}duplicate target names\textquotedbl{}.
diff --git a/docutils/test/functional/expected/standalone_rst_pseudoxml.txt b/docutils/test/functional/expected/standalone_rst_pseudoxml.txt
index 4703f481c..a6887ef4f 100644
--- a/docutils/test/functional/expected/standalone_rst_pseudoxml.txt
+++ b/docutils/test/functional/expected/standalone_rst_pseudoxml.txt
@@ -450,6 +450,14 @@
),
substitution references (
<image alt="EXAMPLE" uri="../../../docs/user/rst/images/biohazard.png">
+ &
+ a
+ <emphasis>
+ trimmed heart
+
+ <literal>
+ (U+2665):
+ ♥
), and
<target ids="inline-hyperlink-targets" names="inline\ hyperlink\ targets">
inline hyperlink targets
@@ -1132,7 +1140,7 @@
<generated classes="sectnum">
2.13.2   
Duplicate Target Names
- <system_message backrefs="id21" level="1" line="438" source="functional/input/data/standard.txt" type="INFO">
+ <system_message backrefs="id21" level="1" line="439" source="functional/input/data/standard.txt" type="INFO">
<paragraph>
Duplicate implicit target name: "duplicate target names".
<paragraph>
@@ -1944,6 +1952,10 @@
<substitution_definition names="EXAMPLE">
<image alt="EXAMPLE" uri="../../../docs/user/rst/images/biohazard.png">
<paragraph>
+ A Unicode example:
+ <substitution_definition ltrim="1" names="heart" rtrim="1">
+ ♥
+ <paragraph>
(Substitution definitions are not visible in the HTML source.)
<section ids="comments" names="comments">
<title auto="1" refid="id66">
@@ -2307,42 +2319,42 @@
<system_message backrefs="id24" ids="id23" level="3" line="104" source="functional/input/data/standard.txt" type="ERROR">
<paragraph>
Undefined substitution referenced: "problematic".
- <system_message backrefs="id17" ids="id83" level="3" line="391" source="functional/input/data/standard.txt" type="ERROR">
+ <system_message backrefs="id17" ids="id83" level="3" line="392" source="functional/input/data/standard.txt" type="ERROR">
<paragraph>
Unknown target name: "5".
- <system_message backrefs="id19" ids="id84" level="3" line="400" source="functional/input/data/standard.txt" type="ERROR">
+ <system_message backrefs="id19" ids="id84" level="3" line="401" source="functional/input/data/standard.txt" type="ERROR">
<paragraph>
Unknown target name: "nonexistent".
- <system_message backrefs="id86" ids="id85" level="3" line="427" source="functional/input/data/standard.txt" type="ERROR">
+ <system_message backrefs="id86" ids="id85" level="3" line="428" source="functional/input/data/standard.txt" type="ERROR">
<paragraph>
Unknown target name: "hyperlink reference without a target".
- <system_message backrefs="id88" ids="id87" level="3" line="440" source="functional/input/data/standard.txt" type="ERROR">
+ <system_message backrefs="id88" ids="id87" level="3" line="441" source="functional/input/data/standard.txt" type="ERROR">
<paragraph>
Duplicate target name, cannot be used as a unique reference: "duplicate target names".
- <system_message level="1" line="163" source="functional/input/data/standard.txt" type="INFO">
+ <system_message level="1" line="164" source="functional/input/data/standard.txt" type="INFO">
<paragraph>
Hyperlink target "target" is not referenced.
- <system_message level="1" line="405" source="functional/input/data/standard.txt" type="INFO">
+ <system_message level="1" line="406" source="functional/input/data/standard.txt" type="INFO">
<paragraph>
Hyperlink target "another-target" is not referenced.
- <system_message level="1" line="473" source="functional/input/data/standard.txt" type="INFO">
+ <system_message level="1" line="474" source="functional/input/data/standard.txt" type="INFO">
<paragraph>
Hyperlink target "image-target-1" is not referenced.
- <system_message level="1" line="474" source="functional/input/data/standard.txt" type="INFO">
+ <system_message level="1" line="475" source="functional/input/data/standard.txt" type="INFO">
<paragraph>
Hyperlink target "image-target-2" is not referenced.
- <system_message level="1" line="475" source="functional/input/data/standard.txt" type="INFO">
+ <system_message level="1" line="476" source="functional/input/data/standard.txt" type="INFO">
<paragraph>
Hyperlink target "image-target-3" is not referenced.
- <system_message level="1" line="639" source="functional/input/data/standard.txt" type="INFO">
+ <system_message level="1" line="640" source="functional/input/data/standard.txt" type="INFO">
<paragraph>
Hyperlink target "target1" is not referenced.
- <system_message level="1" line="640" source="functional/input/data/standard.txt" type="INFO">
+ <system_message level="1" line="641" source="functional/input/data/standard.txt" type="INFO">
<paragraph>
Hyperlink target "target2" is not referenced.
- <system_message level="1" line="685" source="functional/input/data/standard.txt" type="INFO">
+ <system_message level="1" line="686" source="functional/input/data/standard.txt" type="INFO">
<paragraph>
Hyperlink target "docutils" is not referenced.
- <system_message level="1" line="851" source="functional/input/data/standard.txt" type="INFO">
+ <system_message level="1" line="852" source="functional/input/data/standard.txt" type="INFO">
<paragraph>
Hyperlink target "hyperlink targets" is not referenced.
diff --git a/docutils/test/functional/expected/standalone_rst_xetex.tex b/docutils/test/functional/expected/standalone_rst_xetex.tex
index 3f8e9f1b6..7a50bb290 100644
--- a/docutils/test/functional/expected/standalone_rst_xetex.tex
+++ b/docutils/test/functional/expected/standalone_rst_xetex.tex
@@ -349,7 +349,8 @@ cross-references (\hyperref[example]{example}), external hyperlinks with embedde
(\href{http://www.python.org}{Python web site}), \href{http://www.python.org/}{anonymous hyperlink
references}\DUfootnotemark{id40}{id29}{5} (\href{http://docutils.sourceforge.net/}{a second reference}\DUfootnotemark{id42}{id41}{9}), footnote references (manually
numbered\DUfootnotemark{id1}{id8}{1}, anonymous auto-numbered\DUfootnotemark{id2}{id12}{3}, labeled auto-numbered\DUfootnotemark{id3}{label}{2}, or symbolic\DUfootnotemark{id4}{id13}{*}), citation references (\hyperlink{cit2002}{[CIT2002]}),
-substitution references (\includegraphics{../../../docs/user/rst/images/biohazard.png}), and %
+substitution references (\includegraphics{../../../docs/user/rst/images/biohazard.png} \&
+a \emph{trimmed heart} \texttt{(U+2665):}♥), and %
\phantomsection\label{inline-hyperlink-targets}inline hyperlink targets
(see \hyperref[targets]{Targets} below for a reference back to here). Character-level
inline markup is also possible (although exceedingly ugly!) in \emph{re}\texttt{Structured}\emph{Text}. Problems are indicated by %
@@ -1486,6 +1487,8 @@ as a code block, here the rst file \texttt{header\_footer.txt} with line numbers
An inline image (\includegraphics{../../../docs/user/rst/images/biohazard.png}) example:
+A Unicode example:
+
(Substitution definitions are not visible in the HTML source.)
@@ -2894,7 +2897,7 @@ Undefined substitution referenced: \textquotedbl{}problematic\textquotedbl{}.
\DUtitle[system-message]{system-message}
\raisebox{1em}{\hypertarget{id47}{}}
-{\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~391
+{\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~392
\hyperlink{id17}{
Unknown target name: \textquotedbl{}5\textquotedbl{}.
@@ -2904,7 +2907,7 @@ Unknown target name: \textquotedbl{}5\textquotedbl{}.
\DUtitle[system-message]{system-message}
\raisebox{1em}{\hypertarget{id48}{}}
-{\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~400
+{\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~401
\hyperlink{id19}{
Unknown target name: \textquotedbl{}nonexistent\textquotedbl{}.
@@ -2914,7 +2917,7 @@ Unknown target name: \textquotedbl{}nonexistent\textquotedbl{}.
\DUtitle[system-message]{system-message}
\raisebox{1em}{\hypertarget{id49}{}}
-{\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~427
+{\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~428
\hyperlink{id50}{
Unknown target name: \textquotedbl{}hyperlink reference without a target\textquotedbl{}.
@@ -2924,7 +2927,7 @@ Unknown target name: \textquotedbl{}hyperlink reference without a target\textquo
\DUtitle[system-message]{system-message}
\raisebox{1em}{\hypertarget{id51}{}}
-{\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~440
+{\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~441
\hyperlink{id52}{
Duplicate target name, cannot be used as a unique reference: \textquotedbl{}duplicate target names\textquotedbl{}.
diff --git a/docutils/test/functional/input/data/standard.txt b/docutils/test/functional/input/data/standard.txt
index 7e2b1d7f3..8bd1d99f0 100644
--- a/docutils/test/functional/input/data/standard.txt
+++ b/docutils/test/functional/input/data/standard.txt
@@ -109,7 +109,8 @@ cross-references (example_), external hyperlinks with embedded URIs
references`__ (`a second reference`__), footnote references (manually
numbered [1]_, anonymous auto-numbered [#]_, labeled auto-numbered
[#label]_, or symbolic [*]_), citation references ([CIT2002]_),
-substitution references (|example|), and _`inline hyperlink targets`
+substitution references (|example| &
+a *trimmed heart* ``(U+2665):`` |heart|), and _`inline hyperlink targets`
(see Targets_ below for a reference back to here). Character-level
inline markup is also possible (although exceedingly ugly!) in *re*\
``Structured``\ *Text*. Problems are indicated by |problematic| text
@@ -906,6 +907,11 @@ An inline image (|example|) example:
.. |EXAMPLE| image:: ../../../docs/user/rst/images/biohazard.png
+A Unicode example:
+
+.. |heart| unicode:: 0x2665
+ :trim:
+
(Substitution definitions are not visible in the HTML source.)
Comments