Issue #26462: Doc: avoid literal_block warnings, fix syntax highlighting.
Patch by Julien Palard.
diff --git a/Doc/howto/logging-cookbook.rst b/Doc/howto/logging-cookbook.rst
index 074c396..b7f0fa5 100644
--- a/Doc/howto/logging-cookbook.rst
+++ b/Doc/howto/logging-cookbook.rst
@@ -998,7 +998,9 @@
logger = logging.getLogger('mylogger')
logger.debug('A debug message')
-To run this, you will probably need to run as ``root``::
+To run this, you will probably need to run as ``root``:
+
+.. code-block:: shell-session
$ sudo python3.3 chowntest.py
$ cat chowntest.log
@@ -1500,7 +1502,9 @@
completion, the status is as it was before so message #6 appears (like message
#1) whereas message #7 doesn't (just like message #2).
-If we run the resulting script, the result is as follows::
+If we run the resulting script, the result is as follows:
+
+.. code-block:: shell-session
$ python logctx.py
1. This should appear just once on stderr.
@@ -1510,12 +1514,16 @@
6. This should appear just once on stderr.
If we run it again, but pipe ``stderr`` to ``/dev/null``, we see the following,
-which is the only message written to ``stdout``::
+which is the only message written to ``stdout``:
+
+.. code-block:: shell-session
$ python logctx.py 2>/dev/null
5. This should appear twice - once on stderr and once on stdout.
-Once again, but piping ``stdout`` to ``/dev/null``, we get::
+Once again, but piping ``stdout`` to ``/dev/null``, we get:
+
+.. code-block:: shell-session
$ python logctx.py >/dev/null
1. This should appear just once on stderr.
diff --git a/Doc/howto/logging.rst b/Doc/howto/logging.rst
index 5b431f0..6b17b08 100644
--- a/Doc/howto/logging.rst
+++ b/Doc/howto/logging.rst
@@ -106,7 +106,9 @@
logging.warning('Watch out!') # will print a message to the console
logging.info('I told you so') # will not print anything
-If you type these lines into a script and run it, you'll see::
+If you type these lines into a script and run it, you'll see:
+
+.. code-block:: none
WARNING:root:Watch out!
@@ -230,7 +232,9 @@
import logging
logging.warning('%s before you %s', 'Look', 'leap!')
-will display::
+will display:
+
+.. code-block:: none
WARNING:root:Look before you leap!
@@ -585,7 +589,9 @@
logger.error('error message')
logger.critical('critical message')
-Running this module from the command line produces the following output::
+Running this module from the command line produces the following output:
+
+.. code-block:: shell-session
$ python simple_logging_module.py
2005-03-19 15:10:26,618 - simple_example - DEBUG - debug message
@@ -644,7 +650,9 @@
format=%(asctime)s - %(name)s - %(levelname)s - %(message)s
datefmt=
-The output is nearly identical to that of the non-config-file-based example::
+The output is nearly identical to that of the non-config-file-based example:
+
+.. code-block:: shell-session
$ python simple_logging_config.py
2005-03-19 15:38:55,977 - simpleExample - DEBUG - debug message
@@ -1041,4 +1049,3 @@
Useful handlers included with the logging module.
:ref:`A logging cookbook <logging-cookbook>`
-
diff --git a/Doc/howto/regex.rst b/Doc/howto/regex.rst
index 2c95fb4..0d0e9f5 100644
--- a/Doc/howto/regex.rst
+++ b/Doc/howto/regex.rst
@@ -79,7 +79,9 @@
devoted to discussing various metacharacters and what they do.
Here's a complete list of the metacharacters; their meanings will be discussed
-in the rest of this HOWTO. ::
+in the rest of this HOWTO.
+
+.. code-block:: none
. ^ $ * + ? { } [ ] \ | ( )
diff --git a/Doc/howto/unicode.rst b/Doc/howto/unicode.rst
index afd89c7..b94e5b5 100644
--- a/Doc/howto/unicode.rst
+++ b/Doc/howto/unicode.rst
@@ -619,7 +619,9 @@
print os.listdir('.')
print os.listdir(u'.')
-will produce the following output::
+will produce the following output:
+
+.. code-block:: shell-session
amk:~$ python t.py
['.svn', 'filename\xe4\x94\x80abc', ...]