mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
15b0df028e
commit
6e7f6db830
@ -167,6 +167,15 @@ class KF8Writer(object):
|
|||||||
link.set('href', 'kindle:flow:%s?mime=text/css'%idx)
|
link.set('href', 'kindle:flow:%s?mime=text/css'%idx)
|
||||||
|
|
||||||
def extract_svg_into_flows(self):
|
def extract_svg_into_flows(self):
|
||||||
|
images = {}
|
||||||
|
|
||||||
|
for item in self.oeb.manifest:
|
||||||
|
if item.media_type == SVG_MIME:
|
||||||
|
data = self.data(item)
|
||||||
|
images[item.href] = len(self.flows)
|
||||||
|
self.flows.append(etree.tostring(data, encoding='UTF=8',
|
||||||
|
with_tail=True, xml_declaration=True))
|
||||||
|
|
||||||
for item in self.oeb.spine:
|
for item in self.oeb.spine:
|
||||||
root = self.data(item)
|
root = self.data(item)
|
||||||
|
|
||||||
@ -181,6 +190,14 @@ class KF8Writer(object):
|
|||||||
p.insert(pos, img)
|
p.insert(pos, img)
|
||||||
extract(svg)
|
extract(svg)
|
||||||
|
|
||||||
|
for img in XPath('//h:img[@src]')(root):
|
||||||
|
src = img.get('src')
|
||||||
|
abshref = item.abshref(src)
|
||||||
|
idx = images.get(abshref, None)
|
||||||
|
if idx is not None:
|
||||||
|
img.set('src', 'kindle:flow:%s?mime=image/svg+xml'%
|
||||||
|
to_ref(idx))
|
||||||
|
|
||||||
def replace_internal_links_with_placeholders(self):
|
def replace_internal_links_with_placeholders(self):
|
||||||
self.link_map = {}
|
self.link_map = {}
|
||||||
count = 0
|
count = 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user