mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Conversion pipeline: Convert width and height attributes of th e<img> tag to CSS. Fixes #3536 (HTML image size attributes)
This commit is contained in:
parent
3b0eca7efa
commit
ace64ded21
@ -188,6 +188,16 @@ class Stylizer(object):
|
|||||||
%(text, item.href))
|
%(text, item.href))
|
||||||
for elem in matches:
|
for elem in matches:
|
||||||
self.style(elem)._update_cssdict(cssdict)
|
self.style(elem)._update_cssdict(cssdict)
|
||||||
|
for elem in xpath(tree, '//h:img[@width or @height]'):
|
||||||
|
base = elem.get('style', '').strip()
|
||||||
|
if base:
|
||||||
|
base += ';'
|
||||||
|
for prop in ('width', 'height'):
|
||||||
|
val = elem.get(prop, False)
|
||||||
|
if val:
|
||||||
|
base += '%s: %s;'%(prop, val)
|
||||||
|
del elem.attrib[prop]
|
||||||
|
elem.set('style', base)
|
||||||
for elem in xpath(tree, '//h:*[@style]'):
|
for elem in xpath(tree, '//h:*[@style]'):
|
||||||
self.style(elem)._apply_style_attr()
|
self.style(elem)._apply_style_attr()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user