mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #9333 from tk0miya/9330_versionchanged_breaks_list
Fix #9330: versionchanged causes error during pdf build
This commit is contained in:
commit
7673cd6429
2
CHANGES
2
CHANGES
@ -16,6 +16,8 @@ Features added
|
||||
Bugs fixed
|
||||
----------
|
||||
|
||||
* #9330: changeset domain: :rst:dir:`versionchanged` with contents being a list
|
||||
will cause error during pdf build
|
||||
* #9313: LaTeX: complex table with merged cells broken since 4.0
|
||||
|
||||
Testing
|
||||
|
@ -74,8 +74,10 @@ class VersionChange(SphinxDirective):
|
||||
if self.content:
|
||||
self.state.nested_parse(self.content, self.content_offset, node)
|
||||
classes = ['versionmodified', versionlabel_classes[self.name]]
|
||||
if len(node):
|
||||
if isinstance(node[0], nodes.paragraph) and node[0].rawsource:
|
||||
if len(node) > 0 and isinstance(node[0], nodes.paragraph):
|
||||
# the contents start with a paragraph
|
||||
if node[0].rawsource:
|
||||
# make the first paragraph translatable
|
||||
content = nodes.inline(node[0].rawsource, translatable=True)
|
||||
content.source = node[0].source
|
||||
content.line = node[0].line
|
||||
@ -84,10 +86,16 @@ class VersionChange(SphinxDirective):
|
||||
|
||||
para = cast(nodes.paragraph, node[0])
|
||||
para.insert(0, nodes.inline('', '%s: ' % text, classes=classes))
|
||||
else:
|
||||
elif len(node) > 0:
|
||||
# the contents do not starts with a paragraph
|
||||
para = nodes.paragraph('', '',
|
||||
nodes.inline('', '%s.' % text,
|
||||
classes=classes),
|
||||
nodes.inline('', '%s: ' % text, classes=classes),
|
||||
translatable=False)
|
||||
node.insert(0, para)
|
||||
else:
|
||||
# the contents are empty
|
||||
para = nodes.paragraph('', '',
|
||||
nodes.inline('', '%s.' % text, classes=classes),
|
||||
translatable=False)
|
||||
node.append(para)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user