diff options
author | Georg Brandl <georg@python.org> | 2014-01-21 18:20:58 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2014-01-21 18:20:58 (GMT) |
commit | 2866c6a2a1ebedd1e57d2973b0a77ed14684427d (patch) | |
tree | e1cb7e7bf073f883159dc2f8aae598149473d220 | |
parent | 7067b5d92770569dcadb7c637517c5fc242339c5 (diff) | |
parent | 7ed509a38f49ccdff4002abe2311a40a1e020af3 (diff) | |
download | cpython-2866c6a2a1ebedd1e57d2973b0a77ed14684427d.zip cpython-2866c6a2a1ebedd1e57d2973b0a77ed14684427d.tar.gz cpython-2866c6a2a1ebedd1e57d2973b0a77ed14684427d.tar.bz2 |
merge with 3.3
-rw-r--r-- | Doc/tools/sphinxext/pyspecific.py | 32 | ||||
-rw-r--r-- | Doc/tools/sphinxext/static/basic.css | 2 |
2 files changed, 24 insertions, 10 deletions
diff --git a/Doc/tools/sphinxext/pyspecific.py b/Doc/tools/sphinxext/pyspecific.py index 2b5de14..a7ea7df 100644 --- a/Doc/tools/sphinxext/pyspecific.py +++ b/Doc/tools/sphinxext/pyspecific.py @@ -5,7 +5,7 @@ Sphinx extension with Python doc-specific markup. - :copyright: 2008-2013 by Georg Brandl. + :copyright: 2008-2014 by Georg Brandl. :license: Python license. """ @@ -145,8 +145,6 @@ class PyDecoratorMethod(PyDecoratorMixin, PyClassmember): from sphinx.locale import versionlabels from sphinx.util.compat import Directive -versionlabels['deprecated-removed'] = \ - 'Deprecated since version %s, will be removed in version %s' class DeprecatedRemoved(Directive): has_content = True @@ -155,24 +153,40 @@ class DeprecatedRemoved(Directive): final_argument_whitespace = True option_spec = {} + _label = 'Deprecated since version %s, will be removed in version %s' + def run(self): node = addnodes.versionmodified() node.document = self.state.document node['type'] = 'deprecated-removed' version = (self.arguments[0], self.arguments[1]) node['version'] = version + text = self._label % version if len(self.arguments) == 3: inodes, messages = self.state.inline_text(self.arguments[2], self.lineno+1) - node.extend(inodes) - if self.content: - self.state.nested_parse(self.content, self.content_offset, node) - ret = [node] + messages + para = nodes.paragraph(self.arguments[2], '', *inodes) + node.append(para) + else: + messages = [] + if self.content: + self.state.nested_parse(self.content, self.content_offset, node) + if len(node): + if isinstance(node[0], nodes.paragraph) and node[0].rawsource: + content = nodes.inline(node[0].rawsource, translatable=True) + content.source = node[0].source + content.line = node[0].line + content += node[0].children + node[0].replace_self(nodes.paragraph('', '', content)) + node[0].insert(0, nodes.inline('', '%s: ' % text, + classes=['versionmodified'])) else: - ret = [node] + para = nodes.paragraph('', '', + nodes.inline('', '%s.' % text, classes=['versionmodified'])) + node.append(para) env = self.state.document.settings.env env.note_versionchange('deprecated', version[0], node, self.lineno) - return ret + return [node] + messages # Support for including Misc/NEWS diff --git a/Doc/tools/sphinxext/static/basic.css b/Doc/tools/sphinxext/static/basic.css index 2058b05..3242a81 100644 --- a/Doc/tools/sphinxext/static/basic.css +++ b/Doc/tools/sphinxext/static/basic.css @@ -342,7 +342,7 @@ dl.glossary dt { padding: 7px; } -div.deprecated p { +div.deprecated p, div.deprecated-removed p { margin-bottom: 0; } |