Fix handling of HTML files with <hr> as the first element

This commit is contained in:
Kovid Goyal 2007-05-10 20:26:18 +00:00
parent 9026e54fbf
commit be8345b0c2
2 changed files with 6 additions and 4 deletions

View File

@ -415,7 +415,7 @@ class HTMLConverter(object):
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 @@ class HTMLConverter(object):
break
if not self.top.parent:
raise ConversionError, 'Could not parse ' + self.file_name

View File

@ -632,8 +632,8 @@ class TableOfContents(object):
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 @@ class JumpButton(LrsObject, LrsContainer):
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):