summaryrefslogtreecommitdiffstats
path: root/Doc/library
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2023-09-23 06:31:20 (GMT)
committerGitHub <noreply@github.com>2023-09-23 06:31:20 (GMT)
commit92af0cc580051fd1129c7a86af2cbadeb2aa36dc (patch)
tree19504cdaa115df0213978c7e25f96888b29b2861 /Doc/library
parent5e7ea95d9d5c3b80a67ffbeebd76ce4fc327dd8e (diff)
downloadcpython-92af0cc580051fd1129c7a86af2cbadeb2aa36dc.zip
cpython-92af0cc580051fd1129c7a86af2cbadeb2aa36dc.tar.gz
cpython-92af0cc580051fd1129c7a86af2cbadeb2aa36dc.tar.bz2
gh-109634: Use :samp: role (GH-109635)
Diffstat (limited to 'Doc/library')
-rw-r--r--Doc/library/codecs.rst26
-rw-r--r--Doc/library/compileall.rst2
-rw-r--r--Doc/library/ensurepip.rst2
-rw-r--r--Doc/library/functions.rst2
-rw-r--r--Doc/library/html.parser.rst2
-rw-r--r--Doc/library/http.server.rst2
-rw-r--r--Doc/library/os.rst4
-rw-r--r--Doc/library/re.rst2
-rw-r--r--Doc/library/sys.rst4
-rw-r--r--Doc/library/urllib.parse.rst6
10 files changed, 28 insertions, 24 deletions
diff --git a/Doc/library/codecs.rst b/Doc/library/codecs.rst
index 8225236..053bf64 100644
--- a/Doc/library/codecs.rst
+++ b/Doc/library/codecs.rst
@@ -345,9 +345,10 @@ The following error handlers can be used with all Python
+-------------------------+-----------------------------------------------+
| ``'backslashreplace'`` | Replace with backslashed escape sequences. |
| | On encoding, use hexadecimal form of Unicode |
-| | code point with formats ``\xhh`` ``\uxxxx`` |
-| | ``\Uxxxxxxxx``. On decoding, use hexadecimal |
-| | form of byte value with format ``\xhh``. |
+| | code point with formats :samp:`\\x{hh}` |
+| | :samp:`\\u{xxxx}` :samp:`\\U{xxxxxxxx}`. |
+| | On decoding, use hexadecimal form of byte |
+| | value with format :samp:`\\x{hh}`. |
| | Implemented in |
| | :func:`backslashreplace_errors`. |
+-------------------------+-----------------------------------------------+
@@ -373,8 +374,9 @@ The following error handlers are only applicable to encoding (within
+=========================+===============================================+
| ``'xmlcharrefreplace'`` | Replace with XML/HTML numeric character |
| | reference, which is a decimal form of Unicode |
-| | code point with format ``&#num;`` Implemented |
-| | in :func:`xmlcharrefreplace_errors`. |
+| | code point with format :samp:`&#{num};`. |
+| | Implemented in |
+| | :func:`xmlcharrefreplace_errors`. |
+-------------------------+-----------------------------------------------+
| ``'namereplace'`` | Replace with ``\N{...}`` escape sequences, |
| | what appears in the braces is the Name |
@@ -478,8 +480,9 @@ functions:
Malformed data is replaced by a backslashed escape sequence.
On encoding, use the hexadecimal form of Unicode code point with formats
- ``\xhh`` ``\uxxxx`` ``\Uxxxxxxxx``. On decoding, use the hexadecimal form of
- byte value with format ``\xhh``.
+ :samp:`\\x{hh}` :samp:`\\u{xxxx}` :samp:`\\U{xxxxxxxx}`.
+ On decoding, use the hexadecimal form of
+ byte value with format :samp:`\\x{hh}`.
.. versionchanged:: 3.5
Works with decoding and translating.
@@ -492,7 +495,7 @@ functions:
The unencodable character is replaced by an appropriate XML/HTML numeric
character reference, which is a decimal form of Unicode code point with
- format ``&#num;`` .
+ format :samp:`&#{num};` .
.. function:: namereplace_errors(exception)
@@ -1346,9 +1349,10 @@ encodings.
| | | supported. |
+--------------------+---------+---------------------------+
| raw_unicode_escape | | Latin-1 encoding with |
-| | | ``\uXXXX`` and |
-| | | ``\UXXXXXXXX`` for other |
-| | | code points. Existing |
+| | | :samp:`\\u{XXXX}` and |
+| | | :samp:`\\U{XXXXXXXX}`` |
+| | | for other code points. |
+| | | Existing |
| | | backslashes are not |
| | | escaped in any way. |
| | | It is used in the Python |
diff --git a/Doc/library/compileall.rst b/Doc/library/compileall.rst
index 80d96ec..a7455ae 100644
--- a/Doc/library/compileall.rst
+++ b/Doc/library/compileall.rst
@@ -31,7 +31,7 @@ compile Python sources.
Positional arguments are files to compile or directories that contain
source files, traversed recursively. If no argument is given, behave as if
- the command line was ``-l <directories from sys.path>``.
+ the command line was :samp:`-l {<directories from sys.path>}`.
.. cmdoption:: -l
diff --git a/Doc/library/ensurepip.rst b/Doc/library/ensurepip.rst
index d7f89cf..de3b93f 100644
--- a/Doc/library/ensurepip.rst
+++ b/Doc/library/ensurepip.rst
@@ -61,7 +61,7 @@ By default, ``pip`` is installed into the current virtual environment
active virtual environment). The installation location can be controlled
through two additional command line options:
-* ``--root <dir>``: Installs ``pip`` relative to the given root directory
+* :samp:`--root {dir}`: Installs ``pip`` relative to the given root directory
rather than the root of the currently active virtual environment (if any)
or the default root for the current Python installation.
* ``--user``: Installs ``pip`` into the user site packages directory rather
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst
index d9974c6..3520609 100644
--- a/Doc/library/functions.rst
+++ b/Doc/library/functions.rst
@@ -1271,7 +1271,7 @@ are always available. They are listed here in alphabetical order.
* ``'xmlcharrefreplace'`` is only supported when writing to a file.
Characters not supported by the encoding are replaced with the
- appropriate XML character reference ``&#nnn;``.
+ appropriate XML character reference :samp:`&#{nnn};`.
* ``'backslashreplace'`` replaces malformed data by Python's backslashed
escape sequences.
diff --git a/Doc/library/html.parser.rst b/Doc/library/html.parser.rst
index 03aff25..d350901 100644
--- a/Doc/library/html.parser.rst
+++ b/Doc/library/html.parser.rst
@@ -173,7 +173,7 @@ implementations do nothing (except for :meth:`~HTMLParser.handle_startendtag`):
.. method:: HTMLParser.handle_charref(name)
This method is called to process decimal and hexadecimal numeric character
- references of the form ``&#NNN;`` and ``&#xNNN;``. For example, the decimal
+ references of the form :samp:`&#{NNN};` and :samp:`&#x{NNN};`. For example, the decimal
equivalent for ``&gt;`` is ``&#62;``, whereas the hexadecimal is ``&#x3E;``;
in this case the method will receive ``'62'`` or ``'x3E'``. This method
is never called if *convert_charrefs* is ``True``.
diff --git a/Doc/library/http.server.rst b/Doc/library/http.server.rst
index efe8749..6f79b22 100644
--- a/Doc/library/http.server.rst
+++ b/Doc/library/http.server.rst
@@ -217,7 +217,7 @@ provides three different variants:
attribute holds the default values for *message* and *explain* that
will be used if no value is provided; for unknown codes the default value
for both is the string ``???``. The body will be empty if the method is
- HEAD or the response code is one of the following: ``1xx``,
+ HEAD or the response code is one of the following: :samp:`1{xx}`,
``204 No Content``, ``205 Reset Content``, ``304 Not Modified``.
.. versionchanged:: 3.4
diff --git a/Doc/library/os.rst b/Doc/library/os.rst
index 74897a7..4ffd520 100644
--- a/Doc/library/os.rst
+++ b/Doc/library/os.rst
@@ -88,8 +88,8 @@ startup by the :c:func:`PyConfig_Read` function: see
On some systems, conversion using the file system encoding may fail. In this
case, Python uses the :ref:`surrogateescape encoding error handler
<surrogateescape>`, which means that undecodable bytes are replaced by a
- Unicode character U+DCxx on decoding, and these are again translated to the
- original byte on encoding.
+ Unicode character U+DC\ *xx* on decoding, and these are again
+ translated to the original byte on encoding.
The :term:`file system encoding <filesystem encoding and error handler>` must
diff --git a/Doc/library/re.rst b/Doc/library/re.rst
index e506b34..6069600 100644
--- a/Doc/library/re.rst
+++ b/Doc/library/re.rst
@@ -660,7 +660,7 @@ three digits in length.
Unknown escapes consisting of ``'\'`` and an ASCII letter now are errors.
.. versionchanged:: 3.8
- The ``'\N{name}'`` escape sequence has been added. As in string literals,
+ The :samp:`'\\N\\{{name}\\}'` escape sequence has been added. As in string literals,
it expands to the named Unicode character (e.g. ``'\N{EM DASH}'``).
diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst
index c116f4b..ef818a7 100644
--- a/Doc/library/sys.rst
+++ b/Doc/library/sys.rst
@@ -753,7 +753,7 @@ always available.
Return the current value of the flags that are used for
:c:func:`dlopen` calls. Symbolic names for the flag values can be
- found in the :mod:`os` module (``RTLD_xxx`` constants, e.g.
+ found in the :mod:`os` module (:samp:`RTLD_{xxx}` constants, e.g.
:const:`os.RTLD_LAZY`).
.. availability:: Unix.
@@ -1441,7 +1441,7 @@ always available.
lazy resolving of symbols when importing a module, if called as
``sys.setdlopenflags(0)``. To share symbols across extension modules, call as
``sys.setdlopenflags(os.RTLD_GLOBAL)``. Symbolic names for the flag values
- can be found in the :mod:`os` module (``RTLD_xxx`` constants, e.g.
+ can be found in the :mod:`os` module (:samp:`RTLD_{xxx}` constants, e.g.
:const:`os.RTLD_LAZY`).
.. availability:: Unix.
diff --git a/Doc/library/urllib.parse.rst b/Doc/library/urllib.parse.rst
index e1aa4eb..53e5f03 100644
--- a/Doc/library/urllib.parse.rst
+++ b/Doc/library/urllib.parse.rst
@@ -598,7 +598,7 @@ task isn't already covered by the URL parsing functions above.
.. function:: quote(string, safe='/', encoding=None, errors=None)
- Replace special characters in *string* using the ``%xx`` escape. Letters,
+ Replace special characters in *string* using the :samp:`%{xx}` escape. Letters,
digits, and the characters ``'_.-~'`` are never quoted. By default, this
function is intended for quoting the path section of a URL. The optional
*safe* parameter specifies additional ASCII characters that should not be
@@ -645,7 +645,7 @@ task isn't already covered by the URL parsing functions above.
.. function:: unquote(string, encoding='utf-8', errors='replace')
- Replace ``%xx`` escapes with their single-character equivalent.
+ Replace :samp:`%{xx}` escapes with their single-character equivalent.
The optional *encoding* and *errors* parameters specify how to decode
percent-encoded sequences into Unicode characters, as accepted by the
:meth:`bytes.decode` method.
@@ -676,7 +676,7 @@ task isn't already covered by the URL parsing functions above.
.. function:: unquote_to_bytes(string)
- Replace ``%xx`` escapes with their single-octet equivalent, and return a
+ Replace :samp:`%{xx}` escapes with their single-octet equivalent, and return a
:class:`bytes` object.
*string* may be either a :class:`str` or a :class:`bytes` object.