mirror of
https://github.com/less/less.js.git
synced 2026-01-22 13:48:03 -05:00
improve keyword and anonymous input for replace (and %)
This commit is contained in:
@@ -3,7 +3,7 @@ var Node = require("./node"),
|
||||
Variable = require("./variable");
|
||||
|
||||
var Quoted = function (str, content, escaped, index, currentFileInfo) {
|
||||
this.escaped = escaped;
|
||||
this.escaped = (escaped == null) ? true : escaped;
|
||||
this.value = content || '';
|
||||
this.quote = str.charAt(0);
|
||||
this.index = index;
|
||||
|
||||
@@ -161,3 +161,15 @@
|
||||
extract: 3 2 1 C B A;
|
||||
length: 6;
|
||||
}
|
||||
#quoted-functions-in-mixin {
|
||||
replace-double-quoted: 'foo-2';
|
||||
replace-single-quoted: 'foo-4';
|
||||
replace-escaped-string: bar-2;
|
||||
replace-keyword: baz-2;
|
||||
replace-anonymous: qux-2;
|
||||
format-double-quoted: "hello world";
|
||||
format-single-quoted: 'hello single world';
|
||||
format-escaped-string: hello escaped world;
|
||||
format-keyword: hello;
|
||||
format-anonymous: hello anonymous world;
|
||||
}
|
||||
|
||||
@@ -176,3 +176,21 @@
|
||||
extract: extract(@anon, 6) extract(@anon, 5) extract(@anon, 4) extract(@anon, 3) extract(@anon, 2) extract(@anon, 1);
|
||||
length: length(@anon);
|
||||
}
|
||||
|
||||
#quoted-functions-in-mixin {
|
||||
// Quoted type may have some weird side-effects when used in mixins (#2308)
|
||||
.mixin();
|
||||
.mixin() {
|
||||
replace-double-quoted: replace('foo-1', "1", "2");
|
||||
replace-single-quoted: replace('foo-3', "3", "4");
|
||||
replace-escaped-string: replace(~"bar-1", "1", "2");
|
||||
replace-keyword: replace(baz-1, "1", "2");
|
||||
replace-anonymous: replace(e("qux-1"), "1", "2");
|
||||
format-double-quoted: %("hello %s", "world");
|
||||
format-single-quoted: %('hello %s', "single world");
|
||||
format-escaped-string: %(~"hello %s", "escaped world");
|
||||
format-keyword: %(hello);
|
||||
format-anonymous: %(e("hello %s"), "anonymous world");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user