From 6ad43cf40b1f7b0425bf9be41c1acdb64fd749a3 Mon Sep 17 00:00:00 2001 From: Sebastian Tschan Date: Mon, 17 Jun 2013 14:46:31 -0500 Subject: [PATCH 001/103] Print out falsy values. Closes #26. --- Makefile | 2 +- README.md | 10 +--------- index.html | 23 +++++++++++++---------- package.json | 8 ++++---- runtime.js | 4 ++-- test/index.html | 8 ++++---- test/template.html | 1 - test/test.js | 21 ++++++++++++--------- tmpl.js | 6 +++--- tmpl.min.js | 2 +- 10 files changed, 41 insertions(+), 44 deletions(-) delete mode 100644 test/template.html diff --git a/Makefile b/Makefile index 659aa99..4177b32 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ .PHONY: js js: - uglifyjs -nc tmpl.js > tmpl.min.js + node_modules/.bin/uglifyjs tmpl.js -c -m -o tmpl.min.js diff --git a/README.md b/README.md index 5f5b9bf..790060c 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # JavaScript Templates ## Demo -[JavaScript Templates Demo](http://blueimp.github.com/JavaScript-Templates/) +[JavaScript Templates Demo](http://blueimp.github.io/JavaScript-Templates/) ## Usage @@ -271,14 +271,6 @@ Use dot notation to print nested properties: {%=o.author.name%} ``` -Note that the JavaScript Templates engine prints **falsy** values as empty strings. -That is, **undefined**, **null**, **false**, **0** and **NaN** will all be converted to **''**. -To be able to print e.g. the number 0, convert it to a String before using it as an output variable: - -```html -

{%=0+''%}

-``` - ### Evaluation Use **print(str)** to add escaped content to the output: diff --git a/index.html b/index.html index 40bfa06..528362d 100644 --- a/index.html +++ b/index.html @@ -1,7 +1,7 @@ - + JavaScript Templates Demo - - + + - - - + +