SF.net SVN: docutils:[10378 ] trunk/docutils
milde--- via Docutils-checkins <[email protected]> Mon, 13 Jul 2026 11:13:03 +0000
| Newsgroups | gmane.text.docutils.cvs |
|---|---|
| Message-ID | <[email protected]> |
Revision: 10378
http://sourceforge.net/p/docutils/code/10378
Author: milde
Date: 2026-07-13 11:13:03 +0000 (Mon, 13 Jul 2026)
Log Message:
-----------
Inform if a target cannot be propagated to the next element.
Add an INFO system_message if a `<target>` cannot be "propagated" because the
next element is invisible, a footnote, or a citation.
Modified Paths:
--------------
trunk/docutils/HISTORY.rst
trunk/docutils/docutils/transforms/references.py
trunk/docutils/test/functional/expected/standalone_rst_pseudoxml.txt
trunk/docutils/test/test_transforms/test_hyperlinks.py
Modified: trunk/docutils/HISTORY.rst
===================================================================
--- trunk/docutils/HISTORY.rst 2026-06-30 08:11:33 UTC (rev 10377)
+++ trunk/docutils/HISTORY.rst 2026-07-13 11:13:03 UTC (rev 10378)
@@ -100,6 +100,8 @@
`references.ReportDanglingReferences` and
`references.ReportUnreferencedLinks`,
obsolete `references.DanglingReferences`.
+ - Add INFO system_message if a <target> cannot be propagated
+ to the next node.
* docutils/transforms/universal.py
Modified: trunk/docutils/docutils/transforms/references.py
===================================================================
--- trunk/docutils/docutils/transforms/references.py 2026-06-30 08:11:33 UTC (rev 10377)
+++ trunk/docutils/docutils/transforms/references.py 2026-07-13 11:13:03 UTC (rev 10378)
@@ -78,6 +78,9 @@
if (next_node is None
or isinstance(next_node, (nodes.Invisible, nodes.Targetable))
and not isinstance(next_node, nodes.target)):
+ self.document.reporter.info(
+ f'Cannot propagate target "{" ".join(target["names"])}" '
+ 'to next element', base_node=target)
continue
next_node['ids'].extend(target['ids'])
next_node['names'].extend(target['names'])
Modified: trunk/docutils/test/functional/expected/standalone_rst_pseudoxml.txt
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_pseudoxml.txt 2026-06-30 08:11:33 UTC (rev 10377)
+++ trunk/docutils/test/functional/expected/standalone_rst_pseudoxml.txt 2026-07-13 11:13:03 UTC (rev 10378)
@@ -2399,6 +2399,9 @@
<system_message backrefs="problematic-1" ids="system-message-1" level="3" line="99" source="functional/input/data/standard.rst" type="ERROR">
<paragraph>
Undefined substitution referenced: "problematic".
+ <system_message level="1" line="159" source="functional/input/data/standard.rst" type="INFO">
+ <paragraph>
+ Cannot propagate target "target" to next element
<system_message backrefs="footnote-reference-8" ids="system-message-2" level="3" line="390" source="functional/input/data/standard.rst" type="ERROR">
<paragraph>
Unknown target name: "5".
Modified: trunk/docutils/test/test_transforms/test_hyperlinks.py
===================================================================
--- trunk/docutils/test/test_transforms/test_hyperlinks.py 2026-06-30 08:11:33 UTC (rev 10377)
+++ trunk/docutils/test/test_transforms/test_hyperlinks.py 2026-07-13 11:13:03 UTC (rev 10378)
@@ -569,6 +569,9 @@
Footnote; \n\
<reference refid="target">
target
+ <system_message level="1" line="1" source="test data" type="INFO">
+ <paragraph>
+ Cannot propagate target "target" to next element
"""],
["""\
.. _target:
@@ -585,6 +588,9 @@
Citation; \n\
<reference refid="target">
target
+ <system_message level="1" line="1" source="test data" type="INFO">
+ <paragraph>
+ Cannot propagate target "target" to next element
"""],
])
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.