SF.net SVN: docutils:[10168 ] trunk/docutils

milde--- via Docutils-checkins <[email protected]> Mon, 16 Jun 2025 09:58:04 +0000
Newsgroups gmane.text.docutils.cvs
Message-ID <[email protected]>
Revision: 10168
          http://sourceforge.net/p/docutils/code/10168
Author:   milde
Date:     2025-06-16 09:58:04 +0000 (Mon, 16 Jun 2025)
Log Message:
-----------
Drop the (faulty) "name" option of the "target-notes" directive.

Remove "name" from `TargetNotes.option_spec`.

The "target-notes" directive generates one footnote element per external target,
so it is unclear where a "name" attribute should go.

Up to now, the name was dropped by the "TargetNodes" transform and led to
an AssertionError in documents without external references

Modified Paths:
--------------
    trunk/docutils/HISTORY.rst
    trunk/docutils/RELEASE-NOTES.rst
    trunk/docutils/docs/ref/rst/directives.rst
    trunk/docutils/docutils/parsers/rst/directives/references.py
    trunk/docutils/test/test_parsers/test_rst/test_directives/test_target_notes.py
    trunk/docutils/test/test_parsers/test_rst/test_targets.py

Modified: trunk/docutils/HISTORY.rst
===================================================================
--- trunk/docutils/HISTORY.rst	2025-06-16 09:46:32 UTC (rev 10167)
+++ trunk/docutils/HISTORY.rst	2025-06-16 09:58:04 UTC (rev 10168)
@@ -17,8 +17,13 @@
 Release 0.22rc4 (unpublished)
 =============================
 
-Nothing yet.
+* docutils/parsers/rst/directives/references.py
 
+  Remove "name" from `TargetNotes.option_spec`.
+  The "target-notes" directive generates one footnote element per
+  external target but "name" must be unique across the document.
+  So far, the name was silently dropped.
+
 Release 0.22rc3 (2025-06-10)
 ============================
 

Modified: trunk/docutils/RELEASE-NOTES.rst
===================================================================
--- trunk/docutils/RELEASE-NOTES.rst	2025-06-16 09:46:32 UTC (rev 10167)
+++ trunk/docutils/RELEASE-NOTES.rst	2025-06-16 09:58:04 UTC (rev 10168)
@@ -247,9 +247,11 @@
 Release 0.22rc4 (unpublished)
 =============================
 
-Nothing yet.
+Drop the "name" option of the "target-notes" directive.
+(Report an error instead of silently ignoring the value.)
 
 
+
 Release 0.22rc3 (2025-06-10)
 ============================
 

Modified: trunk/docutils/docs/ref/rst/directives.rst
===================================================================
--- trunk/docutils/docs/ref/rst/directives.rst	2025-06-16 09:46:32 UTC (rev 10167)
+++ trunk/docutils/docs/ref/rst/directives.rst	2025-06-16 09:58:04 UTC (rev 10168)
@@ -1314,7 +1314,7 @@
 :Directive Type: "target-notes"
 :Doctree Elements: `\<pending>`_, `\<footnote>`_, `\<footnote_reference>`_
 :Directive Arguments: none
-:Directive Options: `class <class option_>`_, name_
+:Directive Options: `class <class option_>`_
 :Directive Content: none
 
 The "target-notes" directive generates a list of referenced URIs.

Modified: trunk/docutils/docutils/parsers/rst/directives/references.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/directives/references.py	2025-06-16 09:46:32 UTC (rev 10167)
+++ trunk/docutils/docutils/parsers/rst/directives/references.py	2025-06-16 09:58:04 UTC (rev 10168)
@@ -18,8 +18,7 @@
 
     """Target footnote generation."""
 
-    option_spec = {'class': directives.class_option,
-                   'name': directives.unchanged}
+    option_spec = {'class': directives.class_option}
 
     def run(self):
         pending = nodes.pending(references.TargetNotes)

Modified: trunk/docutils/test/test_parsers/test_rst/test_directives/test_target_notes.py
===================================================================
--- trunk/docutils/test/test_parsers/test_rst/test_directives/test_target_notes.py	2025-06-16 09:46:32 UTC (rev 10167)
+++ trunk/docutils/test/test_parsers/test_rst/test_directives/test_target_notes.py	2025-06-16 09:58:04 UTC (rev 10168)
@@ -67,11 +67,14 @@
 """,
 """\
 <document source="test data">
-    <pending ids="targets" names="targets">
-        .. internal attributes:
-             .transform: docutils.transforms.references.TargetNotes
-             .details:
-               class: ['custom']
+    <system_message level="3" line="1" source="test data" type="ERROR">
+        <paragraph>
+            Error in "target-notes" directive:
+            unknown option: "name".
+        <literal_block xml:space="preserve">
+            .. target-notes::
+               :class: custom
+               :name: targets
 """],
 ["""\
 .. target-notes::

Modified: trunk/docutils/test/test_parsers/test_rst/test_targets.py
===================================================================
--- trunk/docutils/test/test_parsers/test_rst/test_targets.py	2025-06-16 09:46:32 UTC (rev 10167)
+++ trunk/docutils/test/test_parsers/test_rst/test_targets.py	2025-06-16 09:58:04 UTC (rev 10168)
@@ -282,7 +282,7 @@
 Title
 =====
 
-.. target-notes::
+.. note:: remember remember
    :name: title
 """,
 """\
@@ -292,13 +292,12 @@
     <section dupnames="title" ids="title">
         <title>
             Title
-        <pending ids="title-1" names="title">
+        <note ids="title-1" names="title">
             <system_message backrefs="title-1" level="1" line="7" source="test data" type="INFO">
                 <paragraph>
                     Target name overrides implicit target name "title".
-            .. internal attributes:
-                 .transform: docutils.transforms.references.TargetNotes
-                 .details:
+            <paragraph>
+                remember remember
 """],
 ["""\
 Duplicate explicit targets.

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.