summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2007-07-05 12:45:43 +0000
committerwiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2007-07-05 12:45:43 +0000
commitd809c190987580c2d872415eebc62e2440f108ae (patch)
treecee83580bf7579beca95eb8364d2b54536d6ee16
parentdf9a46444fb1184886ee10e88ba0e8bba254d6cb (diff)
downloaddocutils-d809c190987580c2d872415eebc62e2440f108ae.tar.gz
make sure invisible elements do not prevent paragraphs from being compacted
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils/docutils@5314 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
-rw-r--r--writers/html4css1/__init__.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/writers/html4css1/__init__.py b/writers/html4css1/__init__.py
index f44f2eaed..ae05cd144 100644
--- a/writers/html4css1/__init__.py
+++ b/writers/html4css1/__init__.py
@@ -1167,12 +1167,11 @@ class HTMLTranslator(nodes.NodeVisitor):
if child is node:
break
return 0
+ parent_length = len([n for n in node.parent if not isinstance(
+ n, (nodes.Invisible, nodes.label))])
if ( self.compact_simple
or self.compact_field_list
- or (self.compact_p
- and (len(node.parent) == 1
- or len(node.parent) == 2
- and isinstance(node.parent[0], nodes.label)))):
+ or self.compact_p and parent_length == 1):
return 1
return 0