Fix loading of external stylesheets in html2epub

This commit is contained in:
Kovid Goyal 2008-09-23 13:33:53 -07:00
parent 501cc90bfa
commit 8f090b2d31
2 changed files with 2 additions and 2 deletions

View File

@ -71,7 +71,7 @@ The expression used must evaluate to a list of elements. To disable chapter dete
use the expression "/". See the XPath Tutorial in the calibre User Manual for further
help on using this feature.
''').replace('\n', ' '))
structure('chapter_mark', ['--chapter-mark'], choices=['pagebreak', 'rule', 'both'],
structure('chapter_mark', ['--chapter-mark'], choices=['pagebreak', 'rule', 'both', 'none'],
default='pagebreak', help=_('Specify how to mark detected chapters. A value of "pagebreak" will insert page breaks before chapters. A value of "rule" will insert a line before chapters. A value of "none" will disable chapter marking and a value of "both" will use both page breaks and lines to mark chapters.'))
structure('cover', ['--cover'], default=None,
help=_('Path to the cover to be used for this book'))

View File

@ -540,7 +540,7 @@ class Processor(Parser):
css = []
for link in self.root.xpath('//link'):
if 'css' in link.get('type', 'text/css').lower():
file = self.htmlfile.resolve(unicode(link.get('href', ''), self.htmlfile.encoding)).path
file = os.path.join(self.tdir, link.get('href', ''))
if file and os.path.exists(file) and os.path.isfile(file):
css.append(open(file, 'rb').read().decode('utf-8'))
link.getparent().remove(link)