Skip to content

Commit 7540d58

Browse files
committed
Coerce noEscape-statements to a string
Also removed `chai-diff`-dependency, since it is unmaintained and not that useful. Fixes #1838
1 parent 520e1d5 commit 7540d58

14 files changed

+71
-98
lines changed

.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ indent_size = 2
55
insert_final_newline = true
66
trim_trailing_whitespace = true
77

8+
[spec/expected/*.js]
9+
insert_final_newline = false
10+
811
[*.yml]
912
indent_size = 2
1013
insert_final_newline = true

lib/handlebars/compiler/javascript-compiler.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ JavaScriptCompiler.prototype = {
308308

309309
if (appendOnly) {
310310
if (bufferStart) {
311-
bufferStart.prepend('return ');
311+
bufferStart.prepend('return ""+');
312312
bufferEnd.add(';');
313313
} else if (!sourceSeen) {
314314
this.source.push('return "";');

package-lock.json

Lines changed: 2 additions & 39 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
"babel-runtime": "^5.1.10",
3737
"benchmark": "~1.0",
3838
"chai": "^4.2.0",
39-
"chai-diff": "^1.0.1",
4039
"concurrently": "^5.0.0",
4140
"dirty-chai": "^2.0.1",
4241
"dtslint": "^0.5.5",

spec/expected/bom.amd.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
define(['handlebars.runtime'], function(Handlebars) {
2-
Handlebars = Handlebars["default"]; var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
3-
return templates['bom'] = template({"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
4-
return "a";
5-
},"useData":true});
6-
});
2+
Handlebars = Handlebars["default"]; var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
3+
return templates['bom'] = template({"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
4+
return "a";
5+
},"useData":true});
6+
});

spec/expected/empty.amd.simple.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
2-
return "";
3-
},"useData":true}
2+
return "";
3+
},"useData":true}

spec/expected/handlebar.path.amd.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
define(['some-path/handlebars.runtime'], function(Handlebars) {
2-
Handlebars = Handlebars["default"]; var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
3-
return templates['empty'] = template({"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
4-
return "";
5-
},"useData":true});
6-
});
2+
Handlebars = Handlebars["default"]; var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
3+
return templates['empty'] = template({"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
4+
return "";
5+
},"useData":true});
6+
});

spec/expected/help.menu.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
Precompile handlebar templates.
22
Usage: handlebars [template|directory]...
3-
43
Options:
54
-f, --output Output File [string]
65
--map Source Map File [string]
@@ -22,4 +21,4 @@ Options:
2221
-e, --extension Template extension. [string] [default: "handlebars"]
2322
-b, --bom Removes the BOM (Byte Order Mark) from the beginning of the templates. [boolean]
2423
-v, --version Prints the current compiler version [boolean]
25-
--help Outputs this message [boolean]
24+
--help Outputs this message [boolean]

spec/expected/namespace.amd.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
define(['handlebars.runtime'], function(Handlebars) {
2-
Handlebars = Handlebars["default"]; var template = Handlebars.template, templates = someNameSpace = someNameSpace || {};
3-
templates['empty'] = template({"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
4-
return "";
5-
},"useData":true});
6-
templates['empty'] = template({"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
7-
return "";
8-
},"useData":true});
9-
return templates;
10-
});
2+
Handlebars = Handlebars["default"]; var template = Handlebars.template, templates = someNameSpace = someNameSpace || {};
3+
templates['empty'] = template({"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
4+
return "";
5+
},"useData":true});
6+
templates['empty'] = template({"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
7+
return "";
8+
},"useData":true});
9+
return templates;
10+
});
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
define(['handlebars.runtime'], function(Handlebars) {
2-
Handlebars = Handlebars["default"]; var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
3-
return templates['non.default.extension'] = template({"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
4-
return "<div>This is a test</div>";
5-
},"useData":true});
6-
});
2+
Handlebars = Handlebars["default"]; var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
3+
return templates['non.default.extension'] = template({"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
4+
return "<div>This is a test</div>";
5+
},"useData":true});
6+
});

0 commit comments

Comments
 (0)