Skip to content

Commit 6b71379

Browse files
committed
Fix potential exception in soup2html.
- Legacy-Id: 340
1 parent 8deca34 commit 6b71379

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

ietf/utils/soup2text.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,9 @@ def render(node, encoding='latin-1', pre=False):
8787
blocks.append(child.text+"\n\n")
8888
node.is_block = True
8989
else:
90-
if child.text:
91-
if child.name in space_tags and not words[-1][-1] in [" ", "\t", "\n"]:
92-
words.append(" ")
93-
words.append(child.text)
90+
if child.name in space_tags and not (words[-1] and words[-1][-1] in [" ", "\t", "\n"]):
91+
words.append(" ")
92+
words.append(child.text)
9493
else:
9594
raise ValueError("Unexpected node type: '%s'" % child)
9695
if words:

0 commit comments

Comments
 (0)