Commits

Nozomu Kaneko committed cd9bc59

fix: paragraphs in versionmodified are ignored when it has no dangling paragraphs.

Comments (0)

Files changed (3)

sphinx/directives/other.py

             inodes, messages = self.state.inline_text(self.arguments[1],
                                                       self.lineno+1)
             node.extend(inodes)
-            if self.content:
-                self.state.nested_parse(self.content, self.content_offset, node)
             ret = [node] + messages
         else:
             ret = [node]
+        if self.content:
+            self.state.nested_parse(self.content, self.content_offset, node)
         env = self.state.document.settings.env
         # XXX should record node.source as well
         env.note_versionchange(node['type'], node['version'], node, node.line)

tests/root/markup.txt

 .. deprecated:: 0.6
    Boring stuff.
 
+.. versionadded:: 1.2
+
+   First paragraph of versionadded.
+
+.. versionchanged:: 1.2
+   First paragraph of versionchanged.
+
+   Second paragraph of versionchanged.
+
 
 Code blocks
 -----------

tests/test_build_html.py

         (".//abbr[@title='abbreviation']", '^abbr$'),
         # version stuff
         (".//span[@class='versionmodified']", 'New in version 0.6'),
+        (".//p[@class='versionadded']/span[@class='versionmodified']",
+         tail_check('First paragraph of versionadded')),
+        (".//p[@class='versionchanged']/span[@class='versionmodified']",
+         tail_check('First paragraph of versionchanged')),
+        (".//p", 'Second paragraph of versionchanged'),
         # footnote reference
         (".//a[@class='footnote-reference']", r'\[1\]'),
         # created by reference lookup