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
c378aeef
Commit
c378aeef
authored
Oct 12, 2013
by
Georg Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix compatibility with upcoming Sphinx 1.2.
parent
e2f0f070
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
16 deletions
+17
-16
Doc/tools/sphinxext/pyspecific.py
Doc/tools/sphinxext/pyspecific.py
+17
-16
No files found.
Doc/tools/sphinxext/pyspecific.py
View file @
c378aeef
...
...
@@ -5,7 +5,7 @@
Sphinx extension with Python doc-specific markup.
:copyright: 2008
, 2009, 2010, 2011, 2012
by Georg Brandl.
:copyright: 2008
-2013
by Georg Brandl.
:license: Python license.
"""
...
...
@@ -13,7 +13,12 @@ ISSUE_URI = 'http://bugs.python.org/issue%s'
SOURCE_URI
=
'http://hg.python.org/cpython/file/3.3/%s'
from
docutils
import
nodes
,
utils
import
sphinx
from
sphinx.util.nodes
import
split_explicit_title
from
sphinx.writers.html
import
HTMLTranslator
from
sphinx.writers.latex
import
LaTeXTranslator
from
sphinx.locale
import
versionlabels
# monkey-patch reST parser to disable alphabetic and roman enumerated lists
from
docutils.parsers.rst.states
import
Body
...
...
@@ -22,21 +27,17 @@ Body.enum.converters['loweralpha'] = \
Body
.
enum
.
converters
[
'lowerroman'
]
=
\
Body
.
enum
.
converters
[
'upperroman'
]
=
lambda
x
:
None
# monkey-patch HTML translator to give versionmodified paragraphs a class
def
new_visit_versionmodified
(
self
,
node
):
self
.
body
.
append
(
self
.
starttag
(
node
,
'p'
,
CLASS
=
node
[
'type'
]))
text
=
versionlabels
[
node
[
'type'
]]
%
node
[
'version'
]
if
len
(
node
):
text
+=
':'
else
:
text
+=
'.'
self
.
body
.
append
(
'<span class="versionmodified">%s</span> '
%
text
)
from
sphinx.writers.html
import
HTMLTranslator
from
sphinx.writers.latex
import
LaTeXTranslator
from
sphinx.locale
import
versionlabels
HTMLTranslator
.
visit_versionmodified
=
new_visit_versionmodified
HTMLTranslator
.
visit_versionmodified
=
new_visit_versionmodified
if
sphinx
.
__version__
[:
3
]
<
'1.2'
:
# monkey-patch HTML translator to give versionmodified paragraphs a class
def
new_visit_versionmodified
(
self
,
node
):
self
.
body
.
append
(
self
.
starttag
(
node
,
'p'
,
CLASS
=
node
[
'type'
]))
text
=
versionlabels
[
node
[
'type'
]]
%
node
[
'version'
]
if
len
(
node
):
text
+=
':'
else
:
text
+=
'.'
self
.
body
.
append
(
'<span class="versionmodified">%s</span> '
%
text
)
HTMLTranslator
.
visit_versionmodified
=
new_visit_versionmodified
# monkey-patch HTML and LaTeX translators to keep doctest blocks in the
# doctest docs themselves
...
...
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