Fix % processing in styles

This commit is contained in:
Kiryl
2022-06-21 17:07:26 +03:00
parent 32f5a5eb15
commit 131fa2642e

View File

@@ -47,8 +47,8 @@ def convert_tag_style_values(size_value: str) -> str:
has_style_attrs = re.search(font_size_regexp, size_value) has_style_attrs = re.search(font_size_regexp, size_value)
if has_style_attrs: if has_style_attrs:
if has_style_attrs.group(1): if has_style_attrs.group(1):
size_value = float(size_value.replace("%", "")) / 100.0 size_value = float(size_value.replace("%", ""))*6
return find_closest_size(size_value) return str(size_value)+'px'
elif has_style_attrs.group(3): elif has_style_attrs.group(3):
size_value = float(size_value.replace("em", "")) size_value = float(size_value.replace("em", ""))
return find_closest_size(size_value) return find_closest_size(size_value)