mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
DOCX Output: Convert images placed by themselves inside block tags as block images rather than inline images. Fixes #1707430 [Image Alignment EPUB to DOCX Conversion](https://bugs.launchpad.net/calibre/+bug/1707430)
This commit is contained in:
parent
56ef1cbd63
commit
40361b77c9
@ -94,10 +94,16 @@ class ImagesManager(object):
|
|||||||
else:
|
else:
|
||||||
parent = html_img.getparent()
|
parent = html_img.getparent()
|
||||||
if len(parent) == 1 and not (parent.text or '').strip() and not (html_img.tail or '').strip():
|
if len(parent) == 1 and not (parent.text or '').strip() and not (html_img.tail or '').strip():
|
||||||
# We have an inline image alone inside a block
|
|
||||||
pstyle = stylizer.style(parent)
|
pstyle = stylizer.style(parent)
|
||||||
if pstyle['text-align'] in ('center', 'right') and 'block' in pstyle['display']:
|
if 'block' in pstyle['display']:
|
||||||
|
# We have an inline image alone inside a block
|
||||||
|
as_block = True
|
||||||
|
floating = pstyle['float']
|
||||||
|
if floating not in {'left', 'right'}:
|
||||||
|
floating = None
|
||||||
|
if pstyle['text-align'] in ('center', 'right'):
|
||||||
floating = pstyle['text-align']
|
floating = pstyle['text-align']
|
||||||
|
floating = floating or 'left'
|
||||||
fake_margins = floating is None
|
fake_margins = floating is None
|
||||||
self.count += 1
|
self.count += 1
|
||||||
img = self.images[href]
|
img = self.images[href]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user