Commits

Georg Brandl committed bcca713 Merge

#415: Do not compact single paragraphs within desc_content nodes.

Comments (0)

Files changed (1)

sphinx/writers/html.py

 from docutils import nodes
 from docutils.writers.html4css1 import Writer, HTMLTranslator as BaseTranslator
 
+from sphinx import addnodes
 from sphinx.locale import admonitionlabels, versionlabels, _
 from sphinx.util.smartypants import sphinx_smarty_pants
 
     def depart_centered(self, node):
         self.body.append('</strong></p>')
 
+    # overwritten
+    def should_be_compact_paragraph(self, node):
+        """Determine if the <p> tags around paragraph can be omitted."""
+        if isinstance(node.parent, addnodes.desc_content):
+            # Never compact desc_content items.
+            return False
+        return BaseTranslator.should_be_compact_paragraph(self, node)
+
     def visit_compact_paragraph(self, node):
         pass
     def depart_compact_paragraph(self, node):