diff --git a/README.markdown b/README.markdown
index 5bfa47c72..15f7e2079 100644
--- a/README.markdown
+++ b/README.markdown
@@ -236,6 +236,35 @@ template(data);
//
```
+Partials can also accept parameters
+
+```js
+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 }
+ ],
+ "rosterProperties": {
+ "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:
@@ -366,6 +395,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.
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;
}
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/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);
}
}
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);
}
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": [
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))
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'];