Improve highlighting of some code blocks. (GH-6401) · python/cpython@46936d5 · GitHub
Skip to content

Commit 46936d5

Browse files
Improve highlighting of some code blocks. (GH-6401)
1 parent 9265dd7 commit 46936d5

29 files changed

Lines changed: 301 additions & 137 deletions

Doc/distutils/configfile.rst

Lines changed: 16 additions & 6 deletions

Doc/distutils/packageindex.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,9 @@ The :command:`register` and :command:`upload` commands both check for the
156156
existence of a :file:`.pypirc` file at the location :file:`$HOME/.pypirc`.
157157
If this file exists, the command uses the username, password, and repository
158158
URL configured in the file. The format of a :file:`.pypirc` file is as
159-
follows::
159+
follows:
160+
161+
.. code-block:: ini
160162
161163
[distutils]
162164
index-servers =
@@ -179,7 +181,9 @@ Each section describing a repository defines three variables:
179181
will be prompt to type it when needed.
180182

181183
If you want to define another server a new section can be created and
182-
listed in the *index-servers* variable::
184+
listed in the *index-servers* variable:
185+
186+
.. code-block:: ini
183187
184188
[distutils]
185189
index-servers =

Doc/extending/embedding.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ options. In this case, the :mod:`sysconfig` module is a useful tool to
323323
programmatically extract the configuration values that you will want to
324324
combine together. For example:
325325

326-
.. code-block:: python
326+
.. code-block:: pycon
327327
328328
>>> import sysconfig
329329
>>> sysconfig.get_config_var('LIBS')

Doc/extending/extending.rst

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ Let's create an extension module called ``spam`` (the favorite food of Monty
4343
Python fans...) and let's say we want to create a Python interface to the C
4444
library function :c:func:`system` [#]_. This function takes a null-terminated
4545
character string as argument and returns an integer. We want this function to
46-
be callable from Python as follows::
46+
be callable from Python as follows:
47+
48+
.. code-block:: pycon
4749
4850
>>> import spam
4951
>>> status = spam.system("ls -l")
@@ -439,7 +441,9 @@ part of the Python interpreter, you will have to change the configuration setup
439441
and rebuild the interpreter. Luckily, this is very simple on Unix: just place
440442
your file (:file:`spammodule.c` for example) in the :file:`Modules/` directory
441443
of an unpacked source distribution, add a line to the file
442-
:file:`Modules/Setup.local` describing your file::
444+
:file:`Modules/Setup.local` describing your file:
445+
446+
.. code-block:: sh
443447
444448
spam spammodule.o
445449
@@ -450,7 +454,9 @@ subdirectory, but then you must first rebuild :file:`Makefile` there by running
450454
:file:`Setup` file.)
451455

452456
If your module requires additional libraries to link with, these can be listed
453-
on the line in the configuration file as well, for instance::
457+
on the line in the configuration file as well, for instance:
458+
459+
.. code-block:: sh
454460
455461
spam spammodule.o -lX11
456462

Doc/extending/newtypes_tutorial.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ field mentioned above. ::
117117
The name of our type. This will appear in the default textual representation of
118118
our objects and in some error messages, for example:
119119

120-
.. code-block:: python
120+
.. code-block:: pycon
121121
122122
>>> "" + custom.Custom()
123123
Traceback (most recent call last):
@@ -183,7 +183,7 @@ set to *NULL*. ::
183183
This adds the type to the module dictionary. This allows us to create
184184
:class:`Custom` instances by calling the :class:`Custom` class:
185185

186-
.. code-block:: python
186+
.. code-block:: pycon
187187
188188
>>> import custom
189189
>>> mycustom = custom.Custom()
@@ -655,7 +655,7 @@ Python has a :term:`cyclic garbage collector (GC) <garbage collection>` that
655655
can identify unneeded objects even when their reference counts are not zero.
656656
This can happen when objects are involved in cycles. For example, consider:
657657

658-
.. code-block:: python
658+
.. code-block:: pycon
659659
660660
>>> l = []
661661
>>> l.append(l)
@@ -672,7 +672,7 @@ Besides, in the second and third versions, we allowed subclassing
672672
:class:`Custom`, and subclasses may add arbitrary attributes. For any of
673673
those two reasons, :class:`Custom` objects can participate in cycles:
674674

675-
.. code-block:: python
675+
.. code-block:: pycon
676676
677677
>>> import custom3
678678
>>> class Derived(custom3.Custom): pass
@@ -796,7 +796,7 @@ built-in :class:`list` type. The new type will be completely compatible with
796796
regular lists, but will have an additional :meth:`increment` method that
797797
increases an internal counter:
798798

799-
.. code-block:: python
799+
.. code-block:: pycon
800800
801801
>>> import sublist
802802
>>> s = sublist.SubList(range(3))

Doc/faq/library.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ interpreter.
7474

7575
Occasionally, a user's environment is so full that the :program:`/usr/bin/env`
7676
program fails; or there's no env program at all. In that case, you can try the
77-
following hack (due to Alex Rezinsky)::
77+
following hack (due to Alex Rezinsky):
78+
79+
.. code-block:: sh
7880
7981
#! /bin/sh
8082
""":"

Doc/faq/windows.rst

Lines changed: 20 additions & 6 deletions

0 commit comments

Comments
 (0)