[Pkg-javascript-commits] [less.js] 02/09: improve keyword and anonymous input for replace (and %)

Jonas Smedegaard dr at jones.dk
Mon Oct 26 23:25:49 UTC 2015


This is an automated email from the git hooks/post-receive script.

js pushed a commit to annotated tag v2.1.1
in repository less.js.

commit ccd49bb619383265acb9fbfe2c98ac055bd713fe
Author: seven-phases-max <seven.phases.max at gmail.com>
Date:   Tue Nov 25 04:04:50 2014 +0400

    improve keyword and anonymous input for replace (and %)
---
 lib/less/tree/quoted.js  |  2 +-
 test/css/functions.css   | 12 ++++++++++++
 test/less/functions.less | 18 ++++++++++++++++++
 3 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/lib/less/tree/quoted.js b/lib/less/tree/quoted.js
index f153455..55aafa0 100644
--- a/lib/less/tree/quoted.js
+++ b/lib/less/tree/quoted.js
@@ -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;
diff --git a/test/css/functions.css b/test/css/functions.css
index 851968a..2d5860d 100644
--- a/test/css/functions.css
+++ b/test/css/functions.css
@@ -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;
+}
diff --git a/test/less/functions.less b/test/less/functions.less
index 3bf390d..f1f6edc 100644
--- a/test/less/functions.less
+++ b/test/less/functions.less
@@ -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");
+  }
+}
+

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/less.js.git



More information about the Pkg-javascript-commits mailing list