Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
c351ce6a
Commit
c351ce6a
authored
Mar 08, 2017
by
INADA Naoki
Committed by
GitHub
Mar 08, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-28331: fix impl-detail label is removed when content is translated. (GH-195)
parent
c45cd167
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
2 deletions
+18
-2
Doc/tools/extensions/pyspecific.py
Doc/tools/extensions/pyspecific.py
+12
-2
Doc/tools/templates/dummy.html
Doc/tools/templates/dummy.html
+6
-0
No files found.
Doc/tools/extensions/pyspecific.py
View file @
c351ce6a
...
@@ -21,6 +21,7 @@ from docutils import nodes, utils
...
@@ -21,6 +21,7 @@ from docutils import nodes, utils
from
sphinx
import
addnodes
from
sphinx
import
addnodes
from
sphinx.builders
import
Builder
from
sphinx.builders
import
Builder
from
sphinx.locale
import
translators
from
sphinx.util.nodes
import
split_explicit_title
from
sphinx.util.nodes
import
split_explicit_title
from
sphinx.util.compat
import
Directive
from
sphinx.util.compat
import
Directive
from
sphinx.writers.html
import
HTMLTranslator
from
sphinx.writers.html
import
HTMLTranslator
...
@@ -103,16 +104,25 @@ class ImplementationDetail(Directive):
...
@@ -103,16 +104,25 @@ class ImplementationDetail(Directive):
optional_arguments
=
1
optional_arguments
=
1
final_argument_whitespace
=
True
final_argument_whitespace
=
True
# This text is copied to templates/dummy.html
label_text
=
'CPython implementation detail:'
def
run
(
self
):
def
run
(
self
):
pnode
=
nodes
.
compound
(
classes
=
[
'impl-detail'
])
pnode
=
nodes
.
compound
(
classes
=
[
'impl-detail'
])
label
=
translators
[
'sphinx'
].
gettext
(
self
.
label_text
)
content
=
self
.
content
content
=
self
.
content
add_text
=
nodes
.
strong
(
'CPython implementation detail:'
,
add_text
=
nodes
.
strong
(
label
,
label
)
'CPython implementation detail:'
)
if
self
.
arguments
:
if
self
.
arguments
:
n
,
m
=
self
.
state
.
inline_text
(
self
.
arguments
[
0
],
self
.
lineno
)
n
,
m
=
self
.
state
.
inline_text
(
self
.
arguments
[
0
],
self
.
lineno
)
pnode
.
append
(
nodes
.
paragraph
(
''
,
''
,
*
(
n
+
m
)))
pnode
.
append
(
nodes
.
paragraph
(
''
,
''
,
*
(
n
+
m
)))
self
.
state
.
nested_parse
(
content
,
self
.
content_offset
,
pnode
)
self
.
state
.
nested_parse
(
content
,
self
.
content_offset
,
pnode
)
if
pnode
.
children
and
isinstance
(
pnode
[
0
],
nodes
.
paragraph
):
if
pnode
.
children
and
isinstance
(
pnode
[
0
],
nodes
.
paragraph
):
content
=
nodes
.
inline
(
pnode
[
0
].
rawsource
,
translatable
=
True
)
content
.
source
=
pnode
[
0
].
source
content
.
line
=
pnode
[
0
].
line
content
+=
pnode
[
0
].
children
pnode
[
0
].
replace_self
(
nodes
.
paragraph
(
''
,
''
,
content
,
translatable
=
False
))
pnode
[
0
].
insert
(
0
,
add_text
)
pnode
[
0
].
insert
(
0
,
add_text
)
pnode
[
0
].
insert
(
1
,
nodes
.
Text
(
' '
))
pnode
[
0
].
insert
(
1
,
nodes
.
Text
(
' '
))
else
:
else
:
...
...
Doc/tools/templates/dummy.html
0 → 100644
View file @
c351ce6a
This file is not an actual template, but used to add some
texts in extensions to sphinx.pot file.
In extensions/pyspecific.py:
{% trans %}CPython implementation detail:{% endtrans %}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment