diff --git a/src/parse/ident.rs b/src/parse/ident.rs index bb92dbd..b55a3ed 100644 --- a/src/parse/ident.rs +++ b/src/parse/ident.rs @@ -248,7 +248,7 @@ impl<'a> Parser<'a> { return Ok(Spanned { node: Value::String(s, QuoteKind::Quoted), span, - }) + }); } '\'' if q == '\'' => { return Ok(Spanned { diff --git a/src/parse/value/css_function.rs b/src/parse/value/css_function.rs index 11cd2bf..fe90a18 100644 --- a/src/parse/value/css_function.rs +++ b/src/parse/value/css_function.rs @@ -47,6 +47,14 @@ impl<'a> Parser<'a> { buf.push(')'); } } + q @ '\'' | q @ '"' => { + buf.push(q); + match self.parse_quoted_string(q)?.node { + Value::String(ref s, ..) => buf.push_str(s), + _ => unreachable!(), + } + buf.push(q); + } c => buf.push(c), } } diff --git a/tests/special-functions.rs b/tests/special-functions.rs index 8af6f23..9511465 100644 --- a/tests/special-functions.rs +++ b/tests/special-functions.rs @@ -49,6 +49,16 @@ test!( "a {\n color: -webkit-calc(1 + 2);\n}\n", "a {\n color: -webkit-calc(1 + 2);\n}\n" ); +test!( + calc_quoted_string, + r#"a { color: calc("\ "); }"#, + "a {\n color: calc(\" \");\n}\n" +); +test!( + calc_quoted_string_single_quoted_paren, + "a {\n color: calc(\")\");\n}\n", + "a {\n color: calc(\")\");\n}\n" +); test!( element_whitespace, "a {\n color: element( 1 );\n}\n",