1
0
mirror of synced 2024-11-22 09:14:23 +01:00

Fix a bug in css cleaning

It's not mandatory to actually have a comment inside
comment delimiter, like `/**/`.
This commit is contained in:
jvoisin 2019-02-23 20:21:11 +01:00
parent dda30c48b7
commit c757a9b7ef

View File

@ -14,7 +14,7 @@ class CSSParser(abstract.AbstractParser):
def remove_all(self) -> bool:
with open(self.filename, encoding='utf-8') as f:
cleaned = re.sub(r'/\*.+?\*/', '', f.read(), 0, self.flags)
cleaned = re.sub(r'/\*.*?\*/', '', f.read(), 0, self.flags)
with open(self.output_filename, 'w', encoding='utf-8') as f:
f.write(cleaned)
return True
@ -22,7 +22,7 @@ class CSSParser(abstract.AbstractParser):
def get_meta(self) -> Dict[str, Any]:
metadata = {}
with open(self.filename, encoding='utf-8') as f:
cssdoc = re.findall(r'/\*(.+?)\*/', f.read(), self.flags)
cssdoc = re.findall(r'/\*(.*?)\*/', f.read(), self.flags)
for match in cssdoc:
for line in match.splitlines():
try: