diff --git a/se/formatting.py b/se/formatting.py index 03a82119..6d361daa 100644 --- a/se/formatting.py +++ b/se/formatting.py @@ -864,7 +864,7 @@ def _format_css_component_list(content: list, in_selector=False, in_paren_block= output += f"#{token.value}" if token.type == "string": - output += f"\"{token.value}\"" + output += token.representation if token.type == "() block": output += f"({_format_css_component_list(token.content, in_selector, True)})" diff --git a/tests/draft_commands/clean/test-2/golden/src/epub/css/local.css b/tests/draft_commands/clean/test-2/golden/src/epub/css/local.css index f50b5c51..deb430ae 100644 --- a/tests/draft_commands/clean/test-2/golden/src/epub/css/local.css +++ b/tests/draft_commands/clean/test-2/golden/src/epub/css/local.css @@ -15,3 +15,11 @@ p:nth-of-type(1)::before{ #chapter-1 tr:first-child{ content: "test"; } + +p::before{ + content: "newlines \A \A \A quotes ' \" \"'backslash \\ letters áè"; +} + +p::after{ + content: "newlines \A \A \A quotes ' \" \"'backslash \\ letters áè"; +} diff --git a/tests/draft_commands/clean/test-2/in/src/epub/css/local.css b/tests/draft_commands/clean/test-2/in/src/epub/css/local.css index c378444a..ef9bdf12 100644 --- a/tests/draft_commands/clean/test-2/in/src/epub/css/local.css +++ b/tests/draft_commands/clean/test-2/in/src/epub/css/local.css @@ -7,3 +7,8 @@ p:nth-of-type(1)::before{content: "test";} #chapter-1::after {content: "test";} #chapter-1 tr:first-child{ content: "test";} + +p::before{ + content: "newlines \a \A \00000A quotes ' \" \22 \27 backslash \\ letters \e1\E8"; +} +p::after{content: 'newlines \a \A \00000A quotes \' " \22 \27 backslash \\ letters \e1\E8';}