From c757a9b7ef3122ea19105ca47a323e81469da594 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Sat, 23 Feb 2019 20:21:11 +0100 Subject: [PATCH] Fix a bug in css cleaning It's not mandatory to actually have a comment inside comment delimiter, like `/**/`. --- libmat2/web.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libmat2/web.py b/libmat2/web.py index 13d5fc8..a31c7ca 100644 --- a/libmat2/web.py +++ b/libmat2/web.py @@ -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: