mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 18:24:30 -04:00
Fix handling of HTML files with <hr> as the first element
This commit is contained in:
parent
9026e54fbf
commit
be8345b0c2
@ -415,7 +415,7 @@ class HTMLConverter(object):
|
|||||||
|
|
||||||
if not self.top.parent:
|
if not self.top.parent:
|
||||||
if not previous:
|
if not previous:
|
||||||
self.top = self.book.pages()[0].contents[0]
|
self.top = self.book.pages()[0].contents[0]
|
||||||
else:
|
else:
|
||||||
found = False
|
found = False
|
||||||
for page in self.book.pages():
|
for page in self.book.pages():
|
||||||
@ -427,6 +427,7 @@ class HTMLConverter(object):
|
|||||||
break
|
break
|
||||||
if not self.top.parent:
|
if not self.top.parent:
|
||||||
raise ConversionError, 'Could not parse ' + self.file_name
|
raise ConversionError, 'Could not parse ' + self.file_name
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -632,8 +632,8 @@ class TableOfContents(object):
|
|||||||
|
|
||||||
|
|
||||||
def addTocEntry(self, tocLabel, textBlock):
|
def addTocEntry(self, tocLabel, textBlock):
|
||||||
if not isinstance(textBlock, (TextBlock, ImageBlock)):
|
if not isinstance(textBlock, (TextBlock, ImageBlock, RuledLine)):
|
||||||
raise LrsError, "TOC destination must be a TextBlock or ImageBlock"+\
|
raise LrsError, "TOC destination must be a TextBlock, ImageBlock or RuledLine"+\
|
||||||
" not a " + str(type(textBlock))
|
" not a " + str(type(textBlock))
|
||||||
|
|
||||||
if textBlock.parent is None or not isinstance(textBlock.parent, Page):
|
if textBlock.parent is None or not isinstance(textBlock.parent, Page):
|
||||||
@ -1968,7 +1968,7 @@ class JumpButton(LrsObject, LrsContainer):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
class RuledLine(LrsContainer, LrsAttributes):
|
class RuledLine(LrsContainer, LrsAttributes, LrsObject):
|
||||||
""" A line. Default is 500 pixels long, 2 pixels wide. """
|
""" A line. Default is 500 pixels long, 2 pixels wide. """
|
||||||
|
|
||||||
defaults = dict(
|
defaults = dict(
|
||||||
@ -1978,6 +1978,7 @@ class RuledLine(LrsContainer, LrsAttributes):
|
|||||||
def __init__(self, **settings):
|
def __init__(self, **settings):
|
||||||
LrsContainer.__init__(self, [])
|
LrsContainer.__init__(self, [])
|
||||||
LrsAttributes.__init__(self, self.defaults, **settings)
|
LrsAttributes.__init__(self, self.defaults, **settings)
|
||||||
|
LrsObject.__init__(self)
|
||||||
|
|
||||||
|
|
||||||
def toLrfContainer(self, lrfWriter, container):
|
def toLrfContainer(self, lrfWriter, container):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user