SF.net SVN: docutils:[9980] trunk/docutils

milde--- via Docutils-checkins <[email protected]>
Newsgroups gmane.text.docutils.cvs
Message-ID <[email protected]>
Revision: 9980
          http://sourceforge.net/p/docutils/code/9980
Author:   milde
Date:     2024-11-12 10:34:13 +0000 (Tue, 12 Nov 2024)
Log Message:
-----------
Announce upcoming change in "doctest block" handling.

Parse doctest blocks as "code" with language "pycon" (pygment name for
Python console).

+1 syntax highlight in line with other "code" elements.
+1 the `<doctest_block>` doctree element can be retired.

Modified Paths:
--------------
    trunk/docutils/RELEASE-NOTES.rst
    trunk/docutils/docs/ref/doctree.rst
    trunk/docutils/docutils/parsers/rst/states.py

Modified: trunk/docutils/RELEASE-NOTES.rst
===================================================================
--- trunk/docutils/RELEASE-NOTES.rst	2024-11-11 17:39:17 UTC (rev 9979)
+++ trunk/docutils/RELEASE-NOTES.rst	2024-11-12 10:34:13 UTC (rev 9980)
@@ -64,8 +64,14 @@
 
   The default unit will change to "pt" in Docutils 2.0.
 
+* The `\<doctest_block>`_ element will be deprecated in Docutils 1.0.
+  The rST parser will handle a `doctest block`_ similar to a "code" directive
+  with language "pycon" (Python console) and generate a <literal_block>.
+
 .. _"refname" attribute: docs/ref/doctree.html#refname
 .. _"colwidth" attribute: docs/ref/doctree.html#colwidth
+.. _<doctest_block>: docs/ref/doctree.html#doctest-block
+.. _doctest block: docs/ref/rst/restructuredtext.html#doctest-blocks
 
 Writers
 -------

Modified: trunk/docutils/docs/ref/doctree.rst
===================================================================
--- trunk/docutils/docs/ref/doctree.rst	2024-11-11 17:39:17 UTC (rev 9979)
+++ trunk/docutils/docs/ref/doctree.rst	2024-11-12 10:34:13 UTC (rev 9980)
@@ -1392,14 +1392,6 @@
 :Children:   text data plus `inline elements`_ (`%text.model`_)
 :Attributes: the `common attributes`_ and `xml:space`_.
 
-<doctest_block> elements are used for interactive Python interpreter
-sessions, which are distinguished by their input prompt: ``>>>``.
-They are meant to illustrate usage by example, and provide an elegant
-and powerful testing environment via the `doctest module`_ in the
-Python standard library.
-
-.. _doctest module: https://docs.python.org/3/library/doctest.html
-
 Examples
 --------
 
@@ -1418,7 +1410,10 @@
         >>> print('this is a Doctest block')
         this is a Doctest block
 
+The <doctest_block> will be deprecated in Docutils 1.0, the
+reStructuredText parser will use a `\<literal_block>`_ instead.
 
+
 <document>
 ==========
 

Modified: trunk/docutils/docutils/parsers/rst/states.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/states.py	2024-11-11 17:39:17 UTC (rev 9979)
+++ trunk/docutils/docutils/parsers/rst/states.py	2024-11-12 10:34:13 UTC (rev 9980)
@@ -1589,9 +1589,8 @@
     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).
+        # TODO: Parse with `directives.body.CodeBlock` with
+        # argument 'pycon' (Python Console) in Docutils 1.0.
         n = nodes.doctest_block(data, data)
         n.line = line
         self.parent += n

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



_______________________________________________
Docutils-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/docutils-checkins
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.