diff --git a/examples/dot_notation.html b/examples/dot_notation.html index 749ca3d..da1bad7 100644 --- a/examples/dot_notation.html +++ b/examples/dot_notation.html @@ -1,4 +1,9 @@ +

{{name}}

Authors:

Price: {{price.currency.symbol}}{{price.value}} {{#price.currency}}{{name}} {{availability.text}}{{/price.currency}}

-

VAT: {{price.currency.symbol}}{{price.vat}}

\ No newline at end of file +

VAT: {{price.currency.symbol}}{{price.vat}}

+ +

Test truthy false values:

+

Zero: {{truthy.zero}}

+

False: {{truthy.notTrue}}

diff --git a/examples/dot_notation.js b/examples/dot_notation.js index c5c8fb2..c1295f5 100644 --- a/examples/dot_notation.js +++ b/examples/dot_notation.js @@ -14,5 +14,10 @@ var dot_notation = { availability:{ status: true, text: "In Stock" + }, + // And now, some truthy false values + truthy: { + zero: 0, + notTrue: false } }; diff --git a/examples/dot_notation.txt b/examples/dot_notation.txt index 770e4ce..d0e4707 100644 --- a/examples/dot_notation.txt +++ b/examples/dot_notation.txt @@ -1,4 +1,9 @@ +

A Book

Authors:

Price: €200 Euro In Stock

VAT: €40

+ +

Test truthy false values:

+

Zero: 0

+

False: false

diff --git a/mustache.js b/mustache.js index e291f05..5677871 100644 --- a/mustache.js +++ b/mustache.js @@ -272,7 +272,10 @@ var Mustache = function() { // check for dot notation eg. foo.bar if(name.match(/([a-z_]+)\./ig)){ - value = is_kinda_truthy(this.walk_context(name, context)); + var childValue = this.walk_context(name, context); + if(is_kinda_truthy(childValue)) { + value = childValue; + } } else{ if(is_kinda_truthy(context[name])) {