mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
EPUB Output: When splitting be a little cleverer about discarding 'empty' pages
This commit is contained in:
parent
181d0065b6
commit
694290a166
@ -346,9 +346,9 @@ class FlowSplitter(object):
|
|||||||
body = self.get_body(root)
|
body = self.get_body(root)
|
||||||
if body is None:
|
if body is None:
|
||||||
return False
|
return False
|
||||||
txt = re.sub(r'\s+', '',
|
txt = re.sub(ur'\s+|\xa0', '',
|
||||||
etree.tostring(body, method='text', encoding=unicode))
|
etree.tostring(body, method='text', encoding=unicode))
|
||||||
if len(txt) > 4:
|
if len(txt) > 1:
|
||||||
return False
|
return False
|
||||||
for img in root.xpath('//h:img', namespaces=NAMESPACES):
|
for img in root.xpath('//h:img', namespaces=NAMESPACES):
|
||||||
if img.get('style', '') != 'display:none':
|
if img.get('style', '') != 'display:none':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user