Skip to content

Commit ea978c6

Browse files
authored
pythongh-113637: Let c_annotations.py to handle the spacing of Limited/Unstable API & Stable ABI translation strings (python#113638)
1 parent dc8df6e commit ea978c6

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

Doc/tools/extensions/c_annotations.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ def add_annotations(self, app, doctree):
126126
f"Object type mismatch in limited API annotation "
127127
f"for {name}: {record['role']!r} != {objtype!r}")
128128
stable_added = record['added']
129-
message = sphinx_gettext(' Part of the ')
129+
message = sphinx_gettext('Part of the')
130+
message = message.center(len(message) + 2)
130131
emph_node = nodes.emphasis(message, message,
131132
classes=['stableabi'])
132133
ref_node = addnodes.pending_xref(
@@ -139,27 +140,27 @@ def add_annotations(self, app, doctree):
139140
ref_node += nodes.Text(sphinx_gettext('Stable ABI'))
140141
emph_node += ref_node
141142
if struct_abi_kind == 'opaque':
142-
emph_node += nodes.Text(sphinx_gettext(' (as an opaque struct)'))
143+
emph_node += nodes.Text(' ' + sphinx_gettext('(as an opaque struct)'))
143144
elif struct_abi_kind == 'full-abi':
144-
emph_node += nodes.Text(sphinx_gettext(' (including all members)'))
145+
emph_node += nodes.Text(' ' + sphinx_gettext('(including all members)'))
145146
if record['ifdef_note']:
146147
emph_node += nodes.Text(' ' + record['ifdef_note'])
147148
if stable_added == '3.2':
148149
# Stable ABI was introduced in 3.2.
149150
pass
150151
else:
151-
emph_node += nodes.Text(sphinx_gettext(' since version %s') % stable_added)
152+
emph_node += nodes.Text(' ' + sphinx_gettext('since version %s') % stable_added)
152153
emph_node += nodes.Text('.')
153154
if struct_abi_kind == 'members':
154155
emph_node += nodes.Text(
155-
sphinx_gettext(' (Only some members are part of the stable ABI.)'))
156+
' ' + sphinx_gettext('(Only some members are part of the stable ABI.)'))
156157
node.insert(0, emph_node)
157158

158159
# Unstable API annotation.
159160
if name.startswith('PyUnstable'):
160161
warn_node = nodes.admonition(
161162
classes=['unstable-c-api', 'warning'])
162-
message = sphinx_gettext('This is ')
163+
message = sphinx_gettext('This is') + ' '
163164
emph_node = nodes.emphasis(message, message)
164165
ref_node = addnodes.pending_xref(
165166
'Unstable API', refdomain="std",

Doc/tools/templates/dummy.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99

1010
In extensions/c_annotations.py:
1111

12-
{% trans %} Part of the {% endtrans %}
12+
{% trans %}Part of the{% endtrans %}
1313
{% trans %}Limited API{% endtrans %}
1414
{% trans %}Stable ABI{% endtrans %}
15-
{% trans %} (as an opaque struct){% endtrans %}
16-
{% trans %} (including all members){% endtrans %}
17-
{% trans %} since version %s{% endtrans %}
18-
{% trans %} (Only some members are part of the stable ABI.){% endtrans %}
19-
{% trans %}This is {% endtrans %}
15+
{% trans %}(as an opaque struct){% endtrans %}
16+
{% trans %}(including all members){% endtrans %}
17+
{% trans %}since version %s{% endtrans %}
18+
{% trans %}(Only some members are part of the stable ABI.){% endtrans %}
19+
{% trans %}This is{% endtrans %}
2020
{% trans %}Unstable API{% endtrans %}
2121
{% trans %}. It may change without warning in minor releases.{% endtrans %}
2222
{% trans %}Return value: Always NULL.{% endtrans %}

Misc/ACKS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Farhan Ahmad
3131
Matthew Ahrens
3232
Nir Aides
3333
Akira
34+
Ege Akman
3435
Yaniv Aknin
3536
Jyrki Alakuijala
3637
Tatiana Al-Chueyr

0 commit comments

Comments
 (0)