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:
Kovid Goyal 2017-08-03 18:01:12 +05:30
parent 56ef1cbd63
commit 40361b77c9
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -94,10 +94,16 @@ class ImagesManager(object):
else:
parent = html_img.getparent()
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)
if pstyle['text-align'] in ('center', 'right') and 'block' in pstyle['display']:
floating = pstyle['text-align']
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 = floating or 'left'
fake_margins = floating is None
self.count += 1
img = self.images[href]