Permalink
Browse files

pull-13 Fixed issue where only booleans could trigger blocks. Now any…

… truthy can
  • Loading branch information...
RayMorgan
RayMorgan committed Dec 21, 2010
1 parent 1c0c7b9 commit 0a42fdb9c70d8a47afd470d793a9b10249af54e2
Showing with 19 additions and 3 deletions.
  1. +7 −3 lib/mu/renderer.js
  2. +3 −0 test/examples/boolean.html
  3. +5 −0 test/examples/boolean.js
  4. +3 −0 test/examples/boolean.txt
  5. +1 −0 test/run_examples_test.js
View
@@ -105,9 +105,9 @@ function normalize(context, name, body) {
function section(view, name, val, tokens, partials, stream, callback) {
// var val = normalize(view, name, body);
- if (typeof val === 'boolean') {
- return val ? render(tokens, view, partials, stream, callback) : callback();
- }
+ // if (typeof val === 'boolean') {
+ // return val ? render(tokens, view, partials, stream, callback) : callback();
+ // }
if (val instanceof Array) {
var i = 0;
@@ -141,6 +141,10 @@ function section(view, name, val, tokens, partials, stream, callback) {
return;
}
+ if (val) {
+ return render(tokens, view, partials, stream, callback);
+ }
+
return callback();
}
@@ -0,0 +1,3 @@
+{{#name}}{{name}}{{/name}}
+{{#age}}{{age}}{{/age}}
+{{#admin}}admin{{/admin}}
View
@@ -0,0 +1,5 @@
+{
+ name: 'Jim',
+ age: 24,
+ admin: true
+}
@@ -0,0 +1,3 @@
+Jim
+24
+admin
@@ -6,6 +6,7 @@ var assert = require('assert'),
mu.root = path.join(__dirname, 'examples');
[
+ 'boolean',
'comments',
'complex',
'deep_partial',

0 comments on commit 0a42fdb

Please sign in to comment.