From 8f275255360c510a2e8dd829637e4d7af2a606db Mon Sep 17 00:00:00 2001 From: ConnorSkees <39542938+ConnorSkees@users.noreply.github.com> Date: Mon, 20 Apr 2020 11:34:49 -0400 Subject: [PATCH] interpolated strings are literal --- src/utils.rs | 5 ++++- tests/interpolation.rs | 5 +++++ tests/str-escape.rs | 4 ++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/utils.rs b/src/utils.rs index 5cab9ef..5ab102f 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -707,7 +707,10 @@ pub(crate) fn parse_quoted_string>( if toks.peek().unwrap().kind == '{' { toks.next(); let interpolation = parse_interpolation(toks, scope, super_selector)?; - s.push_str(&interpolation.node.to_css_string(interpolation.span)?); + s.push_str(&match interpolation.node { + Value::Ident(s, ..) => s, + v => v.to_css_string(interpolation.span)?, + }); continue; } else { s.push('#'); diff --git a/tests/interpolation.rs b/tests/interpolation.rs index bfd384d..eadb6aa 100644 --- a/tests/interpolation.rs +++ b/tests/interpolation.rs @@ -43,3 +43,8 @@ test!( "a {\n color: #{\"a\" 'b'};\n}\n", "a {\n color: a b;\n}\n" ); +test!( + interpolated_string_literally_inserted, + "a {\n color: \"#{\"\\a\"}\";\n}\n", + "a {\n color: \"\\a\";\n}\n" +); diff --git a/tests/str-escape.rs b/tests/str-escape.rs index 20d7d5b..b43c8aa 100644 --- a/tests/str-escape.rs +++ b/tests/str-escape.rs @@ -150,3 +150,7 @@ test!( allows_escaped_quote_at_start_of_ident, "a {\n color: \\\"c\\\";\n}\n" ); +test!( + quoted_escaped_newline_unchanged, + "a {\n color: \"\\a\";\n}\n" +);