Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2866c6a

Browse files
committed
merge with 3.3
2 parents 7067b5d + 7ed509a commit 2866c6a

2 files changed

Lines changed: 24 additions & 10 deletions

File tree

Doc/tools/sphinxext/pyspecific.py

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
Sphinx extension with Python doc-specific markup.
77
8-
:copyright: 2008-2013 by Georg Brandl.
8+
:copyright: 2008-2014 by Georg Brandl.
99
:license: Python license.
1010
"""
1111

@@ -145,8 +145,6 @@ def run(self):
145145
from sphinx.locale import versionlabels
146146
from sphinx.util.compat import Directive
147147

148-
versionlabels['deprecated-removed'] = \
149-
'Deprecated since version %s, will be removed in version %s'
150148

151149
class DeprecatedRemoved(Directive):
152150
has_content = True
@@ -155,24 +153,40 @@ class DeprecatedRemoved(Directive):
155153
final_argument_whitespace = True
156154
option_spec = {}
157155

156+
_label = 'Deprecated since version %s, will be removed in version %s'
157+
158158
def run(self):
159159
node = addnodes.versionmodified()
160160
node.document = self.state.document
161161
node['type'] = 'deprecated-removed'
162162
version = (self.arguments[0], self.arguments[1])
163163
node['version'] = version
164+
text = self._label % version
164165
if len(self.arguments) == 3:
165166
inodes, messages = self.state.inline_text(self.arguments[2],
166167
self.lineno+1)
167-
node.extend(inodes)
168-
if self.content:
169-
self.state.nested_parse(self.content, self.content_offset, node)
170-
ret = [node] + messages
168+
para = nodes.paragraph(self.arguments[2], '', *inodes)
169+
node.append(para)
170+
else:
171+
messages = []
172+
if self.content:
173+
self.state.nested_parse(self.content, self.content_offset, node)
174+
if len(node):
175+
if isinstance(node[0], nodes.paragraph) and node[0].rawsource:
176+
content = nodes.inline(node[0].rawsource, translatable=True)
177+
content.source = node[0].source
178+
content.line = node[0].line
179+
content += node[0].children
180+
node[0].replace_self(nodes.paragraph('', '', content))
181+
node[0].insert(0, nodes.inline('', '%s: ' % text,
182+
classes=['versionmodified']))
171183
else:
172-
ret = [node]
184+
para = nodes.paragraph('', '',
185+
nodes.inline('', '%s.' % text, classes=['versionmodified']))
186+
node.append(para)
173187
env = self.state.document.settings.env
174188
env.note_versionchange('deprecated', version[0], node, self.lineno)
175-
return ret
189+
return [node] + messages
176190

177191

178192
# Support for including Misc/NEWS

Doc/tools/sphinxext/static/basic.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ dl.glossary dt {
342342
padding: 7px;
343343
}
344344

345-
div.deprecated p {
345+
div.deprecated p, div.deprecated-removed p {
346346
margin-bottom: 0;
347347
}
348348

0 commit comments

Comments
 (0)