summaryrefslogtreecommitdiffstats
path: root/Doc/library/string.rst
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2023-10-11 20:24:12 (GMT)
committerGitHub <noreply@github.com>2023-10-11 20:24:12 (GMT)
commitbb7923f556537a463c403dc1097726d8a8e1a6f2 (patch)
tree8efe3bdbcad4b383d2c584ecbd5d1dc0fdaa4c9c /Doc/library/string.rst
parentc523ce0f434582580a3721e15cb7dd6b56ad0236 (diff)
downloadcpython-bb7923f556537a463c403dc1097726d8a8e1a6f2.zip
cpython-bb7923f556537a463c403dc1097726d8a8e1a6f2.tar.gz
cpython-bb7923f556537a463c403dc1097726d8a8e1a6f2.tar.bz2
gh-110631: Fix reST indentation in `Doc/library` (#110685)
Fix wrong indentation in the Doc/library dir.
Diffstat (limited to 'Doc/library/string.rst')
-rw-r--r--Doc/library/string.rst100
1 files changed, 50 insertions, 50 deletions
diff --git a/Doc/library/string.rst b/Doc/library/string.rst
index 9b28f99..262b785 100644
--- a/Doc/library/string.rst
+++ b/Doc/library/string.rst
@@ -206,15 +206,15 @@ literal text, it can be escaped by doubling: ``{{`` and ``}}``.
The grammar for a replacement field is as follows:
- .. productionlist:: format-string
- replacement_field: "{" [`field_name`] ["!" `conversion`] [":" `format_spec`] "}"
- field_name: arg_name ("." `attribute_name` | "[" `element_index` "]")*
- arg_name: [`identifier` | `digit`+]
- attribute_name: `identifier`
- element_index: `digit`+ | `index_string`
- index_string: <any source character except "]"> +
- conversion: "r" | "s" | "a"
- format_spec: <described in the next section>
+.. productionlist:: format-string
+ replacement_field: "{" [`field_name`] ["!" `conversion`] [":" `format_spec`] "}"
+ field_name: arg_name ("." `attribute_name` | "[" `element_index` "]")*
+ arg_name: [`identifier` | `digit`+]
+ attribute_name: `identifier`
+ element_index: `digit`+ | `index_string`
+ index_string: <any source character except "]"> +
+ conversion: "r" | "s" | "a"
+ format_spec: <described in the next section>
In less formal terms, the replacement field can start with a *field_name* that specifies
the object whose value is to be formatted and inserted
@@ -332,30 +332,30 @@ affect the :func:`format` function.
The meaning of the various alignment options is as follows:
- .. index::
- single: < (less); in string formatting
- single: > (greater); in string formatting
- single: = (equals); in string formatting
- single: ^ (caret); in string formatting
-
- +---------+----------------------------------------------------------+
- | Option | Meaning |
- +=========+==========================================================+
- | ``'<'`` | Forces the field to be left-aligned within the available |
- | | space (this is the default for most objects). |
- +---------+----------------------------------------------------------+
- | ``'>'`` | Forces the field to be right-aligned within the |
- | | available space (this is the default for numbers). |
- +---------+----------------------------------------------------------+
- | ``'='`` | Forces the padding to be placed after the sign (if any) |
- | | but before the digits. This is used for printing fields |
- | | in the form '+000000120'. This alignment option is only |
- | | valid for numeric types. It becomes the default for |
- | | numbers when '0' immediately precedes the field width. |
- +---------+----------------------------------------------------------+
- | ``'^'`` | Forces the field to be centered within the available |
- | | space. |
- +---------+----------------------------------------------------------+
+.. index::
+ single: < (less); in string formatting
+ single: > (greater); in string formatting
+ single: = (equals); in string formatting
+ single: ^ (caret); in string formatting
+
++---------+----------------------------------------------------------+
+| Option | Meaning |
++=========+==========================================================+
+| ``'<'`` | Forces the field to be left-aligned within the available |
+| | space (this is the default for most objects). |
++---------+----------------------------------------------------------+
+| ``'>'`` | Forces the field to be right-aligned within the |
+| | available space (this is the default for numbers). |
++---------+----------------------------------------------------------+
+| ``'='`` | Forces the padding to be placed after the sign (if any) |
+| | but before the digits. This is used for printing fields |
+| | in the form '+000000120'. This alignment option is only |
+| | valid for numeric types. It becomes the default for |
+| | numbers when '0' immediately precedes the field width. |
++---------+----------------------------------------------------------+
+| ``'^'`` | Forces the field to be centered within the available |
+| | space. |
++---------+----------------------------------------------------------+
Note that unless a minimum field width is defined, the field width will always
be the same size as the data to fill it, so that the alignment option has no
@@ -364,23 +364,23 @@ meaning in this case.
The *sign* option is only valid for number types, and can be one of the
following:
- .. index::
- single: + (plus); in string formatting
- single: - (minus); in string formatting
- single: space; in string formatting
-
- +---------+----------------------------------------------------------+
- | Option | Meaning |
- +=========+==========================================================+
- | ``'+'`` | indicates that a sign should be used for both |
- | | positive as well as negative numbers. |
- +---------+----------------------------------------------------------+
- | ``'-'`` | indicates that a sign should be used only for negative |
- | | numbers (this is the default behavior). |
- +---------+----------------------------------------------------------+
- | space | indicates that a leading space should be used on |
- | | positive numbers, and a minus sign on negative numbers. |
- +---------+----------------------------------------------------------+
+.. index::
+ single: + (plus); in string formatting
+ single: - (minus); in string formatting
+ single: space; in string formatting
+
++---------+----------------------------------------------------------+
+| Option | Meaning |
++=========+==========================================================+
+| ``'+'`` | indicates that a sign should be used for both |
+| | positive as well as negative numbers. |
++---------+----------------------------------------------------------+
+| ``'-'`` | indicates that a sign should be used only for negative |
+| | numbers (this is the default behavior). |
++---------+----------------------------------------------------------+
+| space | indicates that a leading space should be used on |
+| | positive numbers, and a minus sign on negative numbers. |
++---------+----------------------------------------------------------+
.. index:: single: z; in string formatting