SF.net SVN: docutils:[10296 ] trunk/docutils/docutils/ nodes.py

milde--- via Docutils-checkins <[email protected]> Fri, 06 Feb 2026 09:08:57 +0000
Newsgroups gmane.text.docutils.cvs
Message-ID <[email protected]>
Revision: 10296
          http://sourceforge.net/p/docutils/code/10296
Author:   milde
Date:     2026-02-06 09:08:56 +0000 (Fri, 06 Feb 2026)
Log Message:
-----------
Simplify check if its valid to insert a system_message.

Modified Paths:
--------------
    trunk/docutils/docutils/nodes.py

Modified: trunk/docutils/docutils/nodes.py
===================================================================
--- trunk/docutils/docutils/nodes.py	2026-02-05 21:27:00 UTC (rev 10295)
+++ trunk/docutils/docutils/nodes.py	2026-02-06 09:08:56 UTC (rev 10296)
@@ -1978,18 +1978,11 @@
             # don't add backref id for empty targets (not shown in output)
             if isinstance(node, target) and 'refuri' in node:
                 backrefs = []
-            msg = self.reporter.system_message(level, s,
-                                               backrefs=backrefs,
+            msg = self.reporter.system_message(level, s, backrefs=backrefs,
                                                base_node=node)
             # try appending near to the problem:
-            if msgnode is not None:
+            if msgnode is not None and 'Body' in repr(msgnode.content_model):
                 msgnode += msg
-                try:
-                    msgnode.validate(recursive=False)
-                except ValidationError:
-                    # detach -> will be handled by `Messages` transform
-                    msgnode.pop()
-                    msg.parent = None
 
     def has_name(self, name: str) -> bool:
         return name in self.nameids

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