Skip to content

Commit

Permalink
Also convert [class] in css
Browse files Browse the repository at this point in the history
  • Loading branch information
suchmememanyskill committed Mar 19, 2024
1 parent 413b6f4 commit 49da04e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions css_inject.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ async def load(self) -> Result:
if split_css[x].startswith(".") and split_css[x][1:] in CLASS_MAPPINGS:
split_css[x] = "." + CLASS_MAPPINGS[split_css[x][1:]]

self.css = ("".join(split_css)).replace("\\", "\\\\").replace("`", "\\`")

split_css = re.split(r"(\[class[*^|~]=\"[_a-zA-Z0-9-]*\"\])", self.css)

for x in range(len(split_css)):
if split_css[x].startswith("[class") and split_css[x].endswith("\"]") and split_css[x][9:-2] in CLASS_MAPPINGS:
split_css[x] = split_css[x][0:9] + CLASS_MAPPINGS[split_css[x][9:-2]] + split_css[x][-2:]

self.css = ("".join(split_css)).replace("\\", "\\\\").replace("`", "\\`")
Log(f"Loaded css at {self.cssPath}")

Expand Down

0 comments on commit 49da04e

Please sign in to comment.