SF.net SVN: docutils:[9688 ] trunk/docutils/docutils/t ransforms/universal.py
milde--- via Docutils-checkins <[email protected]>
| Newsgroups | gmane.text.docutils.cvs |
|---|---|
| Message-ID | <[email protected]> |
Revision: 9688
http://sourceforge.net/p/docutils/code/9688
Author: milde
Date: 2024-05-06 07:55:24 +0000 (Mon, 06 May 2024)
Log Message:
-----------
Robustify `transforms.universal.FilterMessages`.
Avoid `KeyError` if a `<problematic>` node does not have a
"refid" attribute.
This attribute is always used with the standard "rst" parser but,
according to the Docutils DTD, optional.
Modified Paths:
--------------
trunk/docutils/docutils/transforms/universal.py
Modified: trunk/docutils/docutils/transforms/universal.py
===================================================================
--- trunk/docutils/docutils/transforms/universal.py 2024-05-06 07:55:16 UTC (rev 9687)
+++ trunk/docutils/docutils/transforms/universal.py 2024-05-06 07:55:24 UTC (rev 9688)
@@ -151,7 +151,7 @@
except (IndexError):
pass
for node in tuple(self.document.findall(nodes.problematic)):
- if node['refid'] not in self.document.ids:
+ if 'refid' in node and node['refid'] not in self.document.ids:
node.parent.replace(node, nodes.Text(node.astext()))
for node in self.document.findall(nodes.section):
if "system-messages" in node['classes'] and len(node) == 1:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.