|
From: <mi...@us...> - 2026-07-22 20:59:27
|
Revision: 10391
http://sourceforge.net/p/docutils/code/10391
Author: milde
Date: 2026-07-22 20:59:24 +0000 (Wed, 22 Jul 2026)
Log Message:
-----------
Use `<inline>` elements for inline targets (anchors).
As all Doctree elements support "ids" and "names" attributes, there is no need
to use a `<target>` element, the generic `<inline>` is well suited.
Therefore, `<target>` elements will become "Empty Body Elements" and
use of `<target>` in inline context or with content become invalid in
Docutils 2.0.
The "rst" parser now uses `<inline>` (instead of `<target>`) elements
for "inline internal targets".
Modified Paths:
--------------
trunk/docutils/HISTORY.rst
trunk/docutils/RELEASE-NOTES.rst
trunk/docutils/docs/ref/doctree.rst
trunk/docutils/docs/ref/docutils.dtd
trunk/docutils/docs/ref/rst/restructuredtext.rst
trunk/docutils/docutils/nodes.py
trunk/docutils/docutils/parsers/rst/states.py
trunk/docutils/docutils/transforms/parts.py
trunk/docutils/docutils/transforms/references.py
trunk/docutils/docutils/writers/latex2e/__init__.py
trunk/docutils/test/functional/expected/footnote-references_latex.tex
trunk/docutils/test/functional/expected/standalone_rst_docutils_xml.xml
trunk/docutils/test/functional/expected/standalone_rst_html4css1.html
trunk/docutils/test/functional/expected/standalone_rst_html5.html
trunk/docutils/test/functional/expected/standalone_rst_pseudoxml.txt
trunk/docutils/test/test_parsers/test_rst/test_character_level_inline_markup.py
trunk/docutils/test/test_parsers/test_rst/test_inline_markup.py
trunk/docutils/test/test_parsers/test_rst/test_targets.py
trunk/docutils/test/test_readers/test_pep/test_inline_markup.py
trunk/docutils/test/test_transforms/test_contents.py
trunk/docutils/test/test_transforms/test_hyperlinks.py
trunk/docutils/test/test_transforms/test_smartquotes.py
Modified: trunk/docutils/HISTORY.rst
===================================================================
--- trunk/docutils/HISTORY.rst 2026-07-22 20:59:04 UTC (rev 10390)
+++ trunk/docutils/HISTORY.rst 2026-07-22 20:59:24 UTC (rev 10391)
@@ -56,6 +56,8 @@
- "lazy IDs":
`document.note_explicit_target()` and `document.note_anonymous_target()`
generate identifiers only if the `legacy_ids`_ setting is True.
+ - Add `Targetable` to parent classes of `inline` to allow test whether
+ inline internal targets are referenced.
* docutils/parsers/__init__.py
@@ -92,6 +94,7 @@
- Generate INFO message, if a directive that does not take
arguments has content above and below directive options.
- Ignore the "match_titles" argument of `RSTState.nested_list_parse()`.
+ - Use <inline> elements in `inline_internal_target()`.
* docutils/readers/standalone.py
@@ -107,6 +110,8 @@
- "lazy IDs": `Contents.build_contents()` ensures sections have an ID
and prefers IDs from external targets if `legacy_ids`_ is False.
+ - Clear "ids" and "names" in `ContentsFilter` so ids and names stay
+ unique when copying section title content for the ToC entry.
* docutils/transforms/references.py
@@ -121,6 +126,8 @@
- Fix anonymous hyperlinks to "clickable" images: "Propagation" of a
<target> in front of a "clickable" image now transfers "ids" and
"names" to the `<image>`, not the wrapping `<reference>`.
+ - Also check `nodes.inline` instances in `ReportUnreferencedTargets`
+ to keep reporting unreferenced inline links.
* docutils/transforms/universal.py
Modified: trunk/docutils/RELEASE-NOTES.rst
===================================================================
--- trunk/docutils/RELEASE-NOTES.rst 2026-07-22 20:59:04 UTC (rev 10390)
+++ trunk/docutils/RELEASE-NOTES.rst 2026-07-22 20:59:24 UTC (rev 10391)
@@ -46,10 +46,9 @@
Document Tree / Docutils DTD
----------------------------
-* Inline `\<target>`_ elements and <target> elements with content will be
- deprecated in Docutils 1.0 and invalid in Docutils 2.0.
- The "rst" parser will use <inline> elements for inline targets
- in Docutils 1.0.
+* Inline `\<target>`_ elements and <target> elements with content are
+ deprecated and will be invalid in Docutils 2.0. (The "rst" parser
+ uses <inline> elements for `inline targets`_ since Docutils 1.0.)
* To match the definition in the "Exchange Table Model", the
`"colwidth" attribute`_ will be stored as a `str` (instead of
@@ -207,6 +206,8 @@
- The <footnote> element's first child (<label>) is now mandatory.
- Use the ``%tbl.table.att`` parameter entity instead of ``%bodyatt``
to customize the <table> element's attribute list in Docutils 1.0.
+ - Inline `\<target>`_ elements and <target> elements with content are
+ deprecated.
Configuration changes:
- `Auto-detection`_ of the input encoding is no longer supported.
@@ -233,6 +234,7 @@
- "lazy IDs": Generate target ids_ in transforms -- after parsing and
only if required in the output document.
Keep behaviour backwards compatible with the legacy_ids_ setting.
+ - Use <inline> elements for `inline targets`_.
HTML5 writer:
- Use normal font size and colour for informal titles of type "rubric".
@@ -1616,7 +1618,6 @@
.. _"class": docs/ref/rst/directives.html#class
.. _csv-table: docs/ref/rst/directives.html#csv-table
.. _"date": docs/ref/rst/directives.html#date
-.. _doctest block: docs/ref/rst/restructuredtext.html#doctest-blocks
.. _"figure": docs/ref/rst/directives.html#figure
.. _identifier normalization:
docs/ref/rst/directives.html#identifier-normalization
@@ -1632,6 +1633,10 @@
docs/ref/rst/definitions.html#semantic-inline-markup-roles
.. _LaTeX syntax for mathematics: docs/ref/rst/mathematics.html
+.. _doctest block: docs/ref/rst/restructuredtext.html#doctest-blocks
+.. _inline targets:
+ docs/ref/rst/restructuredtext.html#inline-internal-targets
+
.. _configuration settings: docs/user/config.html
.. _auto-detection: docs/user/config.html#auto-detect
.. _auto_id_prefix: docs/user/config.html#auto-id-prefix
Modified: trunk/docutils/docs/ref/doctree.rst
===================================================================
--- trunk/docutils/docs/ref/doctree.rst 2026-07-22 20:59:04 UTC (rev 10390)
+++ trunk/docutils/docs/ref/doctree.rst 2026-07-22 20:59:24 UTC (rev 10391)
@@ -310,7 +310,7 @@
`\<footnote_reference>`_, `\<generated>`_, `\<image>`_, `\<inline>`_,
`\<literal>`_, `\<math>`_, `\<problematic>`_, `\<raw>`_, `\<reference>`_,
`\<strong>`_, `\<subscript>`_, `\<substitution_reference>`_,
- `\<superscript>`_, `\<target>`_, `\<title_reference>`_
+ `\<superscript>`_, `\<target>`_ [#inline-targets]_, `\<title_reference>`_
:Docutils class:
``nodes.Inline``
:Parameter Entities:
@@ -2316,8 +2316,8 @@
:Category: `Inline Elements`_
:Analogues: <inline> is analogous to the HTML_ <span> element and the
DocBook_ <phrase> element.
-:Processing: Writers_ typically pass the classes_ attribute to the output
- document and leave styling to the backend or a custom
+:Processing: Writers_ typically pass the classes_ and ids_ attributes to the
+ output document and leave styling to the backend or a custom
stylesheet_. They may also process the classes_ attribute
and convert the <inline> element to a specific element or
render the content distinctly for specific class values.
@@ -2346,7 +2346,10 @@
<inline classes="custom">
interpreted text
+See `\<target>`_ for an example of an <inline> element used as
+`inline target`_ (anchor).
+
<label>
=======
@@ -3238,7 +3241,7 @@
.
<paragraph>
Matching targets must exist in the document, e.g., a
- <target ids="simple" names="simple">
+ <inline ids="simple" names="simple">
simple
inline target or the explicit targets below.
<target ids="phrase-refs" names="phrase\ refs" refuri="doctree.rst">
@@ -3260,7 +3263,7 @@
.
<paragraph>
Matching targets must exist in the document, e.g., a
- <target ids="simple" names="simple">
+ <inline ids="simple" names="simple">
simple
inline target or the explicit targets below.
<target ids="phrase-refs" names="phrase\ refs" refuri="doctree.rst">
@@ -3956,19 +3959,17 @@
provides ids_ or names_ for its content or, if empty, the
next element.
:Parents: all elements employing `%body.elements`_, `%structure.model`_,
- or `%text.model`_ in their content models
-:Children: only text data [#target-content]_
+ or `%text.model`_ [#inline-targets]_ in their content models
+:Children: inline targets may contain text data [#target-content]_
:Attributes: anonymous_, refid_, refname_, refuri_, and
the `common attributes`_.
-.. [#inline-targets] Inline <target> elements will be deprecated in
- Docutils 1.0 and invalid in Docutils 2.0. The "rst" parser will
- use `\<inline>`_ elements for inline targets.
+.. [#inline-targets] Inline <target> elements are deprecated and
+ will be invalid in Docutils 2.0.
+.. [#target-content] <target> elements with content are deprecated
+ and will be invalid in Docutils 2.0.
-.. [#target-content] <target> elements with content will be deprecated in
- Docutils 1.0 and invalid in Docutils 2.0.
-
Examples
--------
@@ -3992,7 +3993,7 @@
<paragraph>
The hyperlink target above points to this paragraph
with an
- <target ids="inline-target" names="inline\ target">
+ <inline ids="inline-target" names="inline\ target">
inline target
.
@@ -4006,7 +4007,7 @@
<paragraph ids="explicit-target alias" names="explicit\ target alias">
The hyperlink target above points to this paragraph
with an
- <target ids="inline-target" names="inline\ target">
+ <inline ids="inline-target" names="inline\ target">
inline target
.
@@ -5573,6 +5574,7 @@
:end-before:
:literal:
+Inline <target> elements are deprecated. [#inline-targets]_
The `%additional.inline.elements`_ placeholder can be used by
wrapper DTDs to extend ``%inline.elements``.
@@ -5706,7 +5708,8 @@
`\<reference>`_, `\<revision>`_, `\<rubric>`_,
`\<status>`_, `\<strong>`_, `\<subscript>`_, `\<substitution_definition>`_,
`\<substitution_reference>`_, `\<subtitle>`_, `\<superscript>`_,
-`\<target>`_, `\<term>`_, `\<title>`_, `\<title_reference>`_, `\<version>`_
+`\<target>`_ [#target-content]_, `\<term>`_, `\<title>`_,
+`\<title_reference>`_, `\<version>`_
.. _%additional.basic.atts:
@@ -5970,6 +5973,7 @@
.. _hyperlink references: rst/restructuredtext.html#hyperlink-references
.. _implicit hyperlink targets: rst/restructuredtext.html#implicit-hyperlink-targets
.. _indirect target: rst/restructuredtext.html#indirect-hyperlink-targets
+.. _inline target: rst/restructuredtext.html#inline-internal-targets
.. _inline literals: rst/restructuredtext.html#inline-literals
.. _inline markup: rst/restructuredtext.html#inline-markup
.. _internal hyperlink targets: rst/restructuredtext.html#internal-hyperlink-targets
Modified: trunk/docutils/docs/ref/docutils.dtd
===================================================================
--- trunk/docutils/docs/ref/docutils.dtd 2026-07-22 20:59:04 UTC (rev 10390)
+++ trunk/docutils/docs/ref/docutils.dtd 2026-07-22 20:59:24 UTC (rev 10391)
@@ -188,6 +188,7 @@
| table | target | tip | warning
%additional.body.elements; ">
+<!-- inline targets are deprecated and will be invalid in Docutils 2.0 -->
<!ENTITY % additional.inline.elements "">
<!ENTITY % inline.elements
" abbreviation | acronym | citation_reference | emphasis
@@ -533,6 +534,7 @@
<!ATTLIST rubric %basic.atts;>
<!-- Empty except when used as an inline element. -->
+<!-- target content is deprecated and will be invalid in Docutils 2.0 -->
<!ELEMENT target %text.model;>
<!ATTLIST target
%basic.atts;
Modified: trunk/docutils/docs/ref/rst/restructuredtext.rst
===================================================================
--- trunk/docutils/docs/ref/rst/restructuredtext.rst 2026-07-22 20:59:04 UTC (rev 10390)
+++ trunk/docutils/docs/ref/rst/restructuredtext.rst 2026-07-22 20:59:24 UTC (rev 10391)
@@ -2965,7 +2965,7 @@
Inline Internal Targets
------------------------
-:Doctree element: `\<target>`_
+:Doctree element: `\<inline>`_
:Start/End strings: ``_``` `````
:See also: `hyperlink targets`_
Modified: trunk/docutils/docutils/nodes.py
===================================================================
--- trunk/docutils/docutils/nodes.py 2026-07-22 20:59:04 UTC (rev 10390)
+++ trunk/docutils/docutils/nodes.py 2026-07-22 20:59:24 UTC (rev 10391)
@@ -2653,7 +2653,7 @@
class acronym(Inline, TextElement): pass
class emphasis(Inline, TextElement): pass
class generated(Inline, TextElement): pass
-class inline(Inline, TextElement): pass
+class inline(Inline, TextElement, Targetable): pass
class literal(Inline, TextElement): pass
class strong(Inline, TextElement): pass
class subscript(Inline, TextElement): pass
Modified: trunk/docutils/docutils/parsers/rst/states.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/states.py 2026-07-22 20:59:04 UTC (rev 10390)
+++ trunk/docutils/docutils/parsers/rst/states.py 2026-07-22 20:59:24 UTC (rev 10391)
@@ -833,9 +833,10 @@
node = nodeclass(rawsource, text)
return (string[:matchstart], [node],
string[textend:], [], endmatch.group(1))
+ role = 'target' if string[matchstart] == '_' else nodeclass.__name__
msg = self.reporter.warning(
- 'Inline %s start-string without end-string.'
- % nodeclass.__name__, line=lineno)
+ f'Inline {role} start-string without end-string.',
+ line=lineno)
text = unescape(string[matchstart:matchend], True)
prb = self.problematic(text, text, msg)
return string[:matchstart], [prb], string[matchend:], [msg], ''
@@ -1009,13 +1010,13 @@
def inline_internal_target(self, match, lineno):
before, inlines, remaining, sysmessages, endstring = self.inline_obj(
- match, lineno, self.patterns.target, nodes.target)
- if inlines and isinstance(inlines[0], nodes.target):
+ match, lineno, self.patterns.target, nodes.inline)
+ if inlines and isinstance(inlines[0], nodes.inline):
assert len(inlines) == 1
- target = inlines[0]
- name = normalize_name(target.astext())
- target['names'].append(name)
- self.document.note_explicit_target(target, self.parent)
+ inline_target = inlines[0]
+ name = normalize_name(inline_target.astext())
+ inline_target['names'].append(name)
+ self.document.note_explicit_target(inline_target, self.parent)
return before, inlines, remaining, sysmessages
def substitution_reference(self, match, lineno):
Modified: trunk/docutils/docutils/transforms/parts.py
===================================================================
--- trunk/docutils/docutils/transforms/parts.py 2026-07-22 20:59:04 UTC (rev 10390)
+++ trunk/docutils/docutils/transforms/parts.py 2026-07-22 20:59:24 UTC (rev 10391)
@@ -162,6 +162,17 @@
def get_entry_text(self):
return self.get_tree_copy().children
+ def default_visit(self, node) -> None:
+ # Copy the current node, and make it the new acting parent.
+ # remove "names" and "ids" (must be unique)
+ super().default_visit(node)
+ self.parent['names'] = []
+ self.parent['ids'] = []
+
+ def visit_Text(self, node):
+ # Text nodes have no attributes, just copy
+ super().default_visit(node)
+
def visit_citation_reference(self, node):
raise nodes.SkipNode
Modified: trunk/docutils/docutils/transforms/references.py
===================================================================
--- trunk/docutils/docutils/transforms/references.py 2026-07-22 20:59:04 UTC (rev 10390)
+++ trunk/docutils/docutils/transforms/references.py 2026-07-22 20:59:24 UTC (rev 10391)
@@ -1043,11 +1043,13 @@
This makes it unsuited for applications like `Sphinx`, that manage
hyperlinks between a set of related documents.
"""
+ # TODO: also check names set with the ":name:" directive options?
+
# Apply after `MatchReferences` (730) but before `Messages` (860):
default_priority = 855
def apply(self) -> None:
- for target in self.document.findall(nodes.target):
+ for target in self.document.findall((nodes.target, nodes.inline)):
if target.referenced:
continue
if target.get('anonymous'):
@@ -1058,6 +1060,8 @@
naming = target['names'][0]
elif target['ids']:
naming = target['ids'][0]
+ elif isinstance(target, nodes.inline):
+ continue
else:
# Propagated target: "ids" and "names" attributes moved
# to the node indicated by "refname" or "refid".
Modified: trunk/docutils/docutils/writers/latex2e/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/latex2e/__init__.py 2026-07-22 20:59:04 UTC (rev 10390)
+++ trunk/docutils/docutils/writers/latex2e/__init__.py 2026-07-22 20:59:24 UTC (rev 10391)
@@ -2546,6 +2546,10 @@
set_anchor = not (isinstance(node.parent, anchor_nodes)
or isinstance(node, anchor_nodes))
add_newline = isinstance(node, nodes.paragraph)
+ # wrap line before inline target
+ if isinstance(node, nodes.inline) and node['ids']:
+ self.out.append('%')
+ self.out.append('\n')
self.out += self.ids_to_labels(node, set_anchor, newline=add_newline)
# Handle "classes" attribute:
for cls in node['classes']:
@@ -3153,7 +3157,7 @@
self.duclass_close(node)
def visit_target(self, node) -> None:
- # Skip indirect targets:
+ # Skip external and indirect targets:
if ('refuri' in node # external hyperlink
or 'refid' in node # resolved internal link
or 'refname' in node): # unresolved internal link
Modified: trunk/docutils/test/functional/expected/footnote-references_latex.tex
===================================================================
--- trunk/docutils/test/functional/expected/footnote-references_latex.tex 2026-07-22 20:59:04 UTC (rev 10390)
+++ trunk/docutils/test/functional/expected/footnote-references_latex.tex 2026-07-22 20:59:24 UTC (rev 10391)
@@ -160,12 +160,12 @@
\texttt{\_`4`} and \texttt{\_`exi`} would lead to a \textquotedbl{}duplicate target name\textquotedbl{} ERROR .
The markup characters for auto-labeled footnotes \textquotedbl{}%
-\phantomsection\label{target-1}*\textquotedbl{} and \textquotedbl{}%
-\phantomsection\label{target-2}\#\textquotedbl{} and
+\phantomsection\label{inline-1}*\textquotedbl{} and \textquotedbl{}%
+\phantomsection\label{inline-2}\#\textquotedbl{} and
the symbols selected by auto-symbol footnotes \textquotedbl{}%
-\phantomsection\label{target-3}†\textquotedbl{} do not become
+\phantomsection\label{inline-3}†\textquotedbl{} do not become
reference names. They can be used in other hyperref targets allowing
-links to \hyperref[target-1]{*}, \hyperref[target-2]{\#} and \hyperref[target-3]{†}.
+links to \hyperref[inline-1]{*}, \hyperref[inline-2]{\#} and \hyperref[inline-3]{†}.
\subsection{5%
@@ -174,9 +174,9 @@
Both, explicit and implicit targets with a number as reference name (e.g.
the inline target \textquotedbl{}%
-\phantomsection\label{target-4}2\textquotedbl{} and the section title \textquotedbl{}5\textquotedbl{} above) cause a gap in
+\phantomsection\label{inline-4}2\textquotedbl{} and the section title \textquotedbl{}5\textquotedbl{} above) cause a gap in
footnote auto-numbering.\footref{latex} The number can be used in a
-footnote-reference although it does not refer to a footnote!\textsuperscript{\hyperref[section-2]{5}}\textsuperscript{\hyperref[target-4]{2}}
+footnote-reference although it does not refer to a footnote!\textsuperscript{\hyperref[section-2]{5}}\textsuperscript{\hyperref[inline-4]{2}}
\begin{DUclass}{admonition-todo}
\begin{DUadmonition}
Modified: trunk/docutils/test/functional/expected/standalone_rst_docutils_xml.xml
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_docutils_xml.xml 2026-07-22 20:59:04 UTC (rev 10390)
+++ trunk/docutils/test/functional/expected/standalone_rst_docutils_xml.xml 2026-07-22 20:59:24 UTC (rev 10391)
@@ -245,7 +245,7 @@
numbered <footnote_reference ids="footnote-reference-1" refid="footnote-1">1</footnote_reference>, anonymous auto-numbered <footnote_reference auto="1" ids="footnote-reference-2" refid="footnote-2">3</footnote_reference>, labeled auto-numbered
<footnote_reference auto="1" ids="footnote-reference-3" refid="label">2</footnote_reference>, or symbolic <footnote_reference auto="*" ids="footnote-reference-4" refid="footnote-3">*</footnote_reference>), citation references (see <citation_reference ids="citation-reference-1" refid="cit2002">CIT2002</citation_reference>),
substitution references (<image alt="EXAMPLE" uri="../../../docs/user/rst/images/biohazard.png"></image> &
- a <emphasis>trimmed heart</emphasis> <literal>(U+2665):</literal>♥), and <target ids="inline-hyperlink-targets" names="inline\ hyperlink\ targets">inline hyperlink targets</target>
+ a <emphasis>trimmed heart</emphasis> <literal>(U+2665):</literal>♥), and <inline ids="inline-hyperlink-targets" names="inline\ hyperlink\ targets">inline hyperlink targets</inline>
(see <reference 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="problematic-1" refid="system-message-1">|problematic|</problematic> text
(generated by processing errors; this one is intentional). Here is a
@@ -1346,7 +1346,7 @@
Inline markup is supported, e.g. <emphasis>emphasis</emphasis>, <strong>strong</strong>, <literal>literal
text</literal>, <subscript>sub-</subscript> and <superscript>super</superscript>scripts,
inline formulas: <math>A = 2 \pi r^2</math>,
-footnotes <footnote_reference ids="footnote-reference-9" refid="footnote-1">1</footnote_reference>, <target ids="hyperlink-targets" names="hyperlink\ targets">hyperlink targets</target>, and <reference refuri="http://www.python.org/">references</reference><target ids="references" names="references" refuri="http://www.python.org/"></target>.</literal_block>
+footnotes <footnote_reference ids="footnote-reference-9" refid="footnote-1">1</footnote_reference>, <inline ids="hyperlink-targets" names="hyperlink\ targets">hyperlink targets</inline>, and <reference refuri="http://www.python.org/">references</reference><target ids="references" names="references" refuri="http://www.python.org/"></target>.</literal_block>
</section>
<section ids="code" names="code">
<title auto="1" refid="toc-entry-52"><generated classes="sectnum">2.14.10 </generated>Code</title>
Modified: trunk/docutils/test/functional/expected/standalone_rst_html4css1.html
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_html4css1.html 2026-07-22 20:59:04 UTC (rev 10390)
+++ trunk/docutils/test/functional/expected/standalone_rst_html4css1.html 2026-07-22 20:59:24 UTC (rev 10391)
@@ -179,7 +179,7 @@
numbered <a class="footnote-reference" href="#footnote-1" id="footnote-reference-1">[1]</a>, anonymous auto-numbered <a class="footnote-reference" href="#footnote-2" id="footnote-reference-2">[3]</a>, labeled auto-numbered
<a class="footnote-reference" href="#label" id="footnote-reference-3">[2]</a>, or symbolic <a class="footnote-reference" href="#footnote-3" id="footnote-reference-4">[*]</a>), citation references (see <a class="citation-reference" href="#cit2002" id="citation-reference-1">[CIT2002]</a>),
substitution references (<img alt="EXAMPLE" src="../../../docs/user/rst/images/biohazard.png" /> &
-a <em>trimmed heart</em> <tt class="docutils literal">(U+2665):</tt>♥), and <span class="target" id="inline-hyperlink-targets">inline hyperlink targets</span>
+a <em>trimmed heart</em> <tt class="docutils literal">(U+2665):</tt>♥), and <span 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="#system-message-1"><span class="problematic" id="problematic-1">|problematic|</span></a> text
(generated by processing errors; this one is intentional). Here is a
@@ -1015,7 +1015,7 @@
Inline markup is supported, e.g. <em>emphasis</em>, <strong>strong</strong>, <tt class="docutils literal">literal
text</tt>, <span class="subscript">sub-</span> and <span class="superscript">super</span>scripts,
inline formulas: <span class="formula"><i>A</i> = 2<i>π</i><i>r</i><sup>2</sup></span>,
-footnotes <a class="footnote-reference" href="#footnote-1" id="footnote-reference-9">[1]</a>, <span class="target" id="hyperlink-targets">hyperlink targets</span>, and <a class="reference external" href="http://www.python.org/">references</a>.
+footnotes <a class="footnote-reference" href="#footnote-1" id="footnote-reference-9">[1]</a>, <span id="hyperlink-targets">hyperlink targets</span>, and <a class="reference external" href="http://www.python.org/">references</a>.
</pre>
</div>
<div class="section" id="code">
Modified: trunk/docutils/test/functional/expected/standalone_rst_html5.html
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_html5.html 2026-07-22 20:59:04 UTC (rev 10390)
+++ trunk/docutils/test/functional/expected/standalone_rst_html5.html 2026-07-22 20:59:24 UTC (rev 10391)
@@ -196,7 +196,7 @@
numbered <a class="brackets" href="#footnote-1" id="footnote-reference-1" role="doc-noteref"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></a>, anonymous auto-numbered <a class="brackets" href="#footnote-2" id="footnote-reference-2" role="doc-noteref"><span class="fn-bracket">[</span>3<span class="fn-bracket">]</span></a>, labeled auto-numbered
<a class="brackets" href="#label" id="footnote-reference-3" role="doc-noteref"><span class="fn-bracket">[</span>2<span class="fn-bracket">]</span></a>, or symbolic <a class="brackets" href="#footnote-3" id="footnote-reference-4" role="doc-noteref"><span class="fn-bracket">[</span>*<span class="fn-bracket">]</span></a>), citation references (see <a class="citation-reference" href="#cit2002" id="citation-reference-1" role="doc-biblioref">[CIT2002]</a>),
substitution references (<img alt="EXAMPLE" src="../../../docs/user/rst/images/biohazard.png" /> &
-a <em>trimmed heart</em> <span class="docutils literal">(U+2665):</span>♥), and <span class="target" id="inline-hyperlink-targets">inline hyperlink targets</span>
+a <em>trimmed heart</em> <span class="docutils literal">(U+2665):</span>♥), and <span id="inline-hyperlink-targets">inline hyperlink targets</span>
(see <a class="reference internal" href="#another-target">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="#system-message-1"><span class="problematic" id="problematic-1">|problematic|</span></a> text
(generated by processing errors; this one is intentional). Here is a
@@ -1025,7 +1025,7 @@
<mn>2</mn>
</msup>
</math>,
-footnotes <a class="brackets" href="#footnote-1" id="footnote-reference-9" role="doc-noteref"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></a>, <span class="target" id="hyperlink-targets">hyperlink targets</span>, and <a class="reference external" href="http://www.python.org/">references</a>.</pre>
+footnotes <a class="brackets" href="#footnote-1" id="footnote-reference-9" role="doc-noteref"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></a>, <span id="hyperlink-targets">hyperlink targets</span>, and <a class="reference external" href="http://www.python.org/">references</a>.</pre>
</section>
<section id="code">
<h4><a class="toc-backref" href="#toc-entry-64" role="doc-backlink"><span class="sectnum">2.14.10 </span>Code</a><a class="self-link" title="link to this section" href="#code"></a></h4>
Modified: trunk/docutils/test/functional/expected/standalone_rst_pseudoxml.txt
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_pseudoxml.txt 2026-07-22 20:59:04 UTC (rev 10390)
+++ trunk/docutils/test/functional/expected/standalone_rst_pseudoxml.txt 2026-07-22 20:59:24 UTC (rev 10391)
@@ -471,7 +471,7 @@
(U+2665):
♥
), and
- <target ids="inline-hyperlink-targets" names="inline\ hyperlink\ targets">
+ <inline ids="inline-hyperlink-targets" names="inline\ hyperlink\ targets">
inline hyperlink targets
(see
@@ -1920,7 +1920,7 @@
<footnote_reference ids="footnote-reference-9" refid="footnote-1">
1
,
- <target ids="hyperlink-targets" names="hyperlink\ targets">
+ <inline ids="hyperlink-targets" names="hyperlink\ targets">
hyperlink targets
, and
<reference refuri="http://www.python.org/">
Modified: trunk/docutils/test/test_parsers/test_rst/test_character_level_inline_markup.py
===================================================================
--- trunk/docutils/test/test_parsers/test_rst/test_character_level_inline_markup.py 2026-07-22 20:59:04 UTC (rev 10390)
+++ trunk/docutils/test/test_parsers/test_rst/test_character_level_inline_markup.py 2026-07-22 20:59:24 UTC (rev 10391)
@@ -326,7 +326,7 @@
This isn't a _target; targets require backquotes.
<paragraph>
With simple-inline-markup, \n\
- <target ids="this" names="this">
+ <inline ids="this" names="this">
this
_ is a a target followed by an
underscore.
Modified: trunk/docutils/test/test_parsers/test_rst/test_inline_markup.py
===================================================================
--- trunk/docutils/test/test_parsers/test_rst/test_inline_markup.py 2026-07-22 20:59:04 UTC (rev 10390)
+++ trunk/docutils/test/test_parsers/test_rst/test_inline_markup.py 2026-07-22 20:59:24 UTC (rev 10391)
@@ -1168,10 +1168,10 @@
Report duplicate refname.
<paragraph>
Explicit targets: \n\
- <target names="file.txt">
+ <inline names="file.txt">
file.txt
, \n\
- <target names="file.html">
+ <inline names="file.html">
file.html
.
<system_message level="1" line="6" source="test data" type="INFO">
@@ -1295,10 +1295,10 @@
Duplicate refnames in references with embedded alias.
<paragraph>
Explicit targets: \n\
- <target names="tg1">
+ <inline names="tg1">
tg1
and \n\
- <target names="tg2">
+ <inline names="tg2">
tg2
.
<system_message level="1" line="6" source="test data" type="INFO">
@@ -1334,19 +1334,19 @@
"""\
<document source="test data">
<paragraph>
- <target names="target">
+ <inline names="target">
target
<paragraph>
Here is \n\
- <target names="another\\ target">
+ <inline names="another\\ target">
another target
in some text. And \n\
- <target names="yet\\ another\\ target">
+ <inline names="yet\\ another\\ target">
yet
another target
, spanning lines.
<paragraph>
- <target names="here\\ is\\ a\\ target">
+ <inline names="here\\ is\\ a\\ target">
Here is a TaRgeT
with case and spacial difficulties.
"""],
@@ -1357,10 +1357,10 @@
<document source="test data">
<paragraph>
l'
- <target names="target1">
+ <inline names="target1">
target1
and l\u2019
- <target names="target2">
+ <inline names="target2">
target2
with apostrophe
"""],
@@ -1373,21 +1373,21 @@
<document source="test data">
<paragraph>
quoted '
- <target names="target1">
+ <inline names="target1">
target1
', quoted "
- <target names="target2">
+ <inline names="target2">
target2
",
quoted \u2018
- <target names="target3">
+ <inline names="target3">
target3
\u2019, quoted \u201c
- <target names="target4">
+ <inline names="target4">
target4
\u201d,
quoted \xab
- <target names="target5">
+ <inline names="target5">
target5
\xbb
"""],
@@ -1399,19 +1399,19 @@
"""\
<document source="test data">
<paragraph>
- <target names="'target1'">
+ <inline names="'target1'">
'target1'
with quotes, \n\
- <target names=""target2"">
+ <inline names=""target2"">
"target2"
with quotes,
- <target names="\u2018target3\u2019">
+ <inline names="\u2018target3\u2019">
\u2018target3\u2019
with quotes, \n\
- <target names="\u201ctarget4\u201d">
+ <inline names="\u201ctarget4\u201d">
\u201ctarget4\u201d
with quotes,
- <target names="\xabtarget5\xbb">
+ <inline names="\xabtarget5\xbb">
\xabtarget5\xbb
with quotes
"""],
Modified: trunk/docutils/test/test_parsers/test_rst/test_targets.py
===================================================================
--- trunk/docutils/test/test_parsers/test_rst/test_targets.py 2026-07-22 20:59:04 UTC (rev 10390)
+++ trunk/docutils/test/test_parsers/test_rst/test_targets.py 2026-07-22 20:59:24 UTC (rev 10391)
@@ -265,7 +265,7 @@
<document source="test data">
<paragraph>
Duplicate indirect \n\
- <target names="targets">
+ <inline names="targets">
targets
(same refname):
<target names="link" refname="targets">
@@ -482,7 +482,7 @@
<line>
Do not insert <system_message> element for duplicate
<line>
- <target dupnames="target" ids="target-2">
+ <inline dupnames="target" ids="target-2">
target
, if this results in an invalid doctree.
<rubric dupnames="target" ids="target-3">
@@ -496,7 +496,7 @@
with
<field>
<field_name>
- <target dupnames="target" ids="target-4">
+ <inline dupnames="target" ids="target-4">
target
<field_body>
<paragraph>
@@ -735,7 +735,7 @@
<line>
Do not insert <system_message> element for duplicate
<line>
- <target dupnames="target" ids="target-5">
+ <inline dupnames="target" ids="target-5">
target
, if this results in an invalid doctree.
<rubric dupnames="target" ids="target-6">
@@ -749,7 +749,7 @@
with
<field>
<field_name>
- <target dupnames="target" ids="target-7">
+ <inline dupnames="target" ids="target-7">
target
<field_body>
<paragraph>
@@ -946,7 +946,7 @@
<document source="test data">
<paragraph>
Duplicate indirect \n\
- <target ids="targets" names="targets">
+ <inline ids="targets" names="targets">
targets
(same refname):
<target ids="link" names="link" refname="targets">
@@ -1163,7 +1163,7 @@
<line>
Do not insert <system_message> element for duplicate
<line>
- <target dupnames="target" ids="id5">
+ <inline dupnames="target" ids="id5">
target
, if this results in an invalid doctree.
<rubric dupnames="target" ids="id6">
@@ -1177,7 +1177,7 @@
with
<field>
<field_name>
- <target dupnames="target" ids="id7">
+ <inline dupnames="target" ids="id7">
target
<field_body>
<paragraph>
Modified: trunk/docutils/test/test_readers/test_pep/test_inline_markup.py
===================================================================
--- trunk/docutils/test/test_readers/test_pep/test_inline_markup.py 2026-07-22 20:59:04 UTC (rev 10390)
+++ trunk/docutils/test/test_readers/test_pep/test_inline_markup.py 2026-07-22 20:59:24 UTC (rev 10391)
@@ -125,7 +125,7 @@
<emphasis>
completeness
, \n\
- <target ids="let-s" names="let's">
+ <inline ids="let-s" names="let's">
let's
\n\
<literal>
Modified: trunk/docutils/test/test_transforms/test_contents.py
===================================================================
--- trunk/docutils/test/test_transforms/test_contents.py 2026-07-22 20:59:04 UTC (rev 10390)
+++ trunk/docutils/test/test_transforms/test_contents.py 2026-07-22 20:59:24 UTC (rev 10391)
@@ -26,6 +26,8 @@
class TransformTestCase(unittest.TestCase):
+ maxDiff = None
+
def test_transforms(self):
parser = Parser()
settings = get_default_settings(Parser)
@@ -86,7 +88,8 @@
<list_item>
<paragraph>
<reference ids="toc-entry-3" refid="title-3">
- Title
+ <inline>
+ Title
3
<list_item>
<paragraph>
@@ -106,7 +109,7 @@
Paragraph 2.
<section ids="title-3" names="title\\ 3">
<title refid="toc-entry-3">
- <target ids="title" names="title">
+ <inline ids="title" names="title">
Title
3
<paragraph>
Modified: trunk/docutils/test/test_transforms/test_hyperlinks.py
===================================================================
--- trunk/docutils/test/test_transforms/test_hyperlinks.py 2026-07-22 20:59:04 UTC (rev 10390)
+++ trunk/docutils/test/test_transforms/test_hyperlinks.py 2026-07-22 20:59:24 UTC (rev 10391)
@@ -859,7 +859,7 @@
Target name overrides implicit target name "foo".
<paragraph>
With legacy_ids = True, an explicit target \n\
- <target ids="foo-1" names="foo">
+ <inline ids="foo-1" names="foo">
foo
overrides a
homonymous implicit target but gets a "diambiguated" identifier.
@@ -891,7 +891,7 @@
Target name overrides implicit target name "foo".
<paragraph>
If an implicit target precedes a homonymous explicit target \n\
- <target ids="foo-1" names="foo">
+ <inline ids="foo-1" names="foo">
foo
,
the explicit target takes over the reference name but not the identifier.
@@ -1325,7 +1325,7 @@
Target name overrides implicit target name "foo".
<paragraph>
With legacy_ids = False, an explicit target \n\
- <target ids="foo" names="foo">
+ <inline ids="foo" names="foo">
foo
takes over the
reference name and identifier of a homonymous implicit target.
Modified: trunk/docutils/test/test_transforms/test_smartquotes.py
===================================================================
--- trunk/docutils/test/test_transforms/test_smartquotes.py 2026-07-22 20:59:04 UTC (rev 10390)
+++ trunk/docutils/test/test_transforms/test_smartquotes.py 2026-07-22 20:59:24 UTC (rev 10391)
@@ -239,7 +239,7 @@
<list_item>
<paragraph>
Around “
- <target ids="targets" names="targets">
+ <inline ids="targets" names="targets">
targets
”, “
<emphasis>
@@ -292,7 +292,7 @@
(in French, smart quotes expand to two characters).
<paragraph classes="language-fr-ch-x-altquot">
Around «\u202f
- <target ids="targets" names="targets">
+ <inline ids="targets" names="targets">
targets
\u202f», «\u202f
<emphasis>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|