py3 compat

This commit is contained in:
Kovid Goyal 2019-10-13 09:40:49 +05:30
parent 5679a596d0
commit dec7a51650
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 4 additions and 3 deletions

View File

@ -475,9 +475,10 @@ class CSSFlattener(object):
try: try:
minlh = self.context.minimum_line_height / 100. minlh = self.context.minimum_line_height / 100.
if not is_drop_cap and style['line-height'] < minlh * fsize: slh = style['line-height']
if not is_drop_cap and isinstance(slh, numbers.Number) and slh < minlh * fsize:
cssdict['line-height'] = unicode_type(minlh) cssdict['line-height'] = unicode_type(minlh)
except: except Exception:
self.oeb.logger.exception('Failed to set minimum line-height') self.oeb.logger.exception('Failed to set minimum line-height')
if cssdict: if cssdict:

View File

@ -240,7 +240,7 @@ def split_string_separator(txt, size):
''' '''
Splits the text by putting \n\n at the point size. Splits the text by putting \n\n at the point size.
''' '''
if len(txt) > size: if len(txt) > size and size > 2:
size -= 2 size -= 2
txt = [] txt = []
for part in (txt[i * size: (i + 1) * size] for i in range(0, len(txt), size)): for part in (txt[i * size: (i + 1) * size] for i in range(0, len(txt), size)):