odf2legi: remove all blank/empty paragraphs (#3960)

This commit is contained in:
Frédéric Péters 2013-12-29 23:03:29 +01:00
parent e665b1f61b
commit 8fd91c19a6
1 changed files with 5 additions and 1 deletions

View File

@ -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)