SF.net SVN: docutils:[9558] trunk/docutils/docutils/writers

milde--- via Docutils-checkins <[email protected]>
Newsgroups gmane.text.docutils.cvs
Message-ID <[email protected]>
Revision: 9558
          http://sourceforge.net/p/docutils/code/9558
Author:   milde
Date:     2024-03-11 17:48:52 +0000 (Mon, 11 Mar 2024)
Log Message:
-----------
Simplify code in "html" translators `depart_term()` method.

Modified Paths:
--------------
    trunk/docutils/docutils/writers/_html_base.py
    trunk/docutils/docutils/writers/html4css1/__init__.py

Modified: trunk/docutils/docutils/writers/_html_base.py
===================================================================
--- trunk/docutils/docutils/writers/_html_base.py	2024-03-11 17:48:43 UTC (rev 9557)
+++ trunk/docutils/docutils/writers/_html_base.py	2024-03-11 17:48:52 UTC (rev 9558)
@@ -1700,9 +1700,8 @@
 
     def depart_term(self, node):
         # Nest (optional) classifier(s) in the <dt> element
-        if isinstance(node.next_node(descend=False, siblings=True),
-                      nodes.classifier):
-            return  # depart_classifier() calls this function again
+        if node.next_node(nodes.classifier, descend=False, siblings=True):
+            return  # skip (depart_classifier() calls this function again)
         if 'details' in node.parent.parent['classes']:
             self.body.append('</summary>\n')
         else:

Modified: trunk/docutils/docutils/writers/html4css1/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/html4css1/__init__.py	2024-03-11 17:48:43 UTC (rev 9557)
+++ trunk/docutils/docutils/writers/html4css1/__init__.py	2024-03-11 17:48:52 UTC (rev 9558)
@@ -882,9 +882,8 @@
 
     def depart_term(self, node):
         # Nest (optional) classifier(s) in the <dt> element
-        if isinstance(node.next_node(descend=False, siblings=True),
-                      nodes.classifier):
-            return  # depart_classifier() calls this function again
+        if node.next_node(nodes.classifier, descend=False, siblings=True):
+            return  # skip (depart_classifier() calls this function again)
         self.body.append('</dt>\n')
 
     # hard-coded vertical alignment

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.