mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Rudimentary support for page-break-after: avoid. May have broken other things.
This commit is contained in:
parent
1bbab6f266
commit
756de168fe
@ -500,6 +500,24 @@ class HTMLConverter(object):
|
||||
self.book.append(self.current_page)
|
||||
self.current_page = None
|
||||
|
||||
if not top.has_text() and top.parent.contents.index(top) == len(top.parent.contents)-1:
|
||||
top.parent.contents.remove(top)
|
||||
opage = top.parent
|
||||
if self.book.last_page() is opage:
|
||||
if self.current_page and self.current_page.has_text():
|
||||
for c in self.current_page.contents:
|
||||
if isinstance(c, (TextBlock, ImageBlock)):
|
||||
return c
|
||||
raise ConversionError(_('Could not parse file: %s')%self.file_name)
|
||||
else:
|
||||
index = self.book.pages().index(opage)
|
||||
for page in list(self.book.pages()[index+1:]):
|
||||
for c in page.contents:
|
||||
if isinstance(c, (TextBlock, ImageBlock)):
|
||||
return c
|
||||
raise ConversionError(_('Could not parse file: %s')%self.file_name)
|
||||
|
||||
|
||||
return top
|
||||
|
||||
def create_link(self, children, tag):
|
||||
@ -1381,7 +1399,7 @@ class HTMLConverter(object):
|
||||
self.targets[self.target_prefix+tag[key]] = self.current_block
|
||||
self.current_block.must_append = True
|
||||
else:
|
||||
self.logger.warn('Could not follow link to '+tag['href'])
|
||||
self.logger.debug('Could not follow link to '+tag['href'])
|
||||
self.process_children(tag, tag_css, tag_pseudo_css)
|
||||
elif tag.has_key('name') or tag.has_key('id'):
|
||||
self.process_anchor(tag, tag_css, tag_pseudo_css)
|
||||
|
Loading…
x
Reference in New Issue
Block a user