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