From 8fd91c19a6edf0e92bc6079b19153947725be154 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Sun, 29 Dec 2013 23:03:29 +0100 Subject: [PATCH] odf2legi: remove all blank/empty paragraphs (#3960) --- odf2legi/odf2legi.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/odf2legi/odf2legi.py b/odf2legi/odf2legi.py index 8cfa0ec..e5abef3 100644 --- a/odf2legi/odf2legi.py +++ b/odf2legi/odf2legi.py @@ -401,7 +401,11 @@ def handle_paragraph(parent, elem): parent.attrib['role'] = align fill_inline(para, elem, invert_bg=invert_bg) - if not (para.text or para.tail or len(para.getchildren())): + if not para.text: + para_text = None + else: + para_text = para.text.replace(' ', '').replace('\t', '').replace(u'\xa0', '') + if not (para_text or para.tail or len(para.getchildren())): # remove empty paragraphs if para in parent: parent.remove(para)