maps in set-nth()
This commit is contained in:
parent
cba2b12771
commit
c7fdf8eef3
@ -78,6 +78,7 @@ pub(crate) fn register(f: &mut HashMap<String, Builtin>) {
|
|||||||
max_args!(args, 3);
|
max_args!(args, 3);
|
||||||
let (mut list, sep) = match arg!(args, 0, "list") {
|
let (mut list, sep) = match arg!(args, 0, "list") {
|
||||||
Value::List(v, sep, ..) => (v, sep),
|
Value::List(v, sep, ..) => (v, sep),
|
||||||
|
Value::Map(m) => (m.entries(), ListSeparator::Comma),
|
||||||
v => (vec![v], ListSeparator::Space),
|
v => (vec![v], ListSeparator::Space),
|
||||||
};
|
};
|
||||||
let n = match arg!(args, 1, "n") {
|
let n = match arg!(args, 1, "n") {
|
||||||
|
@ -83,6 +83,11 @@ test!(
|
|||||||
"a {\n color: set-nth((a, b, c), 1, e);\n}\n",
|
"a {\n color: set-nth((a, b, c), 1, e);\n}\n",
|
||||||
"a {\n color: e, b, c;\n}\n"
|
"a {\n color: e, b, c;\n}\n"
|
||||||
);
|
);
|
||||||
|
test!(
|
||||||
|
set_nth_map,
|
||||||
|
"a {\n color: set-nth((c: d, e: f, g: h), 2, i);\n}\n",
|
||||||
|
"a {\n color: c d, i, g h;\n}\n"
|
||||||
|
);
|
||||||
test!(
|
test!(
|
||||||
append_space_separated,
|
append_space_separated,
|
||||||
"a {\n color: append(a b, c);\n}\n",
|
"a {\n color: append(a b, c);\n}\n",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user