SF.net SVN: docutils:[9979] trunk/docutils/docutils/parsers/rst/states.py

milde--- via Docutils-checkins <[email protected]>
Newsgroups gmane.text.docutils.cvs
Message-ID <[email protected]>
Revision: 9979
          http://sourceforge.net/p/docutils/code/9979
Author:   milde
Date:     2024-11-11 17:39:17 +0000 (Mon, 11 Nov 2024)
Log Message:
-----------
Fix internal "line" attribute of the `<doctest_block>` node.

Patch #211 by Hood Chatham.

Modified Paths:
--------------
    trunk/docutils/docutils/parsers/rst/states.py

Modified: trunk/docutils/docutils/parsers/rst/states.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/states.py	2024-11-09 23:59:18 UTC (rev 9978)
+++ trunk/docutils/docutils/parsers/rst/states.py	2024-11-11 17:39:17 UTC (rev 9979)
@@ -1587,11 +1587,14 @@
         return optlist
 
     def doctest(self, match, context, next_state):
+        line = self.document.current_line
         data = '\n'.join(self.state_machine.get_text_block())
         # TODO: prepend class value ['pycon'] (Python Console)
         # parse with `directives.body.CodeBlock` (returns literal-block
         # with class "code" and syntax highlight markup).
-        self.parent += nodes.doctest_block(data, data)
+        n = nodes.doctest_block(data, data)
+        n.line = line
+        self.parent += n
         return [], next_state, []
 
     def line_block(self, match, context, next_state):

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.