mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #3506 (Cannot convert .LIT to .EPUB)
This commit is contained in:
parent
2d95f2f641
commit
983e9bdb48
@ -362,12 +362,13 @@ class FlowSplitter(object):
|
|||||||
self.log.debug('\t\tSplitting...')
|
self.log.debug('\t\tSplitting...')
|
||||||
root = tree.getroot()
|
root = tree.getroot()
|
||||||
# Split large <pre> tags
|
# Split large <pre> tags
|
||||||
for pre in list(root.xpath('//pre')):
|
for pre in list(XPath('//h:pre')(root)):
|
||||||
text = u''.join(pre.xpath('descendant::text()'))
|
text = u''.join(pre.xpath('descendant::text()'))
|
||||||
pre.text = text
|
pre.text = text
|
||||||
for child in list(pre.iterchildren()):
|
for child in list(pre.iterchildren()):
|
||||||
pre.remove(child)
|
pre.remove(child)
|
||||||
if len(pre.text) > self.max_flow_size*0.5:
|
if len(pre.text) > self.max_flow_size*0.5:
|
||||||
|
self.log.debug('\t\tSplitting large <pre> tag')
|
||||||
frags = self.split_text(pre.text, root, int(0.2*self.max_flow_size))
|
frags = self.split_text(pre.text, root, int(0.2*self.max_flow_size))
|
||||||
new_pres = []
|
new_pres = []
|
||||||
for frag in frags:
|
for frag in frags:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user