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

milde--- via Docutils-checkins <[email protected]>
Newsgroups gmane.text.docutils.cvs
Message-ID <[email protected]>
Revision: 9614
          http://sourceforge.net/p/docutils/code/9614
Author:   milde
Date:     2024-04-06 13:28:00 +0000 (Sat, 06 Apr 2024)
Log Message:
-----------
Don't drop `<field>` identifiers when writing HTML.

A field-list's  `<field>` elements are skipped in HTML output.
Transfer their `id` attribute to the respective `<field_name>`
child element to allow cross-references to field-list items.

Modified Paths:
--------------
    trunk/docutils/HISTORY.txt
    trunk/docutils/docutils/writers/_html_base.py

Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt	2024-04-06 13:27:52 UTC (rev 9613)
+++ trunk/docutils/HISTORY.txt	2024-04-06 13:28:00 UTC (rev 9614)
@@ -24,7 +24,13 @@
     "contents" directive options when used as placeholder for a generated
     table of contents (LaTeX writers with `use_latex_toc`_ setting).
 
+* docutils/writers/_html_base.py
 
+  - <field> elements are skipped in HTML output. Transfer `id` attribute
+    to the respective <field_name> child element to allow cross-references
+    to field-list items.
+
+
 Release 0.21.rc1 (2024-03-26)
 =============================
 

Modified: trunk/docutils/docutils/writers/_html_base.py
===================================================================
--- trunk/docutils/docutils/writers/_html_base.py	2024-04-06 13:27:52 UTC (rev 9613)
+++ trunk/docutils/docutils/writers/_html_base.py	2024-04-06 13:28:00 UTC (rev 9614)
@@ -1040,7 +1040,11 @@
         self.body.append('</dl>\n')
 
     def visit_field(self, node):
-        pass
+        # Insert children (<field_name> and <field_body>) directly.
+        # Transfer "id" attribute to the <field_name> child node.
+        for child in node:
+            if isinstance(child, nodes.field_name):
+                child['ids'].extend(node['ids'])
 
     def depart_field(self, node):
         pass

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.