mirror of https://github.com/python/cpython
Issue #22695: Fix rendering of the deprecated-removed role in HTML.
This commit is contained in:
commit
bf764a1912
|
@ -172,22 +172,20 @@ class DeprecatedRemoved(Directive):
|
||||||
messages = []
|
messages = []
|
||||||
if self.content:
|
if self.content:
|
||||||
self.state.nested_parse(self.content, self.content_offset, node)
|
self.state.nested_parse(self.content, self.content_offset, node)
|
||||||
|
if len(node):
|
||||||
if isinstance(node[0], nodes.paragraph) and node[0].rawsource:
|
if isinstance(node[0], nodes.paragraph) and node[0].rawsource:
|
||||||
content = nodes.inline(node[0].rawsource, translatable=True)
|
content = nodes.inline(node[0].rawsource, translatable=True)
|
||||||
content.source = node[0].source
|
content.source = node[0].source
|
||||||
content.line = node[0].line
|
content.line = node[0].line
|
||||||
content += node[0].children
|
content += node[0].children
|
||||||
node[0].replace_self(nodes.paragraph('', '', content))
|
node[0].replace_self(nodes.paragraph('', '', content))
|
||||||
node[0].insert(0, nodes.inline('', '%s: ' % text,
|
node[0].insert(0, nodes.inline('', '%s: ' % text,
|
||||||
classes=['versionmodified']))
|
classes=['versionmodified']))
|
||||||
else:
|
else:
|
||||||
para = nodes.paragraph('', '',
|
para = nodes.paragraph('', '',
|
||||||
nodes.inline('', '%s.' % text,
|
nodes.inline('', '%s.' % text,
|
||||||
classes=['versionmodified']))
|
classes=['versionmodified']))
|
||||||
if len(node):
|
node.append(para)
|
||||||
node.insert(0, para)
|
|
||||||
else:
|
|
||||||
node.append(para)
|
|
||||||
env = self.state.document.settings.env
|
env = self.state.document.settings.env
|
||||||
env.note_versionchange('deprecated', version[0], node, self.lineno)
|
env.note_versionchange('deprecated', version[0], node, self.lineno)
|
||||||
return [node] + messages
|
return [node] + messages
|
||||||
|
|
Loading…
Reference in New Issue