Fix a bug in css cleaning
It's not mandatory to actually have a comment inside comment delimiter, like `/**/`.
This commit is contained in:
parent
dda30c48b7
commit
c757a9b7ef
@ -14,7 +14,7 @@ class CSSParser(abstract.AbstractParser):
|
|||||||
|
|
||||||
def remove_all(self) -> bool:
|
def remove_all(self) -> bool:
|
||||||
with open(self.filename, encoding='utf-8') as f:
|
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:
|
with open(self.output_filename, 'w', encoding='utf-8') as f:
|
||||||
f.write(cleaned)
|
f.write(cleaned)
|
||||||
return True
|
return True
|
||||||
@ -22,7 +22,7 @@ class CSSParser(abstract.AbstractParser):
|
|||||||
def get_meta(self) -> Dict[str, Any]:
|
def get_meta(self) -> Dict[str, Any]:
|
||||||
metadata = {}
|
metadata = {}
|
||||||
with open(self.filename, encoding='utf-8') as f:
|
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 match in cssdoc:
|
||||||
for line in match.splitlines():
|
for line in match.splitlines():
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user