summaryrefslogtreecommitdiff
path: root/libmat2
diff options
context:
space:
mode:
authorjvoisin2019-02-23 20:21:11 +0100
committerjvoisin2019-02-23 20:21:11 +0100
commitc757a9b7ef3122ea19105ca47a323e81469da594 (patch)
tree9758eca12d22015c808a64bbaa7b5000820d3741 /libmat2
parentdda30c48b7a6f04ed7d508816ce72a1c75badbb2 (diff)
Fix a bug in css cleaning
It's not mandatory to actually have a comment inside comment delimiter, like `/**/`.
Diffstat (limited to 'libmat2')
-rw-r--r--libmat2/web.py4
1 files 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):
14 14
15 def remove_all(self) -> bool: 15 def remove_all(self) -> bool:
16 with open(self.filename, encoding='utf-8') as f: 16 with open(self.filename, encoding='utf-8') as f:
17 cleaned = re.sub(r'/\*.+?\*/', '', f.read(), 0, self.flags) 17 cleaned = re.sub(r'/\*.*?\*/', '', f.read(), 0, self.flags)
18 with open(self.output_filename, 'w', encoding='utf-8') as f: 18 with open(self.output_filename, 'w', encoding='utf-8') as f:
19 f.write(cleaned) 19 f.write(cleaned)
20 return True 20 return True
@@ -22,7 +22,7 @@ class CSSParser(abstract.AbstractParser):
22 def get_meta(self) -> Dict[str, Any]: 22 def get_meta(self) -> Dict[str, Any]:
23 metadata = {} 23 metadata = {}
24 with open(self.filename, encoding='utf-8') as f: 24 with open(self.filename, encoding='utf-8') as f:
25 cssdoc = re.findall(r'/\*(.+?)\*/', f.read(), self.flags) 25 cssdoc = re.findall(r'/\*(.*?)\*/', f.read(), self.flags)
26 for match in cssdoc: 26 for match in cssdoc:
27 for line in match.splitlines(): 27 for line in match.splitlines():
28 try: 28 try: