mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
DOCX: Handle images in v:pict tags
This commit is contained in:
parent
587603c95a
commit
c73c00ad0b
@ -157,6 +157,17 @@ class Images(object):
|
|||||||
ans.set('style', '; '.join('%s: %s' % (k, v) for k, v in style.iteritems()))
|
ans.set('style', '; '.join('%s: %s' % (k, v) for k, v in style.iteritems()))
|
||||||
yield ans
|
yield ans
|
||||||
|
|
||||||
|
def pict_to_html(self, pict, page):
|
||||||
|
for imagedata in XPath('descendant::v:imagedata[@r:id]')(pict):
|
||||||
|
rid = get(imagedata, 'r:id')
|
||||||
|
if rid in self.rid_map:
|
||||||
|
src = self.generate_filename(rid)
|
||||||
|
img = IMG(src='images/%s' % src, style="display:block")
|
||||||
|
alt = get(imagedata, 'o:title')
|
||||||
|
if alt:
|
||||||
|
img(alt=alt)
|
||||||
|
yield img
|
||||||
|
|
||||||
def get_float_properties(self, anchor, style, page):
|
def get_float_properties(self, anchor, style, page):
|
||||||
if 'display' not in style:
|
if 'display' not in style:
|
||||||
style['display'] = 'block'
|
style['display'] = 'block'
|
||||||
@ -200,6 +211,8 @@ class Images(object):
|
|||||||
if elem.tag.endswith('}drawing'):
|
if elem.tag.endswith('}drawing'):
|
||||||
for tag in self.drawing_to_html(elem, page):
|
for tag in self.drawing_to_html(elem, page):
|
||||||
yield tag
|
yield tag
|
||||||
# TODO: Handle w:pict
|
else:
|
||||||
|
for tag in self.pict_to_html(elem, page):
|
||||||
|
yield tag
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user