Fix for comments.
authorRadek Czajka <rczajka@rczajka.pl>
Wed, 22 May 2024 09:44:56 +0000 (11:44 +0200)
committerRadek Czajka <rczajka@rczajka.pl>
Wed, 22 May 2024 09:44:56 +0000 (11:44 +0200)
src/librarian/document.py

index 2e9a4a5..7780b61 100644 (file)
@@ -81,6 +81,7 @@ class WLDocument:
         """
         EXPR = re.compile(r'/\s', re.MULTILINE | re.UNICODE)
         def _compat_assign_ordered_ids_in_elem(elem, i):
         """
         EXPR = re.compile(r'/\s', re.MULTILINE | re.UNICODE)
         def _compat_assign_ordered_ids_in_elem(elem, i):
+            if isinstance(elem, etree._Comment): return i
             elem.attrib['_compat_ordered_id'] = str(i)
             i += 1
             if getattr(elem, 'HTML_CLASS', None) == 'stanza':
             elem.attrib['_compat_ordered_id'] = str(i)
             i += 1
             if getattr(elem, 'HTML_CLASS', None) == 'stanza':