mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Make unit_convert a little more robust
This commit is contained in:
parent
1f1fa673af
commit
e1c15324e3
@ -1138,7 +1138,7 @@ class HTMLConverter(object):
|
|||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
m = re.match("\s*(-*[0-9]*\.?[0-9]*)\s*(%|em|px|mm|cm|in|pt|pc)", val)
|
m = re.match("\s*(-*[0-9]*\.?[0-9]*)\s*(%|em|px|mm|cm|in|pt|pc)", val)
|
||||||
if m is not None:
|
if m is not None and m.group(1):
|
||||||
unit = float(m.group(1))
|
unit = float(m.group(1))
|
||||||
if m.group(2) == '%':
|
if m.group(2) == '%':
|
||||||
normal = self.unit_convert(base_length)
|
normal = self.unit_convert(base_length)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user