Fix #1977 (Error on converting zip with html to ePUB u'invalid literal for float(): +2)

This commit is contained in:
Kovid Goyal 2009-03-03 17:18:16 -08:00
parent 3eb0f3fff1
commit 73af726c71

View File

@ -845,7 +845,12 @@ class Processor(Parser):
except: except:
size = '3' size = '3'
if size and size.strip() and size.strip()[0] in ('+', '-'): if size and size.strip() and size.strip()[0] in ('+', '-'):
size = 3 + float(size) # Hack assumes basefont=3 size = re.search(r'[+-]{0,1}[\d\.]+', size)
try:
size = float(size.group())
except:
size = 0
size += 3 # Hack assumes basefont=3
try: try:
setting = 'font-size: %d%%;'%int((float(size)/3) * 100) setting = 'font-size: %d%%;'%int((float(size)/3) * 100)
except ValueError: except ValueError: