summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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