Skip to content

Commit

Permalink
clean: Do not insert spaces between colons in pseudo-elements (::before)
Browse files Browse the repository at this point in the history
  • Loading branch information
gvtulder committed Sep 4, 2024
1 parent 36d9a65 commit 1a4af7c
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion se/formatting.py
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,7 @@ def _format_css_component_list(content: list, in_selector=False, in_paren_block=
# Here we try to re-add spaces after a : if it's within a paren block.
# We could do this during parsing but we would need to peek ahead to the next item in the loop which
# is too much trouble right now.
output = regex.sub(r"\(([^\"\s]+?):([^\"\s]+?)", r"(\1: \2", output)
output = regex.sub(r"\(([^\"\s)]+?):([^\"\s]+?)", r"(\1: \2", output)

return output.strip()

Expand Down
17 changes: 17 additions & 0 deletions tests/draft_commands/clean/test-2/golden/src/epub/css/local.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
p:nth-of-type(1)::before{
content: "test";
}

@media all and (prefers-color-scheme: dark){
p{
text-align: initial;
}
}

#chapter-1::after{
content: "test";
}

#chapter-1 tr:first-child{
content: "test";
}
9 changes: 9 additions & 0 deletions tests/draft_commands/clean/test-2/in/src/epub/css/local.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@


p:nth-of-type(1)::before{content: "test";}
@media all and (prefers-color-scheme:dark){p{text-align:initial;}}


#chapter-1::after {content: "test";}
#chapter-1 tr:first-child{
content: "test";}

0 comments on commit 1a4af7c

Please sign in to comment.