From c15f90e513640975c41b001f8035cf88711fa608 Mon Sep 17 00:00:00 2001 From: kpdecker Date: Tue, 10 Feb 2015 20:40:53 -0600 Subject: [PATCH 1/9] Fix typo --- lib/handlebars/compiler/compiler.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/handlebars/compiler/compiler.js b/lib/handlebars/compiler/compiler.js index 21de99ca4..e1b4dfb31 100644 --- a/lib/handlebars/compiler/compiler.js +++ b/lib/handlebars/compiler/compiler.js @@ -494,6 +494,6 @@ function transformLiteralToPath(sexpr) { var literal = sexpr.path; // Casting to string here to make false and 0 literal values play nicely with the rest // of the system. - sexpr.path = new AST.PathExpression(false, 0, [literal.original+''], literal.original+'', literal.log); + sexpr.path = new AST.PathExpression(false, 0, [literal.original+''], literal.original+'', literal.loc); } } From 5ede36b8fdd4c89184620fe9cde905ec251c7600 Mon Sep 17 00:00:00 2001 From: Changwoo Park Date: Mon, 16 Feb 2015 18:06:17 +0900 Subject: [PATCH 2/9] Add dashbars' link on README. --- README.markdown | 1 + 1 file changed, 1 insertion(+) diff --git a/README.markdown b/README.markdown index 5bfa47c72..a9f25d2f3 100644 --- a/README.markdown +++ b/README.markdown @@ -366,6 +366,7 @@ Handlebars in the Wild and [@doowb](https://github.com/doowb), is a static site generator that uses Handlebars.js as its template engine. * [CoSchedule](http://coschedule.com) An editorial calendar for WordPress that uses Handlebars.js +* [dashbars](https://github.com/pismute/dashbars) A modern helper library for Handlebars.js. * [Ember.js](http://www.emberjs.com) makes Handlebars.js the primary way to structure your views, also with automatic data binding support. * [Ghost](https://ghost.org/) Just a blogging platform. From 71690ae39d1913e7f58635494859400fb54553d7 Mon Sep 17 00:00:00 2001 From: grassick Date: Wed, 18 Feb 2015 10:57:02 -0500 Subject: [PATCH 3/9] default is a reserved word Quoting it to fix in older browsers, especially Android 2.3.x. --- runtime.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime.js b/runtime.js index 1896fa9db..306207cd2 100644 --- a/runtime.js +++ b/runtime.js @@ -1,3 +1,3 @@ // Create a simple path alias to allow browserify to resolve // the runtime on a supported path. -module.exports = require('./dist/cjs/handlebars.runtime').default; +module.exports = require('./dist/cjs/handlebars.runtime')['default']; From 64ab232d723f5935e21b0e470d04dcf369986172 Mon Sep 17 00:00:00 2001 From: kpdecker Date: Sat, 28 Feb 2015 19:50:52 -0600 Subject: [PATCH 4/9] Fix --version flag Fixes #966 --- bin/handlebars | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/handlebars b/bin/handlebars index 79dfa6fb2..bf64784aa 100755 --- a/bin/handlebars +++ b/bin/handlebars @@ -103,7 +103,7 @@ var argv = optimist.argv; argv.templates = argv._; delete argv._; -if (argv.help || !argv.templates.length) { +if (argv.help || (!argv.templates.length && !argv.version)) { optimist.showHelp(); return; } From ab96073c6bfde771dde1e8ff1aa7444192f7f6df Mon Sep 17 00:00:00 2001 From: kpdecker Date: Mon, 16 Mar 2015 22:06:01 -0500 Subject: [PATCH 5/9] Optimize hot path in escapeExpression Avoid deoptimizations in v8 due to the duct type check on string instances. Partial fix for #973 --- lib/handlebars/utils.js | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/lib/handlebars/utils.js b/lib/handlebars/utils.js index fc2b8464c..41495e1bf 100644 --- a/lib/handlebars/utils.js +++ b/lib/handlebars/utils.js @@ -60,21 +60,23 @@ export function indexOf(array, value) { export function escapeExpression(string) { - // don't escape SafeStrings, since they're already safe - if (string && string.toHTML) { - return string.toHTML(); - } else if (string == null) { - return ""; - } else if (!string) { - return string + ''; - } + if (typeof string !== 'string') { + // don't escape SafeStrings, since they're already safe + if (string && string.toHTML) { + return string.toHTML(); + } else if (string == null) { + return ''; + } else if (!string) { + return string + ''; + } - // Force a string conversion as this will be done by the append regardless and - // the regex test will do this transparently behind the scenes, causing issues if - // an object's to string has escaped characters in it. - string = "" + string; + // Force a string conversion as this will be done by the append regardless and + // the regex test will do this transparently behind the scenes, causing issues if + // an object's to string has escaped characters in it. + string = '' + string; + } - if(!possible.test(string)) { return string; } + if (!possible.test(string)) { return string; } return string.replace(badChars, escapeChar); } From fed86c01adff202766a6781135178f87ac209d86 Mon Sep 17 00:00:00 2001 From: johneke Date: Wed, 18 Mar 2015 20:23:15 -0400 Subject: [PATCH 6/9] Adding documentation for parameters in partials --- README.markdown | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/README.markdown b/README.markdown index a9f25d2f3..0efc733bb 100644 --- a/README.markdown +++ b/README.markdown @@ -236,6 +236,31 @@ template(data); // ``` +Partials can also accept parameters + +```js +var source = "
{{> roster people=listOfPeople rosterName}}
"; + +Handlebars.registerPartial('roster', '

{{rosterName}}

{{#people}}{{id}}: {{name}}{{/people}}') +var template = Handlebars.compile(source); + +var data = { "listOfPeople": [ + { "name": "Alan", "id": 1 }, + { "name": "Yehuda", "id": 2 } + ], + "rosterName": "Cool People" }; + +template(data); + +// Should render: +//
+//

Cool People

+// 1: Alan +// 2: Yehuda +//
+ +``` + ### Comments You can add comments to your templates with the following syntax: From a10d907a65bf32a578e6805048b085e2682ab8e8 Mon Sep 17 00:00:00 2001 From: johneke Date: Wed, 18 Mar 2015 22:55:26 -0400 Subject: [PATCH 7/9] Update README.markdown --- README.markdown | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/README.markdown b/README.markdown index 0efc733bb..15f7e2079 100644 --- a/README.markdown +++ b/README.markdown @@ -239,16 +239,20 @@ template(data); Partials can also accept parameters ```js -var source = "
{{> roster people=listOfPeople rosterName}}
"; +var source = "
{{> roster rosterProperties people=listOfPeople}}
"; Handlebars.registerPartial('roster', '

{{rosterName}}

{{#people}}{{id}}: {{name}}{{/people}}') var template = Handlebars.compile(source); -var data = { "listOfPeople": [ - { "name": "Alan", "id": 1 }, - { "name": "Yehuda", "id": 2 } - ], - "rosterName": "Cool People" }; +var data = { + "listOfPeople": [ + { "name": "Alan", "id": 1 }, + { "name": "Yehuda", "id": 2 } + ], + "rosterProperties": { + "rosterName": "Cool People" + } +}; template(data); From 40894e619b7efed74a3f08cfd556006e4b5dbdab Mon Sep 17 00:00:00 2001 From: kpdecker Date: Tue, 24 Mar 2015 14:22:22 -0500 Subject: [PATCH 8/9] Update release notes --- release-notes.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/release-notes.md b/release-notes.md index ad7b7f026..1d6787eee 100644 --- a/release-notes.md +++ b/release-notes.md @@ -2,7 +2,16 @@ ## Development -[Commits](https://github.com/wycats/handlebars.js/compare/v3.0.0...master) +[Commits](https://github.com/wycats/handlebars.js/compare/v3.0.1...master) + +## v3.0.1 - March 24th, 2015 +- [#984](https://github.com/wycats/handlebars.js/pull/984) - Adding documentation for passing arguments into partials ([@johneke](https://api.github.com/users/johneke)) +- [#973](https://github.com/wycats/handlebars.js/issues/973) - version 3 is slower than version 2 ([@elover](https://api.github.com/users/elover)) +- [#966](https://github.com/wycats/handlebars.js/issues/966) - "handlebars --version" does not work with v3.0.0 ([@abloomston](https://api.github.com/users/abloomston)) +- [#964](https://github.com/wycats/handlebars.js/pull/964) - default is a reserved word ([@grassick](https://api.github.com/users/grassick)) +- [#962](https://github.com/wycats/handlebars.js/pull/962) - Add dashbars' link on README. ([@pismute](https://api.github.com/users/pismute)) + +[Commits](https://github.com/wycats/handlebars.js/compare/v3.0.0...v3.0.1) ## v3.0.0 - February 10th, 2015 - [#941](https://github.com/wycats/handlebars.js/pull/941) - Add support for dynamic partial names ([@kpdecker](https://api.github.com/users/kpdecker)) From afe730e0594440dd17fdc43271fc4a7db19327f3 Mon Sep 17 00:00:00 2001 From: kpdecker Date: Tue, 24 Mar 2015 14:22:38 -0500 Subject: [PATCH 9/9] v3.0.1 --- components/bower.json | 2 +- components/handlebars.js.nuspec | 2 +- lib/handlebars/base.js | 2 +- package.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/components/bower.json b/components/bower.json index 0e1f0a12b..0726c8468 100644 --- a/components/bower.json +++ b/components/bower.json @@ -1,6 +1,6 @@ { "name": "handlebars", - "version": "3.0.0", + "version": "3.0.1", "main": "handlebars.js", "dependencies": {} } diff --git a/components/handlebars.js.nuspec b/components/handlebars.js.nuspec index 8af75b07c..9525fcf4c 100644 --- a/components/handlebars.js.nuspec +++ b/components/handlebars.js.nuspec @@ -2,7 +2,7 @@ handlebars.js - 3.0.0 + 3.0.1 handlebars.js Authors https://github.com/wycats/handlebars.js/blob/master/LICENSE https://github.com/wycats/handlebars.js/ diff --git a/lib/handlebars/base.js b/lib/handlebars/base.js index 67f624cad..293d5eaef 100644 --- a/lib/handlebars/base.js +++ b/lib/handlebars/base.js @@ -1,7 +1,7 @@ module Utils from "./utils"; import Exception from "./exception"; -export var VERSION = "3.0.0"; +export var VERSION = "3.0.1"; export var COMPILER_REVISION = 6; export var REVISION_CHANGES = { diff --git a/package.json b/package.json index a0265507f..f653a3f89 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "handlebars", "barename": "handlebars", - "version": "3.0.0", + "version": "3.0.1", "description": "Handlebars provides the power necessary to let you build semantic templates effectively with no frustration", "homepage": "http://www.handlebarsjs.com/", "keywords": [