mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix various small bugs that could cause conversion to DOCX to error out
This commit is contained in:
parent
5ceb650f2a
commit
389d433d51
@ -61,7 +61,10 @@ class ImagesManager(object):
|
||||
if not src:
|
||||
return
|
||||
href = self.abshref(src)
|
||||
try:
|
||||
rid = self.read_image(href).rid
|
||||
except AttributeError:
|
||||
return
|
||||
drawing = self.create_image_markup(img, stylizer, href, as_block=as_block)
|
||||
block.add_image(drawing, bookmark=bookmark)
|
||||
return rid
|
||||
|
@ -400,7 +400,10 @@ class BlockStyle(DOCXStyle):
|
||||
else:
|
||||
self.text_indent = int(css['text-indent'] * 20)
|
||||
self.css_text_indent = css._get('text-indent')
|
||||
try:
|
||||
self.line_height = max(0, int(css.lineHeight * 20))
|
||||
except (TypeError, ValueError):
|
||||
self.line_height = max(0, int(1.2 * css.fontSize * 20))
|
||||
self.background_color = None if is_table_cell else convert_color(css['background-color'])
|
||||
self.text_align = {'start':'left', 'left':'left', 'end':'right', 'right':'right', 'center':'center', 'justify':'both', 'centre':'center'}.get(
|
||||
css['text-align'].lower(), 'left')
|
||||
|
Loading…
x
Reference in New Issue
Block a user