mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix a few directory relativity bugs.
This commit is contained in:
parent
c4299cd17a
commit
56a64e1540
@ -186,8 +186,10 @@ class Serializer(object):
|
||||
if attr == 'href':
|
||||
if self.serialize_href(val, item):
|
||||
continue
|
||||
elif attr == 'src' and val in hrefs:
|
||||
index = self.images[val]
|
||||
elif attr == 'src':
|
||||
href = item.abshref(val)
|
||||
if href in hrefs:
|
||||
index = self.images[href]
|
||||
buffer.write('recindex="%05d"' % index)
|
||||
continue
|
||||
buffer.write(attr)
|
||||
|
@ -914,11 +914,11 @@ class OEBBook(object):
|
||||
cover = self.manifest.hrefs[href]
|
||||
elif xpath(html, '//h:img[position()=1]'):
|
||||
img = xpath(html, '//h:img[position()=1]')[0]
|
||||
href = img.get('src')
|
||||
href = spine0.abshref(img.get('src'))
|
||||
cover = self.manifest.hrefs[href]
|
||||
elif xpath(html, '//h:object[position()=1]'):
|
||||
object = xpath(html, '//h:object[position()=1]')[0]
|
||||
href = object.get('data')
|
||||
href = spine0.abshref(object.get('data'))
|
||||
cover = self.manifest.hrefs[href]
|
||||
elif xpath(html, '//svg:svg[position()=1]'):
|
||||
svg = copy.deepcopy(xpath(html, '//svg:svg[position()=1]')[0])
|
||||
|
@ -218,7 +218,9 @@ class CSSFlattener(object):
|
||||
for child in node:
|
||||
self.flatten_node(child, stylizer, names, styles, psize, left)
|
||||
|
||||
def flatten_head(self, head, stylizer, href):
|
||||
def flatten_head(self, item, stylizer, href):
|
||||
html = item.data
|
||||
head = html.find(XHTML('head'))
|
||||
for node in head:
|
||||
if node.tag == XHTML('link') \
|
||||
and node.get('rel', 'stylesheet') == 'stylesheet' \
|
||||
@ -227,6 +229,7 @@ class CSSFlattener(object):
|
||||
elif node.tag == XHTML('style') \
|
||||
and node.get('type', CSS_MIME) in OEB_STYLES:
|
||||
head.remove(node)
|
||||
href = item.relhref(href)
|
||||
etree.SubElement(head, XHTML('link'),
|
||||
rel='stylesheet', type=CSS_MIME, href=href)
|
||||
if stylizer.page_rule:
|
||||
@ -259,7 +262,5 @@ class CSSFlattener(object):
|
||||
css = ''.join(".%s {\n%s;\n}\n\n" % (key, val) for key, val in items)
|
||||
href = self.replace_css(css)
|
||||
for item in self.oeb.spine:
|
||||
html = item.data
|
||||
stylizer = self.stylizers[item]
|
||||
head = html.find(XHTML('head'))
|
||||
self.flatten_head(head, stylizer, href)
|
||||
self.flatten_head(item, stylizer, href)
|
||||
|
Loading…
x
Reference in New Issue
Block a user