diff --git a/lib/compiler.js b/lib/compiler.js index 92774d6..f8a2099 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -319,10 +319,11 @@ } function createPartial(node, context) { - var prefix = "<" + (context.prefix || ""); - var sym = prefix + node.n + serialNo++; + var prefix = context.hasOwnProperty('prefix') ? context.prefix : ''; + var sym = "<" + (prefix || '') + node.n + serialNo++; context.partials[sym] = {name: node.n, partials: {}}; - context.code += 't.b(t.rp("' + esc(sym) + '",c,p,"' + (node.indent || '') + '"));'; + var indent = node.hasOwnProperty('indent') ? node.indent : ''; + context.code += 't.b(t.rp("' + esc(sym) + '",c,p,"' + (indent || '') + '"));'; return sym; } @@ -395,7 +396,8 @@ Hogan.parse = function(tokens, text, options) { options = options || {}; - return buildTree(tokens, '', [], options.sectionTags || []); + var sectionTags = options.hasOwnProperty("sectionTags") ? options.sectionTags : []; + return buildTree(tokens, '', [], (sectionTags || [])); } Hogan.cache = {};