Output formats: allow tags with pure whitespace inside.

This commit is contained in:
Andrey Golovizin 2014-09-08 21:13:43 +02:00
parent 1f91582ccd
commit fda2890711

View file

@ -39,7 +39,7 @@ class OutputFormat(object):
def fix_spaces(self, tagged_text): def fix_spaces(self, tagged_text):
for tag, text in tagged_text: for tag, text in tagged_text:
stripped_text = text.rstrip() stripped_text = text.rstrip()
if len(stripped_text) < len(text): if stripped_text and len(stripped_text) < len(text):
traling_whitespace = text[len(stripped_text):] traling_whitespace = text[len(stripped_text):]
yield tag, stripped_text yield tag, stripped_text
yield None, traling_whitespace yield None, traling_whitespace