mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Make page break insertion a little more sensitive.
This commit is contained in:
parent
f393af4d41
commit
abbb49bb39
@ -1010,8 +1010,12 @@ class HTMLConverter(object):
|
||||
self.end_page()
|
||||
self.page_break_found = True
|
||||
if not self.page_break_found and self.page_break.match(tagname):
|
||||
num = len([1 for i in self.current_block.contents if isinstance(i, Paragraph)])
|
||||
if len(self.current_page.contents) > 3 or num > 3:
|
||||
number_of_paragraphs = sum([
|
||||
len([1 for i in block.contents if isinstance(i, Paragraph)])
|
||||
for block in self.current_page.contents is isinstance(block, TextBlock)
|
||||
])
|
||||
|
||||
if number_of_paragraphs > 2:
|
||||
self.end_page()
|
||||
self.logger.debug('Forcing page break at %s', tagname)
|
||||
return end_page
|
||||
|
Loading…
x
Reference in New Issue
Block a user