properly handle quotes in function calls

This commit is contained in:
ConnorSkees 2020-03-31 22:11:01 -04:00
parent 978fbaade0
commit c98bc46c10
2 changed files with 12 additions and 1 deletions

View File

@ -5,7 +5,9 @@ use crate::common::Pos;
use crate::error::SassResult; use crate::error::SassResult;
use crate::scope::Scope; use crate::scope::Scope;
use crate::selector::Selector; use crate::selector::Selector;
use crate::utils::{devour_whitespace, devour_whitespace_or_comment, eat_ident}; use crate::utils::{
devour_whitespace, devour_whitespace_or_comment, eat_ident, read_until_closing_quote,
};
use crate::value::Value; use crate::value::Value;
use crate::Token; use crate::Token;
@ -186,6 +188,10 @@ pub(crate) fn eat_call_args<I: Iterator<Item = Token>>(
val.push(tok); val.push(tok);
val.extend(read_until_close_paren(toks)); val.extend(read_until_close_paren(toks));
} }
'"' | '\'' => {
val.push(tok);
val.extend(read_until_closing_quote(toks, tok.kind));
}
_ => val.push(tok), _ => val.push(tok),
} }
} }

View File

@ -73,3 +73,8 @@ test!(
"@function foo($a) {\n @return $a;\n}\n\na {\n color: foo([a, b]);\n}\n", "@function foo($a) {\n @return $a;\n}\n\na {\n color: foo([a, b]);\n}\n",
"a {\n color: [a, b];\n}\n" "a {\n color: [a, b];\n}\n"
); );
test!(
eats_quoted_content,
"a {\n color: unquote(\"a, b, c, d\");\n}\n",
"a {\n color: a, b, c, d;\n}\n"
);