minor tweak to alter_size for font-sizes

This commit is contained in:
Sanj 2011-07-06 19:07:02 +05:30
parent 2ea1d28e11
commit a83c006d05

View File

@ -23,8 +23,9 @@ def parse_html(value, m):
p = "font\-size: [0-9][0-9]?px" p = "font\-size: [0-9][0-9]?px"
matches = re.findall(p, value) matches = re.findall(p, value)
for match in matches: for match in matches:
# reg = r'font-size:[\s?]
s = match.replace("font-size:", "") s = match.replace("font-size:", "")
val = int(s.replace("px", "")) val = int(s.strip().replace("px", ""))
new_val = int(round(val * m)) new_val = int(round(val * m))
r = "font-size: " + str(new_val) + "px" r = "font-size: " + str(new_val) + "px"
value = value.replace(match, r) value = value.replace(match, r)