mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-09 05:53:10 +02:00
Make unit_convert a little more robust
This commit is contained in:
parent
1f1fa673af
commit
e1c15324e3
1 changed files with 1 additions and 1 deletions
|
|
@ -1138,7 +1138,7 @@ def unit_convert(self, val, pts=False, base_length='10pt'):
|
|||
except ValueError:
|
||||
pass
|
||||
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))
|
||||
if m.group(2) == '%':
|
||||
normal = self.unit_convert(base_length)
|
||||
|
|
|
|||
Loading…
Reference in a new issue