Make unit_convert a little more robust

This commit is contained in:
Kovid Goyal 2007-12-10 00:13:37 +00:00
parent 1f1fa673af
commit e1c15324e3

View File

@ -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)