Make page break insertion a little more sensitive.

This commit is contained in:
Kovid Goyal 2008-03-10 03:36:58 +00:00
parent f393af4d41
commit abbb49bb39

View File

@ -1010,8 +1010,12 @@ class HTMLConverter(object):
self.end_page() self.end_page()
self.page_break_found = True self.page_break_found = True
if not self.page_break_found and self.page_break.match(tagname): 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)]) number_of_paragraphs = sum([
if len(self.current_page.contents) > 3 or num > 3: 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.end_page()
self.logger.debug('Forcing page break at %s', tagname) self.logger.debug('Forcing page break at %s', tagname)
return end_page return end_page