handlebars
Advanced tools
Comparing version 1.3.0 to 2.0.0-alpha.1
@@ -8,4 +8,4 @@ define( | ||
var VERSION = "1.3.0"; | ||
__exports__.VERSION = VERSION;var COMPILER_REVISION = 4; | ||
var VERSION = "v2.0.0-alpha.1"; | ||
__exports__.VERSION = VERSION;var COMPILER_REVISION = 5; | ||
__exports__.COMPILER_REVISION = COMPILER_REVISION; | ||
@@ -16,3 +16,4 @@ var REVISION_CHANGES = { | ||
3: '== 1.0.0-rc.4', | ||
4: '>= 1.0.0' | ||
4: '== 1.x.x', | ||
5: '>= 2.0.0' | ||
}; | ||
@@ -47,2 +48,5 @@ __exports__.REVISION_CHANGES = REVISION_CHANGES; | ||
}, | ||
unregisterHelper: function(name) { | ||
delete this.helpers[name]; | ||
}, | ||
@@ -55,2 +59,5 @@ registerPartial: function(name, str) { | ||
} | ||
}, | ||
unregisterPartial: function(name) { | ||
delete this.partials[name]; | ||
} | ||
@@ -60,7 +67,9 @@ }; | ||
function registerDefaultHelpers(instance) { | ||
instance.registerHelper('helperMissing', function(arg) { | ||
if(arguments.length === 2) { | ||
instance.registerHelper('helperMissing', function(/* [args, ]options */) { | ||
if(arguments.length === 1) { | ||
// A missing field in a {{foo}} constuct. | ||
return undefined; | ||
} else { | ||
throw new Exception("Missing helper: '" + arg + "'"); | ||
// Someone is actually trying to call something, blow up. | ||
throw new Exception("Missing helper: '" + arguments[arguments.length-1].name + "'"); | ||
} | ||
@@ -80,2 +89,6 @@ }); | ||
if(context.length > 0) { | ||
if (options.ids) { | ||
options.ids = [options.name]; | ||
} | ||
return instance.helpers.each(context, options); | ||
@@ -86,3 +99,9 @@ } else { | ||
} else { | ||
return fn(context); | ||
if (options.data && options.ids) { | ||
var data = createFrame(options.data); | ||
data.contextPath = Utils.appendContextPath(options.data.contextPath, options.name); | ||
options = {data: data}; | ||
} | ||
return fn(context, options); | ||
} | ||
@@ -92,5 +111,16 @@ }); | ||
instance.registerHelper('each', function(context, options) { | ||
// Allow for {{#each}} | ||
if (!options) { | ||
options = context; | ||
context = this; | ||
} | ||
var fn = options.fn, inverse = options.inverse; | ||
var i = 0, ret = "", data; | ||
var contextPath; | ||
if (options.data && options.ids) { | ||
contextPath = Utils.appendContextPath(options.data.contextPath, options.ids[0]) + '.'; | ||
} | ||
if (isFunction(context)) { context = context.call(this); } | ||
@@ -109,2 +139,6 @@ | ||
data.last = (i === (context.length-1)); | ||
if (contextPath) { | ||
data.contextPath = contextPath + i; | ||
} | ||
} | ||
@@ -116,6 +150,10 @@ ret = ret + fn(context[i], { data: data }); | ||
if(context.hasOwnProperty(key)) { | ||
if(data) { | ||
data.key = key; | ||
if(data) { | ||
data.key = key; | ||
data.index = i; | ||
data.first = (i === 0); | ||
if (contextPath) { | ||
data.contextPath = contextPath + key; | ||
} | ||
} | ||
@@ -156,3 +194,13 @@ ret = ret + fn(context[key], {data: data}); | ||
if (!Utils.isEmpty(context)) return options.fn(context); | ||
var fn = options.fn; | ||
if (!Utils.isEmpty(context)) { | ||
if (options.data && options.ids) { | ||
var data = createFrame(options.data); | ||
data.contextPath = Utils.appendContextPath(options.data.contextPath, options.ids[0]); | ||
options = {data:data}; | ||
} | ||
return fn(context, options); | ||
} | ||
}); | ||
@@ -164,2 +212,6 @@ | ||
}); | ||
instance.registerHelper('lookup', function(obj, field, options) { | ||
return obj && obj[field]; | ||
}); | ||
} | ||
@@ -191,7 +243,7 @@ | ||
__exports__.log = log;var createFrame = function(object) { | ||
var obj = {}; | ||
Utils.extend(obj, object); | ||
return obj; | ||
var frame = Utils.extend({}, object); | ||
frame._parent = object; | ||
return frame; | ||
}; | ||
__exports__.createFrame = createFrame; | ||
}); |
@@ -90,11 +90,11 @@ define( | ||
// a mustache is an eligible helper if: | ||
// * its id is simple (a single part, not `this` or `..`) | ||
var eligibleHelper = this.eligibleHelper = id.isSimple; | ||
// a mustache is definitely a helper if: | ||
// * it is an eligible helper, and | ||
// * it has at least one parameter or hash segment | ||
this.isHelper = eligibleHelper && (params.length || hash); | ||
this.isHelper = params.length || hash; | ||
// a mustache is an eligible helper if: | ||
// * its id is simple (a single part, not `this` or `..`) | ||
this.eligibleHelper = this.isHelper || id.isSimple; | ||
// if a mustache is an eligible helper but not a definite | ||
@@ -105,3 +105,3 @@ // helper, it is ambiguous, and will be resolved in a later | ||
PartialNode: function(partialName, context, strip, locInfo) { | ||
PartialNode: function(partialName, context, hash, strip, locInfo) { | ||
LocationInfo.call(this, locInfo); | ||
@@ -111,2 +111,3 @@ this.type = "partial"; | ||
this.context = context; | ||
this.hash = hash; | ||
this.strip = strip; | ||
@@ -140,2 +141,16 @@ }, | ||
RawBlockNode: function(mustache, content, close, locInfo) { | ||
LocationInfo.call(this, locInfo); | ||
if (mustache.sexpr.id.original !== close) { | ||
throw new Exception(mustache.sexpr.id.original + " doesn't match " + close, this); | ||
} | ||
content = new AST.ContentNode(content, locInfo); | ||
this.type = 'block'; | ||
this.mustache = mustache; | ||
this.program = new AST.ProgramNode([content], locInfo); | ||
}, | ||
ContentNode: function(string, locInfo) { | ||
@@ -159,3 +174,4 @@ LocationInfo.call(this, locInfo); | ||
dig = [], | ||
depth = 0; | ||
depth = 0, | ||
depthString = ''; | ||
@@ -171,2 +187,3 @@ for(var i=0,l=parts.length; i<l; i++) { | ||
depth++; | ||
depthString += '../'; | ||
} else { | ||
@@ -184,2 +201,3 @@ this.isScoped = true; | ||
this.depth = depth; | ||
this.idName = depthString + this.string; | ||
@@ -203,2 +221,4 @@ // an ID is simple if it only has one part, and that part is not | ||
this.id = id; | ||
this.stringModeValue = id.stringModeValue; | ||
this.idName = '@' + id.stringModeValue; | ||
}, | ||
@@ -214,8 +234,8 @@ | ||
IntegerNode: function(integer, locInfo) { | ||
NumberNode: function(number, locInfo) { | ||
LocationInfo.call(this, locInfo); | ||
this.type = "INTEGER"; | ||
this.type = "NUMBER"; | ||
this.original = | ||
this.integer = integer; | ||
this.stringModeValue = Number(integer); | ||
this.number = number; | ||
this.stringModeValue = Number(number); | ||
}, | ||
@@ -222,0 +242,0 @@ |
@@ -80,2 +80,4 @@ define( | ||
this.options = options; | ||
this.stringParams = options.stringParams; | ||
this.trackIds = options.trackIds; | ||
@@ -91,3 +93,4 @@ // These changes will propagate to the other compiler components | ||
'with': true, | ||
'log': true | ||
'log': true, | ||
'lookup': true | ||
}; | ||
@@ -178,3 +181,3 @@ if (knownHelpers) { | ||
this.opcode('emptyHash'); | ||
this.opcode('blockValue'); | ||
this.opcode('blockValue', sexpr.id.original); | ||
} else { | ||
@@ -195,3 +198,3 @@ this.ambiguousSexpr(sexpr, program, inverse); | ||
hash: function(hash) { | ||
var pairs = hash.pairs, pair, val; | ||
var pairs = hash.pairs, pair; | ||
@@ -202,20 +205,4 @@ this.opcode('pushHash'); | ||
pair = pairs[i]; | ||
val = pair[1]; | ||
if (this.options.stringParams) { | ||
if(val.depth) { | ||
this.addDepth(val.depth); | ||
} | ||
this.opcode('getContext', val.depth || 0); | ||
this.opcode('pushStringParam', val.stringModeValue, val.type); | ||
if (val.type === 'sexpr') { | ||
// Subexpressions get evaluated and passed in | ||
// in string params mode. | ||
this.sexpr(val); | ||
} | ||
} else { | ||
this.accept(val); | ||
} | ||
this.pushParam(pair[1]); | ||
this.opcode('assignToHash', pair[0]); | ||
@@ -230,5 +217,11 @@ } | ||
if(partial.context) { | ||
this.ID(partial.context); | ||
if (partial.hash) { | ||
this.accept(partial.hash); | ||
} else { | ||
this.opcode('push', 'undefined'); | ||
} | ||
if (partial.context) { | ||
this.accept(partial.context); | ||
} else { | ||
this.opcode('push', 'depth0'); | ||
@@ -287,3 +280,4 @@ } | ||
var params = this.setupFullMustacheParams(sexpr, program, inverse), | ||
name = sexpr.id.parts[0]; | ||
id = sexpr.id, | ||
name = id.parts[0]; | ||
@@ -295,2 +289,3 @@ if (this.options.knownHelpers[name]) { | ||
} else { | ||
this.ID(id); | ||
this.opcode('invokeHelper', params.length, name, sexpr.isRoot); | ||
@@ -330,7 +325,3 @@ } | ||
this.options.data = true; | ||
if (data.id.isScoped || data.id.depth) { | ||
throw new Exception('Scoped data references are not supported: ' + data.original, data); | ||
} | ||
this.opcode('lookupData'); | ||
this.opcode('lookupData', data.id.depth); | ||
var parts = data.id.parts; | ||
@@ -346,4 +337,4 @@ for(var i=0, l=parts.length; i<l; i++) { | ||
INTEGER: function(integer) { | ||
this.opcode('pushLiteral', integer.integer); | ||
NUMBER: function(number) { | ||
this.opcode('pushLiteral', number.number); | ||
}, | ||
@@ -381,2 +372,3 @@ | ||
// if ambiguous, we can possibly resolve the ambiguity now | ||
// An eligible helper is one that does not have a complex path, i.e. `this.foo`, `../foo` etc. | ||
if (isEligible && !isHelper) { | ||
@@ -398,23 +390,27 @@ var name = sexpr.id.parts[0]; | ||
pushParams: function(params) { | ||
var i = params.length, param; | ||
var i = params.length; | ||
while(i--) { | ||
param = params[i]; | ||
this.pushParam(params[i]); | ||
} | ||
}, | ||
if(this.options.stringParams) { | ||
if(param.depth) { | ||
this.addDepth(param.depth); | ||
} | ||
pushParam: function(val) { | ||
if (this.stringParams) { | ||
if(val.depth) { | ||
this.addDepth(val.depth); | ||
} | ||
this.opcode('getContext', val.depth || 0); | ||
this.opcode('pushStringParam', val.stringModeValue, val.type); | ||
this.opcode('getContext', param.depth || 0); | ||
this.opcode('pushStringParam', param.stringModeValue, param.type); | ||
if (param.type === 'sexpr') { | ||
// Subexpressions get evaluated and passed in | ||
// in string params mode. | ||
this.sexpr(param); | ||
} | ||
} else { | ||
this[param.type](param); | ||
if (val.type === 'sexpr') { | ||
// Subexpressions get evaluated and passed in | ||
// in string params mode. | ||
this.sexpr(val); | ||
} | ||
} else { | ||
if (this.trackIds) { | ||
this.opcode('pushId', val.type, val.idName || val.stringModeValue); | ||
} | ||
this.accept(val); | ||
} | ||
@@ -476,3 +472,3 @@ }, | ||
// Template is only compiled on first use and cached after that point. | ||
return function(context, options) { | ||
var ret = function(context, options) { | ||
if (!compiled) { | ||
@@ -483,2 +479,9 @@ compiled = compileInput(); | ||
}; | ||
ret.child = function(i) { | ||
if (!compiled) { | ||
compiled = compileInput(); | ||
} | ||
return compiled.child(i); | ||
}; | ||
return ret; | ||
} | ||
@@ -485,0 +488,0 @@ |
@@ -26,8 +26,5 @@ define( | ||
if (/^[0-9]+$/.test(name)) { | ||
ret = parent + "[" + name + "]"; | ||
} else if (JavaScriptCompiler.isValidJavaScriptVariableName(name)) { | ||
if (JavaScriptCompiler.isValidJavaScriptVariableName(name)) { | ||
ret = parent + "." + name; | ||
} | ||
else { | ||
} else { | ||
ret = parent + "['" + name + "']"; | ||
@@ -46,3 +43,3 @@ } | ||
versions = REVISION_CHANGES[revision]; | ||
return "this.compilerInfo = ["+revision+",'"+versions+"'];\n"; | ||
return [revision, versions]; | ||
}, | ||
@@ -72,2 +69,5 @@ | ||
this.options = options || {}; | ||
this.stringParams = this.options.stringParams; | ||
this.trackIds = this.options.trackIds; | ||
this.precompile = !asObject; | ||
@@ -80,4 +80,3 @@ log('debug', this.environment.disassemble() + "\n\n"); | ||
programs: [], | ||
environments: [], | ||
aliases: { } | ||
environments: [] | ||
}; | ||
@@ -89,2 +88,3 @@ | ||
this.stackVars = []; | ||
this.aliases = {}; | ||
this.registers = { list: [] }; | ||
@@ -123,62 +123,56 @@ this.hashes = []; | ||
return this.createFunctionContext(asObject); | ||
}, | ||
var fn = this.createFunctionContext(asObject); | ||
if (!this.isChild) { | ||
var ret = { | ||
compiler: this.compilerInfo(), | ||
main: fn | ||
}; | ||
this.context.programs.map(function(program, index) { | ||
if (program) { | ||
ret[index] = program; | ||
} | ||
}); | ||
preamble: function() { | ||
var out = []; | ||
if (this.environment.usePartial) { | ||
ret.usePartial = true; | ||
} | ||
if (this.options.data) { | ||
ret.useData = true; | ||
} | ||
if (!this.isChild) { | ||
var namespace = this.namespace; | ||
if (!asObject) { | ||
ret.compiler = JSON.stringify(ret.compiler); | ||
ret = this.objectLiteral(ret); | ||
} | ||
var copies = "helpers = this.merge(helpers, " + namespace + ".helpers);"; | ||
if (this.environment.usePartial) { copies = copies + " partials = this.merge(partials, " + namespace + ".partials);"; } | ||
if (this.options.data) { copies = copies + " data = data || {};"; } | ||
out.push(copies); | ||
return ret; | ||
} else { | ||
out.push(''); | ||
return fn; | ||
} | ||
}, | ||
if (!this.environment.isSimple) { | ||
out.push(", buffer = " + this.initializeBuffer()); | ||
} else { | ||
out.push(""); | ||
} | ||
preamble: function() { | ||
// track the last context pushed into place to allow skipping the | ||
// getContext opcode when it would be a noop | ||
this.lastContext = 0; | ||
this.source = out; | ||
this.source = []; | ||
}, | ||
createFunctionContext: function(asObject) { | ||
var varDeclarations = ''; | ||
var locals = this.stackVars.concat(this.registers.list); | ||
if(locals.length > 0) { | ||
this.source[1] = this.source[1] + ", " + locals.join(", "); | ||
varDeclarations += ", " + locals.join(", "); | ||
} | ||
// Generate minimizer alias mappings | ||
if (!this.isChild) { | ||
for (var alias in this.context.aliases) { | ||
if (this.context.aliases.hasOwnProperty(alias)) { | ||
this.source[1] = this.source[1] + ', ' + alias + '=' + this.context.aliases[alias]; | ||
} | ||
for (var alias in this.aliases) { | ||
if (this.aliases.hasOwnProperty(alias)) { | ||
varDeclarations += ', ' + alias + '=' + this.aliases[alias]; | ||
} | ||
} | ||
if (this.source[1]) { | ||
this.source[1] = "var " + this.source[1].substring(2) + ";"; | ||
} | ||
var params = ["depth0", "helpers", "partials", "data"]; | ||
// Merge children | ||
if (!this.isChild) { | ||
this.source[1] += '\n' + this.context.programs.join('\n') + '\n'; | ||
} | ||
if (!this.environment.isSimple) { | ||
this.pushSource("return buffer;"); | ||
} | ||
var params = this.isChild ? ["depth0", "data"] : ["Handlebars", "depth0", "helpers", "partials", "data"]; | ||
for(var i=0, l=this.environment.depths.list.length; i<l; i++) { | ||
@@ -189,8 +183,4 @@ params.push("depth" + this.environment.depths.list[i]); | ||
// Perform a second pass over the output to merge content when possible | ||
var source = this.mergeSource(); | ||
var source = this.mergeSource(varDeclarations); | ||
if (!this.isChild) { | ||
source = this.compilerInfo()+source; | ||
} | ||
if (asObject) { | ||
@@ -201,12 +191,11 @@ params.push(source); | ||
} else { | ||
var functionSource = 'function ' + (this.name || '') + '(' + params.join(',') + ') {\n ' + source + '}'; | ||
log('debug', functionSource + "\n\n"); | ||
return functionSource; | ||
return 'function(' + params.join(',') + ') {\n ' + source + '}'; | ||
} | ||
}, | ||
mergeSource: function() { | ||
// WARN: We are not handling the case where buffer is still populated as the source should | ||
// not have buffer append operations as their final action. | ||
mergeSource: function(varDeclarations) { | ||
var source = '', | ||
buffer; | ||
buffer, | ||
appendOnly = !this.forceBuffer, | ||
appendFirst; | ||
for (var i = 0, len = this.source.length; i < len; i++) { | ||
@@ -222,8 +211,35 @@ var line = this.source[i]; | ||
if (buffer) { | ||
source += 'buffer += ' + buffer + ';\n '; | ||
if (!source) { | ||
appendFirst = true; | ||
source = buffer + ';\n '; | ||
} else { | ||
source += 'buffer += ' + buffer + ';\n '; | ||
} | ||
buffer = undefined; | ||
} | ||
source += line + '\n '; | ||
if (!this.environment.isSimple) { | ||
appendOnly = false; | ||
} | ||
} | ||
} | ||
if (appendOnly) { | ||
if (buffer || !source) { | ||
source += 'return ' + (buffer || '""') + ';\n'; | ||
} | ||
} else { | ||
varDeclarations += ", buffer = " + (appendFirst ? '' : this.initializeBuffer()); | ||
if (buffer) { | ||
source += 'return buffer + ' + buffer + ';\n'; | ||
} else { | ||
source += 'return buffer;\n'; | ||
} | ||
} | ||
if (varDeclarations) { | ||
source = 'var ' + varDeclarations.substring(2) + (appendFirst ? '' : ';\n ') + source; | ||
} | ||
return source; | ||
@@ -238,10 +254,10 @@ }, | ||
// The purpose of this opcode is to take a block of the form | ||
// `{{#foo}}...{{/foo}}`, resolve the value of `foo`, and | ||
// `{{#this.foo}}...{{/this.foo}}`, resolve the value of `foo`, and | ||
// replace it on the stack with the result of properly | ||
// invoking blockHelperMissing. | ||
blockValue: function() { | ||
this.context.aliases.blockHelperMissing = 'helpers.blockHelperMissing'; | ||
blockValue: function(name) { | ||
this.aliases.blockHelperMissing = 'helpers.blockHelperMissing'; | ||
var params = ["depth0"]; | ||
this.setupParams(0, params); | ||
this.setupParams(name, 0, params); | ||
@@ -261,7 +277,10 @@ this.replaceStack(function(current) { | ||
ambiguousBlockValue: function() { | ||
this.context.aliases.blockHelperMissing = 'helpers.blockHelperMissing'; | ||
this.aliases.blockHelperMissing = 'helpers.blockHelperMissing'; | ||
// We're being a bit cheeky and reusing the options value from the prior exec | ||
var params = ["depth0"]; | ||
this.setupParams(0, params); | ||
this.setupParams('', 0, params, true); | ||
this.flushInline(); | ||
var current = this.topStack(); | ||
@@ -331,3 +350,3 @@ params.splice(1, 0, current); | ||
appendEscaped: function() { | ||
this.context.aliases.escapeExpression = 'this.escapeExpression'; | ||
this.aliases.escapeExpression = 'this.escapeExpression'; | ||
@@ -379,3 +398,3 @@ this.pushSource(this.appendToBuffer("escapeExpression(" + this.popStack() + ")")); | ||
resolvePossibleLambda: function() { | ||
this.context.aliases.functionType = '"function"'; | ||
this.aliases.functionType = '"function"'; | ||
@@ -406,4 +425,8 @@ this.replaceStack(function(current) { | ||
// Push the data lookup operator | ||
lookupData: function() { | ||
this.pushStackLiteral('data'); | ||
lookupData: function(depth) { | ||
if (!depth) { | ||
this.pushStackLiteral('data'); | ||
} else { | ||
this.pushStackLiteral('this.data(data, ' + depth + ')'); | ||
} | ||
}, | ||
@@ -438,3 +461,6 @@ | ||
if (this.options.stringParams) { | ||
if (this.trackIds) { | ||
this.push('{}'); // hashIds | ||
} | ||
if (this.stringParams) { | ||
this.push('{}'); // hashContexts | ||
@@ -448,3 +474,3 @@ this.push('{}'); // hashTypes | ||
} | ||
this.hash = {values: [], types: [], contexts: []}; | ||
this.hash = {values: [], types: [], contexts: [], ids: []}; | ||
}, | ||
@@ -455,3 +481,6 @@ popHash: function() { | ||
if (this.options.stringParams) { | ||
if (this.trackIds) { | ||
this.push('{' + hash.ids.join(',') + '}'); | ||
} | ||
if (this.stringParams) { | ||
this.push('{' + hash.contexts.join(',') + '}'); | ||
@@ -523,9 +552,9 @@ this.push('{' + hash.types.join(',') + '}'); | ||
invokeHelper: function(paramSize, name, isRoot) { | ||
this.context.aliases.helperMissing = 'helpers.helperMissing'; | ||
this.aliases.helperMissing = 'helpers.helperMissing'; | ||
this.useRegister('helper'); | ||
var helper = this.lastHelper = this.setupHelper(paramSize, name, true); | ||
var nonHelper = this.nameLookup('depth' + this.lastContext, name, 'context'); | ||
var nonHelper = this.popStack(); | ||
var helper = this.setupHelper(paramSize, name); | ||
var lookup = 'helper = ' + helper.name + ' || ' + nonHelper; | ||
var lookup = 'helper = ' + helper.name + ' || ' + nonHelper + ' || helperMissing'; | ||
if (helper.paramsInit) { | ||
@@ -535,8 +564,3 @@ lookup += ',' + helper.paramsInit; | ||
this.push( | ||
'(' | ||
+ lookup | ||
+ ',helper ' | ||
+ '? helper.call(' + helper.callParams + ') ' | ||
+ ': helperMissing.call(' + helper.helperMissingParams + '))'); | ||
this.push('(' + lookup + ',helper.call(' + helper.callParams + '))'); | ||
@@ -576,3 +600,3 @@ // Always flush subexpressions. This is both to prevent the compounding size issue that | ||
invokeAmbiguous: function(name, helperCall) { | ||
this.context.aliases.functionType = '"function"'; | ||
this.aliases.functionType = '"function"'; | ||
this.useRegister('helper'); | ||
@@ -584,11 +608,8 @@ | ||
var helperName = this.lastHelper = this.nameLookup('helpers', name, 'helper'); | ||
var nonHelper = this.nameLookup('depth' + this.lastContext, name, 'context'); | ||
var nextStack = this.nextStack(); | ||
if (helper.paramsInit) { | ||
this.pushSource(helper.paramsInit); | ||
} | ||
this.pushSource('if (helper = ' + helperName + ') { ' + nextStack + ' = helper.call(' + helper.callParams + '); }'); | ||
this.pushSource('else { helper = ' + nonHelper + '; ' + nextStack + ' = typeof helper === functionType ? helper.call(' + helper.callParams + ') : helper; }'); | ||
this.push( | ||
'((helper = ' + helperName + ' || ' + nonHelper | ||
+ (helper.paramsInit ? '),(' + helper.paramsInit : '') + '),' | ||
+ '(typeof helper === functionType ? helper.call(' + helper.callParams + ') : helper))'); | ||
}, | ||
@@ -604,3 +625,3 @@ | ||
invokePartial: function(name) { | ||
var params = [this.nameLookup('partials', name, 'partial'), "'" + name + "'", this.popStack(), "helpers", "partials"]; | ||
var params = [this.nameLookup('partials', name, 'partial'), "'" + name + "'", this.popStack(), this.popStack(), "helpers", "partials"]; | ||
@@ -611,4 +632,3 @@ if (this.options.data) { | ||
this.context.aliases.self = "this"; | ||
this.push("self.invokePartial(" + params.join(", ") + ")"); | ||
this.push("this.invokePartial(" + params.join(", ") + ")"); | ||
}, | ||
@@ -626,5 +646,9 @@ | ||
context, | ||
type; | ||
type, | ||
id; | ||
if (this.options.stringParams) { | ||
if (this.trackIds) { | ||
id = this.popStack(); | ||
} | ||
if (this.stringParams) { | ||
type = this.popStack(); | ||
@@ -641,5 +665,18 @@ context = this.popStack(); | ||
} | ||
if (id) { | ||
hash.ids.push("'" + key + "': " + id); | ||
} | ||
hash.values.push("'" + key + "': (" + value + ")"); | ||
}, | ||
pushId: function(type, name) { | ||
if (type === 'ID' || type === 'DATA') { | ||
this.pushString(name); | ||
} else if (type === 'sexpr') { | ||
this.pushStackLiteral('true'); | ||
} else { | ||
this.pushStackLiteral('null'); | ||
} | ||
}, | ||
// HELPERS | ||
@@ -663,3 +700,3 @@ | ||
child.name = 'program' + index; | ||
this.context.programs[index] = compiler.compile(child, options, this.context); | ||
this.context.programs[index] = compiler.compile(child, options, this.context, !this.precompile); | ||
this.context.environments[index] = child; | ||
@@ -682,6 +719,4 @@ } else { | ||
programExpression: function(guid) { | ||
this.context.aliases.self = "this"; | ||
if(guid == null) { | ||
return "self.noop"; | ||
return 'this.noop'; | ||
} | ||
@@ -692,3 +727,3 @@ | ||
var programParams = [child.index, child.name, "data"]; | ||
var programParams = [child.index, 'data']; | ||
@@ -698,7 +733,6 @@ for(var i=0, l = depths.length; i<l; i++) { | ||
if(depth === 1) { programParams.push("depth0"); } | ||
else { programParams.push("depth" + (depth - 1)); } | ||
programParams.push('depth' + (depth - 1)); | ||
} | ||
return (depths.length === 0 ? "self.program(" : "self.programWithDepth(") + programParams.join(", ") + ")"; | ||
return (depths.length === 0 ? 'this.program(' : 'this.programWithDepth(') + programParams.join(', ') + ')'; | ||
}, | ||
@@ -861,5 +895,17 @@ | ||
setupHelper: function(paramSize, name, missingParams) { | ||
objectLiteral: function(obj) { | ||
var pairs = []; | ||
for (var key in obj) { | ||
if (obj.hasOwnProperty(key)) { | ||
pairs.push(this.quotedString(key) + ':' + obj[key]); | ||
} | ||
} | ||
return '{' + pairs.join(',') + '}'; | ||
}, | ||
setupHelper: function(paramSize, name, blockHelper) { | ||
var params = [], | ||
paramsInit = this.setupParams(paramSize, params, missingParams); | ||
paramsInit = this.setupParams(name, paramSize, params, blockHelper); | ||
var foundHelper = this.nameLookup('helpers', name, 'helper'); | ||
@@ -871,16 +917,19 @@ | ||
name: foundHelper, | ||
callParams: ["depth0"].concat(params).join(", "), | ||
helperMissingParams: missingParams && ["depth0", this.quotedString(name)].concat(params).join(", ") | ||
callParams: ["depth0"].concat(params).join(", ") | ||
}; | ||
}, | ||
setupOptions: function(paramSize, params) { | ||
var options = [], contexts = [], types = [], param, inverse, program; | ||
setupOptions: function(helper, paramSize, params) { | ||
var options = {}, contexts = [], types = [], ids = [], param, inverse, program; | ||
options.push("hash:" + this.popStack()); | ||
options.name = this.quotedString(helper); | ||
options.hash = this.popStack(); | ||
if (this.options.stringParams) { | ||
options.push("hashTypes:" + this.popStack()); | ||
options.push("hashContexts:" + this.popStack()); | ||
if (this.trackIds) { | ||
options.hashIds = this.popStack(); | ||
} | ||
if (this.stringParams) { | ||
options.hashTypes = this.popStack(); | ||
options.hashContexts = this.popStack(); | ||
} | ||
@@ -894,20 +943,21 @@ inverse = this.popStack(); | ||
if (!program) { | ||
this.context.aliases.self = "this"; | ||
program = "self.noop"; | ||
program = 'this.noop'; | ||
} | ||
if (!inverse) { | ||
this.context.aliases.self = "this"; | ||
inverse = "self.noop"; | ||
inverse = 'this.noop'; | ||
} | ||
options.push("inverse:" + inverse); | ||
options.push("fn:" + program); | ||
options.fn = program; | ||
options.inverse = inverse; | ||
} | ||
for(var i=0; i<paramSize; i++) { | ||
for (var i = 0; i < paramSize; i++) { | ||
param = this.popStack(); | ||
params.push(param); | ||
if(this.options.stringParams) { | ||
if (this.trackIds) { | ||
ids.push(this.popStack()); | ||
} | ||
if (this.stringParams) { | ||
types.push(this.popStack()); | ||
@@ -918,9 +968,12 @@ contexts.push(this.popStack()); | ||
if (this.options.stringParams) { | ||
options.push("contexts:[" + contexts.join(",") + "]"); | ||
options.push("types:[" + types.join(",") + "]"); | ||
if (this.trackIds) { | ||
options.ids = "[" + ids.join(",") + "]"; | ||
} | ||
if (this.stringParams) { | ||
options.types = "[" + types.join(",") + "]"; | ||
options.contexts = "[" + contexts.join(",") + "]"; | ||
} | ||
if(this.options.data) { | ||
options.push("data:data"); | ||
if (this.options.data) { | ||
options.data = "data"; | ||
} | ||
@@ -933,4 +986,4 @@ | ||
// to fill in | ||
setupParams: function(paramSize, params, useRegister) { | ||
var options = '{' + this.setupOptions(paramSize, params).join(',') + '}'; | ||
setupParams: function(helperName, paramSize, params, useRegister) { | ||
var options = this.objectLiteral(this.setupOptions(helperName, paramSize, params)); | ||
@@ -973,6 +1026,3 @@ if (useRegister) { | ||
JavaScriptCompiler.isValidJavaScriptVariableName = function(name) { | ||
if(!JavaScriptCompiler.RESERVED_WORDS[name] && /^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(name)) { | ||
return true; | ||
} | ||
return false; | ||
return !JavaScriptCompiler.RESERVED_WORDS[name] && /^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(name); | ||
}; | ||
@@ -979,0 +1029,0 @@ |
@@ -10,5 +10,5 @@ define( | ||
yy: {}, | ||
symbols_: {"error":2,"root":3,"statements":4,"EOF":5,"program":6,"simpleInverse":7,"statement":8,"openInverse":9,"closeBlock":10,"openBlock":11,"mustache":12,"partial":13,"CONTENT":14,"COMMENT":15,"OPEN_BLOCK":16,"sexpr":17,"CLOSE":18,"OPEN_INVERSE":19,"OPEN_ENDBLOCK":20,"path":21,"OPEN":22,"OPEN_UNESCAPED":23,"CLOSE_UNESCAPED":24,"OPEN_PARTIAL":25,"partialName":26,"partial_option0":27,"sexpr_repetition0":28,"sexpr_option0":29,"dataName":30,"param":31,"STRING":32,"INTEGER":33,"BOOLEAN":34,"OPEN_SEXPR":35,"CLOSE_SEXPR":36,"hash":37,"hash_repetition_plus0":38,"hashSegment":39,"ID":40,"EQUALS":41,"DATA":42,"pathSegments":43,"SEP":44,"$accept":0,"$end":1}, | ||
terminals_: {2:"error",5:"EOF",14:"CONTENT",15:"COMMENT",16:"OPEN_BLOCK",18:"CLOSE",19:"OPEN_INVERSE",20:"OPEN_ENDBLOCK",22:"OPEN",23:"OPEN_UNESCAPED",24:"CLOSE_UNESCAPED",25:"OPEN_PARTIAL",32:"STRING",33:"INTEGER",34:"BOOLEAN",35:"OPEN_SEXPR",36:"CLOSE_SEXPR",40:"ID",41:"EQUALS",42:"DATA",44:"SEP"}, | ||
productions_: [0,[3,2],[3,1],[6,2],[6,3],[6,2],[6,1],[6,1],[6,0],[4,1],[4,2],[8,3],[8,3],[8,1],[8,1],[8,1],[8,1],[11,3],[9,3],[10,3],[12,3],[12,3],[13,4],[7,2],[17,3],[17,1],[31,1],[31,1],[31,1],[31,1],[31,1],[31,3],[37,1],[39,3],[26,1],[26,1],[26,1],[30,2],[21,1],[43,3],[43,1],[27,0],[27,1],[28,0],[28,2],[29,0],[29,1],[38,1],[38,2]], | ||
symbols_: {"error":2,"root":3,"statements":4,"EOF":5,"program":6,"simpleInverse":7,"statement":8,"openRawBlock":9,"CONTENT":10,"END_RAW_BLOCK":11,"openInverse":12,"closeBlock":13,"openBlock":14,"mustache":15,"partial":16,"COMMENT":17,"OPEN_RAW_BLOCK":18,"sexpr":19,"CLOSE_RAW_BLOCK":20,"OPEN_BLOCK":21,"CLOSE":22,"OPEN_INVERSE":23,"OPEN_ENDBLOCK":24,"path":25,"OPEN":26,"OPEN_UNESCAPED":27,"CLOSE_UNESCAPED":28,"OPEN_PARTIAL":29,"partialName":30,"param":31,"partial_option0":32,"partial_option1":33,"sexpr_repetition0":34,"sexpr_option0":35,"dataName":36,"STRING":37,"NUMBER":38,"BOOLEAN":39,"OPEN_SEXPR":40,"CLOSE_SEXPR":41,"hash":42,"hash_repetition_plus0":43,"hashSegment":44,"ID":45,"EQUALS":46,"DATA":47,"pathSegments":48,"SEP":49,"$accept":0,"$end":1}, | ||
terminals_: {2:"error",5:"EOF",10:"CONTENT",11:"END_RAW_BLOCK",17:"COMMENT",18:"OPEN_RAW_BLOCK",20:"CLOSE_RAW_BLOCK",21:"OPEN_BLOCK",22:"CLOSE",23:"OPEN_INVERSE",24:"OPEN_ENDBLOCK",26:"OPEN",27:"OPEN_UNESCAPED",28:"CLOSE_UNESCAPED",29:"OPEN_PARTIAL",37:"STRING",38:"NUMBER",39:"BOOLEAN",40:"OPEN_SEXPR",41:"CLOSE_SEXPR",45:"ID",46:"EQUALS",47:"DATA",49:"SEP"}, | ||
productions_: [0,[3,2],[3,1],[6,2],[6,3],[6,2],[6,1],[6,1],[6,0],[4,1],[4,2],[8,3],[8,3],[8,3],[8,1],[8,1],[8,1],[8,1],[9,3],[14,3],[12,3],[13,3],[15,3],[15,3],[16,5],[16,4],[7,2],[19,3],[19,1],[31,1],[31,1],[31,1],[31,1],[31,1],[31,3],[42,1],[44,3],[30,1],[30,1],[30,1],[36,2],[25,1],[48,3],[48,1],[32,0],[32,1],[33,0],[33,1],[34,0],[34,2],[35,0],[35,1],[43,1],[43,2]], | ||
performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) { | ||
@@ -38,74 +38,80 @@ | ||
break; | ||
case 11:this.$ = new yy.BlockNode($$[$0-2], $$[$0-1].inverse, $$[$0-1], $$[$0], this._$); | ||
case 11:this.$ = new yy.RawBlockNode($$[$0-2], $$[$0-1], $$[$0], this._$); | ||
break; | ||
case 12:this.$ = new yy.BlockNode($$[$0-2], $$[$0-1], $$[$0-1].inverse, $$[$0], this._$); | ||
case 12:this.$ = new yy.BlockNode($$[$0-2], $$[$0-1].inverse, $$[$0-1], $$[$0], this._$); | ||
break; | ||
case 13:this.$ = $$[$0]; | ||
case 13:this.$ = new yy.BlockNode($$[$0-2], $$[$0-1], $$[$0-1].inverse, $$[$0], this._$); | ||
break; | ||
case 14:this.$ = $$[$0]; | ||
break; | ||
case 15:this.$ = new yy.ContentNode($$[$0], this._$); | ||
case 15:this.$ = $$[$0]; | ||
break; | ||
case 16:this.$ = new yy.CommentNode($$[$0], this._$); | ||
case 16:this.$ = new yy.ContentNode($$[$0], this._$); | ||
break; | ||
case 17:this.$ = new yy.MustacheNode($$[$0-1], null, $$[$0-2], stripFlags($$[$0-2], $$[$0]), this._$); | ||
case 17:this.$ = new yy.CommentNode($$[$0], this._$); | ||
break; | ||
case 18:this.$ = new yy.MustacheNode($$[$0-1], null, $$[$0-2], stripFlags($$[$0-2], $$[$0]), this._$); | ||
case 18:this.$ = new yy.MustacheNode($$[$0-1], null, '', '', this._$); | ||
break; | ||
case 19:this.$ = {path: $$[$0-1], strip: stripFlags($$[$0-2], $$[$0])}; | ||
case 19:this.$ = new yy.MustacheNode($$[$0-1], null, $$[$0-2], stripFlags($$[$0-2], $$[$0]), this._$); | ||
break; | ||
case 20:this.$ = new yy.MustacheNode($$[$0-1], null, $$[$0-2], stripFlags($$[$0-2], $$[$0]), this._$); | ||
break; | ||
case 21:this.$ = new yy.MustacheNode($$[$0-1], null, $$[$0-2], stripFlags($$[$0-2], $$[$0]), this._$); | ||
case 21:this.$ = {path: $$[$0-1], strip: stripFlags($$[$0-2], $$[$0])}; | ||
break; | ||
case 22:this.$ = new yy.PartialNode($$[$0-2], $$[$0-1], stripFlags($$[$0-3], $$[$0]), this._$); | ||
case 22:this.$ = new yy.MustacheNode($$[$0-1], null, $$[$0-2], stripFlags($$[$0-2], $$[$0]), this._$); | ||
break; | ||
case 23:this.$ = stripFlags($$[$0-1], $$[$0]); | ||
case 23:this.$ = new yy.MustacheNode($$[$0-1], null, $$[$0-2], stripFlags($$[$0-2], $$[$0]), this._$); | ||
break; | ||
case 24:this.$ = new yy.SexprNode([$$[$0-2]].concat($$[$0-1]), $$[$0], this._$); | ||
case 24:this.$ = new yy.PartialNode($$[$0-3], $$[$0-2], $$[$0-1], stripFlags($$[$0-4], $$[$0]), this._$); | ||
break; | ||
case 25:this.$ = new yy.SexprNode([$$[$0]], null, this._$); | ||
case 25:this.$ = new yy.PartialNode($$[$0-2], undefined, $$[$0-1], stripFlags($$[$0-3], $$[$0]), this._$); | ||
break; | ||
case 26:this.$ = $$[$0]; | ||
case 26:this.$ = stripFlags($$[$0-1], $$[$0]); | ||
break; | ||
case 27:this.$ = new yy.StringNode($$[$0], this._$); | ||
case 27:this.$ = new yy.SexprNode([$$[$0-2]].concat($$[$0-1]), $$[$0], this._$); | ||
break; | ||
case 28:this.$ = new yy.IntegerNode($$[$0], this._$); | ||
case 28:this.$ = new yy.SexprNode([$$[$0]], null, this._$); | ||
break; | ||
case 29:this.$ = new yy.BooleanNode($$[$0], this._$); | ||
case 29:this.$ = $$[$0]; | ||
break; | ||
case 30:this.$ = $$[$0]; | ||
case 30:this.$ = new yy.StringNode($$[$0], this._$); | ||
break; | ||
case 31:$$[$0-1].isHelper = true; this.$ = $$[$0-1]; | ||
case 31:this.$ = new yy.NumberNode($$[$0], this._$); | ||
break; | ||
case 32:this.$ = new yy.HashNode($$[$0], this._$); | ||
case 32:this.$ = new yy.BooleanNode($$[$0], this._$); | ||
break; | ||
case 33:this.$ = [$$[$0-2], $$[$0]]; | ||
case 33:this.$ = $$[$0]; | ||
break; | ||
case 34:this.$ = new yy.PartialNameNode($$[$0], this._$); | ||
case 34:$$[$0-1].isHelper = true; this.$ = $$[$0-1]; | ||
break; | ||
case 35:this.$ = new yy.PartialNameNode(new yy.StringNode($$[$0], this._$), this._$); | ||
case 35:this.$ = new yy.HashNode($$[$0], this._$); | ||
break; | ||
case 36:this.$ = new yy.PartialNameNode(new yy.IntegerNode($$[$0], this._$)); | ||
case 36:this.$ = [$$[$0-2], $$[$0]]; | ||
break; | ||
case 37:this.$ = new yy.DataNode($$[$0], this._$); | ||
case 37:this.$ = new yy.PartialNameNode($$[$0], this._$); | ||
break; | ||
case 38:this.$ = new yy.IdNode($$[$0], this._$); | ||
case 38:this.$ = new yy.PartialNameNode(new yy.StringNode($$[$0], this._$), this._$); | ||
break; | ||
case 39: $$[$0-2].push({part: $$[$0], separator: $$[$0-1]}); this.$ = $$[$0-2]; | ||
case 39:this.$ = new yy.PartialNameNode(new yy.NumberNode($$[$0], this._$)); | ||
break; | ||
case 40:this.$ = [{part: $$[$0]}]; | ||
case 40:this.$ = new yy.DataNode($$[$0], this._$); | ||
break; | ||
case 43:this.$ = []; | ||
case 41:this.$ = new yy.IdNode($$[$0], this._$); | ||
break; | ||
case 44:$$[$0-1].push($$[$0]); | ||
case 42: $$[$0-2].push({part: $$[$0], separator: $$[$0-1]}); this.$ = $$[$0-2]; | ||
break; | ||
case 47:this.$ = [$$[$0]]; | ||
case 43:this.$ = [{part: $$[$0]}]; | ||
break; | ||
case 48:$$[$0-1].push($$[$0]); | ||
case 48:this.$ = []; | ||
break; | ||
case 49:$$[$0-1].push($$[$0]); | ||
break; | ||
case 52:this.$ = [$$[$0]]; | ||
break; | ||
case 53:$$[$0-1].push($$[$0]); | ||
break; | ||
} | ||
}, | ||
table: [{3:1,4:2,5:[1,3],8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],25:[1,15]},{1:[3]},{5:[1,16],8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],25:[1,15]},{1:[2,2]},{5:[2,9],14:[2,9],15:[2,9],16:[2,9],19:[2,9],20:[2,9],22:[2,9],23:[2,9],25:[2,9]},{4:20,6:18,7:19,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,21],20:[2,8],22:[1,13],23:[1,14],25:[1,15]},{4:20,6:22,7:19,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,21],20:[2,8],22:[1,13],23:[1,14],25:[1,15]},{5:[2,13],14:[2,13],15:[2,13],16:[2,13],19:[2,13],20:[2,13],22:[2,13],23:[2,13],25:[2,13]},{5:[2,14],14:[2,14],15:[2,14],16:[2,14],19:[2,14],20:[2,14],22:[2,14],23:[2,14],25:[2,14]},{5:[2,15],14:[2,15],15:[2,15],16:[2,15],19:[2,15],20:[2,15],22:[2,15],23:[2,15],25:[2,15]},{5:[2,16],14:[2,16],15:[2,16],16:[2,16],19:[2,16],20:[2,16],22:[2,16],23:[2,16],25:[2,16]},{17:23,21:24,30:25,40:[1,28],42:[1,27],43:26},{17:29,21:24,30:25,40:[1,28],42:[1,27],43:26},{17:30,21:24,30:25,40:[1,28],42:[1,27],43:26},{17:31,21:24,30:25,40:[1,28],42:[1,27],43:26},{21:33,26:32,32:[1,34],33:[1,35],40:[1,28],43:26},{1:[2,1]},{5:[2,10],14:[2,10],15:[2,10],16:[2,10],19:[2,10],20:[2,10],22:[2,10],23:[2,10],25:[2,10]},{10:36,20:[1,37]},{4:38,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,7],22:[1,13],23:[1,14],25:[1,15]},{7:39,8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,21],20:[2,6],22:[1,13],23:[1,14],25:[1,15]},{17:23,18:[1,40],21:24,30:25,40:[1,28],42:[1,27],43:26},{10:41,20:[1,37]},{18:[1,42]},{18:[2,43],24:[2,43],28:43,32:[2,43],33:[2,43],34:[2,43],35:[2,43],36:[2,43],40:[2,43],42:[2,43]},{18:[2,25],24:[2,25],36:[2,25]},{18:[2,38],24:[2,38],32:[2,38],33:[2,38],34:[2,38],35:[2,38],36:[2,38],40:[2,38],42:[2,38],44:[1,44]},{21:45,40:[1,28],43:26},{18:[2,40],24:[2,40],32:[2,40],33:[2,40],34:[2,40],35:[2,40],36:[2,40],40:[2,40],42:[2,40],44:[2,40]},{18:[1,46]},{18:[1,47]},{24:[1,48]},{18:[2,41],21:50,27:49,40:[1,28],43:26},{18:[2,34],40:[2,34]},{18:[2,35],40:[2,35]},{18:[2,36],40:[2,36]},{5:[2,11],14:[2,11],15:[2,11],16:[2,11],19:[2,11],20:[2,11],22:[2,11],23:[2,11],25:[2,11]},{21:51,40:[1,28],43:26},{8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,3],22:[1,13],23:[1,14],25:[1,15]},{4:52,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,5],22:[1,13],23:[1,14],25:[1,15]},{14:[2,23],15:[2,23],16:[2,23],19:[2,23],20:[2,23],22:[2,23],23:[2,23],25:[2,23]},{5:[2,12],14:[2,12],15:[2,12],16:[2,12],19:[2,12],20:[2,12],22:[2,12],23:[2,12],25:[2,12]},{14:[2,18],15:[2,18],16:[2,18],19:[2,18],20:[2,18],22:[2,18],23:[2,18],25:[2,18]},{18:[2,45],21:56,24:[2,45],29:53,30:60,31:54,32:[1,57],33:[1,58],34:[1,59],35:[1,61],36:[2,45],37:55,38:62,39:63,40:[1,64],42:[1,27],43:26},{40:[1,65]},{18:[2,37],24:[2,37],32:[2,37],33:[2,37],34:[2,37],35:[2,37],36:[2,37],40:[2,37],42:[2,37]},{14:[2,17],15:[2,17],16:[2,17],19:[2,17],20:[2,17],22:[2,17],23:[2,17],25:[2,17]},{5:[2,20],14:[2,20],15:[2,20],16:[2,20],19:[2,20],20:[2,20],22:[2,20],23:[2,20],25:[2,20]},{5:[2,21],14:[2,21],15:[2,21],16:[2,21],19:[2,21],20:[2,21],22:[2,21],23:[2,21],25:[2,21]},{18:[1,66]},{18:[2,42]},{18:[1,67]},{8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],25:[1,15]},{18:[2,24],24:[2,24],36:[2,24]},{18:[2,44],24:[2,44],32:[2,44],33:[2,44],34:[2,44],35:[2,44],36:[2,44],40:[2,44],42:[2,44]},{18:[2,46],24:[2,46],36:[2,46]},{18:[2,26],24:[2,26],32:[2,26],33:[2,26],34:[2,26],35:[2,26],36:[2,26],40:[2,26],42:[2,26]},{18:[2,27],24:[2,27],32:[2,27],33:[2,27],34:[2,27],35:[2,27],36:[2,27],40:[2,27],42:[2,27]},{18:[2,28],24:[2,28],32:[2,28],33:[2,28],34:[2,28],35:[2,28],36:[2,28],40:[2,28],42:[2,28]},{18:[2,29],24:[2,29],32:[2,29],33:[2,29],34:[2,29],35:[2,29],36:[2,29],40:[2,29],42:[2,29]},{18:[2,30],24:[2,30],32:[2,30],33:[2,30],34:[2,30],35:[2,30],36:[2,30],40:[2,30],42:[2,30]},{17:68,21:24,30:25,40:[1,28],42:[1,27],43:26},{18:[2,32],24:[2,32],36:[2,32],39:69,40:[1,70]},{18:[2,47],24:[2,47],36:[2,47],40:[2,47]},{18:[2,40],24:[2,40],32:[2,40],33:[2,40],34:[2,40],35:[2,40],36:[2,40],40:[2,40],41:[1,71],42:[2,40],44:[2,40]},{18:[2,39],24:[2,39],32:[2,39],33:[2,39],34:[2,39],35:[2,39],36:[2,39],40:[2,39],42:[2,39],44:[2,39]},{5:[2,22],14:[2,22],15:[2,22],16:[2,22],19:[2,22],20:[2,22],22:[2,22],23:[2,22],25:[2,22]},{5:[2,19],14:[2,19],15:[2,19],16:[2,19],19:[2,19],20:[2,19],22:[2,19],23:[2,19],25:[2,19]},{36:[1,72]},{18:[2,48],24:[2,48],36:[2,48],40:[2,48]},{41:[1,71]},{21:56,30:60,31:73,32:[1,57],33:[1,58],34:[1,59],35:[1,61],40:[1,28],42:[1,27],43:26},{18:[2,31],24:[2,31],32:[2,31],33:[2,31],34:[2,31],35:[2,31],36:[2,31],40:[2,31],42:[2,31]},{18:[2,33],24:[2,33],36:[2,33],40:[2,33]}], | ||
defaultActions: {3:[2,2],16:[2,1],50:[2,42]}, | ||
table: [{3:1,4:2,5:[1,3],8:4,9:5,10:[1,10],12:6,14:7,15:8,16:9,17:[1,11],18:[1,12],21:[1,14],23:[1,13],26:[1,15],27:[1,16],29:[1,17]},{1:[3]},{5:[1,18],8:19,9:5,10:[1,10],12:6,14:7,15:8,16:9,17:[1,11],18:[1,12],21:[1,14],23:[1,13],26:[1,15],27:[1,16],29:[1,17]},{1:[2,2]},{5:[2,9],10:[2,9],17:[2,9],18:[2,9],21:[2,9],23:[2,9],24:[2,9],26:[2,9],27:[2,9],29:[2,9]},{10:[1,20]},{4:23,6:21,7:22,8:4,9:5,10:[1,10],12:6,14:7,15:8,16:9,17:[1,11],18:[1,12],21:[1,14],23:[1,24],24:[2,8],26:[1,15],27:[1,16],29:[1,17]},{4:23,6:25,7:22,8:4,9:5,10:[1,10],12:6,14:7,15:8,16:9,17:[1,11],18:[1,12],21:[1,14],23:[1,24],24:[2,8],26:[1,15],27:[1,16],29:[1,17]},{5:[2,14],10:[2,14],17:[2,14],18:[2,14],21:[2,14],23:[2,14],24:[2,14],26:[2,14],27:[2,14],29:[2,14]},{5:[2,15],10:[2,15],17:[2,15],18:[2,15],21:[2,15],23:[2,15],24:[2,15],26:[2,15],27:[2,15],29:[2,15]},{5:[2,16],10:[2,16],17:[2,16],18:[2,16],21:[2,16],23:[2,16],24:[2,16],26:[2,16],27:[2,16],29:[2,16]},{5:[2,17],10:[2,17],17:[2,17],18:[2,17],21:[2,17],23:[2,17],24:[2,17],26:[2,17],27:[2,17],29:[2,17]},{19:26,25:27,36:28,45:[1,31],47:[1,30],48:29},{19:32,25:27,36:28,45:[1,31],47:[1,30],48:29},{19:33,25:27,36:28,45:[1,31],47:[1,30],48:29},{19:34,25:27,36:28,45:[1,31],47:[1,30],48:29},{19:35,25:27,36:28,45:[1,31],47:[1,30],48:29},{25:37,30:36,37:[1,38],38:[1,39],45:[1,31],48:29},{1:[2,1]},{5:[2,10],10:[2,10],17:[2,10],18:[2,10],21:[2,10],23:[2,10],24:[2,10],26:[2,10],27:[2,10],29:[2,10]},{11:[1,40]},{13:41,24:[1,42]},{4:43,8:4,9:5,10:[1,10],12:6,14:7,15:8,16:9,17:[1,11],18:[1,12],21:[1,14],23:[1,13],24:[2,7],26:[1,15],27:[1,16],29:[1,17]},{7:44,8:19,9:5,10:[1,10],12:6,14:7,15:8,16:9,17:[1,11],18:[1,12],21:[1,14],23:[1,24],24:[2,6],26:[1,15],27:[1,16],29:[1,17]},{19:32,22:[1,45],25:27,36:28,45:[1,31],47:[1,30],48:29},{13:46,24:[1,42]},{20:[1,47]},{20:[2,48],22:[2,48],28:[2,48],34:48,37:[2,48],38:[2,48],39:[2,48],40:[2,48],41:[2,48],45:[2,48],47:[2,48]},{20:[2,28],22:[2,28],28:[2,28],41:[2,28]},{20:[2,41],22:[2,41],28:[2,41],37:[2,41],38:[2,41],39:[2,41],40:[2,41],41:[2,41],45:[2,41],47:[2,41],49:[1,49]},{25:50,45:[1,31],48:29},{20:[2,43],22:[2,43],28:[2,43],37:[2,43],38:[2,43],39:[2,43],40:[2,43],41:[2,43],45:[2,43],47:[2,43],49:[2,43]},{22:[1,51]},{22:[1,52]},{22:[1,53]},{28:[1,54]},{22:[2,46],25:57,31:55,33:56,36:61,37:[1,58],38:[1,59],39:[1,60],40:[1,62],42:63,43:64,44:66,45:[1,65],47:[1,30],48:29},{22:[2,37],37:[2,37],38:[2,37],39:[2,37],40:[2,37],45:[2,37],47:[2,37]},{22:[2,38],37:[2,38],38:[2,38],39:[2,38],40:[2,38],45:[2,38],47:[2,38]},{22:[2,39],37:[2,39],38:[2,39],39:[2,39],40:[2,39],45:[2,39],47:[2,39]},{5:[2,11],10:[2,11],17:[2,11],18:[2,11],21:[2,11],23:[2,11],24:[2,11],26:[2,11],27:[2,11],29:[2,11]},{5:[2,12],10:[2,12],17:[2,12],18:[2,12],21:[2,12],23:[2,12],24:[2,12],26:[2,12],27:[2,12],29:[2,12]},{25:67,45:[1,31],48:29},{8:19,9:5,10:[1,10],12:6,14:7,15:8,16:9,17:[1,11],18:[1,12],21:[1,14],23:[1,13],24:[2,3],26:[1,15],27:[1,16],29:[1,17]},{4:68,8:4,9:5,10:[1,10],12:6,14:7,15:8,16:9,17:[1,11],18:[1,12],21:[1,14],23:[1,13],24:[2,5],26:[1,15],27:[1,16],29:[1,17]},{10:[2,26],17:[2,26],18:[2,26],21:[2,26],23:[2,26],24:[2,26],26:[2,26],27:[2,26],29:[2,26]},{5:[2,13],10:[2,13],17:[2,13],18:[2,13],21:[2,13],23:[2,13],24:[2,13],26:[2,13],27:[2,13],29:[2,13]},{10:[2,18]},{20:[2,50],22:[2,50],25:57,28:[2,50],31:70,35:69,36:61,37:[1,58],38:[1,59],39:[1,60],40:[1,62],41:[2,50],42:71,43:64,44:66,45:[1,65],47:[1,30],48:29},{45:[1,72]},{20:[2,40],22:[2,40],28:[2,40],37:[2,40],38:[2,40],39:[2,40],40:[2,40],41:[2,40],45:[2,40],47:[2,40]},{10:[2,20],17:[2,20],18:[2,20],21:[2,20],23:[2,20],24:[2,20],26:[2,20],27:[2,20],29:[2,20]},{10:[2,19],17:[2,19],18:[2,19],21:[2,19],23:[2,19],24:[2,19],26:[2,19],27:[2,19],29:[2,19]},{5:[2,22],10:[2,22],17:[2,22],18:[2,22],21:[2,22],23:[2,22],24:[2,22],26:[2,22],27:[2,22],29:[2,22]},{5:[2,23],10:[2,23],17:[2,23],18:[2,23],21:[2,23],23:[2,23],24:[2,23],26:[2,23],27:[2,23],29:[2,23]},{22:[2,44],32:73,42:74,43:64,44:66,45:[1,75]},{22:[1,76]},{20:[2,29],22:[2,29],28:[2,29],37:[2,29],38:[2,29],39:[2,29],40:[2,29],41:[2,29],45:[2,29],47:[2,29]},{20:[2,30],22:[2,30],28:[2,30],37:[2,30],38:[2,30],39:[2,30],40:[2,30],41:[2,30],45:[2,30],47:[2,30]},{20:[2,31],22:[2,31],28:[2,31],37:[2,31],38:[2,31],39:[2,31],40:[2,31],41:[2,31],45:[2,31],47:[2,31]},{20:[2,32],22:[2,32],28:[2,32],37:[2,32],38:[2,32],39:[2,32],40:[2,32],41:[2,32],45:[2,32],47:[2,32]},{20:[2,33],22:[2,33],28:[2,33],37:[2,33],38:[2,33],39:[2,33],40:[2,33],41:[2,33],45:[2,33],47:[2,33]},{19:77,25:27,36:28,45:[1,31],47:[1,30],48:29},{22:[2,47]},{20:[2,35],22:[2,35],28:[2,35],41:[2,35],44:78,45:[1,75]},{20:[2,43],22:[2,43],28:[2,43],37:[2,43],38:[2,43],39:[2,43],40:[2,43],41:[2,43],45:[2,43],46:[1,79],47:[2,43],49:[2,43]},{20:[2,52],22:[2,52],28:[2,52],41:[2,52],45:[2,52]},{22:[1,80]},{8:19,9:5,10:[1,10],12:6,14:7,15:8,16:9,17:[1,11],18:[1,12],21:[1,14],23:[1,13],24:[2,4],26:[1,15],27:[1,16],29:[1,17]},{20:[2,27],22:[2,27],28:[2,27],41:[2,27]},{20:[2,49],22:[2,49],28:[2,49],37:[2,49],38:[2,49],39:[2,49],40:[2,49],41:[2,49],45:[2,49],47:[2,49]},{20:[2,51],22:[2,51],28:[2,51],41:[2,51]},{20:[2,42],22:[2,42],28:[2,42],37:[2,42],38:[2,42],39:[2,42],40:[2,42],41:[2,42],45:[2,42],47:[2,42],49:[2,42]},{22:[1,81]},{22:[2,45]},{46:[1,79]},{5:[2,25],10:[2,25],17:[2,25],18:[2,25],21:[2,25],23:[2,25],24:[2,25],26:[2,25],27:[2,25],29:[2,25]},{41:[1,82]},{20:[2,53],22:[2,53],28:[2,53],41:[2,53],45:[2,53]},{25:57,31:83,36:61,37:[1,58],38:[1,59],39:[1,60],40:[1,62],45:[1,31],47:[1,30],48:29},{5:[2,21],10:[2,21],17:[2,21],18:[2,21],21:[2,21],23:[2,21],24:[2,21],26:[2,21],27:[2,21],29:[2,21]},{5:[2,24],10:[2,24],17:[2,24],18:[2,24],21:[2,24],23:[2,24],24:[2,24],26:[2,24],27:[2,24],29:[2,24]},{20:[2,34],22:[2,34],28:[2,34],37:[2,34],38:[2,34],39:[2,34],40:[2,34],41:[2,34],45:[2,34],47:[2,34]},{20:[2,36],22:[2,36],28:[2,36],41:[2,36],45:[2,36]}], | ||
defaultActions: {3:[2,2],18:[2,1],47:[2,18],63:[2,47],74:[2,45]}, | ||
parseError: function parseError(str, hash) { | ||
@@ -416,76 +422,98 @@ throw new Error(str); | ||
} | ||
if(yy_.yytext) return 14; | ||
if(yy_.yytext) return 10; | ||
break; | ||
case 1:return 14; | ||
case 1:return 10; | ||
break; | ||
case 2: | ||
this.popState(); | ||
return 14; | ||
return 10; | ||
break; | ||
case 3:strip(0,4); this.popState(); return 15; | ||
case 3: | ||
yy_.yytext = yy_.yytext.substr(5, yy_.yyleng-9); | ||
this.popState(); | ||
return 11; | ||
break; | ||
case 4:return 35; | ||
case 4: return 10; | ||
break; | ||
case 5:return 36; | ||
case 5:strip(0,4); this.popState(); return 17; | ||
break; | ||
case 6:return 25; | ||
case 6:return 40; | ||
break; | ||
case 7:return 16; | ||
case 7:return 41; | ||
break; | ||
case 8:return 20; | ||
case 8: return 18; | ||
break; | ||
case 9:return 19; | ||
case 9: | ||
this.popState(); | ||
this.begin('raw'); | ||
return 20; | ||
break; | ||
case 10:return 19; | ||
case 10: | ||
yy_.yytext = yy_.yytext.substr(4, yy_.yyleng-8); | ||
this.popState(); | ||
return 'RAW_BLOCK'; | ||
break; | ||
case 11:return 23; | ||
case 11:return 29; | ||
break; | ||
case 12:return 22; | ||
case 12:return 21; | ||
break; | ||
case 13:this.popState(); this.begin('com'); | ||
case 13:return 24; | ||
break; | ||
case 14:strip(3,5); this.popState(); return 15; | ||
case 14:return 23; | ||
break; | ||
case 15:return 22; | ||
case 15:return 23; | ||
break; | ||
case 16:return 41; | ||
case 16:return 27; | ||
break; | ||
case 17:return 40; | ||
case 17:return 26; | ||
break; | ||
case 18:return 40; | ||
case 18:this.popState(); this.begin('com'); | ||
break; | ||
case 19:return 44; | ||
case 19:strip(3,5); this.popState(); return 17; | ||
break; | ||
case 20:// ignore whitespace | ||
case 20:return 26; | ||
break; | ||
case 21:this.popState(); return 24; | ||
case 21:return 46; | ||
break; | ||
case 22:this.popState(); return 18; | ||
case 22:return 45; | ||
break; | ||
case 23:yy_.yytext = strip(1,2).replace(/\\"/g,'"'); return 32; | ||
case 23:return 45; | ||
break; | ||
case 24:yy_.yytext = strip(1,2).replace(/\\'/g,"'"); return 32; | ||
case 24:return 49; | ||
break; | ||
case 25:return 42; | ||
case 25:// ignore whitespace | ||
break; | ||
case 26:return 34; | ||
case 26:this.popState(); return 28; | ||
break; | ||
case 27:return 34; | ||
case 27:this.popState(); return 22; | ||
break; | ||
case 28:return 33; | ||
case 28:yy_.yytext = strip(1,2).replace(/\\"/g,'"'); return 37; | ||
break; | ||
case 29:return 40; | ||
case 29:yy_.yytext = strip(1,2).replace(/\\'/g,"'"); return 37; | ||
break; | ||
case 30:yy_.yytext = strip(1,2); return 40; | ||
case 30:return 47; | ||
break; | ||
case 31:return 'INVALID'; | ||
case 31:return 39; | ||
break; | ||
case 32:return 5; | ||
case 32:return 39; | ||
break; | ||
case 33:return 38; | ||
break; | ||
case 34:return 45; | ||
break; | ||
case 35:yy_.yytext = strip(1,2); return 45; | ||
break; | ||
case 36:return 'INVALID'; | ||
break; | ||
case 37:return 5; | ||
break; | ||
} | ||
}; | ||
lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:[\s\S]*?--\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{!--)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{(~)?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:-?[0-9]+(?=([~}\s)])))/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)]))))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/]; | ||
lexer.conditions = {"mu":{"rules":[4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32],"inclusive":false},"emu":{"rules":[2],"inclusive":false},"com":{"rules":[3],"inclusive":false},"INITIAL":{"rules":[0,1,32],"inclusive":true}}; | ||
lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/,/^(?:[^\x00]*?(?=(\{\{\{\{\/)))/,/^(?:[\s\S]*?--\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{\{\{)/,/^(?:\}\}\}\})/,/^(?:\{\{\{\{[^\x00]*\}\}\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{!--)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{(~)?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)]))))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/]; | ||
lexer.conditions = {"mu":{"rules":[6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37],"inclusive":false},"emu":{"rules":[2],"inclusive":false},"com":{"rules":[5],"inclusive":false},"raw":{"rules":[3,4],"inclusive":false},"INITIAL":{"rules":[0,1,37],"inclusive":true}}; | ||
return lexer;})() | ||
@@ -492,0 +520,0 @@ parser.lexer = lexer; |
@@ -89,3 +89,8 @@ define( | ||
var content = this.accept(partial.partialName); | ||
if(partial.context) { content = content + " " + this.accept(partial.context); } | ||
if(partial.context) { | ||
content += " " + this.accept(partial.context); | ||
} | ||
if (partial.hash) { | ||
content += " " + this.accept(partial.hash); | ||
} | ||
return this.pad("{{> " + content + " }}"); | ||
@@ -111,4 +116,4 @@ }; | ||
PrintVisitor.prototype.INTEGER = function(integer) { | ||
return "INTEGER{" + integer.integer + "}"; | ||
PrintVisitor.prototype.NUMBER = function(number) { | ||
return "NUMBER{" + number.number + "}"; | ||
}; | ||
@@ -115,0 +120,0 @@ |
@@ -9,2 +9,3 @@ define( | ||
var REVISION_CHANGES = __dependency3__.REVISION_CHANGES; | ||
var createFrame = __dependency3__.createFrame; | ||
@@ -38,4 +39,10 @@ function checkRevision(compilerInfo) { | ||
// for external users to override these as psuedo-supported APIs. | ||
var invokePartialWrapper = function(partial, name, context, helpers, partials, data) { | ||
var result = env.VM.invokePartial.apply(this, arguments); | ||
env.VM.checkRevision(templateSpec.compiler); | ||
var invokePartialWrapper = function(partial, name, context, hash, helpers, partials, data) { | ||
if (hash) { | ||
context = Utils.extend({}, context, hash); | ||
} | ||
var result = env.VM.invokePartial.call(this, partial, name, context, helpers, partials, data); | ||
if (result != null) { return result; } | ||
@@ -56,12 +63,33 @@ | ||
invokePartial: invokePartialWrapper, | ||
fn: function(i) { | ||
return templateSpec[i]; | ||
}, | ||
programs: [], | ||
program: function(i, fn, data) { | ||
var programWrapper = this.programs[i]; | ||
program: function(i, data) { | ||
var programWrapper = this.programs[i], | ||
fn = this.fn(i); | ||
if(data) { | ||
programWrapper = program(i, fn, data); | ||
programWrapper = program(this, i, fn, data); | ||
} else if (!programWrapper) { | ||
programWrapper = this.programs[i] = program(i, fn); | ||
programWrapper = this.programs[i] = program(this, i, fn); | ||
} | ||
return programWrapper; | ||
}, | ||
programWithDepth: env.VM.programWithDepth, | ||
initData: function(context, data) { | ||
if (!data || !('root' in data)) { | ||
data = data ? createFrame(data) : {}; | ||
data.root = context; | ||
} | ||
return data; | ||
}, | ||
data: function(data, depth) { | ||
while (data && depth--) { | ||
data = data._parent; | ||
} | ||
return data; | ||
}, | ||
merge: function(param, common) { | ||
@@ -71,40 +99,46 @@ var ret = param || common; | ||
if (param && common && (param !== common)) { | ||
ret = {}; | ||
Utils.extend(ret, common); | ||
Utils.extend(ret, param); | ||
ret = Utils.extend({}, common, param); | ||
} | ||
return ret; | ||
}, | ||
programWithDepth: env.VM.programWithDepth, | ||
noop: env.VM.noop, | ||
compilerInfo: null | ||
compilerInfo: templateSpec.compiler | ||
}; | ||
return function(context, options) { | ||
var ret = function(context, options) { | ||
options = options || {}; | ||
var namespace = options.partial ? options : env, | ||
helpers, | ||
partials; | ||
partials, | ||
data = options.data; | ||
if (!options.partial) { | ||
helpers = options.helpers; | ||
partials = options.partials; | ||
} | ||
var result = templateSpec.call( | ||
container, | ||
namespace, context, | ||
helpers, | ||
partials, | ||
options.data); | ||
helpers = container.helpers = container.merge(options.helpers, namespace.helpers); | ||
if (!options.partial) { | ||
env.VM.checkRevision(container.compilerInfo); | ||
if (templateSpec.usePartial) { | ||
partials = container.partials = container.merge(options.partials, namespace.partials); | ||
} | ||
if (templateSpec.useData) { | ||
data = container.initData(context, data); | ||
} | ||
} else { | ||
helpers = container.helpers = options.helpers; | ||
partials = container.partials = options.partials; | ||
} | ||
return templateSpec.main.call(container, context, helpers, partials, data); | ||
}; | ||
return result; | ||
ret.child = function(i) { | ||
return container.programWithDepth(i); | ||
}; | ||
return ret; | ||
} | ||
__exports__.template = template;function programWithDepth(i, fn, data /*, $depth */) { | ||
var args = Array.prototype.slice.call(arguments, 3); | ||
__exports__.template = template;function programWithDepth(i, data /*, $depth */) { | ||
/*jshint -W040 */ | ||
var args = Array.prototype.slice.call(arguments, 2), | ||
container = this, | ||
fn = container.fn(i); | ||
@@ -114,3 +148,3 @@ var prog = function(context, options) { | ||
return fn.apply(this, [context, options.data || data].concat(args)); | ||
return fn.apply(container, [context, container.helpers, container.partials, options.data || data].concat(args)); | ||
}; | ||
@@ -122,7 +156,7 @@ prog.program = i; | ||
__exports__.programWithDepth = programWithDepth;function program(i, fn, data) { | ||
__exports__.programWithDepth = programWithDepth;function program(container, i, fn, data) { | ||
var prog = function(context, options) { | ||
options = options || {}; | ||
return fn(context, options.data || data); | ||
return fn.call(container, context, container.helpers, container.partials, options.data || data); | ||
}; | ||
@@ -129,0 +163,0 @@ prog.program = i; |
@@ -24,8 +24,12 @@ define( | ||
function extend(obj, value) { | ||
for(var key in value) { | ||
if(Object.prototype.hasOwnProperty.call(value, key)) { | ||
obj[key] = value[key]; | ||
function extend(obj /* , ...source */) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
for (var key in arguments[i]) { | ||
if (Object.prototype.hasOwnProperty.call(arguments[i], key)) { | ||
obj[key] = arguments[i][key]; | ||
} | ||
} | ||
} | ||
return obj; | ||
} | ||
@@ -80,3 +84,7 @@ | ||
__exports__.isEmpty = isEmpty; | ||
__exports__.isEmpty = isEmpty;function appendContextPath(contextPath, id) { | ||
return (contextPath ? contextPath + '.' : '') + id; | ||
} | ||
__exports__.appendContextPath = appendContextPath; | ||
}); |
@@ -5,4 +5,4 @@ "use strict"; | ||
var VERSION = "1.3.0"; | ||
exports.VERSION = VERSION;var COMPILER_REVISION = 4; | ||
var VERSION = "v2.0.0-alpha.1"; | ||
exports.VERSION = VERSION;var COMPILER_REVISION = 5; | ||
exports.COMPILER_REVISION = COMPILER_REVISION; | ||
@@ -13,3 +13,4 @@ var REVISION_CHANGES = { | ||
3: '== 1.0.0-rc.4', | ||
4: '>= 1.0.0' | ||
4: '== 1.x.x', | ||
5: '>= 2.0.0' | ||
}; | ||
@@ -44,2 +45,5 @@ exports.REVISION_CHANGES = REVISION_CHANGES; | ||
}, | ||
unregisterHelper: function(name) { | ||
delete this.helpers[name]; | ||
}, | ||
@@ -52,2 +56,5 @@ registerPartial: function(name, str) { | ||
} | ||
}, | ||
unregisterPartial: function(name) { | ||
delete this.partials[name]; | ||
} | ||
@@ -57,7 +64,9 @@ }; | ||
function registerDefaultHelpers(instance) { | ||
instance.registerHelper('helperMissing', function(arg) { | ||
if(arguments.length === 2) { | ||
instance.registerHelper('helperMissing', function(/* [args, ]options */) { | ||
if(arguments.length === 1) { | ||
// A missing field in a {{foo}} constuct. | ||
return undefined; | ||
} else { | ||
throw new Exception("Missing helper: '" + arg + "'"); | ||
// Someone is actually trying to call something, blow up. | ||
throw new Exception("Missing helper: '" + arguments[arguments.length-1].name + "'"); | ||
} | ||
@@ -77,2 +86,6 @@ }); | ||
if(context.length > 0) { | ||
if (options.ids) { | ||
options.ids = [options.name]; | ||
} | ||
return instance.helpers.each(context, options); | ||
@@ -83,3 +96,9 @@ } else { | ||
} else { | ||
return fn(context); | ||
if (options.data && options.ids) { | ||
var data = createFrame(options.data); | ||
data.contextPath = Utils.appendContextPath(options.data.contextPath, options.name); | ||
options = {data: data}; | ||
} | ||
return fn(context, options); | ||
} | ||
@@ -89,5 +108,16 @@ }); | ||
instance.registerHelper('each', function(context, options) { | ||
// Allow for {{#each}} | ||
if (!options) { | ||
options = context; | ||
context = this; | ||
} | ||
var fn = options.fn, inverse = options.inverse; | ||
var i = 0, ret = "", data; | ||
var contextPath; | ||
if (options.data && options.ids) { | ||
contextPath = Utils.appendContextPath(options.data.contextPath, options.ids[0]) + '.'; | ||
} | ||
if (isFunction(context)) { context = context.call(this); } | ||
@@ -106,2 +136,6 @@ | ||
data.last = (i === (context.length-1)); | ||
if (contextPath) { | ||
data.contextPath = contextPath + i; | ||
} | ||
} | ||
@@ -113,6 +147,10 @@ ret = ret + fn(context[i], { data: data }); | ||
if(context.hasOwnProperty(key)) { | ||
if(data) { | ||
data.key = key; | ||
if(data) { | ||
data.key = key; | ||
data.index = i; | ||
data.first = (i === 0); | ||
if (contextPath) { | ||
data.contextPath = contextPath + key; | ||
} | ||
} | ||
@@ -153,3 +191,13 @@ ret = ret + fn(context[key], {data: data}); | ||
if (!Utils.isEmpty(context)) return options.fn(context); | ||
var fn = options.fn; | ||
if (!Utils.isEmpty(context)) { | ||
if (options.data && options.ids) { | ||
var data = createFrame(options.data); | ||
data.contextPath = Utils.appendContextPath(options.data.contextPath, options.ids[0]); | ||
options = {data:data}; | ||
} | ||
return fn(context, options); | ||
} | ||
}); | ||
@@ -161,2 +209,6 @@ | ||
}); | ||
instance.registerHelper('lookup', function(obj, field, options) { | ||
return obj && obj[field]; | ||
}); | ||
} | ||
@@ -188,6 +240,6 @@ | ||
exports.log = log;var createFrame = function(object) { | ||
var obj = {}; | ||
Utils.extend(obj, object); | ||
return obj; | ||
var frame = Utils.extend({}, object); | ||
frame._parent = object; | ||
return frame; | ||
}; | ||
exports.createFrame = createFrame; |
@@ -87,11 +87,11 @@ "use strict"; | ||
// a mustache is an eligible helper if: | ||
// * its id is simple (a single part, not `this` or `..`) | ||
var eligibleHelper = this.eligibleHelper = id.isSimple; | ||
// a mustache is definitely a helper if: | ||
// * it is an eligible helper, and | ||
// * it has at least one parameter or hash segment | ||
this.isHelper = eligibleHelper && (params.length || hash); | ||
this.isHelper = params.length || hash; | ||
// a mustache is an eligible helper if: | ||
// * its id is simple (a single part, not `this` or `..`) | ||
this.eligibleHelper = this.isHelper || id.isSimple; | ||
// if a mustache is an eligible helper but not a definite | ||
@@ -102,3 +102,3 @@ // helper, it is ambiguous, and will be resolved in a later | ||
PartialNode: function(partialName, context, strip, locInfo) { | ||
PartialNode: function(partialName, context, hash, strip, locInfo) { | ||
LocationInfo.call(this, locInfo); | ||
@@ -108,2 +108,3 @@ this.type = "partial"; | ||
this.context = context; | ||
this.hash = hash; | ||
this.strip = strip; | ||
@@ -137,2 +138,16 @@ }, | ||
RawBlockNode: function(mustache, content, close, locInfo) { | ||
LocationInfo.call(this, locInfo); | ||
if (mustache.sexpr.id.original !== close) { | ||
throw new Exception(mustache.sexpr.id.original + " doesn't match " + close, this); | ||
} | ||
content = new AST.ContentNode(content, locInfo); | ||
this.type = 'block'; | ||
this.mustache = mustache; | ||
this.program = new AST.ProgramNode([content], locInfo); | ||
}, | ||
ContentNode: function(string, locInfo) { | ||
@@ -156,3 +171,4 @@ LocationInfo.call(this, locInfo); | ||
dig = [], | ||
depth = 0; | ||
depth = 0, | ||
depthString = ''; | ||
@@ -168,2 +184,3 @@ for(var i=0,l=parts.length; i<l; i++) { | ||
depth++; | ||
depthString += '../'; | ||
} else { | ||
@@ -181,2 +198,3 @@ this.isScoped = true; | ||
this.depth = depth; | ||
this.idName = depthString + this.string; | ||
@@ -200,2 +218,4 @@ // an ID is simple if it only has one part, and that part is not | ||
this.id = id; | ||
this.stringModeValue = id.stringModeValue; | ||
this.idName = '@' + id.stringModeValue; | ||
}, | ||
@@ -211,8 +231,8 @@ | ||
IntegerNode: function(integer, locInfo) { | ||
NumberNode: function(number, locInfo) { | ||
LocationInfo.call(this, locInfo); | ||
this.type = "INTEGER"; | ||
this.type = "NUMBER"; | ||
this.original = | ||
this.integer = integer; | ||
this.stringModeValue = Number(integer); | ||
this.number = number; | ||
this.stringModeValue = Number(number); | ||
}, | ||
@@ -219,0 +239,0 @@ |
@@ -77,2 +77,4 @@ "use strict"; | ||
this.options = options; | ||
this.stringParams = options.stringParams; | ||
this.trackIds = options.trackIds; | ||
@@ -88,3 +90,4 @@ // These changes will propagate to the other compiler components | ||
'with': true, | ||
'log': true | ||
'log': true, | ||
'lookup': true | ||
}; | ||
@@ -175,3 +178,3 @@ if (knownHelpers) { | ||
this.opcode('emptyHash'); | ||
this.opcode('blockValue'); | ||
this.opcode('blockValue', sexpr.id.original); | ||
} else { | ||
@@ -192,3 +195,3 @@ this.ambiguousSexpr(sexpr, program, inverse); | ||
hash: function(hash) { | ||
var pairs = hash.pairs, pair, val; | ||
var pairs = hash.pairs, pair; | ||
@@ -199,20 +202,4 @@ this.opcode('pushHash'); | ||
pair = pairs[i]; | ||
val = pair[1]; | ||
if (this.options.stringParams) { | ||
if(val.depth) { | ||
this.addDepth(val.depth); | ||
} | ||
this.opcode('getContext', val.depth || 0); | ||
this.opcode('pushStringParam', val.stringModeValue, val.type); | ||
if (val.type === 'sexpr') { | ||
// Subexpressions get evaluated and passed in | ||
// in string params mode. | ||
this.sexpr(val); | ||
} | ||
} else { | ||
this.accept(val); | ||
} | ||
this.pushParam(pair[1]); | ||
this.opcode('assignToHash', pair[0]); | ||
@@ -227,5 +214,11 @@ } | ||
if(partial.context) { | ||
this.ID(partial.context); | ||
if (partial.hash) { | ||
this.accept(partial.hash); | ||
} else { | ||
this.opcode('push', 'undefined'); | ||
} | ||
if (partial.context) { | ||
this.accept(partial.context); | ||
} else { | ||
this.opcode('push', 'depth0'); | ||
@@ -284,3 +277,4 @@ } | ||
var params = this.setupFullMustacheParams(sexpr, program, inverse), | ||
name = sexpr.id.parts[0]; | ||
id = sexpr.id, | ||
name = id.parts[0]; | ||
@@ -292,2 +286,3 @@ if (this.options.knownHelpers[name]) { | ||
} else { | ||
this.ID(id); | ||
this.opcode('invokeHelper', params.length, name, sexpr.isRoot); | ||
@@ -327,7 +322,3 @@ } | ||
this.options.data = true; | ||
if (data.id.isScoped || data.id.depth) { | ||
throw new Exception('Scoped data references are not supported: ' + data.original, data); | ||
} | ||
this.opcode('lookupData'); | ||
this.opcode('lookupData', data.id.depth); | ||
var parts = data.id.parts; | ||
@@ -343,4 +334,4 @@ for(var i=0, l=parts.length; i<l; i++) { | ||
INTEGER: function(integer) { | ||
this.opcode('pushLiteral', integer.integer); | ||
NUMBER: function(number) { | ||
this.opcode('pushLiteral', number.number); | ||
}, | ||
@@ -378,2 +369,3 @@ | ||
// if ambiguous, we can possibly resolve the ambiguity now | ||
// An eligible helper is one that does not have a complex path, i.e. `this.foo`, `../foo` etc. | ||
if (isEligible && !isHelper) { | ||
@@ -395,23 +387,27 @@ var name = sexpr.id.parts[0]; | ||
pushParams: function(params) { | ||
var i = params.length, param; | ||
var i = params.length; | ||
while(i--) { | ||
param = params[i]; | ||
this.pushParam(params[i]); | ||
} | ||
}, | ||
if(this.options.stringParams) { | ||
if(param.depth) { | ||
this.addDepth(param.depth); | ||
} | ||
pushParam: function(val) { | ||
if (this.stringParams) { | ||
if(val.depth) { | ||
this.addDepth(val.depth); | ||
} | ||
this.opcode('getContext', val.depth || 0); | ||
this.opcode('pushStringParam', val.stringModeValue, val.type); | ||
this.opcode('getContext', param.depth || 0); | ||
this.opcode('pushStringParam', param.stringModeValue, param.type); | ||
if (param.type === 'sexpr') { | ||
// Subexpressions get evaluated and passed in | ||
// in string params mode. | ||
this.sexpr(param); | ||
} | ||
} else { | ||
this[param.type](param); | ||
if (val.type === 'sexpr') { | ||
// Subexpressions get evaluated and passed in | ||
// in string params mode. | ||
this.sexpr(val); | ||
} | ||
} else { | ||
if (this.trackIds) { | ||
this.opcode('pushId', val.type, val.idName || val.stringModeValue); | ||
} | ||
this.accept(val); | ||
} | ||
@@ -473,3 +469,3 @@ }, | ||
// Template is only compiled on first use and cached after that point. | ||
return function(context, options) { | ||
var ret = function(context, options) { | ||
if (!compiled) { | ||
@@ -480,4 +476,11 @@ compiled = compileInput(); | ||
}; | ||
ret.child = function(i) { | ||
if (!compiled) { | ||
compiled = compileInput(); | ||
} | ||
return compiled.child(i); | ||
}; | ||
return ret; | ||
} | ||
exports.compile = compile; |
@@ -23,8 +23,5 @@ "use strict"; | ||
if (/^[0-9]+$/.test(name)) { | ||
ret = parent + "[" + name + "]"; | ||
} else if (JavaScriptCompiler.isValidJavaScriptVariableName(name)) { | ||
if (JavaScriptCompiler.isValidJavaScriptVariableName(name)) { | ||
ret = parent + "." + name; | ||
} | ||
else { | ||
} else { | ||
ret = parent + "['" + name + "']"; | ||
@@ -43,3 +40,3 @@ } | ||
versions = REVISION_CHANGES[revision]; | ||
return "this.compilerInfo = ["+revision+",'"+versions+"'];\n"; | ||
return [revision, versions]; | ||
}, | ||
@@ -69,2 +66,5 @@ | ||
this.options = options || {}; | ||
this.stringParams = this.options.stringParams; | ||
this.trackIds = this.options.trackIds; | ||
this.precompile = !asObject; | ||
@@ -77,4 +77,3 @@ log('debug', this.environment.disassemble() + "\n\n"); | ||
programs: [], | ||
environments: [], | ||
aliases: { } | ||
environments: [] | ||
}; | ||
@@ -86,2 +85,3 @@ | ||
this.stackVars = []; | ||
this.aliases = {}; | ||
this.registers = { list: [] }; | ||
@@ -120,62 +120,56 @@ this.hashes = []; | ||
return this.createFunctionContext(asObject); | ||
}, | ||
var fn = this.createFunctionContext(asObject); | ||
if (!this.isChild) { | ||
var ret = { | ||
compiler: this.compilerInfo(), | ||
main: fn | ||
}; | ||
this.context.programs.map(function(program, index) { | ||
if (program) { | ||
ret[index] = program; | ||
} | ||
}); | ||
preamble: function() { | ||
var out = []; | ||
if (this.environment.usePartial) { | ||
ret.usePartial = true; | ||
} | ||
if (this.options.data) { | ||
ret.useData = true; | ||
} | ||
if (!this.isChild) { | ||
var namespace = this.namespace; | ||
if (!asObject) { | ||
ret.compiler = JSON.stringify(ret.compiler); | ||
ret = this.objectLiteral(ret); | ||
} | ||
var copies = "helpers = this.merge(helpers, " + namespace + ".helpers);"; | ||
if (this.environment.usePartial) { copies = copies + " partials = this.merge(partials, " + namespace + ".partials);"; } | ||
if (this.options.data) { copies = copies + " data = data || {};"; } | ||
out.push(copies); | ||
return ret; | ||
} else { | ||
out.push(''); | ||
return fn; | ||
} | ||
}, | ||
if (!this.environment.isSimple) { | ||
out.push(", buffer = " + this.initializeBuffer()); | ||
} else { | ||
out.push(""); | ||
} | ||
preamble: function() { | ||
// track the last context pushed into place to allow skipping the | ||
// getContext opcode when it would be a noop | ||
this.lastContext = 0; | ||
this.source = out; | ||
this.source = []; | ||
}, | ||
createFunctionContext: function(asObject) { | ||
var varDeclarations = ''; | ||
var locals = this.stackVars.concat(this.registers.list); | ||
if(locals.length > 0) { | ||
this.source[1] = this.source[1] + ", " + locals.join(", "); | ||
varDeclarations += ", " + locals.join(", "); | ||
} | ||
// Generate minimizer alias mappings | ||
if (!this.isChild) { | ||
for (var alias in this.context.aliases) { | ||
if (this.context.aliases.hasOwnProperty(alias)) { | ||
this.source[1] = this.source[1] + ', ' + alias + '=' + this.context.aliases[alias]; | ||
} | ||
for (var alias in this.aliases) { | ||
if (this.aliases.hasOwnProperty(alias)) { | ||
varDeclarations += ', ' + alias + '=' + this.aliases[alias]; | ||
} | ||
} | ||
if (this.source[1]) { | ||
this.source[1] = "var " + this.source[1].substring(2) + ";"; | ||
} | ||
var params = ["depth0", "helpers", "partials", "data"]; | ||
// Merge children | ||
if (!this.isChild) { | ||
this.source[1] += '\n' + this.context.programs.join('\n') + '\n'; | ||
} | ||
if (!this.environment.isSimple) { | ||
this.pushSource("return buffer;"); | ||
} | ||
var params = this.isChild ? ["depth0", "data"] : ["Handlebars", "depth0", "helpers", "partials", "data"]; | ||
for(var i=0, l=this.environment.depths.list.length; i<l; i++) { | ||
@@ -186,8 +180,4 @@ params.push("depth" + this.environment.depths.list[i]); | ||
// Perform a second pass over the output to merge content when possible | ||
var source = this.mergeSource(); | ||
var source = this.mergeSource(varDeclarations); | ||
if (!this.isChild) { | ||
source = this.compilerInfo()+source; | ||
} | ||
if (asObject) { | ||
@@ -198,12 +188,11 @@ params.push(source); | ||
} else { | ||
var functionSource = 'function ' + (this.name || '') + '(' + params.join(',') + ') {\n ' + source + '}'; | ||
log('debug', functionSource + "\n\n"); | ||
return functionSource; | ||
return 'function(' + params.join(',') + ') {\n ' + source + '}'; | ||
} | ||
}, | ||
mergeSource: function() { | ||
// WARN: We are not handling the case where buffer is still populated as the source should | ||
// not have buffer append operations as their final action. | ||
mergeSource: function(varDeclarations) { | ||
var source = '', | ||
buffer; | ||
buffer, | ||
appendOnly = !this.forceBuffer, | ||
appendFirst; | ||
for (var i = 0, len = this.source.length; i < len; i++) { | ||
@@ -219,8 +208,35 @@ var line = this.source[i]; | ||
if (buffer) { | ||
source += 'buffer += ' + buffer + ';\n '; | ||
if (!source) { | ||
appendFirst = true; | ||
source = buffer + ';\n '; | ||
} else { | ||
source += 'buffer += ' + buffer + ';\n '; | ||
} | ||
buffer = undefined; | ||
} | ||
source += line + '\n '; | ||
if (!this.environment.isSimple) { | ||
appendOnly = false; | ||
} | ||
} | ||
} | ||
if (appendOnly) { | ||
if (buffer || !source) { | ||
source += 'return ' + (buffer || '""') + ';\n'; | ||
} | ||
} else { | ||
varDeclarations += ", buffer = " + (appendFirst ? '' : this.initializeBuffer()); | ||
if (buffer) { | ||
source += 'return buffer + ' + buffer + ';\n'; | ||
} else { | ||
source += 'return buffer;\n'; | ||
} | ||
} | ||
if (varDeclarations) { | ||
source = 'var ' + varDeclarations.substring(2) + (appendFirst ? '' : ';\n ') + source; | ||
} | ||
return source; | ||
@@ -235,10 +251,10 @@ }, | ||
// The purpose of this opcode is to take a block of the form | ||
// `{{#foo}}...{{/foo}}`, resolve the value of `foo`, and | ||
// `{{#this.foo}}...{{/this.foo}}`, resolve the value of `foo`, and | ||
// replace it on the stack with the result of properly | ||
// invoking blockHelperMissing. | ||
blockValue: function() { | ||
this.context.aliases.blockHelperMissing = 'helpers.blockHelperMissing'; | ||
blockValue: function(name) { | ||
this.aliases.blockHelperMissing = 'helpers.blockHelperMissing'; | ||
var params = ["depth0"]; | ||
this.setupParams(0, params); | ||
this.setupParams(name, 0, params); | ||
@@ -258,7 +274,10 @@ this.replaceStack(function(current) { | ||
ambiguousBlockValue: function() { | ||
this.context.aliases.blockHelperMissing = 'helpers.blockHelperMissing'; | ||
this.aliases.blockHelperMissing = 'helpers.blockHelperMissing'; | ||
// We're being a bit cheeky and reusing the options value from the prior exec | ||
var params = ["depth0"]; | ||
this.setupParams(0, params); | ||
this.setupParams('', 0, params, true); | ||
this.flushInline(); | ||
var current = this.topStack(); | ||
@@ -328,3 +347,3 @@ params.splice(1, 0, current); | ||
appendEscaped: function() { | ||
this.context.aliases.escapeExpression = 'this.escapeExpression'; | ||
this.aliases.escapeExpression = 'this.escapeExpression'; | ||
@@ -376,3 +395,3 @@ this.pushSource(this.appendToBuffer("escapeExpression(" + this.popStack() + ")")); | ||
resolvePossibleLambda: function() { | ||
this.context.aliases.functionType = '"function"'; | ||
this.aliases.functionType = '"function"'; | ||
@@ -403,4 +422,8 @@ this.replaceStack(function(current) { | ||
// Push the data lookup operator | ||
lookupData: function() { | ||
this.pushStackLiteral('data'); | ||
lookupData: function(depth) { | ||
if (!depth) { | ||
this.pushStackLiteral('data'); | ||
} else { | ||
this.pushStackLiteral('this.data(data, ' + depth + ')'); | ||
} | ||
}, | ||
@@ -435,3 +458,6 @@ | ||
if (this.options.stringParams) { | ||
if (this.trackIds) { | ||
this.push('{}'); // hashIds | ||
} | ||
if (this.stringParams) { | ||
this.push('{}'); // hashContexts | ||
@@ -445,3 +471,3 @@ this.push('{}'); // hashTypes | ||
} | ||
this.hash = {values: [], types: [], contexts: []}; | ||
this.hash = {values: [], types: [], contexts: [], ids: []}; | ||
}, | ||
@@ -452,3 +478,6 @@ popHash: function() { | ||
if (this.options.stringParams) { | ||
if (this.trackIds) { | ||
this.push('{' + hash.ids.join(',') + '}'); | ||
} | ||
if (this.stringParams) { | ||
this.push('{' + hash.contexts.join(',') + '}'); | ||
@@ -520,9 +549,9 @@ this.push('{' + hash.types.join(',') + '}'); | ||
invokeHelper: function(paramSize, name, isRoot) { | ||
this.context.aliases.helperMissing = 'helpers.helperMissing'; | ||
this.aliases.helperMissing = 'helpers.helperMissing'; | ||
this.useRegister('helper'); | ||
var helper = this.lastHelper = this.setupHelper(paramSize, name, true); | ||
var nonHelper = this.nameLookup('depth' + this.lastContext, name, 'context'); | ||
var nonHelper = this.popStack(); | ||
var helper = this.setupHelper(paramSize, name); | ||
var lookup = 'helper = ' + helper.name + ' || ' + nonHelper; | ||
var lookup = 'helper = ' + helper.name + ' || ' + nonHelper + ' || helperMissing'; | ||
if (helper.paramsInit) { | ||
@@ -532,8 +561,3 @@ lookup += ',' + helper.paramsInit; | ||
this.push( | ||
'(' | ||
+ lookup | ||
+ ',helper ' | ||
+ '? helper.call(' + helper.callParams + ') ' | ||
+ ': helperMissing.call(' + helper.helperMissingParams + '))'); | ||
this.push('(' + lookup + ',helper.call(' + helper.callParams + '))'); | ||
@@ -573,3 +597,3 @@ // Always flush subexpressions. This is both to prevent the compounding size issue that | ||
invokeAmbiguous: function(name, helperCall) { | ||
this.context.aliases.functionType = '"function"'; | ||
this.aliases.functionType = '"function"'; | ||
this.useRegister('helper'); | ||
@@ -581,11 +605,8 @@ | ||
var helperName = this.lastHelper = this.nameLookup('helpers', name, 'helper'); | ||
var nonHelper = this.nameLookup('depth' + this.lastContext, name, 'context'); | ||
var nextStack = this.nextStack(); | ||
if (helper.paramsInit) { | ||
this.pushSource(helper.paramsInit); | ||
} | ||
this.pushSource('if (helper = ' + helperName + ') { ' + nextStack + ' = helper.call(' + helper.callParams + '); }'); | ||
this.pushSource('else { helper = ' + nonHelper + '; ' + nextStack + ' = typeof helper === functionType ? helper.call(' + helper.callParams + ') : helper; }'); | ||
this.push( | ||
'((helper = ' + helperName + ' || ' + nonHelper | ||
+ (helper.paramsInit ? '),(' + helper.paramsInit : '') + '),' | ||
+ '(typeof helper === functionType ? helper.call(' + helper.callParams + ') : helper))'); | ||
}, | ||
@@ -601,3 +622,3 @@ | ||
invokePartial: function(name) { | ||
var params = [this.nameLookup('partials', name, 'partial'), "'" + name + "'", this.popStack(), "helpers", "partials"]; | ||
var params = [this.nameLookup('partials', name, 'partial'), "'" + name + "'", this.popStack(), this.popStack(), "helpers", "partials"]; | ||
@@ -608,4 +629,3 @@ if (this.options.data) { | ||
this.context.aliases.self = "this"; | ||
this.push("self.invokePartial(" + params.join(", ") + ")"); | ||
this.push("this.invokePartial(" + params.join(", ") + ")"); | ||
}, | ||
@@ -623,5 +643,9 @@ | ||
context, | ||
type; | ||
type, | ||
id; | ||
if (this.options.stringParams) { | ||
if (this.trackIds) { | ||
id = this.popStack(); | ||
} | ||
if (this.stringParams) { | ||
type = this.popStack(); | ||
@@ -638,5 +662,18 @@ context = this.popStack(); | ||
} | ||
if (id) { | ||
hash.ids.push("'" + key + "': " + id); | ||
} | ||
hash.values.push("'" + key + "': (" + value + ")"); | ||
}, | ||
pushId: function(type, name) { | ||
if (type === 'ID' || type === 'DATA') { | ||
this.pushString(name); | ||
} else if (type === 'sexpr') { | ||
this.pushStackLiteral('true'); | ||
} else { | ||
this.pushStackLiteral('null'); | ||
} | ||
}, | ||
// HELPERS | ||
@@ -660,3 +697,3 @@ | ||
child.name = 'program' + index; | ||
this.context.programs[index] = compiler.compile(child, options, this.context); | ||
this.context.programs[index] = compiler.compile(child, options, this.context, !this.precompile); | ||
this.context.environments[index] = child; | ||
@@ -679,6 +716,4 @@ } else { | ||
programExpression: function(guid) { | ||
this.context.aliases.self = "this"; | ||
if(guid == null) { | ||
return "self.noop"; | ||
return 'this.noop'; | ||
} | ||
@@ -689,3 +724,3 @@ | ||
var programParams = [child.index, child.name, "data"]; | ||
var programParams = [child.index, 'data']; | ||
@@ -695,7 +730,6 @@ for(var i=0, l = depths.length; i<l; i++) { | ||
if(depth === 1) { programParams.push("depth0"); } | ||
else { programParams.push("depth" + (depth - 1)); } | ||
programParams.push('depth' + (depth - 1)); | ||
} | ||
return (depths.length === 0 ? "self.program(" : "self.programWithDepth(") + programParams.join(", ") + ")"; | ||
return (depths.length === 0 ? 'this.program(' : 'this.programWithDepth(') + programParams.join(', ') + ')'; | ||
}, | ||
@@ -858,5 +892,17 @@ | ||
setupHelper: function(paramSize, name, missingParams) { | ||
objectLiteral: function(obj) { | ||
var pairs = []; | ||
for (var key in obj) { | ||
if (obj.hasOwnProperty(key)) { | ||
pairs.push(this.quotedString(key) + ':' + obj[key]); | ||
} | ||
} | ||
return '{' + pairs.join(',') + '}'; | ||
}, | ||
setupHelper: function(paramSize, name, blockHelper) { | ||
var params = [], | ||
paramsInit = this.setupParams(paramSize, params, missingParams); | ||
paramsInit = this.setupParams(name, paramSize, params, blockHelper); | ||
var foundHelper = this.nameLookup('helpers', name, 'helper'); | ||
@@ -868,16 +914,19 @@ | ||
name: foundHelper, | ||
callParams: ["depth0"].concat(params).join(", "), | ||
helperMissingParams: missingParams && ["depth0", this.quotedString(name)].concat(params).join(", ") | ||
callParams: ["depth0"].concat(params).join(", ") | ||
}; | ||
}, | ||
setupOptions: function(paramSize, params) { | ||
var options = [], contexts = [], types = [], param, inverse, program; | ||
setupOptions: function(helper, paramSize, params) { | ||
var options = {}, contexts = [], types = [], ids = [], param, inverse, program; | ||
options.push("hash:" + this.popStack()); | ||
options.name = this.quotedString(helper); | ||
options.hash = this.popStack(); | ||
if (this.options.stringParams) { | ||
options.push("hashTypes:" + this.popStack()); | ||
options.push("hashContexts:" + this.popStack()); | ||
if (this.trackIds) { | ||
options.hashIds = this.popStack(); | ||
} | ||
if (this.stringParams) { | ||
options.hashTypes = this.popStack(); | ||
options.hashContexts = this.popStack(); | ||
} | ||
@@ -891,20 +940,21 @@ inverse = this.popStack(); | ||
if (!program) { | ||
this.context.aliases.self = "this"; | ||
program = "self.noop"; | ||
program = 'this.noop'; | ||
} | ||
if (!inverse) { | ||
this.context.aliases.self = "this"; | ||
inverse = "self.noop"; | ||
inverse = 'this.noop'; | ||
} | ||
options.push("inverse:" + inverse); | ||
options.push("fn:" + program); | ||
options.fn = program; | ||
options.inverse = inverse; | ||
} | ||
for(var i=0; i<paramSize; i++) { | ||
for (var i = 0; i < paramSize; i++) { | ||
param = this.popStack(); | ||
params.push(param); | ||
if(this.options.stringParams) { | ||
if (this.trackIds) { | ||
ids.push(this.popStack()); | ||
} | ||
if (this.stringParams) { | ||
types.push(this.popStack()); | ||
@@ -915,9 +965,12 @@ contexts.push(this.popStack()); | ||
if (this.options.stringParams) { | ||
options.push("contexts:[" + contexts.join(",") + "]"); | ||
options.push("types:[" + types.join(",") + "]"); | ||
if (this.trackIds) { | ||
options.ids = "[" + ids.join(",") + "]"; | ||
} | ||
if (this.stringParams) { | ||
options.types = "[" + types.join(",") + "]"; | ||
options.contexts = "[" + contexts.join(",") + "]"; | ||
} | ||
if(this.options.data) { | ||
options.push("data:data"); | ||
if (this.options.data) { | ||
options.data = "data"; | ||
} | ||
@@ -930,4 +983,4 @@ | ||
// to fill in | ||
setupParams: function(paramSize, params, useRegister) { | ||
var options = '{' + this.setupOptions(paramSize, params).join(',') + '}'; | ||
setupParams: function(helperName, paramSize, params, useRegister) { | ||
var options = this.objectLiteral(this.setupOptions(helperName, paramSize, params)); | ||
@@ -970,8 +1023,5 @@ if (useRegister) { | ||
JavaScriptCompiler.isValidJavaScriptVariableName = function(name) { | ||
if(!JavaScriptCompiler.RESERVED_WORDS[name] && /^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(name)) { | ||
return true; | ||
} | ||
return false; | ||
return !JavaScriptCompiler.RESERVED_WORDS[name] && /^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(name); | ||
}; | ||
exports["default"] = JavaScriptCompiler; |
@@ -7,5 +7,5 @@ "use strict"; | ||
yy: {}, | ||
symbols_: {"error":2,"root":3,"statements":4,"EOF":5,"program":6,"simpleInverse":7,"statement":8,"openInverse":9,"closeBlock":10,"openBlock":11,"mustache":12,"partial":13,"CONTENT":14,"COMMENT":15,"OPEN_BLOCK":16,"sexpr":17,"CLOSE":18,"OPEN_INVERSE":19,"OPEN_ENDBLOCK":20,"path":21,"OPEN":22,"OPEN_UNESCAPED":23,"CLOSE_UNESCAPED":24,"OPEN_PARTIAL":25,"partialName":26,"partial_option0":27,"sexpr_repetition0":28,"sexpr_option0":29,"dataName":30,"param":31,"STRING":32,"INTEGER":33,"BOOLEAN":34,"OPEN_SEXPR":35,"CLOSE_SEXPR":36,"hash":37,"hash_repetition_plus0":38,"hashSegment":39,"ID":40,"EQUALS":41,"DATA":42,"pathSegments":43,"SEP":44,"$accept":0,"$end":1}, | ||
terminals_: {2:"error",5:"EOF",14:"CONTENT",15:"COMMENT",16:"OPEN_BLOCK",18:"CLOSE",19:"OPEN_INVERSE",20:"OPEN_ENDBLOCK",22:"OPEN",23:"OPEN_UNESCAPED",24:"CLOSE_UNESCAPED",25:"OPEN_PARTIAL",32:"STRING",33:"INTEGER",34:"BOOLEAN",35:"OPEN_SEXPR",36:"CLOSE_SEXPR",40:"ID",41:"EQUALS",42:"DATA",44:"SEP"}, | ||
productions_: [0,[3,2],[3,1],[6,2],[6,3],[6,2],[6,1],[6,1],[6,0],[4,1],[4,2],[8,3],[8,3],[8,1],[8,1],[8,1],[8,1],[11,3],[9,3],[10,3],[12,3],[12,3],[13,4],[7,2],[17,3],[17,1],[31,1],[31,1],[31,1],[31,1],[31,1],[31,3],[37,1],[39,3],[26,1],[26,1],[26,1],[30,2],[21,1],[43,3],[43,1],[27,0],[27,1],[28,0],[28,2],[29,0],[29,1],[38,1],[38,2]], | ||
symbols_: {"error":2,"root":3,"statements":4,"EOF":5,"program":6,"simpleInverse":7,"statement":8,"openRawBlock":9,"CONTENT":10,"END_RAW_BLOCK":11,"openInverse":12,"closeBlock":13,"openBlock":14,"mustache":15,"partial":16,"COMMENT":17,"OPEN_RAW_BLOCK":18,"sexpr":19,"CLOSE_RAW_BLOCK":20,"OPEN_BLOCK":21,"CLOSE":22,"OPEN_INVERSE":23,"OPEN_ENDBLOCK":24,"path":25,"OPEN":26,"OPEN_UNESCAPED":27,"CLOSE_UNESCAPED":28,"OPEN_PARTIAL":29,"partialName":30,"param":31,"partial_option0":32,"partial_option1":33,"sexpr_repetition0":34,"sexpr_option0":35,"dataName":36,"STRING":37,"NUMBER":38,"BOOLEAN":39,"OPEN_SEXPR":40,"CLOSE_SEXPR":41,"hash":42,"hash_repetition_plus0":43,"hashSegment":44,"ID":45,"EQUALS":46,"DATA":47,"pathSegments":48,"SEP":49,"$accept":0,"$end":1}, | ||
terminals_: {2:"error",5:"EOF",10:"CONTENT",11:"END_RAW_BLOCK",17:"COMMENT",18:"OPEN_RAW_BLOCK",20:"CLOSE_RAW_BLOCK",21:"OPEN_BLOCK",22:"CLOSE",23:"OPEN_INVERSE",24:"OPEN_ENDBLOCK",26:"OPEN",27:"OPEN_UNESCAPED",28:"CLOSE_UNESCAPED",29:"OPEN_PARTIAL",37:"STRING",38:"NUMBER",39:"BOOLEAN",40:"OPEN_SEXPR",41:"CLOSE_SEXPR",45:"ID",46:"EQUALS",47:"DATA",49:"SEP"}, | ||
productions_: [0,[3,2],[3,1],[6,2],[6,3],[6,2],[6,1],[6,1],[6,0],[4,1],[4,2],[8,3],[8,3],[8,3],[8,1],[8,1],[8,1],[8,1],[9,3],[14,3],[12,3],[13,3],[15,3],[15,3],[16,5],[16,4],[7,2],[19,3],[19,1],[31,1],[31,1],[31,1],[31,1],[31,1],[31,3],[42,1],[44,3],[30,1],[30,1],[30,1],[36,2],[25,1],[48,3],[48,1],[32,0],[32,1],[33,0],[33,1],[34,0],[34,2],[35,0],[35,1],[43,1],[43,2]], | ||
performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) { | ||
@@ -35,74 +35,80 @@ | ||
break; | ||
case 11:this.$ = new yy.BlockNode($$[$0-2], $$[$0-1].inverse, $$[$0-1], $$[$0], this._$); | ||
case 11:this.$ = new yy.RawBlockNode($$[$0-2], $$[$0-1], $$[$0], this._$); | ||
break; | ||
case 12:this.$ = new yy.BlockNode($$[$0-2], $$[$0-1], $$[$0-1].inverse, $$[$0], this._$); | ||
case 12:this.$ = new yy.BlockNode($$[$0-2], $$[$0-1].inverse, $$[$0-1], $$[$0], this._$); | ||
break; | ||
case 13:this.$ = $$[$0]; | ||
case 13:this.$ = new yy.BlockNode($$[$0-2], $$[$0-1], $$[$0-1].inverse, $$[$0], this._$); | ||
break; | ||
case 14:this.$ = $$[$0]; | ||
break; | ||
case 15:this.$ = new yy.ContentNode($$[$0], this._$); | ||
case 15:this.$ = $$[$0]; | ||
break; | ||
case 16:this.$ = new yy.CommentNode($$[$0], this._$); | ||
case 16:this.$ = new yy.ContentNode($$[$0], this._$); | ||
break; | ||
case 17:this.$ = new yy.MustacheNode($$[$0-1], null, $$[$0-2], stripFlags($$[$0-2], $$[$0]), this._$); | ||
case 17:this.$ = new yy.CommentNode($$[$0], this._$); | ||
break; | ||
case 18:this.$ = new yy.MustacheNode($$[$0-1], null, $$[$0-2], stripFlags($$[$0-2], $$[$0]), this._$); | ||
case 18:this.$ = new yy.MustacheNode($$[$0-1], null, '', '', this._$); | ||
break; | ||
case 19:this.$ = {path: $$[$0-1], strip: stripFlags($$[$0-2], $$[$0])}; | ||
case 19:this.$ = new yy.MustacheNode($$[$0-1], null, $$[$0-2], stripFlags($$[$0-2], $$[$0]), this._$); | ||
break; | ||
case 20:this.$ = new yy.MustacheNode($$[$0-1], null, $$[$0-2], stripFlags($$[$0-2], $$[$0]), this._$); | ||
break; | ||
case 21:this.$ = new yy.MustacheNode($$[$0-1], null, $$[$0-2], stripFlags($$[$0-2], $$[$0]), this._$); | ||
case 21:this.$ = {path: $$[$0-1], strip: stripFlags($$[$0-2], $$[$0])}; | ||
break; | ||
case 22:this.$ = new yy.PartialNode($$[$0-2], $$[$0-1], stripFlags($$[$0-3], $$[$0]), this._$); | ||
case 22:this.$ = new yy.MustacheNode($$[$0-1], null, $$[$0-2], stripFlags($$[$0-2], $$[$0]), this._$); | ||
break; | ||
case 23:this.$ = stripFlags($$[$0-1], $$[$0]); | ||
case 23:this.$ = new yy.MustacheNode($$[$0-1], null, $$[$0-2], stripFlags($$[$0-2], $$[$0]), this._$); | ||
break; | ||
case 24:this.$ = new yy.SexprNode([$$[$0-2]].concat($$[$0-1]), $$[$0], this._$); | ||
case 24:this.$ = new yy.PartialNode($$[$0-3], $$[$0-2], $$[$0-1], stripFlags($$[$0-4], $$[$0]), this._$); | ||
break; | ||
case 25:this.$ = new yy.SexprNode([$$[$0]], null, this._$); | ||
case 25:this.$ = new yy.PartialNode($$[$0-2], undefined, $$[$0-1], stripFlags($$[$0-3], $$[$0]), this._$); | ||
break; | ||
case 26:this.$ = $$[$0]; | ||
case 26:this.$ = stripFlags($$[$0-1], $$[$0]); | ||
break; | ||
case 27:this.$ = new yy.StringNode($$[$0], this._$); | ||
case 27:this.$ = new yy.SexprNode([$$[$0-2]].concat($$[$0-1]), $$[$0], this._$); | ||
break; | ||
case 28:this.$ = new yy.IntegerNode($$[$0], this._$); | ||
case 28:this.$ = new yy.SexprNode([$$[$0]], null, this._$); | ||
break; | ||
case 29:this.$ = new yy.BooleanNode($$[$0], this._$); | ||
case 29:this.$ = $$[$0]; | ||
break; | ||
case 30:this.$ = $$[$0]; | ||
case 30:this.$ = new yy.StringNode($$[$0], this._$); | ||
break; | ||
case 31:$$[$0-1].isHelper = true; this.$ = $$[$0-1]; | ||
case 31:this.$ = new yy.NumberNode($$[$0], this._$); | ||
break; | ||
case 32:this.$ = new yy.HashNode($$[$0], this._$); | ||
case 32:this.$ = new yy.BooleanNode($$[$0], this._$); | ||
break; | ||
case 33:this.$ = [$$[$0-2], $$[$0]]; | ||
case 33:this.$ = $$[$0]; | ||
break; | ||
case 34:this.$ = new yy.PartialNameNode($$[$0], this._$); | ||
case 34:$$[$0-1].isHelper = true; this.$ = $$[$0-1]; | ||
break; | ||
case 35:this.$ = new yy.PartialNameNode(new yy.StringNode($$[$0], this._$), this._$); | ||
case 35:this.$ = new yy.HashNode($$[$0], this._$); | ||
break; | ||
case 36:this.$ = new yy.PartialNameNode(new yy.IntegerNode($$[$0], this._$)); | ||
case 36:this.$ = [$$[$0-2], $$[$0]]; | ||
break; | ||
case 37:this.$ = new yy.DataNode($$[$0], this._$); | ||
case 37:this.$ = new yy.PartialNameNode($$[$0], this._$); | ||
break; | ||
case 38:this.$ = new yy.IdNode($$[$0], this._$); | ||
case 38:this.$ = new yy.PartialNameNode(new yy.StringNode($$[$0], this._$), this._$); | ||
break; | ||
case 39: $$[$0-2].push({part: $$[$0], separator: $$[$0-1]}); this.$ = $$[$0-2]; | ||
case 39:this.$ = new yy.PartialNameNode(new yy.NumberNode($$[$0], this._$)); | ||
break; | ||
case 40:this.$ = [{part: $$[$0]}]; | ||
case 40:this.$ = new yy.DataNode($$[$0], this._$); | ||
break; | ||
case 43:this.$ = []; | ||
case 41:this.$ = new yy.IdNode($$[$0], this._$); | ||
break; | ||
case 44:$$[$0-1].push($$[$0]); | ||
case 42: $$[$0-2].push({part: $$[$0], separator: $$[$0-1]}); this.$ = $$[$0-2]; | ||
break; | ||
case 47:this.$ = [$$[$0]]; | ||
case 43:this.$ = [{part: $$[$0]}]; | ||
break; | ||
case 48:$$[$0-1].push($$[$0]); | ||
case 48:this.$ = []; | ||
break; | ||
case 49:$$[$0-1].push($$[$0]); | ||
break; | ||
case 52:this.$ = [$$[$0]]; | ||
break; | ||
case 53:$$[$0-1].push($$[$0]); | ||
break; | ||
} | ||
}, | ||
table: [{3:1,4:2,5:[1,3],8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],25:[1,15]},{1:[3]},{5:[1,16],8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],25:[1,15]},{1:[2,2]},{5:[2,9],14:[2,9],15:[2,9],16:[2,9],19:[2,9],20:[2,9],22:[2,9],23:[2,9],25:[2,9]},{4:20,6:18,7:19,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,21],20:[2,8],22:[1,13],23:[1,14],25:[1,15]},{4:20,6:22,7:19,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,21],20:[2,8],22:[1,13],23:[1,14],25:[1,15]},{5:[2,13],14:[2,13],15:[2,13],16:[2,13],19:[2,13],20:[2,13],22:[2,13],23:[2,13],25:[2,13]},{5:[2,14],14:[2,14],15:[2,14],16:[2,14],19:[2,14],20:[2,14],22:[2,14],23:[2,14],25:[2,14]},{5:[2,15],14:[2,15],15:[2,15],16:[2,15],19:[2,15],20:[2,15],22:[2,15],23:[2,15],25:[2,15]},{5:[2,16],14:[2,16],15:[2,16],16:[2,16],19:[2,16],20:[2,16],22:[2,16],23:[2,16],25:[2,16]},{17:23,21:24,30:25,40:[1,28],42:[1,27],43:26},{17:29,21:24,30:25,40:[1,28],42:[1,27],43:26},{17:30,21:24,30:25,40:[1,28],42:[1,27],43:26},{17:31,21:24,30:25,40:[1,28],42:[1,27],43:26},{21:33,26:32,32:[1,34],33:[1,35],40:[1,28],43:26},{1:[2,1]},{5:[2,10],14:[2,10],15:[2,10],16:[2,10],19:[2,10],20:[2,10],22:[2,10],23:[2,10],25:[2,10]},{10:36,20:[1,37]},{4:38,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,7],22:[1,13],23:[1,14],25:[1,15]},{7:39,8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,21],20:[2,6],22:[1,13],23:[1,14],25:[1,15]},{17:23,18:[1,40],21:24,30:25,40:[1,28],42:[1,27],43:26},{10:41,20:[1,37]},{18:[1,42]},{18:[2,43],24:[2,43],28:43,32:[2,43],33:[2,43],34:[2,43],35:[2,43],36:[2,43],40:[2,43],42:[2,43]},{18:[2,25],24:[2,25],36:[2,25]},{18:[2,38],24:[2,38],32:[2,38],33:[2,38],34:[2,38],35:[2,38],36:[2,38],40:[2,38],42:[2,38],44:[1,44]},{21:45,40:[1,28],43:26},{18:[2,40],24:[2,40],32:[2,40],33:[2,40],34:[2,40],35:[2,40],36:[2,40],40:[2,40],42:[2,40],44:[2,40]},{18:[1,46]},{18:[1,47]},{24:[1,48]},{18:[2,41],21:50,27:49,40:[1,28],43:26},{18:[2,34],40:[2,34]},{18:[2,35],40:[2,35]},{18:[2,36],40:[2,36]},{5:[2,11],14:[2,11],15:[2,11],16:[2,11],19:[2,11],20:[2,11],22:[2,11],23:[2,11],25:[2,11]},{21:51,40:[1,28],43:26},{8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,3],22:[1,13],23:[1,14],25:[1,15]},{4:52,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,5],22:[1,13],23:[1,14],25:[1,15]},{14:[2,23],15:[2,23],16:[2,23],19:[2,23],20:[2,23],22:[2,23],23:[2,23],25:[2,23]},{5:[2,12],14:[2,12],15:[2,12],16:[2,12],19:[2,12],20:[2,12],22:[2,12],23:[2,12],25:[2,12]},{14:[2,18],15:[2,18],16:[2,18],19:[2,18],20:[2,18],22:[2,18],23:[2,18],25:[2,18]},{18:[2,45],21:56,24:[2,45],29:53,30:60,31:54,32:[1,57],33:[1,58],34:[1,59],35:[1,61],36:[2,45],37:55,38:62,39:63,40:[1,64],42:[1,27],43:26},{40:[1,65]},{18:[2,37],24:[2,37],32:[2,37],33:[2,37],34:[2,37],35:[2,37],36:[2,37],40:[2,37],42:[2,37]},{14:[2,17],15:[2,17],16:[2,17],19:[2,17],20:[2,17],22:[2,17],23:[2,17],25:[2,17]},{5:[2,20],14:[2,20],15:[2,20],16:[2,20],19:[2,20],20:[2,20],22:[2,20],23:[2,20],25:[2,20]},{5:[2,21],14:[2,21],15:[2,21],16:[2,21],19:[2,21],20:[2,21],22:[2,21],23:[2,21],25:[2,21]},{18:[1,66]},{18:[2,42]},{18:[1,67]},{8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],25:[1,15]},{18:[2,24],24:[2,24],36:[2,24]},{18:[2,44],24:[2,44],32:[2,44],33:[2,44],34:[2,44],35:[2,44],36:[2,44],40:[2,44],42:[2,44]},{18:[2,46],24:[2,46],36:[2,46]},{18:[2,26],24:[2,26],32:[2,26],33:[2,26],34:[2,26],35:[2,26],36:[2,26],40:[2,26],42:[2,26]},{18:[2,27],24:[2,27],32:[2,27],33:[2,27],34:[2,27],35:[2,27],36:[2,27],40:[2,27],42:[2,27]},{18:[2,28],24:[2,28],32:[2,28],33:[2,28],34:[2,28],35:[2,28],36:[2,28],40:[2,28],42:[2,28]},{18:[2,29],24:[2,29],32:[2,29],33:[2,29],34:[2,29],35:[2,29],36:[2,29],40:[2,29],42:[2,29]},{18:[2,30],24:[2,30],32:[2,30],33:[2,30],34:[2,30],35:[2,30],36:[2,30],40:[2,30],42:[2,30]},{17:68,21:24,30:25,40:[1,28],42:[1,27],43:26},{18:[2,32],24:[2,32],36:[2,32],39:69,40:[1,70]},{18:[2,47],24:[2,47],36:[2,47],40:[2,47]},{18:[2,40],24:[2,40],32:[2,40],33:[2,40],34:[2,40],35:[2,40],36:[2,40],40:[2,40],41:[1,71],42:[2,40],44:[2,40]},{18:[2,39],24:[2,39],32:[2,39],33:[2,39],34:[2,39],35:[2,39],36:[2,39],40:[2,39],42:[2,39],44:[2,39]},{5:[2,22],14:[2,22],15:[2,22],16:[2,22],19:[2,22],20:[2,22],22:[2,22],23:[2,22],25:[2,22]},{5:[2,19],14:[2,19],15:[2,19],16:[2,19],19:[2,19],20:[2,19],22:[2,19],23:[2,19],25:[2,19]},{36:[1,72]},{18:[2,48],24:[2,48],36:[2,48],40:[2,48]},{41:[1,71]},{21:56,30:60,31:73,32:[1,57],33:[1,58],34:[1,59],35:[1,61],40:[1,28],42:[1,27],43:26},{18:[2,31],24:[2,31],32:[2,31],33:[2,31],34:[2,31],35:[2,31],36:[2,31],40:[2,31],42:[2,31]},{18:[2,33],24:[2,33],36:[2,33],40:[2,33]}], | ||
defaultActions: {3:[2,2],16:[2,1],50:[2,42]}, | ||
table: [{3:1,4:2,5:[1,3],8:4,9:5,10:[1,10],12:6,14:7,15:8,16:9,17:[1,11],18:[1,12],21:[1,14],23:[1,13],26:[1,15],27:[1,16],29:[1,17]},{1:[3]},{5:[1,18],8:19,9:5,10:[1,10],12:6,14:7,15:8,16:9,17:[1,11],18:[1,12],21:[1,14],23:[1,13],26:[1,15],27:[1,16],29:[1,17]},{1:[2,2]},{5:[2,9],10:[2,9],17:[2,9],18:[2,9],21:[2,9],23:[2,9],24:[2,9],26:[2,9],27:[2,9],29:[2,9]},{10:[1,20]},{4:23,6:21,7:22,8:4,9:5,10:[1,10],12:6,14:7,15:8,16:9,17:[1,11],18:[1,12],21:[1,14],23:[1,24],24:[2,8],26:[1,15],27:[1,16],29:[1,17]},{4:23,6:25,7:22,8:4,9:5,10:[1,10],12:6,14:7,15:8,16:9,17:[1,11],18:[1,12],21:[1,14],23:[1,24],24:[2,8],26:[1,15],27:[1,16],29:[1,17]},{5:[2,14],10:[2,14],17:[2,14],18:[2,14],21:[2,14],23:[2,14],24:[2,14],26:[2,14],27:[2,14],29:[2,14]},{5:[2,15],10:[2,15],17:[2,15],18:[2,15],21:[2,15],23:[2,15],24:[2,15],26:[2,15],27:[2,15],29:[2,15]},{5:[2,16],10:[2,16],17:[2,16],18:[2,16],21:[2,16],23:[2,16],24:[2,16],26:[2,16],27:[2,16],29:[2,16]},{5:[2,17],10:[2,17],17:[2,17],18:[2,17],21:[2,17],23:[2,17],24:[2,17],26:[2,17],27:[2,17],29:[2,17]},{19:26,25:27,36:28,45:[1,31],47:[1,30],48:29},{19:32,25:27,36:28,45:[1,31],47:[1,30],48:29},{19:33,25:27,36:28,45:[1,31],47:[1,30],48:29},{19:34,25:27,36:28,45:[1,31],47:[1,30],48:29},{19:35,25:27,36:28,45:[1,31],47:[1,30],48:29},{25:37,30:36,37:[1,38],38:[1,39],45:[1,31],48:29},{1:[2,1]},{5:[2,10],10:[2,10],17:[2,10],18:[2,10],21:[2,10],23:[2,10],24:[2,10],26:[2,10],27:[2,10],29:[2,10]},{11:[1,40]},{13:41,24:[1,42]},{4:43,8:4,9:5,10:[1,10],12:6,14:7,15:8,16:9,17:[1,11],18:[1,12],21:[1,14],23:[1,13],24:[2,7],26:[1,15],27:[1,16],29:[1,17]},{7:44,8:19,9:5,10:[1,10],12:6,14:7,15:8,16:9,17:[1,11],18:[1,12],21:[1,14],23:[1,24],24:[2,6],26:[1,15],27:[1,16],29:[1,17]},{19:32,22:[1,45],25:27,36:28,45:[1,31],47:[1,30],48:29},{13:46,24:[1,42]},{20:[1,47]},{20:[2,48],22:[2,48],28:[2,48],34:48,37:[2,48],38:[2,48],39:[2,48],40:[2,48],41:[2,48],45:[2,48],47:[2,48]},{20:[2,28],22:[2,28],28:[2,28],41:[2,28]},{20:[2,41],22:[2,41],28:[2,41],37:[2,41],38:[2,41],39:[2,41],40:[2,41],41:[2,41],45:[2,41],47:[2,41],49:[1,49]},{25:50,45:[1,31],48:29},{20:[2,43],22:[2,43],28:[2,43],37:[2,43],38:[2,43],39:[2,43],40:[2,43],41:[2,43],45:[2,43],47:[2,43],49:[2,43]},{22:[1,51]},{22:[1,52]},{22:[1,53]},{28:[1,54]},{22:[2,46],25:57,31:55,33:56,36:61,37:[1,58],38:[1,59],39:[1,60],40:[1,62],42:63,43:64,44:66,45:[1,65],47:[1,30],48:29},{22:[2,37],37:[2,37],38:[2,37],39:[2,37],40:[2,37],45:[2,37],47:[2,37]},{22:[2,38],37:[2,38],38:[2,38],39:[2,38],40:[2,38],45:[2,38],47:[2,38]},{22:[2,39],37:[2,39],38:[2,39],39:[2,39],40:[2,39],45:[2,39],47:[2,39]},{5:[2,11],10:[2,11],17:[2,11],18:[2,11],21:[2,11],23:[2,11],24:[2,11],26:[2,11],27:[2,11],29:[2,11]},{5:[2,12],10:[2,12],17:[2,12],18:[2,12],21:[2,12],23:[2,12],24:[2,12],26:[2,12],27:[2,12],29:[2,12]},{25:67,45:[1,31],48:29},{8:19,9:5,10:[1,10],12:6,14:7,15:8,16:9,17:[1,11],18:[1,12],21:[1,14],23:[1,13],24:[2,3],26:[1,15],27:[1,16],29:[1,17]},{4:68,8:4,9:5,10:[1,10],12:6,14:7,15:8,16:9,17:[1,11],18:[1,12],21:[1,14],23:[1,13],24:[2,5],26:[1,15],27:[1,16],29:[1,17]},{10:[2,26],17:[2,26],18:[2,26],21:[2,26],23:[2,26],24:[2,26],26:[2,26],27:[2,26],29:[2,26]},{5:[2,13],10:[2,13],17:[2,13],18:[2,13],21:[2,13],23:[2,13],24:[2,13],26:[2,13],27:[2,13],29:[2,13]},{10:[2,18]},{20:[2,50],22:[2,50],25:57,28:[2,50],31:70,35:69,36:61,37:[1,58],38:[1,59],39:[1,60],40:[1,62],41:[2,50],42:71,43:64,44:66,45:[1,65],47:[1,30],48:29},{45:[1,72]},{20:[2,40],22:[2,40],28:[2,40],37:[2,40],38:[2,40],39:[2,40],40:[2,40],41:[2,40],45:[2,40],47:[2,40]},{10:[2,20],17:[2,20],18:[2,20],21:[2,20],23:[2,20],24:[2,20],26:[2,20],27:[2,20],29:[2,20]},{10:[2,19],17:[2,19],18:[2,19],21:[2,19],23:[2,19],24:[2,19],26:[2,19],27:[2,19],29:[2,19]},{5:[2,22],10:[2,22],17:[2,22],18:[2,22],21:[2,22],23:[2,22],24:[2,22],26:[2,22],27:[2,22],29:[2,22]},{5:[2,23],10:[2,23],17:[2,23],18:[2,23],21:[2,23],23:[2,23],24:[2,23],26:[2,23],27:[2,23],29:[2,23]},{22:[2,44],32:73,42:74,43:64,44:66,45:[1,75]},{22:[1,76]},{20:[2,29],22:[2,29],28:[2,29],37:[2,29],38:[2,29],39:[2,29],40:[2,29],41:[2,29],45:[2,29],47:[2,29]},{20:[2,30],22:[2,30],28:[2,30],37:[2,30],38:[2,30],39:[2,30],40:[2,30],41:[2,30],45:[2,30],47:[2,30]},{20:[2,31],22:[2,31],28:[2,31],37:[2,31],38:[2,31],39:[2,31],40:[2,31],41:[2,31],45:[2,31],47:[2,31]},{20:[2,32],22:[2,32],28:[2,32],37:[2,32],38:[2,32],39:[2,32],40:[2,32],41:[2,32],45:[2,32],47:[2,32]},{20:[2,33],22:[2,33],28:[2,33],37:[2,33],38:[2,33],39:[2,33],40:[2,33],41:[2,33],45:[2,33],47:[2,33]},{19:77,25:27,36:28,45:[1,31],47:[1,30],48:29},{22:[2,47]},{20:[2,35],22:[2,35],28:[2,35],41:[2,35],44:78,45:[1,75]},{20:[2,43],22:[2,43],28:[2,43],37:[2,43],38:[2,43],39:[2,43],40:[2,43],41:[2,43],45:[2,43],46:[1,79],47:[2,43],49:[2,43]},{20:[2,52],22:[2,52],28:[2,52],41:[2,52],45:[2,52]},{22:[1,80]},{8:19,9:5,10:[1,10],12:6,14:7,15:8,16:9,17:[1,11],18:[1,12],21:[1,14],23:[1,13],24:[2,4],26:[1,15],27:[1,16],29:[1,17]},{20:[2,27],22:[2,27],28:[2,27],41:[2,27]},{20:[2,49],22:[2,49],28:[2,49],37:[2,49],38:[2,49],39:[2,49],40:[2,49],41:[2,49],45:[2,49],47:[2,49]},{20:[2,51],22:[2,51],28:[2,51],41:[2,51]},{20:[2,42],22:[2,42],28:[2,42],37:[2,42],38:[2,42],39:[2,42],40:[2,42],41:[2,42],45:[2,42],47:[2,42],49:[2,42]},{22:[1,81]},{22:[2,45]},{46:[1,79]},{5:[2,25],10:[2,25],17:[2,25],18:[2,25],21:[2,25],23:[2,25],24:[2,25],26:[2,25],27:[2,25],29:[2,25]},{41:[1,82]},{20:[2,53],22:[2,53],28:[2,53],41:[2,53],45:[2,53]},{25:57,31:83,36:61,37:[1,58],38:[1,59],39:[1,60],40:[1,62],45:[1,31],47:[1,30],48:29},{5:[2,21],10:[2,21],17:[2,21],18:[2,21],21:[2,21],23:[2,21],24:[2,21],26:[2,21],27:[2,21],29:[2,21]},{5:[2,24],10:[2,24],17:[2,24],18:[2,24],21:[2,24],23:[2,24],24:[2,24],26:[2,24],27:[2,24],29:[2,24]},{20:[2,34],22:[2,34],28:[2,34],37:[2,34],38:[2,34],39:[2,34],40:[2,34],41:[2,34],45:[2,34],47:[2,34]},{20:[2,36],22:[2,36],28:[2,36],41:[2,36],45:[2,36]}], | ||
defaultActions: {3:[2,2],18:[2,1],47:[2,18],63:[2,47],74:[2,45]}, | ||
parseError: function parseError(str, hash) { | ||
@@ -413,76 +419,98 @@ throw new Error(str); | ||
} | ||
if(yy_.yytext) return 14; | ||
if(yy_.yytext) return 10; | ||
break; | ||
case 1:return 14; | ||
case 1:return 10; | ||
break; | ||
case 2: | ||
this.popState(); | ||
return 14; | ||
return 10; | ||
break; | ||
case 3:strip(0,4); this.popState(); return 15; | ||
case 3: | ||
yy_.yytext = yy_.yytext.substr(5, yy_.yyleng-9); | ||
this.popState(); | ||
return 11; | ||
break; | ||
case 4:return 35; | ||
case 4: return 10; | ||
break; | ||
case 5:return 36; | ||
case 5:strip(0,4); this.popState(); return 17; | ||
break; | ||
case 6:return 25; | ||
case 6:return 40; | ||
break; | ||
case 7:return 16; | ||
case 7:return 41; | ||
break; | ||
case 8:return 20; | ||
case 8: return 18; | ||
break; | ||
case 9:return 19; | ||
case 9: | ||
this.popState(); | ||
this.begin('raw'); | ||
return 20; | ||
break; | ||
case 10:return 19; | ||
case 10: | ||
yy_.yytext = yy_.yytext.substr(4, yy_.yyleng-8); | ||
this.popState(); | ||
return 'RAW_BLOCK'; | ||
break; | ||
case 11:return 23; | ||
case 11:return 29; | ||
break; | ||
case 12:return 22; | ||
case 12:return 21; | ||
break; | ||
case 13:this.popState(); this.begin('com'); | ||
case 13:return 24; | ||
break; | ||
case 14:strip(3,5); this.popState(); return 15; | ||
case 14:return 23; | ||
break; | ||
case 15:return 22; | ||
case 15:return 23; | ||
break; | ||
case 16:return 41; | ||
case 16:return 27; | ||
break; | ||
case 17:return 40; | ||
case 17:return 26; | ||
break; | ||
case 18:return 40; | ||
case 18:this.popState(); this.begin('com'); | ||
break; | ||
case 19:return 44; | ||
case 19:strip(3,5); this.popState(); return 17; | ||
break; | ||
case 20:// ignore whitespace | ||
case 20:return 26; | ||
break; | ||
case 21:this.popState(); return 24; | ||
case 21:return 46; | ||
break; | ||
case 22:this.popState(); return 18; | ||
case 22:return 45; | ||
break; | ||
case 23:yy_.yytext = strip(1,2).replace(/\\"/g,'"'); return 32; | ||
case 23:return 45; | ||
break; | ||
case 24:yy_.yytext = strip(1,2).replace(/\\'/g,"'"); return 32; | ||
case 24:return 49; | ||
break; | ||
case 25:return 42; | ||
case 25:// ignore whitespace | ||
break; | ||
case 26:return 34; | ||
case 26:this.popState(); return 28; | ||
break; | ||
case 27:return 34; | ||
case 27:this.popState(); return 22; | ||
break; | ||
case 28:return 33; | ||
case 28:yy_.yytext = strip(1,2).replace(/\\"/g,'"'); return 37; | ||
break; | ||
case 29:return 40; | ||
case 29:yy_.yytext = strip(1,2).replace(/\\'/g,"'"); return 37; | ||
break; | ||
case 30:yy_.yytext = strip(1,2); return 40; | ||
case 30:return 47; | ||
break; | ||
case 31:return 'INVALID'; | ||
case 31:return 39; | ||
break; | ||
case 32:return 5; | ||
case 32:return 39; | ||
break; | ||
case 33:return 38; | ||
break; | ||
case 34:return 45; | ||
break; | ||
case 35:yy_.yytext = strip(1,2); return 45; | ||
break; | ||
case 36:return 'INVALID'; | ||
break; | ||
case 37:return 5; | ||
break; | ||
} | ||
}; | ||
lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:[\s\S]*?--\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{!--)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{(~)?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:-?[0-9]+(?=([~}\s)])))/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)]))))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/]; | ||
lexer.conditions = {"mu":{"rules":[4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32],"inclusive":false},"emu":{"rules":[2],"inclusive":false},"com":{"rules":[3],"inclusive":false},"INITIAL":{"rules":[0,1,32],"inclusive":true}}; | ||
lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/,/^(?:[^\x00]*?(?=(\{\{\{\{\/)))/,/^(?:[\s\S]*?--\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{\{\{)/,/^(?:\}\}\}\})/,/^(?:\{\{\{\{[^\x00]*\}\}\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{!--)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{(~)?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)]))))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/]; | ||
lexer.conditions = {"mu":{"rules":[6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37],"inclusive":false},"emu":{"rules":[2],"inclusive":false},"com":{"rules":[5],"inclusive":false},"raw":{"rules":[3,4],"inclusive":false},"INITIAL":{"rules":[0,1,37],"inclusive":true}}; | ||
return lexer;})() | ||
@@ -489,0 +517,0 @@ parser.lexer = lexer; |
@@ -86,3 +86,8 @@ "use strict"; | ||
var content = this.accept(partial.partialName); | ||
if(partial.context) { content = content + " " + this.accept(partial.context); } | ||
if(partial.context) { | ||
content += " " + this.accept(partial.context); | ||
} | ||
if (partial.hash) { | ||
content += " " + this.accept(partial.hash); | ||
} | ||
return this.pad("{{> " + content + " }}"); | ||
@@ -108,4 +113,4 @@ }; | ||
PrintVisitor.prototype.INTEGER = function(integer) { | ||
return "INTEGER{" + integer.integer + "}"; | ||
PrintVisitor.prototype.NUMBER = function(number) { | ||
return "NUMBER{" + number.number + "}"; | ||
}; | ||
@@ -112,0 +117,0 @@ |
@@ -6,2 +6,3 @@ "use strict"; | ||
var REVISION_CHANGES = require("./base").REVISION_CHANGES; | ||
var createFrame = require("./base").createFrame; | ||
@@ -35,4 +36,10 @@ function checkRevision(compilerInfo) { | ||
// for external users to override these as psuedo-supported APIs. | ||
var invokePartialWrapper = function(partial, name, context, helpers, partials, data) { | ||
var result = env.VM.invokePartial.apply(this, arguments); | ||
env.VM.checkRevision(templateSpec.compiler); | ||
var invokePartialWrapper = function(partial, name, context, hash, helpers, partials, data) { | ||
if (hash) { | ||
context = Utils.extend({}, context, hash); | ||
} | ||
var result = env.VM.invokePartial.call(this, partial, name, context, helpers, partials, data); | ||
if (result != null) { return result; } | ||
@@ -53,12 +60,33 @@ | ||
invokePartial: invokePartialWrapper, | ||
fn: function(i) { | ||
return templateSpec[i]; | ||
}, | ||
programs: [], | ||
program: function(i, fn, data) { | ||
var programWrapper = this.programs[i]; | ||
program: function(i, data) { | ||
var programWrapper = this.programs[i], | ||
fn = this.fn(i); | ||
if(data) { | ||
programWrapper = program(i, fn, data); | ||
programWrapper = program(this, i, fn, data); | ||
} else if (!programWrapper) { | ||
programWrapper = this.programs[i] = program(i, fn); | ||
programWrapper = this.programs[i] = program(this, i, fn); | ||
} | ||
return programWrapper; | ||
}, | ||
programWithDepth: env.VM.programWithDepth, | ||
initData: function(context, data) { | ||
if (!data || !('root' in data)) { | ||
data = data ? createFrame(data) : {}; | ||
data.root = context; | ||
} | ||
return data; | ||
}, | ||
data: function(data, depth) { | ||
while (data && depth--) { | ||
data = data._parent; | ||
} | ||
return data; | ||
}, | ||
merge: function(param, common) { | ||
@@ -68,40 +96,46 @@ var ret = param || common; | ||
if (param && common && (param !== common)) { | ||
ret = {}; | ||
Utils.extend(ret, common); | ||
Utils.extend(ret, param); | ||
ret = Utils.extend({}, common, param); | ||
} | ||
return ret; | ||
}, | ||
programWithDepth: env.VM.programWithDepth, | ||
noop: env.VM.noop, | ||
compilerInfo: null | ||
compilerInfo: templateSpec.compiler | ||
}; | ||
return function(context, options) { | ||
var ret = function(context, options) { | ||
options = options || {}; | ||
var namespace = options.partial ? options : env, | ||
helpers, | ||
partials; | ||
partials, | ||
data = options.data; | ||
if (!options.partial) { | ||
helpers = options.helpers; | ||
partials = options.partials; | ||
} | ||
var result = templateSpec.call( | ||
container, | ||
namespace, context, | ||
helpers, | ||
partials, | ||
options.data); | ||
helpers = container.helpers = container.merge(options.helpers, namespace.helpers); | ||
if (!options.partial) { | ||
env.VM.checkRevision(container.compilerInfo); | ||
if (templateSpec.usePartial) { | ||
partials = container.partials = container.merge(options.partials, namespace.partials); | ||
} | ||
if (templateSpec.useData) { | ||
data = container.initData(context, data); | ||
} | ||
} else { | ||
helpers = container.helpers = options.helpers; | ||
partials = container.partials = options.partials; | ||
} | ||
return templateSpec.main.call(container, context, helpers, partials, data); | ||
}; | ||
return result; | ||
ret.child = function(i) { | ||
return container.programWithDepth(i); | ||
}; | ||
return ret; | ||
} | ||
exports.template = template;function programWithDepth(i, fn, data /*, $depth */) { | ||
var args = Array.prototype.slice.call(arguments, 3); | ||
exports.template = template;function programWithDepth(i, data /*, $depth */) { | ||
/*jshint -W040 */ | ||
var args = Array.prototype.slice.call(arguments, 2), | ||
container = this, | ||
fn = container.fn(i); | ||
@@ -111,3 +145,3 @@ var prog = function(context, options) { | ||
return fn.apply(this, [context, options.data || data].concat(args)); | ||
return fn.apply(container, [context, container.helpers, container.partials, options.data || data].concat(args)); | ||
}; | ||
@@ -119,7 +153,7 @@ prog.program = i; | ||
exports.programWithDepth = programWithDepth;function program(i, fn, data) { | ||
exports.programWithDepth = programWithDepth;function program(container, i, fn, data) { | ||
var prog = function(context, options) { | ||
options = options || {}; | ||
return fn(context, options.data || data); | ||
return fn.call(container, context, container.helpers, container.partials, options.data || data); | ||
}; | ||
@@ -126,0 +160,0 @@ prog.program = i; |
@@ -21,8 +21,12 @@ "use strict"; | ||
function extend(obj, value) { | ||
for(var key in value) { | ||
if(Object.prototype.hasOwnProperty.call(value, key)) { | ||
obj[key] = value[key]; | ||
function extend(obj /* , ...source */) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
for (var key in arguments[i]) { | ||
if (Object.prototype.hasOwnProperty.call(arguments[i], key)) { | ||
obj[key] = arguments[i][key]; | ||
} | ||
} | ||
} | ||
return obj; | ||
} | ||
@@ -77,2 +81,6 @@ | ||
exports.isEmpty = isEmpty; | ||
exports.isEmpty = isEmpty;function appendContextPath(contextPath, id) { | ||
return (contextPath ? contextPath + '.' : '') + id; | ||
} | ||
exports.appendContextPath = appendContextPath; |
/*! | ||
handlebars v1.3.0 | ||
handlebars vv2.0.0-alpha.1 | ||
Copyright (C) 2011 by Yehuda Katz | ||
Copyright (C) 2011-2014 by Yehuda Katz | ||
@@ -27,3 +27,3 @@ Permission is hereby granted, free of charge, to any person obtaining a copy | ||
*/ | ||
define("handlebars/safe-string",["exports"],function(a){function b(a){this.string=a}b.prototype.toString=function(){return""+this.string},a["default"]=b}),define("handlebars/utils",["./safe-string","exports"],function(a,b){function c(a){return h[a]||"&"}function d(a,b){for(var c in b)Object.prototype.hasOwnProperty.call(b,c)&&(a[c]=b[c])}function e(a){return a instanceof g?a.toString():a||0===a?(a=""+a,j.test(a)?a.replace(i,c):a):""}function f(a){return a||0===a?m(a)&&0===a.length?!0:!1:!0}var g=a["default"],h={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},i=/[&<>"'`]/g,j=/[&<>"'`]/;b.extend=d;var k=Object.prototype.toString;b.toString=k;var l=function(a){return"function"==typeof a};l(/x/)&&(l=function(a){return"function"==typeof a&&"[object Function]"===k.call(a)});var l;b.isFunction=l;var m=Array.isArray||function(a){return a&&"object"==typeof a?"[object Array]"===k.call(a):!1};b.isArray=m,b.escapeExpression=e,b.isEmpty=f}),define("handlebars/exception",["exports"],function(a){function b(a,b){var d;b&&b.firstLine&&(d=b.firstLine,a+=" - "+d+":"+b.firstColumn);for(var e=Error.prototype.constructor.call(this,a),f=0;f<c.length;f++)this[c[f]]=e[c[f]];d&&(this.lineNumber=d,this.column=b.firstColumn)}var c=["description","fileName","lineNumber","message","name","number","stack"];b.prototype=new Error,a["default"]=b}),define("handlebars/base",["./utils","./exception","exports"],function(a,b,c){function d(a,b){this.helpers=a||{},this.partials=b||{},e(this)}function e(a){a.registerHelper("helperMissing",function(a){if(2===arguments.length)return void 0;throw new h("Missing helper: '"+a+"'")}),a.registerHelper("blockHelperMissing",function(b,c){var d=c.inverse||function(){},e=c.fn;return m(b)&&(b=b.call(this)),b===!0?e(this):b===!1||null==b?d(this):l(b)?b.length>0?a.helpers.each(b,c):d(this):e(b)}),a.registerHelper("each",function(a,b){var c,d=b.fn,e=b.inverse,f=0,g="";if(m(a)&&(a=a.call(this)),b.data&&(c=q(b.data)),a&&"object"==typeof a)if(l(a))for(var h=a.length;h>f;f++)c&&(c.index=f,c.first=0===f,c.last=f===a.length-1),g+=d(a[f],{data:c});else for(var i in a)a.hasOwnProperty(i)&&(c&&(c.key=i,c.index=f,c.first=0===f),g+=d(a[i],{data:c}),f++);return 0===f&&(g=e(this)),g}),a.registerHelper("if",function(a,b){return m(a)&&(a=a.call(this)),!b.hash.includeZero&&!a||g.isEmpty(a)?b.inverse(this):b.fn(this)}),a.registerHelper("unless",function(b,c){return a.helpers["if"].call(this,b,{fn:c.inverse,inverse:c.fn,hash:c.hash})}),a.registerHelper("with",function(a,b){return m(a)&&(a=a.call(this)),g.isEmpty(a)?void 0:b.fn(a)}),a.registerHelper("log",function(b,c){var d=c.data&&null!=c.data.level?parseInt(c.data.level,10):1;a.log(d,b)})}function f(a,b){p.log(a,b)}var g=a,h=b["default"],i="1.3.0";c.VERSION=i;var j=4;c.COMPILER_REVISION=j;var k={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:">= 1.0.0"};c.REVISION_CHANGES=k;var l=g.isArray,m=g.isFunction,n=g.toString,o="[object Object]";c.HandlebarsEnvironment=d,d.prototype={constructor:d,logger:p,log:f,registerHelper:function(a,b,c){if(n.call(a)===o){if(c||b)throw new h("Arg not supported with multiple helpers");g.extend(this.helpers,a)}else c&&(b.not=c),this.helpers[a]=b},registerPartial:function(a,b){n.call(a)===o?g.extend(this.partials,a):this.partials[a]=b}};var p={methodMap:{0:"debug",1:"info",2:"warn",3:"error"},DEBUG:0,INFO:1,WARN:2,ERROR:3,level:3,log:function(a,b){if(p.level<=a){var c=p.methodMap[a];"undefined"!=typeof console&&console[c]&&console[c].call(console,b)}}};c.logger=p,c.log=f;var q=function(a){var b={};return g.extend(b,a),b};c.createFrame=q}),define("handlebars/runtime",["./utils","./exception","./base","exports"],function(a,b,c,d){function e(a){var b=a&&a[0]||1,c=m;if(b!==c){if(c>b){var d=n[c],e=n[b];throw new l("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+d+") or downgrade your runtime to an older version ("+e+").")}throw new l("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+a[1]+").")}}function f(a,b){if(!b)throw new l("No environment passed to template");var c=function(a,c,d,e,f,g){var h=b.VM.invokePartial.apply(this,arguments);if(null!=h)return h;if(b.compile){var i={helpers:e,partials:f,data:g};return f[c]=b.compile(a,{data:void 0!==g},b),f[c](d,i)}throw new l("The partial "+c+" could not be compiled when running in runtime-only mode")},d={escapeExpression:k.escapeExpression,invokePartial:c,programs:[],program:function(a,b,c){var d=this.programs[a];return c?d=h(a,b,c):d||(d=this.programs[a]=h(a,b)),d},merge:function(a,b){var c=a||b;return a&&b&&a!==b&&(c={},k.extend(c,b),k.extend(c,a)),c},programWithDepth:b.VM.programWithDepth,noop:b.VM.noop,compilerInfo:null};return function(c,e){e=e||{};var f,g,h=e.partial?e:b;e.partial||(f=e.helpers,g=e.partials);var i=a.call(d,h,c,f,g,e.data);return e.partial||b.VM.checkRevision(d.compilerInfo),i}}function g(a,b,c){var d=Array.prototype.slice.call(arguments,3),e=function(a,e){return e=e||{},b.apply(this,[a,e.data||c].concat(d))};return e.program=a,e.depth=d.length,e}function h(a,b,c){var d=function(a,d){return d=d||{},b(a,d.data||c)};return d.program=a,d.depth=0,d}function i(a,b,c,d,e,f){var g={partial:!0,helpers:d,partials:e,data:f};if(void 0===a)throw new l("The partial "+b+" could not be found");return a instanceof Function?a(c,g):void 0}function j(){return""}var k=a,l=b["default"],m=c.COMPILER_REVISION,n=c.REVISION_CHANGES;d.checkRevision=e,d.template=f,d.programWithDepth=g,d.program=h,d.invokePartial=i,d.noop=j}),define("handlebars.runtime",["./handlebars/base","./handlebars/safe-string","./handlebars/exception","./handlebars/utils","./handlebars/runtime","exports"],function(a,b,c,d,e,f){var g=a,h=b["default"],i=c["default"],j=d,k=e,l=function(){var a=new g.HandlebarsEnvironment;return j.extend(a,g),a.SafeString=h,a.Exception=i,a.Utils=j,a.VM=k,a.template=function(b){return k.template(b,a)},a},m=l();m.create=l,f["default"]=m}),define("handlebars/compiler/ast",["../exception","exports"],function(a,b){function c(a){a=a||{},this.firstLine=a.first_line,this.firstColumn=a.first_column,this.lastColumn=a.last_column,this.lastLine=a.last_line}var d=a["default"],e={ProgramNode:function(a,b,d,f){var g,h;3===arguments.length?(f=d,d=null):2===arguments.length&&(f=b,b=null),c.call(this,f),this.type="program",this.statements=a,this.strip={},d?(h=d[0],h?(g={first_line:h.firstLine,last_line:h.lastLine,last_column:h.lastColumn,first_column:h.firstColumn},this.inverse=new e.ProgramNode(d,b,g)):this.inverse=new e.ProgramNode(d,b),this.strip.right=b.left):b&&(this.strip.left=b.right)},MustacheNode:function(a,b,d,f,g){if(c.call(this,g),this.type="mustache",this.strip=f,null!=d&&d.charAt){var h=d.charAt(3)||d.charAt(2);this.escaped="{"!==h&&"&"!==h}else this.escaped=!!d;this.sexpr=a instanceof e.SexprNode?a:new e.SexprNode(a,b),this.sexpr.isRoot=!0,this.id=this.sexpr.id,this.params=this.sexpr.params,this.hash=this.sexpr.hash,this.eligibleHelper=this.sexpr.eligibleHelper,this.isHelper=this.sexpr.isHelper},SexprNode:function(a,b,d){c.call(this,d),this.type="sexpr",this.hash=b;var e=this.id=a[0],f=this.params=a.slice(1),g=this.eligibleHelper=e.isSimple;this.isHelper=g&&(f.length||b)},PartialNode:function(a,b,d,e){c.call(this,e),this.type="partial",this.partialName=a,this.context=b,this.strip=d},BlockNode:function(a,b,e,f,g){if(c.call(this,g),a.sexpr.id.original!==f.path.original)throw new d(a.sexpr.id.original+" doesn't match "+f.path.original,this);this.type="block",this.mustache=a,this.program=b,this.inverse=e,this.strip={left:a.strip.left,right:f.strip.right},(b||e).strip.left=a.strip.right,(e||b).strip.right=f.strip.left,e&&!b&&(this.isInverse=!0)},ContentNode:function(a,b){c.call(this,b),this.type="content",this.string=a},HashNode:function(a,b){c.call(this,b),this.type="hash",this.pairs=a},IdNode:function(a,b){c.call(this,b),this.type="ID";for(var e="",f=[],g=0,h=0,i=a.length;i>h;h++){var j=a[h].part;if(e+=(a[h].separator||"")+j,".."===j||"."===j||"this"===j){if(f.length>0)throw new d("Invalid path: "+e,this);".."===j?g++:this.isScoped=!0}else f.push(j)}this.original=e,this.parts=f,this.string=f.join("."),this.depth=g,this.isSimple=1===a.length&&!this.isScoped&&0===g,this.stringModeValue=this.string},PartialNameNode:function(a,b){c.call(this,b),this.type="PARTIAL_NAME",this.name=a.original},DataNode:function(a,b){c.call(this,b),this.type="DATA",this.id=a},StringNode:function(a,b){c.call(this,b),this.type="STRING",this.original=this.string=this.stringModeValue=a},IntegerNode:function(a,b){c.call(this,b),this.type="INTEGER",this.original=this.integer=a,this.stringModeValue=Number(a)},BooleanNode:function(a,b){c.call(this,b),this.type="BOOLEAN",this.bool=a,this.stringModeValue="true"===a},CommentNode:function(a,b){c.call(this,b),this.type="comment",this.comment=a}};b["default"]=e}),define("handlebars/compiler/parser",["exports"],function(a){var b=function(){function a(a,b){return{left:"~"===a.charAt(2),right:"~"===b.charAt(0)||"~"===b.charAt(1)}}function b(){this.yy={}}var c={trace:function(){},yy:{},symbols_:{error:2,root:3,statements:4,EOF:5,program:6,simpleInverse:7,statement:8,openInverse:9,closeBlock:10,openBlock:11,mustache:12,partial:13,CONTENT:14,COMMENT:15,OPEN_BLOCK:16,sexpr:17,CLOSE:18,OPEN_INVERSE:19,OPEN_ENDBLOCK:20,path:21,OPEN:22,OPEN_UNESCAPED:23,CLOSE_UNESCAPED:24,OPEN_PARTIAL:25,partialName:26,partial_option0:27,sexpr_repetition0:28,sexpr_option0:29,dataName:30,param:31,STRING:32,INTEGER:33,BOOLEAN:34,OPEN_SEXPR:35,CLOSE_SEXPR:36,hash:37,hash_repetition_plus0:38,hashSegment:39,ID:40,EQUALS:41,DATA:42,pathSegments:43,SEP:44,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",14:"CONTENT",15:"COMMENT",16:"OPEN_BLOCK",18:"CLOSE",19:"OPEN_INVERSE",20:"OPEN_ENDBLOCK",22:"OPEN",23:"OPEN_UNESCAPED",24:"CLOSE_UNESCAPED",25:"OPEN_PARTIAL",32:"STRING",33:"INTEGER",34:"BOOLEAN",35:"OPEN_SEXPR",36:"CLOSE_SEXPR",40:"ID",41:"EQUALS",42:"DATA",44:"SEP"},productions_:[0,[3,2],[3,1],[6,2],[6,3],[6,2],[6,1],[6,1],[6,0],[4,1],[4,2],[8,3],[8,3],[8,1],[8,1],[8,1],[8,1],[11,3],[9,3],[10,3],[12,3],[12,3],[13,4],[7,2],[17,3],[17,1],[31,1],[31,1],[31,1],[31,1],[31,1],[31,3],[37,1],[39,3],[26,1],[26,1],[26,1],[30,2],[21,1],[43,3],[43,1],[27,0],[27,1],[28,0],[28,2],[29,0],[29,1],[38,1],[38,2]],performAction:function(b,c,d,e,f,g){var h=g.length-1;switch(f){case 1:return new e.ProgramNode(g[h-1],this._$);case 2:return new e.ProgramNode([],this._$);case 3:this.$=new e.ProgramNode([],g[h-1],g[h],this._$);break;case 4:this.$=new e.ProgramNode(g[h-2],g[h-1],g[h],this._$);break;case 5:this.$=new e.ProgramNode(g[h-1],g[h],[],this._$);break;case 6:this.$=new e.ProgramNode(g[h],this._$);break;case 7:this.$=new e.ProgramNode([],this._$);break;case 8:this.$=new e.ProgramNode([],this._$);break;case 9:this.$=[g[h]];break;case 10:g[h-1].push(g[h]),this.$=g[h-1];break;case 11:this.$=new e.BlockNode(g[h-2],g[h-1].inverse,g[h-1],g[h],this._$);break;case 12:this.$=new e.BlockNode(g[h-2],g[h-1],g[h-1].inverse,g[h],this._$);break;case 13:this.$=g[h];break;case 14:this.$=g[h];break;case 15:this.$=new e.ContentNode(g[h],this._$);break;case 16:this.$=new e.CommentNode(g[h],this._$);break;case 17:this.$=new e.MustacheNode(g[h-1],null,g[h-2],a(g[h-2],g[h]),this._$);break;case 18:this.$=new e.MustacheNode(g[h-1],null,g[h-2],a(g[h-2],g[h]),this._$);break;case 19:this.$={path:g[h-1],strip:a(g[h-2],g[h])};break;case 20:this.$=new e.MustacheNode(g[h-1],null,g[h-2],a(g[h-2],g[h]),this._$);break;case 21:this.$=new e.MustacheNode(g[h-1],null,g[h-2],a(g[h-2],g[h]),this._$);break;case 22:this.$=new e.PartialNode(g[h-2],g[h-1],a(g[h-3],g[h]),this._$);break;case 23:this.$=a(g[h-1],g[h]);break;case 24:this.$=new e.SexprNode([g[h-2]].concat(g[h-1]),g[h],this._$);break;case 25:this.$=new e.SexprNode([g[h]],null,this._$);break;case 26:this.$=g[h];break;case 27:this.$=new e.StringNode(g[h],this._$);break;case 28:this.$=new e.IntegerNode(g[h],this._$);break;case 29:this.$=new e.BooleanNode(g[h],this._$);break;case 30:this.$=g[h];break;case 31:g[h-1].isHelper=!0,this.$=g[h-1];break;case 32:this.$=new e.HashNode(g[h],this._$);break;case 33:this.$=[g[h-2],g[h]];break;case 34:this.$=new e.PartialNameNode(g[h],this._$);break;case 35:this.$=new e.PartialNameNode(new e.StringNode(g[h],this._$),this._$);break;case 36:this.$=new e.PartialNameNode(new e.IntegerNode(g[h],this._$));break;case 37:this.$=new e.DataNode(g[h],this._$);break;case 38:this.$=new e.IdNode(g[h],this._$);break;case 39:g[h-2].push({part:g[h],separator:g[h-1]}),this.$=g[h-2];break;case 40:this.$=[{part:g[h]}];break;case 43:this.$=[];break;case 44:g[h-1].push(g[h]);break;case 47:this.$=[g[h]];break;case 48:g[h-1].push(g[h])}},table:[{3:1,4:2,5:[1,3],8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],25:[1,15]},{1:[3]},{5:[1,16],8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],25:[1,15]},{1:[2,2]},{5:[2,9],14:[2,9],15:[2,9],16:[2,9],19:[2,9],20:[2,9],22:[2,9],23:[2,9],25:[2,9]},{4:20,6:18,7:19,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,21],20:[2,8],22:[1,13],23:[1,14],25:[1,15]},{4:20,6:22,7:19,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,21],20:[2,8],22:[1,13],23:[1,14],25:[1,15]},{5:[2,13],14:[2,13],15:[2,13],16:[2,13],19:[2,13],20:[2,13],22:[2,13],23:[2,13],25:[2,13]},{5:[2,14],14:[2,14],15:[2,14],16:[2,14],19:[2,14],20:[2,14],22:[2,14],23:[2,14],25:[2,14]},{5:[2,15],14:[2,15],15:[2,15],16:[2,15],19:[2,15],20:[2,15],22:[2,15],23:[2,15],25:[2,15]},{5:[2,16],14:[2,16],15:[2,16],16:[2,16],19:[2,16],20:[2,16],22:[2,16],23:[2,16],25:[2,16]},{17:23,21:24,30:25,40:[1,28],42:[1,27],43:26},{17:29,21:24,30:25,40:[1,28],42:[1,27],43:26},{17:30,21:24,30:25,40:[1,28],42:[1,27],43:26},{17:31,21:24,30:25,40:[1,28],42:[1,27],43:26},{21:33,26:32,32:[1,34],33:[1,35],40:[1,28],43:26},{1:[2,1]},{5:[2,10],14:[2,10],15:[2,10],16:[2,10],19:[2,10],20:[2,10],22:[2,10],23:[2,10],25:[2,10]},{10:36,20:[1,37]},{4:38,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,7],22:[1,13],23:[1,14],25:[1,15]},{7:39,8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,21],20:[2,6],22:[1,13],23:[1,14],25:[1,15]},{17:23,18:[1,40],21:24,30:25,40:[1,28],42:[1,27],43:26},{10:41,20:[1,37]},{18:[1,42]},{18:[2,43],24:[2,43],28:43,32:[2,43],33:[2,43],34:[2,43],35:[2,43],36:[2,43],40:[2,43],42:[2,43]},{18:[2,25],24:[2,25],36:[2,25]},{18:[2,38],24:[2,38],32:[2,38],33:[2,38],34:[2,38],35:[2,38],36:[2,38],40:[2,38],42:[2,38],44:[1,44]},{21:45,40:[1,28],43:26},{18:[2,40],24:[2,40],32:[2,40],33:[2,40],34:[2,40],35:[2,40],36:[2,40],40:[2,40],42:[2,40],44:[2,40]},{18:[1,46]},{18:[1,47]},{24:[1,48]},{18:[2,41],21:50,27:49,40:[1,28],43:26},{18:[2,34],40:[2,34]},{18:[2,35],40:[2,35]},{18:[2,36],40:[2,36]},{5:[2,11],14:[2,11],15:[2,11],16:[2,11],19:[2,11],20:[2,11],22:[2,11],23:[2,11],25:[2,11]},{21:51,40:[1,28],43:26},{8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,3],22:[1,13],23:[1,14],25:[1,15]},{4:52,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,5],22:[1,13],23:[1,14],25:[1,15]},{14:[2,23],15:[2,23],16:[2,23],19:[2,23],20:[2,23],22:[2,23],23:[2,23],25:[2,23]},{5:[2,12],14:[2,12],15:[2,12],16:[2,12],19:[2,12],20:[2,12],22:[2,12],23:[2,12],25:[2,12]},{14:[2,18],15:[2,18],16:[2,18],19:[2,18],20:[2,18],22:[2,18],23:[2,18],25:[2,18]},{18:[2,45],21:56,24:[2,45],29:53,30:60,31:54,32:[1,57],33:[1,58],34:[1,59],35:[1,61],36:[2,45],37:55,38:62,39:63,40:[1,64],42:[1,27],43:26},{40:[1,65]},{18:[2,37],24:[2,37],32:[2,37],33:[2,37],34:[2,37],35:[2,37],36:[2,37],40:[2,37],42:[2,37]},{14:[2,17],15:[2,17],16:[2,17],19:[2,17],20:[2,17],22:[2,17],23:[2,17],25:[2,17]},{5:[2,20],14:[2,20],15:[2,20],16:[2,20],19:[2,20],20:[2,20],22:[2,20],23:[2,20],25:[2,20]},{5:[2,21],14:[2,21],15:[2,21],16:[2,21],19:[2,21],20:[2,21],22:[2,21],23:[2,21],25:[2,21]},{18:[1,66]},{18:[2,42]},{18:[1,67]},{8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],25:[1,15]},{18:[2,24],24:[2,24],36:[2,24]},{18:[2,44],24:[2,44],32:[2,44],33:[2,44],34:[2,44],35:[2,44],36:[2,44],40:[2,44],42:[2,44]},{18:[2,46],24:[2,46],36:[2,46]},{18:[2,26],24:[2,26],32:[2,26],33:[2,26],34:[2,26],35:[2,26],36:[2,26],40:[2,26],42:[2,26]},{18:[2,27],24:[2,27],32:[2,27],33:[2,27],34:[2,27],35:[2,27],36:[2,27],40:[2,27],42:[2,27]},{18:[2,28],24:[2,28],32:[2,28],33:[2,28],34:[2,28],35:[2,28],36:[2,28],40:[2,28],42:[2,28]},{18:[2,29],24:[2,29],32:[2,29],33:[2,29],34:[2,29],35:[2,29],36:[2,29],40:[2,29],42:[2,29]},{18:[2,30],24:[2,30],32:[2,30],33:[2,30],34:[2,30],35:[2,30],36:[2,30],40:[2,30],42:[2,30]},{17:68,21:24,30:25,40:[1,28],42:[1,27],43:26},{18:[2,32],24:[2,32],36:[2,32],39:69,40:[1,70]},{18:[2,47],24:[2,47],36:[2,47],40:[2,47]},{18:[2,40],24:[2,40],32:[2,40],33:[2,40],34:[2,40],35:[2,40],36:[2,40],40:[2,40],41:[1,71],42:[2,40],44:[2,40]},{18:[2,39],24:[2,39],32:[2,39],33:[2,39],34:[2,39],35:[2,39],36:[2,39],40:[2,39],42:[2,39],44:[2,39]},{5:[2,22],14:[2,22],15:[2,22],16:[2,22],19:[2,22],20:[2,22],22:[2,22],23:[2,22],25:[2,22]},{5:[2,19],14:[2,19],15:[2,19],16:[2,19],19:[2,19],20:[2,19],22:[2,19],23:[2,19],25:[2,19]},{36:[1,72]},{18:[2,48],24:[2,48],36:[2,48],40:[2,48]},{41:[1,71]},{21:56,30:60,31:73,32:[1,57],33:[1,58],34:[1,59],35:[1,61],40:[1,28],42:[1,27],43:26},{18:[2,31],24:[2,31],32:[2,31],33:[2,31],34:[2,31],35:[2,31],36:[2,31],40:[2,31],42:[2,31]},{18:[2,33],24:[2,33],36:[2,33],40:[2,33]}],defaultActions:{3:[2,2],16:[2,1],50:[2,42]},parseError:function(a){throw new Error(a)},parse:function(a){function b(){var a;return a=c.lexer.lex()||1,"number"!=typeof a&&(a=c.symbols_[a]||a),a}var c=this,d=[0],e=[null],f=[],g=this.table,h="",i=0,j=0,k=0;this.lexer.setInput(a),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,this.yy.parser=this,"undefined"==typeof this.lexer.yylloc&&(this.lexer.yylloc={});var l=this.lexer.yylloc;f.push(l);var m=this.lexer.options&&this.lexer.options.ranges;"function"==typeof this.yy.parseError&&(this.parseError=this.yy.parseError);for(var n,o,p,q,r,s,t,u,v,w={};;){if(p=d[d.length-1],this.defaultActions[p]?q=this.defaultActions[p]:((null===n||"undefined"==typeof n)&&(n=b()),q=g[p]&&g[p][n]),"undefined"==typeof q||!q.length||!q[0]){var x="";if(!k){v=[];for(s in g[p])this.terminals_[s]&&s>2&&v.push("'"+this.terminals_[s]+"'");x=this.lexer.showPosition?"Parse error on line "+(i+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+v.join(", ")+", got '"+(this.terminals_[n]||n)+"'":"Parse error on line "+(i+1)+": Unexpected "+(1==n?"end of input":"'"+(this.terminals_[n]||n)+"'"),this.parseError(x,{text:this.lexer.match,token:this.terminals_[n]||n,line:this.lexer.yylineno,loc:l,expected:v})}}if(q[0]instanceof Array&&q.length>1)throw new Error("Parse Error: multiple actions possible at state: "+p+", token: "+n);switch(q[0]){case 1:d.push(n),e.push(this.lexer.yytext),f.push(this.lexer.yylloc),d.push(q[1]),n=null,o?(n=o,o=null):(j=this.lexer.yyleng,h=this.lexer.yytext,i=this.lexer.yylineno,l=this.lexer.yylloc,k>0&&k--);break;case 2:if(t=this.productions_[q[1]][1],w.$=e[e.length-t],w._$={first_line:f[f.length-(t||1)].first_line,last_line:f[f.length-1].last_line,first_column:f[f.length-(t||1)].first_column,last_column:f[f.length-1].last_column},m&&(w._$.range=[f[f.length-(t||1)].range[0],f[f.length-1].range[1]]),r=this.performAction.call(w,h,j,i,this.yy,q[1],e,f),"undefined"!=typeof r)return r;t&&(d=d.slice(0,-1*t*2),e=e.slice(0,-1*t),f=f.slice(0,-1*t)),d.push(this.productions_[q[1]][0]),e.push(w.$),f.push(w._$),u=g[d[d.length-2]][d[d.length-1]],d.push(u);break;case 3:return!0}}return!0}},d=function(){var a={EOF:1,parseError:function(a,b){if(!this.yy.parser)throw new Error(a);this.yy.parser.parseError(a,b)},setInput:function(a){return this._input=a,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var a=this._input[0];this.yytext+=a,this.yyleng++,this.offset++,this.match+=a,this.matched+=a;var b=a.match(/(?:\r\n?|\n).*/g);return b?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),a},unput:function(a){var b=a.length,c=a.split(/(?:\r\n?|\n)/g);this._input=a+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-b-1),this.offset-=b;var d=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),c.length-1&&(this.yylineno-=c.length-1);var e=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:c?(c.length===d.length?this.yylloc.first_column:0)+d[d.length-c.length].length-c[0].length:this.yylloc.first_column-b},this.options.ranges&&(this.yylloc.range=[e[0],e[0]+this.yyleng-b]),this},more:function(){return this._more=!0,this},less:function(a){this.unput(this.match.slice(a))},pastInput:function(){var a=this.matched.substr(0,this.matched.length-this.match.length);return(a.length>20?"...":"")+a.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var a=this.match;return a.length<20&&(a+=this._input.substr(0,20-a.length)),(a.substr(0,20)+(a.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var a=this.pastInput(),b=new Array(a.length+1).join("-");return a+this.upcomingInput()+"\n"+b+"^"},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var a,b,c,d,e;this._more||(this.yytext="",this.match="");for(var f=this._currentRules(),g=0;g<f.length&&(c=this._input.match(this.rules[f[g]]),!c||b&&!(c[0].length>b[0].length)||(b=c,d=g,this.options.flex));g++);return b?(e=b[0].match(/(?:\r\n?|\n).*/g),e&&(this.yylineno+=e.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:e?e[e.length-1].length-e[e.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+b[0].length},this.yytext+=b[0],this.match+=b[0],this.matches=b,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._input=this._input.slice(b[0].length),this.matched+=b[0],a=this.performAction.call(this,this.yy,this,f[d],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),a?a:void 0):""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var a=this.next();return"undefined"!=typeof a?a:this.lex()},begin:function(a){this.conditionStack.push(a)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(a){this.begin(a)}};return a.options={},a.performAction=function(a,b,c,d){function e(a,c){return b.yytext=b.yytext.substr(a,b.yyleng-c)}switch(c){case 0:if("\\\\"===b.yytext.slice(-2)?(e(0,1),this.begin("mu")):"\\"===b.yytext.slice(-1)?(e(0,1),this.begin("emu")):this.begin("mu"),b.yytext)return 14;break;case 1:return 14;case 2:return this.popState(),14;case 3:return e(0,4),this.popState(),15;case 4:return 35;case 5:return 36;case 6:return 25;case 7:return 16;case 8:return 20;case 9:return 19;case 10:return 19;case 11:return 23;case 12:return 22;case 13:this.popState(),this.begin("com");break;case 14:return e(3,5),this.popState(),15;case 15:return 22;case 16:return 41;case 17:return 40;case 18:return 40;case 19:return 44;case 20:break;case 21:return this.popState(),24;case 22:return this.popState(),18;case 23:return b.yytext=e(1,2).replace(/\\"/g,'"'),32;case 24:return b.yytext=e(1,2).replace(/\\'/g,"'"),32;case 25:return 42;case 26:return 34;case 27:return 34;case 28:return 33;case 29:return 40;case 30:return b.yytext=e(1,2),40;case 31:return"INVALID";case 32:return 5}},a.rules=[/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:[\s\S]*?--\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{!--)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{(~)?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:-?[0-9]+(?=([~}\s)])))/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)]))))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/],a.conditions={mu:{rules:[4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32],inclusive:!1},emu:{rules:[2],inclusive:!1},com:{rules:[3],inclusive:!1},INITIAL:{rules:[0,1,32],inclusive:!0}},a}();return c.lexer=d,b.prototype=c,c.Parser=b,new b}();a["default"]=b}),define("handlebars/compiler/base",["./parser","./ast","exports"],function(a,b,c){function d(a){return a.constructor===f.ProgramNode?a:(e.yy=f,e.parse(a))}var e=a["default"],f=b["default"];c.parser=e,c.parse=d}),define("handlebars/compiler/compiler",["../exception","exports"],function(a,b){function c(){}function d(a,b,c){if(null==a||"string"!=typeof a&&a.constructor!==c.AST.ProgramNode)throw new f("You must pass a string or Handlebars AST to Handlebars.precompile. You passed "+a);b=b||{},"data"in b||(b.data=!0);var d=c.parse(a),e=(new c.Compiler).compile(d,b);return(new c.JavaScriptCompiler).compile(e,b)}function e(a,b,c){function d(){var d=c.parse(a),e=(new c.Compiler).compile(d,b),f=(new c.JavaScriptCompiler).compile(e,b,void 0,!0);return c.template(f)}if(null==a||"string"!=typeof a&&a.constructor!==c.AST.ProgramNode)throw new f("You must pass a string or Handlebars AST to Handlebars.compile. You passed "+a);b=b||{},"data"in b||(b.data=!0);var e;return function(a,b){return e||(e=d()),e.call(this,a,b)}}var f=a["default"];b.Compiler=c,c.prototype={compiler:c,disassemble:function(){for(var a,b,c,d=this.opcodes,e=[],f=0,g=d.length;g>f;f++)if(a=d[f],"DECLARE"===a.opcode)e.push("DECLARE "+a.name+"="+a.value);else{b=[];for(var h=0;h<a.args.length;h++)c=a.args[h],"string"==typeof c&&(c='"'+c.replace("\n","\\n")+'"'),b.push(c);e.push(a.opcode+" "+b.join(" "))}return e.join("\n")},equals:function(a){var b=this.opcodes.length;if(a.opcodes.length!==b)return!1;for(var c=0;b>c;c++){var d=this.opcodes[c],e=a.opcodes[c];if(d.opcode!==e.opcode||d.args.length!==e.args.length)return!1;for(var f=0;f<d.args.length;f++)if(d.args[f]!==e.args[f])return!1}if(b=this.children.length,a.children.length!==b)return!1;for(c=0;b>c;c++)if(!this.children[c].equals(a.children[c]))return!1;return!0},guid:0,compile:function(a,b){this.opcodes=[],this.children=[],this.depths={list:[]},this.options=b;var c=this.options.knownHelpers;if(this.options.knownHelpers={helperMissing:!0,blockHelperMissing:!0,each:!0,"if":!0,unless:!0,"with":!0,log:!0},c)for(var d in c)this.options.knownHelpers[d]=c[d];return this.accept(a)},accept:function(a){var b,c=a.strip||{};return c.left&&this.opcode("strip"),b=this[a.type](a),c.right&&this.opcode("strip"),b},program:function(a){for(var b=a.statements,c=0,d=b.length;d>c;c++)this.accept(b[c]);return this.isSimple=1===d,this.depths.list=this.depths.list.sort(function(a,b){return a-b}),this},compileProgram:function(a){var b,c=(new this.compiler).compile(a,this.options),d=this.guid++;this.usePartial=this.usePartial||c.usePartial,this.children[d]=c;for(var e=0,f=c.depths.list.length;f>e;e++)b=c.depths.list[e],2>b||this.addDepth(b-1);return d},block:function(a){var b=a.mustache,c=a.program,d=a.inverse;c&&(c=this.compileProgram(c)),d&&(d=this.compileProgram(d));var e=b.sexpr,f=this.classifySexpr(e);"helper"===f?this.helperSexpr(e,c,d):"simple"===f?(this.simpleSexpr(e),this.opcode("pushProgram",c),this.opcode("pushProgram",d),this.opcode("emptyHash"),this.opcode("blockValue")):(this.ambiguousSexpr(e,c,d),this.opcode("pushProgram",c),this.opcode("pushProgram",d),this.opcode("emptyHash"),this.opcode("ambiguousBlockValue")),this.opcode("append")},hash:function(a){var b,c,d=a.pairs;this.opcode("pushHash");for(var e=0,f=d.length;f>e;e++)b=d[e],c=b[1],this.options.stringParams?(c.depth&&this.addDepth(c.depth),this.opcode("getContext",c.depth||0),this.opcode("pushStringParam",c.stringModeValue,c.type),"sexpr"===c.type&&this.sexpr(c)):this.accept(c),this.opcode("assignToHash",b[0]);this.opcode("popHash")},partial:function(a){var b=a.partialName;this.usePartial=!0,a.context?this.ID(a.context):this.opcode("push","depth0"),this.opcode("invokePartial",b.name),this.opcode("append")},content:function(a){this.opcode("appendContent",a.string)},mustache:function(a){this.sexpr(a.sexpr),a.escaped&&!this.options.noEscape?this.opcode("appendEscaped"):this.opcode("append")},ambiguousSexpr:function(a,b,c){var d=a.id,e=d.parts[0],f=null!=b||null!=c;this.opcode("getContext",d.depth),this.opcode("pushProgram",b),this.opcode("pushProgram",c),this.opcode("invokeAmbiguous",e,f)},simpleSexpr:function(a){var b=a.id;"DATA"===b.type?this.DATA(b):b.parts.length?this.ID(b):(this.addDepth(b.depth),this.opcode("getContext",b.depth),this.opcode("pushContext")),this.opcode("resolvePossibleLambda")},helperSexpr:function(a,b,c){var d=this.setupFullMustacheParams(a,b,c),e=a.id.parts[0];if(this.options.knownHelpers[e])this.opcode("invokeKnownHelper",d.length,e);else{if(this.options.knownHelpersOnly)throw new f("You specified knownHelpersOnly, but used the unknown helper "+e,a);this.opcode("invokeHelper",d.length,e,a.isRoot)}},sexpr:function(a){var b=this.classifySexpr(a);"simple"===b?this.simpleSexpr(a):"helper"===b?this.helperSexpr(a):this.ambiguousSexpr(a)},ID:function(a){this.addDepth(a.depth),this.opcode("getContext",a.depth);var b=a.parts[0];b?this.opcode("lookupOnContext",a.parts[0]):this.opcode("pushContext");for(var c=1,d=a.parts.length;d>c;c++)this.opcode("lookup",a.parts[c])},DATA:function(a){if(this.options.data=!0,a.id.isScoped||a.id.depth)throw new f("Scoped data references are not supported: "+a.original,a);this.opcode("lookupData");for(var b=a.id.parts,c=0,d=b.length;d>c;c++)this.opcode("lookup",b[c])},STRING:function(a){this.opcode("pushString",a.string)},INTEGER:function(a){this.opcode("pushLiteral",a.integer)},BOOLEAN:function(a){this.opcode("pushLiteral",a.bool)},comment:function(){},opcode:function(a){this.opcodes.push({opcode:a,args:[].slice.call(arguments,1)})},declare:function(a,b){this.opcodes.push({opcode:"DECLARE",name:a,value:b})},addDepth:function(a){0!==a&&(this.depths[a]||(this.depths[a]=!0,this.depths.list.push(a)))},classifySexpr:function(a){var b=a.isHelper,c=a.eligibleHelper,d=this.options;if(c&&!b){var e=a.id.parts[0];d.knownHelpers[e]?b=!0:d.knownHelpersOnly&&(c=!1)}return b?"helper":c?"ambiguous":"simple"},pushParams:function(a){for(var b,c=a.length;c--;)b=a[c],this.options.stringParams?(b.depth&&this.addDepth(b.depth),this.opcode("getContext",b.depth||0),this.opcode("pushStringParam",b.stringModeValue,b.type),"sexpr"===b.type&&this.sexpr(b)):this[b.type](b)},setupFullMustacheParams:function(a,b,c){var d=a.params;return this.pushParams(d),this.opcode("pushProgram",b),this.opcode("pushProgram",c),a.hash?this.hash(a.hash):this.opcode("emptyHash"),d}},b.precompile=d,b.compile=e}),define("handlebars/compiler/javascript-compiler",["../base","../exception","exports"],function(a,b,c){function d(a){this.value=a}function e(){}var f=a.COMPILER_REVISION,g=a.REVISION_CHANGES,h=a.log,i=b["default"];e.prototype={nameLookup:function(a,b){var c,d;return 0===a.indexOf("depth")&&(c=!0),d=/^[0-9]+$/.test(b)?a+"["+b+"]":e.isValidJavaScriptVariableName(b)?a+"."+b:a+"['"+b+"']",c?"("+a+" && "+d+")":d},compilerInfo:function(){var a=f,b=g[a];return"this.compilerInfo = ["+a+",'"+b+"'];\n" | ||
},appendToBuffer:function(a){return this.environment.isSimple?"return "+a+";":{appendToBuffer:!0,content:a,toString:function(){return"buffer += "+a+";"}}},initializeBuffer:function(){return this.quotedString("")},namespace:"Handlebars",compile:function(a,b,c,d){this.environment=a,this.options=b||{},h("debug",this.environment.disassemble()+"\n\n"),this.name=this.environment.name,this.isChild=!!c,this.context=c||{programs:[],environments:[],aliases:{}},this.preamble(),this.stackSlot=0,this.stackVars=[],this.registers={list:[]},this.hashes=[],this.compileStack=[],this.inlineStack=[],this.compileChildren(a,b);var e,f=a.opcodes;this.i=0;for(var g=f.length;this.i<g;this.i++)e=f[this.i],"DECLARE"===e.opcode?this[e.name]=e.value:this[e.opcode].apply(this,e.args),e.opcode!==this.stripNext&&(this.stripNext=!1);if(this.pushSource(""),this.stackSlot||this.inlineStack.length||this.compileStack.length)throw new i("Compile completed with content left on stack");return this.createFunctionContext(d)},preamble:function(){var a=[];if(this.isChild)a.push("");else{var b=this.namespace,c="helpers = this.merge(helpers, "+b+".helpers);";this.environment.usePartial&&(c=c+" partials = this.merge(partials, "+b+".partials);"),this.options.data&&(c+=" data = data || {};"),a.push(c)}this.environment.isSimple?a.push(""):a.push(", buffer = "+this.initializeBuffer()),this.lastContext=0,this.source=a},createFunctionContext:function(a){var b=this.stackVars.concat(this.registers.list);if(b.length>0&&(this.source[1]=this.source[1]+", "+b.join(", ")),!this.isChild)for(var c in this.context.aliases)this.context.aliases.hasOwnProperty(c)&&(this.source[1]=this.source[1]+", "+c+"="+this.context.aliases[c]);this.source[1]&&(this.source[1]="var "+this.source[1].substring(2)+";"),this.isChild||(this.source[1]+="\n"+this.context.programs.join("\n")+"\n"),this.environment.isSimple||this.pushSource("return buffer;");for(var d=this.isChild?["depth0","data"]:["Handlebars","depth0","helpers","partials","data"],e=0,f=this.environment.depths.list.length;f>e;e++)d.push("depth"+this.environment.depths.list[e]);var g=this.mergeSource();if(this.isChild||(g=this.compilerInfo()+g),a)return d.push(g),Function.apply(this,d);var i="function "+(this.name||"")+"("+d.join(",")+") {\n "+g+"}";return h("debug",i+"\n\n"),i},mergeSource:function(){for(var a,b="",c=0,d=this.source.length;d>c;c++){var e=this.source[c];e.appendToBuffer?a=a?a+"\n + "+e.content:e.content:(a&&(b+="buffer += "+a+";\n ",a=void 0),b+=e+"\n ")}return b},blockValue:function(){this.context.aliases.blockHelperMissing="helpers.blockHelperMissing";var a=["depth0"];this.setupParams(0,a),this.replaceStack(function(b){return a.splice(1,0,b),"blockHelperMissing.call("+a.join(", ")+")"})},ambiguousBlockValue:function(){this.context.aliases.blockHelperMissing="helpers.blockHelperMissing";var a=["depth0"];this.setupParams(0,a);var b=this.topStack();a.splice(1,0,b),this.pushSource("if (!"+this.lastHelper+") { "+b+" = blockHelperMissing.call("+a.join(", ")+"); }")},appendContent:function(a){this.pendingContent&&(a=this.pendingContent+a),this.stripNext&&(a=a.replace(/^\s+/,"")),this.pendingContent=a},strip:function(){this.pendingContent&&(this.pendingContent=this.pendingContent.replace(/\s+$/,"")),this.stripNext="strip"},append:function(){this.flushInline();var a=this.popStack();this.pushSource("if("+a+" || "+a+" === 0) { "+this.appendToBuffer(a)+" }"),this.environment.isSimple&&this.pushSource("else { "+this.appendToBuffer("''")+" }")},appendEscaped:function(){this.context.aliases.escapeExpression="this.escapeExpression",this.pushSource(this.appendToBuffer("escapeExpression("+this.popStack()+")"))},getContext:function(a){this.lastContext!==a&&(this.lastContext=a)},lookupOnContext:function(a){this.push(this.nameLookup("depth"+this.lastContext,a,"context"))},pushContext:function(){this.pushStackLiteral("depth"+this.lastContext)},resolvePossibleLambda:function(){this.context.aliases.functionType='"function"',this.replaceStack(function(a){return"typeof "+a+" === functionType ? "+a+".apply(depth0) : "+a})},lookup:function(a){this.replaceStack(function(b){return b+" == null || "+b+" === false ? "+b+" : "+this.nameLookup(b,a,"context")})},lookupData:function(){this.pushStackLiteral("data")},pushStringParam:function(a,b){this.pushStackLiteral("depth"+this.lastContext),this.pushString(b),"sexpr"!==b&&("string"==typeof a?this.pushString(a):this.pushStackLiteral(a))},emptyHash:function(){this.pushStackLiteral("{}"),this.options.stringParams&&(this.push("{}"),this.push("{}"))},pushHash:function(){this.hash&&this.hashes.push(this.hash),this.hash={values:[],types:[],contexts:[]}},popHash:function(){var a=this.hash;this.hash=this.hashes.pop(),this.options.stringParams&&(this.push("{"+a.contexts.join(",")+"}"),this.push("{"+a.types.join(",")+"}")),this.push("{\n "+a.values.join(",\n ")+"\n }")},pushString:function(a){this.pushStackLiteral(this.quotedString(a))},push:function(a){return this.inlineStack.push(a),a},pushLiteral:function(a){this.pushStackLiteral(a)},pushProgram:function(a){null!=a?this.pushStackLiteral(this.programExpression(a)):this.pushStackLiteral(null)},invokeHelper:function(a,b,c){this.context.aliases.helperMissing="helpers.helperMissing",this.useRegister("helper");var d=this.lastHelper=this.setupHelper(a,b,!0),e=this.nameLookup("depth"+this.lastContext,b,"context"),f="helper = "+d.name+" || "+e;d.paramsInit&&(f+=","+d.paramsInit),this.push("("+f+",helper ? helper.call("+d.callParams+") : helperMissing.call("+d.helperMissingParams+"))"),c||this.flushInline()},invokeKnownHelper:function(a,b){var c=this.setupHelper(a,b);this.push(c.name+".call("+c.callParams+")")},invokeAmbiguous:function(a,b){this.context.aliases.functionType='"function"',this.useRegister("helper"),this.emptyHash();var c=this.setupHelper(0,a,b),d=this.lastHelper=this.nameLookup("helpers",a,"helper"),e=this.nameLookup("depth"+this.lastContext,a,"context"),f=this.nextStack();c.paramsInit&&this.pushSource(c.paramsInit),this.pushSource("if (helper = "+d+") { "+f+" = helper.call("+c.callParams+"); }"),this.pushSource("else { helper = "+e+"; "+f+" = typeof helper === functionType ? helper.call("+c.callParams+") : helper; }")},invokePartial:function(a){var b=[this.nameLookup("partials",a,"partial"),"'"+a+"'",this.popStack(),"helpers","partials"];this.options.data&&b.push("data"),this.context.aliases.self="this",this.push("self.invokePartial("+b.join(", ")+")")},assignToHash:function(a){var b,c,d=this.popStack();this.options.stringParams&&(c=this.popStack(),b=this.popStack());var e=this.hash;b&&e.contexts.push("'"+a+"': "+b),c&&e.types.push("'"+a+"': "+c),e.values.push("'"+a+"': ("+d+")")},compiler:e,compileChildren:function(a,b){for(var c,d,e=a.children,f=0,g=e.length;g>f;f++){c=e[f],d=new this.compiler;var h=this.matchExistingProgram(c);null==h?(this.context.programs.push(""),h=this.context.programs.length,c.index=h,c.name="program"+h,this.context.programs[h]=d.compile(c,b,this.context),this.context.environments[h]=c):(c.index=h,c.name="program"+h)}},matchExistingProgram:function(a){for(var b=0,c=this.context.environments.length;c>b;b++){var d=this.context.environments[b];if(d&&d.equals(a))return b}},programExpression:function(a){if(this.context.aliases.self="this",null==a)return"self.noop";for(var b,c=this.environment.children[a],d=c.depths.list,e=[c.index,c.name,"data"],f=0,g=d.length;g>f;f++)b=d[f],1===b?e.push("depth0"):e.push("depth"+(b-1));return(0===d.length?"self.program(":"self.programWithDepth(")+e.join(", ")+")"},register:function(a,b){this.useRegister(a),this.pushSource(a+" = "+b+";")},useRegister:function(a){this.registers[a]||(this.registers[a]=!0,this.registers.list.push(a))},pushStackLiteral:function(a){return this.push(new d(a))},pushSource:function(a){this.pendingContent&&(this.source.push(this.appendToBuffer(this.quotedString(this.pendingContent))),this.pendingContent=void 0),a&&this.source.push(a)},pushStack:function(a){this.flushInline();var b=this.incrStack();return a&&this.pushSource(b+" = "+a+";"),this.compileStack.push(b),b},replaceStack:function(a){var b,c,e,f="",g=this.isInline();if(g){var h=this.popStack(!0);if(h instanceof d)b=h.value,e=!0;else{c=!this.stackSlot;var i=c?this.incrStack():this.topStackName();f="("+this.push(i)+" = "+h+"),",b=this.topStack()}}else b=this.topStack();var j=a.call(this,b);return g?(e||this.popStack(),c&&this.stackSlot--,this.push("("+f+j+")")):(/^stack/.test(b)||(b=this.nextStack()),this.pushSource(b+" = ("+f+j+");")),b},nextStack:function(){return this.pushStack()},incrStack:function(){return this.stackSlot++,this.stackSlot>this.stackVars.length&&this.stackVars.push("stack"+this.stackSlot),this.topStackName()},topStackName:function(){return"stack"+this.stackSlot},flushInline:function(){var a=this.inlineStack;if(a.length){this.inlineStack=[];for(var b=0,c=a.length;c>b;b++){var e=a[b];e instanceof d?this.compileStack.push(e):this.pushStack(e)}}},isInline:function(){return this.inlineStack.length},popStack:function(a){var b=this.isInline(),c=(b?this.inlineStack:this.compileStack).pop();if(!a&&c instanceof d)return c.value;if(!b){if(!this.stackSlot)throw new i("Invalid stack pop");this.stackSlot--}return c},topStack:function(a){var b=this.isInline()?this.inlineStack:this.compileStack,c=b[b.length-1];return!a&&c instanceof d?c.value:c},quotedString:function(a){return'"'+a.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")+'"'},setupHelper:function(a,b,c){var d=[],e=this.setupParams(a,d,c),f=this.nameLookup("helpers",b,"helper");return{params:d,paramsInit:e,name:f,callParams:["depth0"].concat(d).join(", "),helperMissingParams:c&&["depth0",this.quotedString(b)].concat(d).join(", ")}},setupOptions:function(a,b){var c,d,e,f=[],g=[],h=[];f.push("hash:"+this.popStack()),this.options.stringParams&&(f.push("hashTypes:"+this.popStack()),f.push("hashContexts:"+this.popStack())),d=this.popStack(),e=this.popStack(),(e||d)&&(e||(this.context.aliases.self="this",e="self.noop"),d||(this.context.aliases.self="this",d="self.noop"),f.push("inverse:"+d),f.push("fn:"+e));for(var i=0;a>i;i++)c=this.popStack(),b.push(c),this.options.stringParams&&(h.push(this.popStack()),g.push(this.popStack()));return this.options.stringParams&&(f.push("contexts:["+g.join(",")+"]"),f.push("types:["+h.join(",")+"]")),this.options.data&&f.push("data:data"),f},setupParams:function(a,b,c){var d="{"+this.setupOptions(a,b).join(",")+"}";return c?(this.useRegister("options"),b.push("options"),"options="+d):(b.push(d),"")}};for(var j="break else new var case finally return void catch for switch while continue function this with default if throw delete in try do instanceof typeof abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public let yield".split(" "),k=e.RESERVED_WORDS={},l=0,m=j.length;m>l;l++)k[j[l]]=!0;e.isValidJavaScriptVariableName=function(a){return!e.RESERVED_WORDS[a]&&/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(a)?!0:!1},c["default"]=e}),define("handlebars",["./handlebars.runtime","./handlebars/compiler/ast","./handlebars/compiler/base","./handlebars/compiler/compiler","./handlebars/compiler/javascript-compiler","exports"],function(a,b,c,d,e,f){var g=a["default"],h=b["default"],i=c.parser,j=c.parse,k=d.Compiler,l=d.compile,m=d.precompile,n=e["default"],o=g.create,p=function(){var a=o();return a.compile=function(b,c){return l(b,c,a)},a.precompile=function(b,c){return m(b,c,a)},a.AST=h,a.Compiler=k,a.JavaScriptCompiler=n,a.Parser=i,a.parse=j,a};g=p(),g.create=p,f["default"]=g}); | ||
define("handlebars/safe-string",["exports"],function(a){function b(a){this.string=a}b.prototype.toString=function(){return""+this.string},a["default"]=b}),define("handlebars/utils",["./safe-string","exports"],function(a,b){function c(a){return i[a]||"&"}function d(a){for(var b=1;b<arguments.length;b++)for(var c in arguments[b])Object.prototype.hasOwnProperty.call(arguments[b],c)&&(a[c]=arguments[b][c]);return a}function e(a){return a instanceof h?a.toString():a||0===a?(a=""+a,k.test(a)?a.replace(j,c):a):""}function f(a){return a||0===a?n(a)&&0===a.length?!0:!1:!0}function g(a,b){return(a?a+".":"")+b}var h=a["default"],i={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},j=/[&<>"'`]/g,k=/[&<>"'`]/;b.extend=d;var l=Object.prototype.toString;b.toString=l;var m=function(a){return"function"==typeof a};m(/x/)&&(m=function(a){return"function"==typeof a&&"[object Function]"===l.call(a)});var m;b.isFunction=m;var n=Array.isArray||function(a){return a&&"object"==typeof a?"[object Array]"===l.call(a):!1};b.isArray=n,b.escapeExpression=e,b.isEmpty=f,b.appendContextPath=g}),define("handlebars/exception",["exports"],function(a){function b(a,b){var d;b&&b.firstLine&&(d=b.firstLine,a+=" - "+d+":"+b.firstColumn);for(var e=Error.prototype.constructor.call(this,a),f=0;f<c.length;f++)this[c[f]]=e[c[f]];d&&(this.lineNumber=d,this.column=b.firstColumn)}var c=["description","fileName","lineNumber","message","name","number","stack"];b.prototype=new Error,a["default"]=b}),define("handlebars/base",["./utils","./exception","exports"],function(a,b,c){function d(a,b){this.helpers=a||{},this.partials=b||{},e(this)}function e(a){a.registerHelper("helperMissing",function(){if(1===arguments.length)return void 0;throw new h("Missing helper: '"+arguments[arguments.length-1].name+"'")}),a.registerHelper("blockHelperMissing",function(b,c){var d=c.inverse||function(){},e=c.fn;if(m(b)&&(b=b.call(this)),b===!0)return e(this);if(b===!1||null==b)return d(this);if(l(b))return b.length>0?(c.ids&&(c.ids=[c.name]),a.helpers.each(b,c)):d(this);if(c.data&&c.ids){var f=q(c.data);f.contextPath=g.appendContextPath(c.data.contextPath,c.name),c={data:f}}return e(b,c)}),a.registerHelper("each",function(a,b){b||(b=a,a=this);var c,d,e=b.fn,f=b.inverse,h=0,i="";if(b.data&&b.ids&&(d=g.appendContextPath(b.data.contextPath,b.ids[0])+"."),m(a)&&(a=a.call(this)),b.data&&(c=q(b.data)),a&&"object"==typeof a)if(l(a))for(var j=a.length;j>h;h++)c&&(c.index=h,c.first=0===h,c.last=h===a.length-1,d&&(c.contextPath=d+h)),i+=e(a[h],{data:c});else for(var k in a)a.hasOwnProperty(k)&&(c&&(c.key=k,c.index=h,c.first=0===h,d&&(c.contextPath=d+k)),i+=e(a[k],{data:c}),h++);return 0===h&&(i=f(this)),i}),a.registerHelper("if",function(a,b){return m(a)&&(a=a.call(this)),!b.hash.includeZero&&!a||g.isEmpty(a)?b.inverse(this):b.fn(this)}),a.registerHelper("unless",function(b,c){return a.helpers["if"].call(this,b,{fn:c.inverse,inverse:c.fn,hash:c.hash})}),a.registerHelper("with",function(a,b){m(a)&&(a=a.call(this));var c=b.fn;if(!g.isEmpty(a)){if(b.data&&b.ids){var d=q(b.data);d.contextPath=g.appendContextPath(b.data.contextPath,b.ids[0]),b={data:d}}return c(a,b)}}),a.registerHelper("log",function(b,c){var d=c.data&&null!=c.data.level?parseInt(c.data.level,10):1;a.log(d,b)}),a.registerHelper("lookup",function(a,b){return a&&a[b]})}function f(a,b){p.log(a,b)}var g=a,h=b["default"],i="v2.0.0-alpha.1";c.VERSION=i;var j=5;c.COMPILER_REVISION=j;var k={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:"== 1.x.x",5:">= 2.0.0"};c.REVISION_CHANGES=k;var l=g.isArray,m=g.isFunction,n=g.toString,o="[object Object]";c.HandlebarsEnvironment=d,d.prototype={constructor:d,logger:p,log:f,registerHelper:function(a,b,c){if(n.call(a)===o){if(c||b)throw new h("Arg not supported with multiple helpers");g.extend(this.helpers,a)}else c&&(b.not=c),this.helpers[a]=b},unregisterHelper:function(a){delete this.helpers[a]},registerPartial:function(a,b){n.call(a)===o?g.extend(this.partials,a):this.partials[a]=b},unregisterPartial:function(a){delete this.partials[a]}};var p={methodMap:{0:"debug",1:"info",2:"warn",3:"error"},DEBUG:0,INFO:1,WARN:2,ERROR:3,level:3,log:function(a,b){if(p.level<=a){var c=p.methodMap[a];"undefined"!=typeof console&&console[c]&&console[c].call(console,b)}}};c.logger=p,c.log=f;var q=function(a){var b=g.extend({},a);return b._parent=a,b};c.createFrame=q}),define("handlebars/runtime",["./utils","./exception","./base","exports"],function(a,b,c,d){function e(a){var b=a&&a[0]||1,c=m;if(b!==c){if(c>b){var d=n[c],e=n[b];throw new l("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+d+") or downgrade your runtime to an older version ("+e+").")}throw new l("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+a[1]+").")}}function f(a,b){if(!b)throw new l("No environment passed to template");b.VM.checkRevision(a.compiler);var c=function(a,c,d,e,f,g,h){e&&(d=k.extend({},d,e));var i=b.VM.invokePartial.call(this,a,c,d,f,g,h);if(null!=i)return i;if(b.compile){var j={helpers:f,partials:g,data:h};return g[c]=b.compile(a,{data:void 0!==h},b),g[c](d,j)}throw new l("The partial "+c+" could not be compiled when running in runtime-only mode")},d={escapeExpression:k.escapeExpression,invokePartial:c,fn:function(b){return a[b]},programs:[],program:function(a,b){var c=this.programs[a],d=this.fn(a);return b?c=h(this,a,d,b):c||(c=this.programs[a]=h(this,a,d)),c},programWithDepth:b.VM.programWithDepth,initData:function(a,b){return b&&"root"in b||(b=b?o(b):{},b.root=a),b},data:function(a,b){for(;a&&b--;)a=a._parent;return a},merge:function(a,b){var c=a||b;return a&&b&&a!==b&&(c=k.extend({},b,a)),c},noop:b.VM.noop,compilerInfo:a.compiler},e=function(c,e){e=e||{};var f,g,h=e.partial?e:b,i=e.data;return e.partial?(f=d.helpers=e.helpers,g=d.partials=e.partials):(f=d.helpers=d.merge(e.helpers,h.helpers),a.usePartial&&(g=d.partials=d.merge(e.partials,h.partials)),a.useData&&(i=d.initData(c,i))),a.main.call(d,c,f,g,i)};return e.child=function(a){return d.programWithDepth(a)},e}function g(a,b){var c=Array.prototype.slice.call(arguments,2),d=this,e=d.fn(a),f=function(a,f){return f=f||{},e.apply(d,[a,d.helpers,d.partials,f.data||b].concat(c))};return f.program=a,f.depth=c.length,f}function h(a,b,c,d){var e=function(b,e){return e=e||{},c.call(a,b,a.helpers,a.partials,e.data||d)};return e.program=b,e.depth=0,e}function i(a,b,c,d,e,f){var g={partial:!0,helpers:d,partials:e,data:f};if(void 0===a)throw new l("The partial "+b+" could not be found");return a instanceof Function?a(c,g):void 0}function j(){return""}var k=a,l=b["default"],m=c.COMPILER_REVISION,n=c.REVISION_CHANGES,o=c.createFrame;d.checkRevision=e,d.template=f,d.programWithDepth=g,d.program=h,d.invokePartial=i,d.noop=j}),define("handlebars.runtime",["./handlebars/base","./handlebars/safe-string","./handlebars/exception","./handlebars/utils","./handlebars/runtime","exports"],function(a,b,c,d,e,f){var g=a,h=b["default"],i=c["default"],j=d,k=e,l=function(){var a=new g.HandlebarsEnvironment;return j.extend(a,g),a.SafeString=h,a.Exception=i,a.Utils=j,a.VM=k,a.template=function(b){return k.template(b,a)},a},m=l();m.create=l,f["default"]=m}),define("handlebars/compiler/ast",["../exception","exports"],function(a,b){function c(a){a=a||{},this.firstLine=a.first_line,this.firstColumn=a.first_column,this.lastColumn=a.last_column,this.lastLine=a.last_line}var d=a["default"],e={ProgramNode:function(a,b,d,f){var g,h;3===arguments.length?(f=d,d=null):2===arguments.length&&(f=b,b=null),c.call(this,f),this.type="program",this.statements=a,this.strip={},d?(h=d[0],h?(g={first_line:h.firstLine,last_line:h.lastLine,last_column:h.lastColumn,first_column:h.firstColumn},this.inverse=new e.ProgramNode(d,b,g)):this.inverse=new e.ProgramNode(d,b),this.strip.right=b.left):b&&(this.strip.left=b.right)},MustacheNode:function(a,b,d,f,g){if(c.call(this,g),this.type="mustache",this.strip=f,null!=d&&d.charAt){var h=d.charAt(3)||d.charAt(2);this.escaped="{"!==h&&"&"!==h}else this.escaped=!!d;this.sexpr=a instanceof e.SexprNode?a:new e.SexprNode(a,b),this.sexpr.isRoot=!0,this.id=this.sexpr.id,this.params=this.sexpr.params,this.hash=this.sexpr.hash,this.eligibleHelper=this.sexpr.eligibleHelper,this.isHelper=this.sexpr.isHelper},SexprNode:function(a,b,d){c.call(this,d),this.type="sexpr",this.hash=b;var e=this.id=a[0],f=this.params=a.slice(1);this.isHelper=f.length||b,this.eligibleHelper=this.isHelper||e.isSimple},PartialNode:function(a,b,d,e,f){c.call(this,f),this.type="partial",this.partialName=a,this.context=b,this.hash=d,this.strip=e},BlockNode:function(a,b,e,f,g){if(c.call(this,g),a.sexpr.id.original!==f.path.original)throw new d(a.sexpr.id.original+" doesn't match "+f.path.original,this);this.type="block",this.mustache=a,this.program=b,this.inverse=e,this.strip={left:a.strip.left,right:f.strip.right},(b||e).strip.left=a.strip.right,(e||b).strip.right=f.strip.left,e&&!b&&(this.isInverse=!0)},RawBlockNode:function(a,b,f,g){if(c.call(this,g),a.sexpr.id.original!==f)throw new d(a.sexpr.id.original+" doesn't match "+f,this);b=new e.ContentNode(b,g),this.type="block",this.mustache=a,this.program=new e.ProgramNode([b],g)},ContentNode:function(a,b){c.call(this,b),this.type="content",this.string=a},HashNode:function(a,b){c.call(this,b),this.type="hash",this.pairs=a},IdNode:function(a,b){c.call(this,b),this.type="ID";for(var e="",f=[],g=0,h="",i=0,j=a.length;j>i;i++){var k=a[i].part;if(e+=(a[i].separator||"")+k,".."===k||"."===k||"this"===k){if(f.length>0)throw new d("Invalid path: "+e,this);".."===k?(g++,h+="../"):this.isScoped=!0}else f.push(k)}this.original=e,this.parts=f,this.string=f.join("."),this.depth=g,this.idName=h+this.string,this.isSimple=1===a.length&&!this.isScoped&&0===g,this.stringModeValue=this.string},PartialNameNode:function(a,b){c.call(this,b),this.type="PARTIAL_NAME",this.name=a.original},DataNode:function(a,b){c.call(this,b),this.type="DATA",this.id=a,this.stringModeValue=a.stringModeValue,this.idName="@"+a.stringModeValue},StringNode:function(a,b){c.call(this,b),this.type="STRING",this.original=this.string=this.stringModeValue=a},NumberNode:function(a,b){c.call(this,b),this.type="NUMBER",this.original=this.number=a,this.stringModeValue=Number(a)},BooleanNode:function(a,b){c.call(this,b),this.type="BOOLEAN",this.bool=a,this.stringModeValue="true"===a},CommentNode:function(a,b){c.call(this,b),this.type="comment",this.comment=a}};b["default"]=e}),define("handlebars/compiler/parser",["exports"],function(a){var b=function(){function a(a,b){return{left:"~"===a.charAt(2),right:"~"===b.charAt(0)||"~"===b.charAt(1)}}function b(){this.yy={}}var c={trace:function(){},yy:{},symbols_:{error:2,root:3,statements:4,EOF:5,program:6,simpleInverse:7,statement:8,openRawBlock:9,CONTENT:10,END_RAW_BLOCK:11,openInverse:12,closeBlock:13,openBlock:14,mustache:15,partial:16,COMMENT:17,OPEN_RAW_BLOCK:18,sexpr:19,CLOSE_RAW_BLOCK:20,OPEN_BLOCK:21,CLOSE:22,OPEN_INVERSE:23,OPEN_ENDBLOCK:24,path:25,OPEN:26,OPEN_UNESCAPED:27,CLOSE_UNESCAPED:28,OPEN_PARTIAL:29,partialName:30,param:31,partial_option0:32,partial_option1:33,sexpr_repetition0:34,sexpr_option0:35,dataName:36,STRING:37,NUMBER:38,BOOLEAN:39,OPEN_SEXPR:40,CLOSE_SEXPR:41,hash:42,hash_repetition_plus0:43,hashSegment:44,ID:45,EQUALS:46,DATA:47,pathSegments:48,SEP:49,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",10:"CONTENT",11:"END_RAW_BLOCK",17:"COMMENT",18:"OPEN_RAW_BLOCK",20:"CLOSE_RAW_BLOCK",21:"OPEN_BLOCK",22:"CLOSE",23:"OPEN_INVERSE",24:"OPEN_ENDBLOCK",26:"OPEN",27:"OPEN_UNESCAPED",28:"CLOSE_UNESCAPED",29:"OPEN_PARTIAL",37:"STRING",38:"NUMBER",39:"BOOLEAN",40:"OPEN_SEXPR",41:"CLOSE_SEXPR",45:"ID",46:"EQUALS",47:"DATA",49:"SEP"},productions_:[0,[3,2],[3,1],[6,2],[6,3],[6,2],[6,1],[6,1],[6,0],[4,1],[4,2],[8,3],[8,3],[8,3],[8,1],[8,1],[8,1],[8,1],[9,3],[14,3],[12,3],[13,3],[15,3],[15,3],[16,5],[16,4],[7,2],[19,3],[19,1],[31,1],[31,1],[31,1],[31,1],[31,1],[31,3],[42,1],[44,3],[30,1],[30,1],[30,1],[36,2],[25,1],[48,3],[48,1],[32,0],[32,1],[33,0],[33,1],[34,0],[34,2],[35,0],[35,1],[43,1],[43,2]],performAction:function(b,c,d,e,f,g){var h=g.length-1;switch(f){case 1:return new e.ProgramNode(g[h-1],this._$);case 2:return new e.ProgramNode([],this._$);case 3:this.$=new e.ProgramNode([],g[h-1],g[h],this._$);break;case 4:this.$=new e.ProgramNode(g[h-2],g[h-1],g[h],this._$);break;case 5:this.$=new e.ProgramNode(g[h-1],g[h],[],this._$);break;case 6:this.$=new e.ProgramNode(g[h],this._$);break;case 7:this.$=new e.ProgramNode([],this._$);break;case 8:this.$=new e.ProgramNode([],this._$);break;case 9:this.$=[g[h]];break;case 10:g[h-1].push(g[h]),this.$=g[h-1];break;case 11:this.$=new e.RawBlockNode(g[h-2],g[h-1],g[h],this._$);break;case 12:this.$=new e.BlockNode(g[h-2],g[h-1].inverse,g[h-1],g[h],this._$);break;case 13:this.$=new e.BlockNode(g[h-2],g[h-1],g[h-1].inverse,g[h],this._$);break;case 14:this.$=g[h];break;case 15:this.$=g[h];break;case 16:this.$=new e.ContentNode(g[h],this._$);break;case 17:this.$=new e.CommentNode(g[h],this._$);break;case 18:this.$=new e.MustacheNode(g[h-1],null,"","",this._$);break;case 19:this.$=new e.MustacheNode(g[h-1],null,g[h-2],a(g[h-2],g[h]),this._$);break;case 20:this.$=new e.MustacheNode(g[h-1],null,g[h-2],a(g[h-2],g[h]),this._$);break;case 21:this.$={path:g[h-1],strip:a(g[h-2],g[h])};break;case 22:this.$=new e.MustacheNode(g[h-1],null,g[h-2],a(g[h-2],g[h]),this._$);break;case 23:this.$=new e.MustacheNode(g[h-1],null,g[h-2],a(g[h-2],g[h]),this._$);break;case 24:this.$=new e.PartialNode(g[h-3],g[h-2],g[h-1],a(g[h-4],g[h]),this._$);break;case 25:this.$=new e.PartialNode(g[h-2],void 0,g[h-1],a(g[h-3],g[h]),this._$);break;case 26:this.$=a(g[h-1],g[h]);break;case 27:this.$=new e.SexprNode([g[h-2]].concat(g[h-1]),g[h],this._$);break;case 28:this.$=new e.SexprNode([g[h]],null,this._$);break;case 29:this.$=g[h];break;case 30:this.$=new e.StringNode(g[h],this._$);break;case 31:this.$=new e.NumberNode(g[h],this._$);break;case 32:this.$=new e.BooleanNode(g[h],this._$);break;case 33:this.$=g[h];break;case 34:g[h-1].isHelper=!0,this.$=g[h-1];break;case 35:this.$=new e.HashNode(g[h],this._$);break;case 36:this.$=[g[h-2],g[h]];break;case 37:this.$=new e.PartialNameNode(g[h],this._$);break;case 38:this.$=new e.PartialNameNode(new e.StringNode(g[h],this._$),this._$);break;case 39:this.$=new e.PartialNameNode(new e.NumberNode(g[h],this._$));break;case 40:this.$=new e.DataNode(g[h],this._$);break;case 41:this.$=new e.IdNode(g[h],this._$);break;case 42:g[h-2].push({part:g[h],separator:g[h-1]}),this.$=g[h-2];break;case 43:this.$=[{part:g[h]}];break;case 48:this.$=[];break;case 49:g[h-1].push(g[h]);break;case 52:this.$=[g[h]];break;case 53:g[h-1].push(g[h])}},table:[{3:1,4:2,5:[1,3],8:4,9:5,10:[1,10],12:6,14:7,15:8,16:9,17:[1,11],18:[1,12],21:[1,14],23:[1,13],26:[1,15],27:[1,16],29:[1,17]},{1:[3]},{5:[1,18],8:19,9:5,10:[1,10],12:6,14:7,15:8,16:9,17:[1,11],18:[1,12],21:[1,14],23:[1,13],26:[1,15],27:[1,16],29:[1,17]},{1:[2,2]},{5:[2,9],10:[2,9],17:[2,9],18:[2,9],21:[2,9],23:[2,9],24:[2,9],26:[2,9],27:[2,9],29:[2,9]},{10:[1,20]},{4:23,6:21,7:22,8:4,9:5,10:[1,10],12:6,14:7,15:8,16:9,17:[1,11],18:[1,12],21:[1,14],23:[1,24],24:[2,8],26:[1,15],27:[1,16],29:[1,17]},{4:23,6:25,7:22,8:4,9:5,10:[1,10],12:6,14:7,15:8,16:9,17:[1,11],18:[1,12],21:[1,14],23:[1,24],24:[2,8],26:[1,15],27:[1,16],29:[1,17]},{5:[2,14],10:[2,14],17:[2,14],18:[2,14],21:[2,14],23:[2,14],24:[2,14],26:[2,14],27:[2,14],29:[2,14]},{5:[2,15],10:[2,15],17:[2,15],18:[2,15],21:[2,15],23:[2,15],24:[2,15],26:[2,15],27:[2,15],29:[2,15]},{5:[2,16],10:[2,16],17:[2,16],18:[2,16],21:[2,16],23:[2,16],24:[2,16],26:[2,16],27:[2,16],29:[2,16]},{5:[2,17],10:[2,17],17:[2,17],18:[2,17],21:[2,17],23:[2,17],24:[2,17],26:[2,17],27:[2,17],29:[2,17]},{19:26,25:27,36:28,45:[1,31],47:[1,30],48:29},{19:32,25:27,36:28,45:[1,31],47:[1,30],48:29},{19:33,25:27,36:28,45:[1,31],47:[1,30],48:29},{19:34,25:27,36:28,45:[1,31],47:[1,30],48:29},{19:35,25:27,36:28,45:[1,31],47:[1,30],48:29},{25:37,30:36,37:[1,38],38:[1,39],45:[1,31],48:29},{1:[2,1]},{5:[2,10],10:[2,10],17:[2,10],18:[2,10],21:[2,10],23:[2,10],24:[2,10],26:[2,10],27:[2,10],29:[2,10]},{11:[1,40]},{13:41,24:[1,42]},{4:43,8:4,9:5,10:[1,10],12:6,14:7,15:8,16:9,17:[1,11],18:[1,12],21:[1,14],23:[1,13],24:[2,7],26:[1,15],27:[1,16],29:[1,17]},{7:44,8:19,9:5,10:[1,10],12:6,14:7,15:8,16:9,17:[1,11],18:[1,12],21:[1,14],23:[1,24],24:[2,6],26:[1,15],27:[1,16],29:[1,17]},{19:32,22:[1,45],25:27,36:28,45:[1,31],47:[1,30],48:29},{13:46,24:[1,42]},{20:[1,47]},{20:[2,48],22:[2,48],28:[2,48],34:48,37:[2,48],38:[2,48],39:[2,48],40:[2,48],41:[2,48],45:[2,48],47:[2,48]},{20:[2,28],22:[2,28],28:[2,28],41:[2,28]},{20:[2,41],22:[2,41],28:[2,41],37:[2,41],38:[2,41],39:[2,41],40:[2,41],41:[2,41],45:[2,41],47:[2,41],49:[1,49]},{25:50,45:[1,31],48:29},{20:[2,43],22:[2,43],28:[2,43],37:[2,43],38:[2,43],39:[2,43],40:[2,43],41:[2,43],45:[2,43],47:[2,43],49:[2,43]},{22:[1,51]},{22:[1,52]},{22:[1,53]},{28:[1,54]},{22:[2,46],25:57,31:55,33:56,36:61,37:[1,58],38:[1,59],39:[1,60],40:[1,62],42:63,43:64,44:66,45:[1,65],47:[1,30],48:29},{22:[2,37],37:[2,37],38:[2,37],39:[2,37],40:[2,37],45:[2,37],47:[2,37]},{22:[2,38],37:[2,38],38:[2,38],39:[2,38],40:[2,38],45:[2,38],47:[2,38]},{22:[2,39],37:[2,39],38:[2,39],39:[2,39],40:[2,39],45:[2,39],47:[2,39]},{5:[2,11],10:[2,11],17:[2,11],18:[2,11],21:[2,11],23:[2,11],24:[2,11],26:[2,11],27:[2,11],29:[2,11]},{5:[2,12],10:[2,12],17:[2,12],18:[2,12],21:[2,12],23:[2,12],24:[2,12],26:[2,12],27:[2,12],29:[2,12]},{25:67,45:[1,31],48:29},{8:19,9:5,10:[1,10],12:6,14:7,15:8,16:9,17:[1,11],18:[1,12],21:[1,14],23:[1,13],24:[2,3],26:[1,15],27:[1,16],29:[1,17]},{4:68,8:4,9:5,10:[1,10],12:6,14:7,15:8,16:9,17:[1,11],18:[1,12],21:[1,14],23:[1,13],24:[2,5],26:[1,15],27:[1,16],29:[1,17]},{10:[2,26],17:[2,26],18:[2,26],21:[2,26],23:[2,26],24:[2,26],26:[2,26],27:[2,26],29:[2,26]},{5:[2,13],10:[2,13],17:[2,13],18:[2,13],21:[2,13],23:[2,13],24:[2,13],26:[2,13],27:[2,13],29:[2,13]},{10:[2,18]},{20:[2,50],22:[2,50],25:57,28:[2,50],31:70,35:69,36:61,37:[1,58],38:[1,59],39:[1,60],40:[1,62],41:[2,50],42:71,43:64,44:66,45:[1,65],47:[1,30],48:29},{45:[1,72]},{20:[2,40],22:[2,40],28:[2,40],37:[2,40],38:[2,40],39:[2,40],40:[2,40],41:[2,40],45:[2,40],47:[2,40]},{10:[2,20],17:[2,20],18:[2,20],21:[2,20],23:[2,20],24:[2,20],26:[2,20],27:[2,20],29:[2,20]},{10:[2,19],17:[2,19],18:[2,19],21:[2,19],23:[2,19],24:[2,19],26:[2,19],27:[2,19],29:[2,19]},{5:[2,22],10:[2,22],17:[2,22],18:[2,22],21:[2,22],23:[2,22],24:[2,22],26:[2,22],27:[2,22],29:[2,22]},{5:[2,23],10:[2,23],17:[2,23],18:[2,23],21:[2,23],23:[2,23],24:[2,23],26:[2,23],27:[2,23],29:[2,23]},{22:[2,44],32:73,42:74,43:64,44:66,45:[1,75]},{22:[1,76]},{20:[2,29],22:[2,29],28:[2,29],37:[2,29],38:[2,29],39:[2,29],40:[2,29],41:[2,29],45:[2,29],47:[2,29]},{20:[2,30],22:[2,30],28:[2,30],37:[2,30],38:[2,30],39:[2,30],40:[2,30],41:[2,30],45:[2,30],47:[2,30]},{20:[2,31],22:[2,31],28:[2,31],37:[2,31],38:[2,31],39:[2,31],40:[2,31],41:[2,31],45:[2,31],47:[2,31]},{20:[2,32],22:[2,32],28:[2,32],37:[2,32],38:[2,32],39:[2,32],40:[2,32],41:[2,32],45:[2,32],47:[2,32]},{20:[2,33],22:[2,33],28:[2,33],37:[2,33],38:[2,33],39:[2,33],40:[2,33],41:[2,33],45:[2,33],47:[2,33]},{19:77,25:27,36:28,45:[1,31],47:[1,30],48:29},{22:[2,47]},{20:[2,35],22:[2,35],28:[2,35],41:[2,35],44:78,45:[1,75]},{20:[2,43],22:[2,43],28:[2,43],37:[2,43],38:[2,43],39:[2,43],40:[2,43],41:[2,43],45:[2,43],46:[1,79],47:[2,43],49:[2,43]},{20:[2,52],22:[2,52],28:[2,52],41:[2,52],45:[2,52]},{22:[1,80]},{8:19,9:5,10:[1,10],12:6,14:7,15:8,16:9,17:[1,11],18:[1,12],21:[1,14],23:[1,13],24:[2,4],26:[1,15],27:[1,16],29:[1,17]},{20:[2,27],22:[2,27],28:[2,27],41:[2,27]},{20:[2,49],22:[2,49],28:[2,49],37:[2,49],38:[2,49],39:[2,49],40:[2,49],41:[2,49],45:[2,49],47:[2,49]},{20:[2,51],22:[2,51],28:[2,51],41:[2,51]},{20:[2,42],22:[2,42],28:[2,42],37:[2,42],38:[2,42],39:[2,42],40:[2,42],41:[2,42],45:[2,42],47:[2,42],49:[2,42]},{22:[1,81]},{22:[2,45]},{46:[1,79]},{5:[2,25],10:[2,25],17:[2,25],18:[2,25],21:[2,25],23:[2,25],24:[2,25],26:[2,25],27:[2,25],29:[2,25]},{41:[1,82]},{20:[2,53],22:[2,53],28:[2,53],41:[2,53],45:[2,53]},{25:57,31:83,36:61,37:[1,58],38:[1,59],39:[1,60],40:[1,62],45:[1,31],47:[1,30],48:29},{5:[2,21],10:[2,21],17:[2,21],18:[2,21],21:[2,21],23:[2,21],24:[2,21],26:[2,21],27:[2,21],29:[2,21]},{5:[2,24],10:[2,24],17:[2,24],18:[2,24],21:[2,24],23:[2,24],24:[2,24],26:[2,24],27:[2,24],29:[2,24]},{20:[2,34],22:[2,34],28:[2,34],37:[2,34],38:[2,34],39:[2,34],40:[2,34],41:[2,34],45:[2,34],47:[2,34]},{20:[2,36],22:[2,36],28:[2,36],41:[2,36],45:[2,36]}],defaultActions:{3:[2,2],18:[2,1],47:[2,18],63:[2,47],74:[2,45]},parseError:function(a){throw new Error(a)},parse:function(a){function b(){var a;return a=c.lexer.lex()||1,"number"!=typeof a&&(a=c.symbols_[a]||a),a}var c=this,d=[0],e=[null],f=[],g=this.table,h="",i=0,j=0,k=0;this.lexer.setInput(a),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,this.yy.parser=this,"undefined"==typeof this.lexer.yylloc&&(this.lexer.yylloc={});var l=this.lexer.yylloc;f.push(l);var m=this.lexer.options&&this.lexer.options.ranges;"function"==typeof this.yy.parseError&&(this.parseError=this.yy.parseError);for(var n,o,p,q,r,s,t,u,v,w={};;){if(p=d[d.length-1],this.defaultActions[p]?q=this.defaultActions[p]:((null===n||"undefined"==typeof n)&&(n=b()),q=g[p]&&g[p][n]),"undefined"==typeof q||!q.length||!q[0]){var x="";if(!k){v=[];for(s in g[p])this.terminals_[s]&&s>2&&v.push("'"+this.terminals_[s]+"'");x=this.lexer.showPosition?"Parse error on line "+(i+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+v.join(", ")+", got '"+(this.terminals_[n]||n)+"'":"Parse error on line "+(i+1)+": Unexpected "+(1==n?"end of input":"'"+(this.terminals_[n]||n)+"'"),this.parseError(x,{text:this.lexer.match,token:this.terminals_[n]||n,line:this.lexer.yylineno,loc:l,expected:v})}}if(q[0]instanceof Array&&q.length>1)throw new Error("Parse Error: multiple actions possible at state: "+p+", token: "+n);switch(q[0]){case 1:d.push(n),e.push(this.lexer.yytext),f.push(this.lexer.yylloc),d.push(q[1]),n=null,o?(n=o,o=null):(j=this.lexer.yyleng,h=this.lexer.yytext,i=this.lexer.yylineno,l=this.lexer.yylloc,k>0&&k--);break;case 2:if(t=this.productions_[q[1]][1],w.$=e[e.length-t],w._$={first_line:f[f.length-(t||1)].first_line,last_line:f[f.length-1].last_line,first_column:f[f.length-(t||1)].first_column,last_column:f[f.length-1].last_column},m&&(w._$.range=[f[f.length-(t||1)].range[0],f[f.length-1].range[1]]),r=this.performAction.call(w,h,j,i,this.yy,q[1],e,f),"undefined"!=typeof r)return r;t&&(d=d.slice(0,-1*t*2),e=e.slice(0,-1*t),f=f.slice(0,-1*t)),d.push(this.productions_[q[1]][0]),e.push(w.$),f.push(w._$),u=g[d[d.length-2]][d[d.length-1]],d.push(u);break;case 3:return!0}}return!0}},d=function(){var a={EOF:1,parseError:function(a,b){if(!this.yy.parser)throw new Error(a);this.yy.parser.parseError(a,b)},setInput:function(a){return this._input=a,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var a=this._input[0];this.yytext+=a,this.yyleng++,this.offset++,this.match+=a,this.matched+=a;var b=a.match(/(?:\r\n?|\n).*/g);return b?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),a},unput:function(a){var b=a.length,c=a.split(/(?:\r\n?|\n)/g);this._input=a+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-b-1),this.offset-=b;var d=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),c.length-1&&(this.yylineno-=c.length-1);var e=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:c?(c.length===d.length?this.yylloc.first_column:0)+d[d.length-c.length].length-c[0].length:this.yylloc.first_column-b},this.options.ranges&&(this.yylloc.range=[e[0],e[0]+this.yyleng-b]),this},more:function(){return this._more=!0,this},less:function(a){this.unput(this.match.slice(a))},pastInput:function(){var a=this.matched.substr(0,this.matched.length-this.match.length);return(a.length>20?"...":"")+a.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var a=this.match;return a.length<20&&(a+=this._input.substr(0,20-a.length)),(a.substr(0,20)+(a.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var a=this.pastInput(),b=new Array(a.length+1).join("-");return a+this.upcomingInput()+"\n"+b+"^"},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var a,b,c,d,e;this._more||(this.yytext="",this.match="");for(var f=this._currentRules(),g=0;g<f.length&&(c=this._input.match(this.rules[f[g]]),!c||b&&!(c[0].length>b[0].length)||(b=c,d=g,this.options.flex));g++);return b?(e=b[0].match(/(?:\r\n?|\n).*/g),e&&(this.yylineno+=e.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:e?e[e.length-1].length-e[e.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+b[0].length},this.yytext+=b[0],this.match+=b[0],this.matches=b,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._input=this._input.slice(b[0].length),this.matched+=b[0],a=this.performAction.call(this,this.yy,this,f[d],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),a?a:void 0):""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var a=this.next();return"undefined"!=typeof a?a:this.lex()},begin:function(a){this.conditionStack.push(a)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(a){this.begin(a)}};return a.options={},a.performAction=function(a,b,c,d){function e(a,c){return b.yytext=b.yytext.substr(a,b.yyleng-c)}switch(c){case 0:if("\\\\"===b.yytext.slice(-2)?(e(0,1),this.begin("mu")):"\\"===b.yytext.slice(-1)?(e(0,1),this.begin("emu")):this.begin("mu"),b.yytext)return 10;break;case 1:return 10;case 2:return this.popState(),10;case 3:return b.yytext=b.yytext.substr(5,b.yyleng-9),this.popState(),11;case 4:return 10;case 5:return e(0,4),this.popState(),17;case 6:return 40;case 7:return 41;case 8:return 18;case 9:return this.popState(),this.begin("raw"),20;case 10:return b.yytext=b.yytext.substr(4,b.yyleng-8),this.popState(),"RAW_BLOCK";case 11:return 29;case 12:return 21;case 13:return 24;case 14:return 23;case 15:return 23;case 16:return 27;case 17:return 26;case 18:this.popState(),this.begin("com");break;case 19:return e(3,5),this.popState(),17;case 20:return 26;case 21:return 46;case 22:return 45;case 23:return 45;case 24:return 49;case 25:break;case 26:return this.popState(),28;case 27:return this.popState(),22;case 28:return b.yytext=e(1,2).replace(/\\"/g,'"'),37;case 29:return b.yytext=e(1,2).replace(/\\'/g,"'"),37;case 30:return 47;case 31:return 39;case 32:return 39;case 33:return 38;case 34:return 45;case 35:return b.yytext=e(1,2),45;case 36:return"INVALID";case 37:return 5}},a.rules=[/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/,/^(?:[^\x00]*?(?=(\{\{\{\{\/)))/,/^(?:[\s\S]*?--\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{\{\{)/,/^(?:\}\}\}\})/,/^(?:\{\{\{\{[^\x00]*\}\}\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{!--)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{(~)?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)]))))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/],a.conditions={mu:{rules:[6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37],inclusive:!1},emu:{rules:[2],inclusive:!1},com:{rules:[5],inclusive:!1},raw:{rules:[3,4],inclusive:!1},INITIAL:{rules:[0,1,37],inclusive:!0}},a}();return c.lexer=d,b.prototype=c,c.Parser=b,new b}();a["default"]=b}),define("handlebars/compiler/base",["./parser","./ast","exports"],function(a,b,c){function d(a){return a.constructor===f.ProgramNode?a:(e.yy=f,e.parse(a))}var e=a["default"],f=b["default"];c.parser=e,c.parse=d}),define("handlebars/compiler/compiler",["../exception","exports"],function(a,b){function c(){}function d(a,b,c){if(null==a||"string"!=typeof a&&a.constructor!==c.AST.ProgramNode)throw new f("You must pass a string or Handlebars AST to Handlebars.precompile. You passed "+a);b=b||{},"data"in b||(b.data=!0);var d=c.parse(a),e=(new c.Compiler).compile(d,b);return(new c.JavaScriptCompiler).compile(e,b)}function e(a,b,c){function d(){var d=c.parse(a),e=(new c.Compiler).compile(d,b),f=(new c.JavaScriptCompiler).compile(e,b,void 0,!0);return c.template(f)}if(null==a||"string"!=typeof a&&a.constructor!==c.AST.ProgramNode)throw new f("You must pass a string or Handlebars AST to Handlebars.compile. You passed "+a);b=b||{},"data"in b||(b.data=!0);var e,g=function(a,b){return e||(e=d()),e.call(this,a,b)};return g.child=function(a){return e||(e=d()),e.child(a)},g}var f=a["default"];b.Compiler=c,c.prototype={compiler:c,disassemble:function(){for(var a,b,c,d=this.opcodes,e=[],f=0,g=d.length;g>f;f++)if(a=d[f],"DECLARE"===a.opcode)e.push("DECLARE "+a.name+"="+a.value);else{b=[];for(var h=0;h<a.args.length;h++)c=a.args[h],"string"==typeof c&&(c='"'+c.replace("\n","\\n")+'"'),b.push(c);e.push(a.opcode+" "+b.join(" "))}return e.join("\n")},equals:function(a){var b=this.opcodes.length;if(a.opcodes.length!==b)return!1;for(var c=0;b>c;c++){var d=this.opcodes[c],e=a.opcodes[c];if(d.opcode!==e.opcode||d.args.length!==e.args.length)return!1;for(var f=0;f<d.args.length;f++)if(d.args[f]!==e.args[f])return!1}if(b=this.children.length,a.children.length!==b)return!1;for(c=0;b>c;c++)if(!this.children[c].equals(a.children[c]))return!1;return!0},guid:0,compile:function(a,b){this.opcodes=[],this.children=[],this.depths={list:[]},this.options=b,this.stringParams=b.stringParams,this.trackIds=b.trackIds;var c=this.options.knownHelpers;if(this.options.knownHelpers={helperMissing:!0,blockHelperMissing:!0,each:!0,"if":!0,unless:!0,"with":!0,log:!0,lookup:!0},c)for(var d in c)this.options.knownHelpers[d]=c[d];return this.accept(a)},accept:function(a){var b,c=a.strip||{};return c.left&&this.opcode("strip"),b=this[a.type](a),c.right&&this.opcode("strip"),b},program:function(a){for(var b=a.statements,c=0,d=b.length;d>c;c++)this.accept(b[c]);return this.isSimple=1===d,this.depths.list=this.depths.list.sort(function(a,b){return a-b}),this},compileProgram:function(a){var b,c=(new this.compiler).compile(a,this.options),d=this.guid++;this.usePartial=this.usePartial||c.usePartial,this.children[d]=c;for(var e=0,f=c.depths.list.length;f>e;e++)b=c.depths.list[e],2>b||this.addDepth(b-1);return d},block:function(a){var b=a.mustache,c=a.program,d=a.inverse;c&&(c=this.compileProgram(c)),d&&(d=this.compileProgram(d));var e=b.sexpr,f=this.classifySexpr(e);"helper"===f?this.helperSexpr(e,c,d):"simple"===f?(this.simpleSexpr(e),this.opcode("pushProgram",c),this.opcode("pushProgram",d),this.opcode("emptyHash"),this.opcode("blockValue",e.id.original)):(this.ambiguousSexpr(e,c,d),this.opcode("pushProgram",c),this.opcode("pushProgram",d),this.opcode("emptyHash"),this.opcode("ambiguousBlockValue")),this.opcode("append") | ||
},hash:function(a){var b,c=a.pairs;this.opcode("pushHash");for(var d=0,e=c.length;e>d;d++)b=c[d],this.pushParam(b[1]),this.opcode("assignToHash",b[0]);this.opcode("popHash")},partial:function(a){var b=a.partialName;this.usePartial=!0,a.hash?this.accept(a.hash):this.opcode("push","undefined"),a.context?this.accept(a.context):this.opcode("push","depth0"),this.opcode("invokePartial",b.name),this.opcode("append")},content:function(a){this.opcode("appendContent",a.string)},mustache:function(a){this.sexpr(a.sexpr),a.escaped&&!this.options.noEscape?this.opcode("appendEscaped"):this.opcode("append")},ambiguousSexpr:function(a,b,c){var d=a.id,e=d.parts[0],f=null!=b||null!=c;this.opcode("getContext",d.depth),this.opcode("pushProgram",b),this.opcode("pushProgram",c),this.opcode("invokeAmbiguous",e,f)},simpleSexpr:function(a){var b=a.id;"DATA"===b.type?this.DATA(b):b.parts.length?this.ID(b):(this.addDepth(b.depth),this.opcode("getContext",b.depth),this.opcode("pushContext")),this.opcode("resolvePossibleLambda")},helperSexpr:function(a,b,c){var d=this.setupFullMustacheParams(a,b,c),e=a.id,g=e.parts[0];if(this.options.knownHelpers[g])this.opcode("invokeKnownHelper",d.length,g);else{if(this.options.knownHelpersOnly)throw new f("You specified knownHelpersOnly, but used the unknown helper "+g,a);this.ID(e),this.opcode("invokeHelper",d.length,g,a.isRoot)}},sexpr:function(a){var b=this.classifySexpr(a);"simple"===b?this.simpleSexpr(a):"helper"===b?this.helperSexpr(a):this.ambiguousSexpr(a)},ID:function(a){this.addDepth(a.depth),this.opcode("getContext",a.depth);var b=a.parts[0];b?this.opcode("lookupOnContext",a.parts[0]):this.opcode("pushContext");for(var c=1,d=a.parts.length;d>c;c++)this.opcode("lookup",a.parts[c])},DATA:function(a){this.options.data=!0,this.opcode("lookupData",a.id.depth);for(var b=a.id.parts,c=0,d=b.length;d>c;c++)this.opcode("lookup",b[c])},STRING:function(a){this.opcode("pushString",a.string)},NUMBER:function(a){this.opcode("pushLiteral",a.number)},BOOLEAN:function(a){this.opcode("pushLiteral",a.bool)},comment:function(){},opcode:function(a){this.opcodes.push({opcode:a,args:[].slice.call(arguments,1)})},declare:function(a,b){this.opcodes.push({opcode:"DECLARE",name:a,value:b})},addDepth:function(a){0!==a&&(this.depths[a]||(this.depths[a]=!0,this.depths.list.push(a)))},classifySexpr:function(a){var b=a.isHelper,c=a.eligibleHelper,d=this.options;if(c&&!b){var e=a.id.parts[0];d.knownHelpers[e]?b=!0:d.knownHelpersOnly&&(c=!1)}return b?"helper":c?"ambiguous":"simple"},pushParams:function(a){for(var b=a.length;b--;)this.pushParam(a[b])},pushParam:function(a){this.stringParams?(a.depth&&this.addDepth(a.depth),this.opcode("getContext",a.depth||0),this.opcode("pushStringParam",a.stringModeValue,a.type),"sexpr"===a.type&&this.sexpr(a)):(this.trackIds&&this.opcode("pushId",a.type,a.idName||a.stringModeValue),this.accept(a))},setupFullMustacheParams:function(a,b,c){var d=a.params;return this.pushParams(d),this.opcode("pushProgram",b),this.opcode("pushProgram",c),a.hash?this.hash(a.hash):this.opcode("emptyHash"),d}},b.precompile=d,b.compile=e}),define("handlebars/compiler/javascript-compiler",["../base","../exception","exports"],function(a,b,c){function d(a){this.value=a}function e(){}var f=a.COMPILER_REVISION,g=a.REVISION_CHANGES,h=a.log,i=b["default"];e.prototype={nameLookup:function(a,b){var c,d;return 0===a.indexOf("depth")&&(c=!0),d=e.isValidJavaScriptVariableName(b)?a+"."+b:a+"['"+b+"']",c?"("+a+" && "+d+")":d},compilerInfo:function(){var a=f,b=g[a];return[a,b]},appendToBuffer:function(a){return this.environment.isSimple?"return "+a+";":{appendToBuffer:!0,content:a,toString:function(){return"buffer += "+a+";"}}},initializeBuffer:function(){return this.quotedString("")},namespace:"Handlebars",compile:function(a,b,c,d){this.environment=a,this.options=b||{},this.stringParams=this.options.stringParams,this.trackIds=this.options.trackIds,this.precompile=!d,h("debug",this.environment.disassemble()+"\n\n"),this.name=this.environment.name,this.isChild=!!c,this.context=c||{programs:[],environments:[]},this.preamble(),this.stackSlot=0,this.stackVars=[],this.aliases={},this.registers={list:[]},this.hashes=[],this.compileStack=[],this.inlineStack=[],this.compileChildren(a,b);var e,f=a.opcodes;this.i=0;for(var g=f.length;this.i<g;this.i++)e=f[this.i],"DECLARE"===e.opcode?this[e.name]=e.value:this[e.opcode].apply(this,e.args),e.opcode!==this.stripNext&&(this.stripNext=!1);if(this.pushSource(""),this.stackSlot||this.inlineStack.length||this.compileStack.length)throw new i("Compile completed with content left on stack");var j=this.createFunctionContext(d);if(this.isChild)return j;var k={compiler:this.compilerInfo(),main:j};return this.context.programs.map(function(a,b){a&&(k[b]=a)}),this.environment.usePartial&&(k.usePartial=!0),this.options.data&&(k.useData=!0),d||(k.compiler=JSON.stringify(k.compiler),k=this.objectLiteral(k)),k},preamble:function(){this.lastContext=0,this.source=[]},createFunctionContext:function(a){var b="",c=this.stackVars.concat(this.registers.list);c.length>0&&(b+=", "+c.join(", "));for(var d in this.aliases)this.aliases.hasOwnProperty(d)&&(b+=", "+d+"="+this.aliases[d]);for(var e=["depth0","helpers","partials","data"],f=0,g=this.environment.depths.list.length;g>f;f++)e.push("depth"+this.environment.depths.list[f]);var h=this.mergeSource(b);return a?(e.push(h),Function.apply(this,e)):"function("+e.join(",")+") {\n "+h+"}"},mergeSource:function(a){for(var b,c,d="",e=!this.forceBuffer,f=0,g=this.source.length;g>f;f++){var h=this.source[f];h.appendToBuffer?b=b?b+"\n + "+h.content:h.content:(b&&(d?d+="buffer += "+b+";\n ":(c=!0,d=b+";\n "),b=void 0),d+=h+"\n ",this.environment.isSimple||(e=!1))}return e?(b||!d)&&(d+="return "+(b||'""')+";\n"):(a+=", buffer = "+(c?"":this.initializeBuffer()),d+=b?"return buffer + "+b+";\n":"return buffer;\n"),a&&(d="var "+a.substring(2)+(c?"":";\n ")+d),d},blockValue:function(a){this.aliases.blockHelperMissing="helpers.blockHelperMissing";var b=["depth0"];this.setupParams(a,0,b),this.replaceStack(function(a){return b.splice(1,0,a),"blockHelperMissing.call("+b.join(", ")+")"})},ambiguousBlockValue:function(){this.aliases.blockHelperMissing="helpers.blockHelperMissing";var a=["depth0"];this.setupParams("",0,a,!0),this.flushInline();var b=this.topStack();a.splice(1,0,b),this.pushSource("if (!"+this.lastHelper+") { "+b+" = blockHelperMissing.call("+a.join(", ")+"); }")},appendContent:function(a){this.pendingContent&&(a=this.pendingContent+a),this.stripNext&&(a=a.replace(/^\s+/,"")),this.pendingContent=a},strip:function(){this.pendingContent&&(this.pendingContent=this.pendingContent.replace(/\s+$/,"")),this.stripNext="strip"},append:function(){this.flushInline();var a=this.popStack();this.pushSource("if("+a+" || "+a+" === 0) { "+this.appendToBuffer(a)+" }"),this.environment.isSimple&&this.pushSource("else { "+this.appendToBuffer("''")+" }")},appendEscaped:function(){this.aliases.escapeExpression="this.escapeExpression",this.pushSource(this.appendToBuffer("escapeExpression("+this.popStack()+")"))},getContext:function(a){this.lastContext!==a&&(this.lastContext=a)},lookupOnContext:function(a){this.push(this.nameLookup("depth"+this.lastContext,a,"context"))},pushContext:function(){this.pushStackLiteral("depth"+this.lastContext)},resolvePossibleLambda:function(){this.aliases.functionType='"function"',this.replaceStack(function(a){return"typeof "+a+" === functionType ? "+a+".apply(depth0) : "+a})},lookup:function(a){this.replaceStack(function(b){return b+" == null || "+b+" === false ? "+b+" : "+this.nameLookup(b,a,"context")})},lookupData:function(a){a?this.pushStackLiteral("this.data(data, "+a+")"):this.pushStackLiteral("data")},pushStringParam:function(a,b){this.pushStackLiteral("depth"+this.lastContext),this.pushString(b),"sexpr"!==b&&("string"==typeof a?this.pushString(a):this.pushStackLiteral(a))},emptyHash:function(){this.pushStackLiteral("{}"),this.trackIds&&this.push("{}"),this.stringParams&&(this.push("{}"),this.push("{}"))},pushHash:function(){this.hash&&this.hashes.push(this.hash),this.hash={values:[],types:[],contexts:[],ids:[]}},popHash:function(){var a=this.hash;this.hash=this.hashes.pop(),this.trackIds&&this.push("{"+a.ids.join(",")+"}"),this.stringParams&&(this.push("{"+a.contexts.join(",")+"}"),this.push("{"+a.types.join(",")+"}")),this.push("{\n "+a.values.join(",\n ")+"\n }")},pushString:function(a){this.pushStackLiteral(this.quotedString(a))},push:function(a){return this.inlineStack.push(a),a},pushLiteral:function(a){this.pushStackLiteral(a)},pushProgram:function(a){null!=a?this.pushStackLiteral(this.programExpression(a)):this.pushStackLiteral(null)},invokeHelper:function(a,b,c){this.aliases.helperMissing="helpers.helperMissing",this.useRegister("helper");var d=this.popStack(),e=this.setupHelper(a,b),f="helper = "+e.name+" || "+d+" || helperMissing";e.paramsInit&&(f+=","+e.paramsInit),this.push("("+f+",helper.call("+e.callParams+"))"),c||this.flushInline()},invokeKnownHelper:function(a,b){var c=this.setupHelper(a,b);this.push(c.name+".call("+c.callParams+")")},invokeAmbiguous:function(a,b){this.aliases.functionType='"function"',this.useRegister("helper"),this.emptyHash();var c=this.setupHelper(0,a,b),d=this.lastHelper=this.nameLookup("helpers",a,"helper"),e=this.nameLookup("depth"+this.lastContext,a,"context");this.push("((helper = "+d+" || "+e+(c.paramsInit?"),("+c.paramsInit:"")+"),(typeof helper === functionType ? helper.call("+c.callParams+") : helper))")},invokePartial:function(a){var b=[this.nameLookup("partials",a,"partial"),"'"+a+"'",this.popStack(),this.popStack(),"helpers","partials"];this.options.data&&b.push("data"),this.push("this.invokePartial("+b.join(", ")+")")},assignToHash:function(a){var b,c,d,e=this.popStack();this.trackIds&&(d=this.popStack()),this.stringParams&&(c=this.popStack(),b=this.popStack());var f=this.hash;b&&f.contexts.push("'"+a+"': "+b),c&&f.types.push("'"+a+"': "+c),d&&f.ids.push("'"+a+"': "+d),f.values.push("'"+a+"': ("+e+")")},pushId:function(a,b){"ID"===a||"DATA"===a?this.pushString(b):"sexpr"===a?this.pushStackLiteral("true"):this.pushStackLiteral("null")},compiler:e,compileChildren:function(a,b){for(var c,d,e=a.children,f=0,g=e.length;g>f;f++){c=e[f],d=new this.compiler;var h=this.matchExistingProgram(c);null==h?(this.context.programs.push(""),h=this.context.programs.length,c.index=h,c.name="program"+h,this.context.programs[h]=d.compile(c,b,this.context,!this.precompile),this.context.environments[h]=c):(c.index=h,c.name="program"+h)}},matchExistingProgram:function(a){for(var b=0,c=this.context.environments.length;c>b;b++){var d=this.context.environments[b];if(d&&d.equals(a))return b}},programExpression:function(a){if(null==a)return"this.noop";for(var b,c=this.environment.children[a],d=c.depths.list,e=[c.index,"data"],f=0,g=d.length;g>f;f++)b=d[f],e.push("depth"+(b-1));return(0===d.length?"this.program(":"this.programWithDepth(")+e.join(", ")+")"},register:function(a,b){this.useRegister(a),this.pushSource(a+" = "+b+";")},useRegister:function(a){this.registers[a]||(this.registers[a]=!0,this.registers.list.push(a))},pushStackLiteral:function(a){return this.push(new d(a))},pushSource:function(a){this.pendingContent&&(this.source.push(this.appendToBuffer(this.quotedString(this.pendingContent))),this.pendingContent=void 0),a&&this.source.push(a)},pushStack:function(a){this.flushInline();var b=this.incrStack();return a&&this.pushSource(b+" = "+a+";"),this.compileStack.push(b),b},replaceStack:function(a){var b,c,e,f="",g=this.isInline();if(g){var h=this.popStack(!0);if(h instanceof d)b=h.value,e=!0;else{c=!this.stackSlot;var i=c?this.incrStack():this.topStackName();f="("+this.push(i)+" = "+h+"),",b=this.topStack()}}else b=this.topStack();var j=a.call(this,b);return g?(e||this.popStack(),c&&this.stackSlot--,this.push("("+f+j+")")):(/^stack/.test(b)||(b=this.nextStack()),this.pushSource(b+" = ("+f+j+");")),b},nextStack:function(){return this.pushStack()},incrStack:function(){return this.stackSlot++,this.stackSlot>this.stackVars.length&&this.stackVars.push("stack"+this.stackSlot),this.topStackName()},topStackName:function(){return"stack"+this.stackSlot},flushInline:function(){var a=this.inlineStack;if(a.length){this.inlineStack=[];for(var b=0,c=a.length;c>b;b++){var e=a[b];e instanceof d?this.compileStack.push(e):this.pushStack(e)}}},isInline:function(){return this.inlineStack.length},popStack:function(a){var b=this.isInline(),c=(b?this.inlineStack:this.compileStack).pop();if(!a&&c instanceof d)return c.value;if(!b){if(!this.stackSlot)throw new i("Invalid stack pop");this.stackSlot--}return c},topStack:function(a){var b=this.isInline()?this.inlineStack:this.compileStack,c=b[b.length-1];return!a&&c instanceof d?c.value:c},quotedString:function(a){return'"'+a.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")+'"'},objectLiteral:function(a){var b=[];for(var c in a)a.hasOwnProperty(c)&&b.push(this.quotedString(c)+":"+a[c]);return"{"+b.join(",")+"}"},setupHelper:function(a,b,c){var d=[],e=this.setupParams(b,a,d,c),f=this.nameLookup("helpers",b,"helper");return{params:d,paramsInit:e,name:f,callParams:["depth0"].concat(d).join(", ")}},setupOptions:function(a,b,c){var d,e,f,g={},h=[],i=[],j=[];g.name=this.quotedString(a),g.hash=this.popStack(),this.trackIds&&(g.hashIds=this.popStack()),this.stringParams&&(g.hashTypes=this.popStack(),g.hashContexts=this.popStack()),e=this.popStack(),f=this.popStack(),(f||e)&&(f||(f="this.noop"),e||(e="this.noop"),g.fn=f,g.inverse=e);for(var k=0;b>k;k++)d=this.popStack(),c.push(d),this.trackIds&&j.push(this.popStack()),this.stringParams&&(i.push(this.popStack()),h.push(this.popStack()));return this.trackIds&&(g.ids="["+j.join(",")+"]"),this.stringParams&&(g.types="["+i.join(",")+"]",g.contexts="["+h.join(",")+"]"),this.options.data&&(g.data="data"),g},setupParams:function(a,b,c,d){var e=this.objectLiteral(this.setupOptions(a,b,c));return d?(this.useRegister("options"),c.push("options"),"options="+e):(c.push(e),"")}};for(var j="break else new var case finally return void catch for switch while continue function this with default if throw delete in try do instanceof typeof abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public let yield".split(" "),k=e.RESERVED_WORDS={},l=0,m=j.length;m>l;l++)k[j[l]]=!0;e.isValidJavaScriptVariableName=function(a){return!e.RESERVED_WORDS[a]&&/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(a)},c["default"]=e}),define("handlebars",["./handlebars.runtime","./handlebars/compiler/ast","./handlebars/compiler/base","./handlebars/compiler/compiler","./handlebars/compiler/javascript-compiler","exports"],function(a,b,c,d,e,f){var g=a["default"],h=b["default"],i=c.parser,j=c.parse,k=d.Compiler,l=d.compile,m=d.precompile,n=e["default"],o=g.create,p=function(){var a=o();return a.compile=function(b,c){return l(b,c,a)},a.precompile=function(b,c){return m(b,c,a)},a.AST=h,a.Compiler=k,a.JavaScriptCompiler=n,a.Parser=i,a.parse=j,a};g=p(),g.create=p,f["default"]=g}); |
/*! | ||
handlebars v1.3.0 | ||
handlebars vv2.0.0-alpha.1 | ||
Copyright (C) 2011 by Yehuda Katz | ||
Copyright (C) 2011-2014 by Yehuda Katz | ||
@@ -27,3 +27,3 @@ Permission is hereby granted, free of charge, to any person obtaining a copy | ||
*/ | ||
var Handlebars=function(){var a=function(){"use strict";function a(a){this.string=a}var b;return a.prototype.toString=function(){return""+this.string},b=a}(),b=function(a){"use strict";function b(a){return h[a]||"&"}function c(a,b){for(var c in b)Object.prototype.hasOwnProperty.call(b,c)&&(a[c]=b[c])}function d(a){return a instanceof g?a.toString():a||0===a?(a=""+a,j.test(a)?a.replace(i,b):a):""}function e(a){return a||0===a?m(a)&&0===a.length?!0:!1:!0}var f={},g=a,h={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},i=/[&<>"'`]/g,j=/[&<>"'`]/;f.extend=c;var k=Object.prototype.toString;f.toString=k;var l=function(a){return"function"==typeof a};l(/x/)&&(l=function(a){return"function"==typeof a&&"[object Function]"===k.call(a)});var l;f.isFunction=l;var m=Array.isArray||function(a){return a&&"object"==typeof a?"[object Array]"===k.call(a):!1};return f.isArray=m,f.escapeExpression=d,f.isEmpty=e,f}(a),c=function(){"use strict";function a(a,b){var d;b&&b.firstLine&&(d=b.firstLine,a+=" - "+d+":"+b.firstColumn);for(var e=Error.prototype.constructor.call(this,a),f=0;f<c.length;f++)this[c[f]]=e[c[f]];d&&(this.lineNumber=d,this.column=b.firstColumn)}var b,c=["description","fileName","lineNumber","message","name","number","stack"];return a.prototype=new Error,b=a}(),d=function(a,b){"use strict";function c(a,b){this.helpers=a||{},this.partials=b||{},d(this)}function d(a){a.registerHelper("helperMissing",function(a){if(2===arguments.length)return void 0;throw new h("Missing helper: '"+a+"'")}),a.registerHelper("blockHelperMissing",function(b,c){var d=c.inverse||function(){},e=c.fn;return m(b)&&(b=b.call(this)),b===!0?e(this):b===!1||null==b?d(this):l(b)?b.length>0?a.helpers.each(b,c):d(this):e(b)}),a.registerHelper("each",function(a,b){var c,d=b.fn,e=b.inverse,f=0,g="";if(m(a)&&(a=a.call(this)),b.data&&(c=q(b.data)),a&&"object"==typeof a)if(l(a))for(var h=a.length;h>f;f++)c&&(c.index=f,c.first=0===f,c.last=f===a.length-1),g+=d(a[f],{data:c});else for(var i in a)a.hasOwnProperty(i)&&(c&&(c.key=i,c.index=f,c.first=0===f),g+=d(a[i],{data:c}),f++);return 0===f&&(g=e(this)),g}),a.registerHelper("if",function(a,b){return m(a)&&(a=a.call(this)),!b.hash.includeZero&&!a||g.isEmpty(a)?b.inverse(this):b.fn(this)}),a.registerHelper("unless",function(b,c){return a.helpers["if"].call(this,b,{fn:c.inverse,inverse:c.fn,hash:c.hash})}),a.registerHelper("with",function(a,b){return m(a)&&(a=a.call(this)),g.isEmpty(a)?void 0:b.fn(a)}),a.registerHelper("log",function(b,c){var d=c.data&&null!=c.data.level?parseInt(c.data.level,10):1;a.log(d,b)})}function e(a,b){p.log(a,b)}var f={},g=a,h=b,i="1.3.0";f.VERSION=i;var j=4;f.COMPILER_REVISION=j;var k={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:">= 1.0.0"};f.REVISION_CHANGES=k;var l=g.isArray,m=g.isFunction,n=g.toString,o="[object Object]";f.HandlebarsEnvironment=c,c.prototype={constructor:c,logger:p,log:e,registerHelper:function(a,b,c){if(n.call(a)===o){if(c||b)throw new h("Arg not supported with multiple helpers");g.extend(this.helpers,a)}else c&&(b.not=c),this.helpers[a]=b},registerPartial:function(a,b){n.call(a)===o?g.extend(this.partials,a):this.partials[a]=b}};var p={methodMap:{0:"debug",1:"info",2:"warn",3:"error"},DEBUG:0,INFO:1,WARN:2,ERROR:3,level:3,log:function(a,b){if(p.level<=a){var c=p.methodMap[a];"undefined"!=typeof console&&console[c]&&console[c].call(console,b)}}};f.logger=p,f.log=e;var q=function(a){var b={};return g.extend(b,a),b};return f.createFrame=q,f}(b,c),e=function(a,b,c){"use strict";function d(a){var b=a&&a[0]||1,c=m;if(b!==c){if(c>b){var d=n[c],e=n[b];throw new l("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+d+") or downgrade your runtime to an older version ("+e+").")}throw new l("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+a[1]+").")}}function e(a,b){if(!b)throw new l("No environment passed to template");var c=function(a,c,d,e,f,g){var h=b.VM.invokePartial.apply(this,arguments);if(null!=h)return h;if(b.compile){var i={helpers:e,partials:f,data:g};return f[c]=b.compile(a,{data:void 0!==g},b),f[c](d,i)}throw new l("The partial "+c+" could not be compiled when running in runtime-only mode")},d={escapeExpression:k.escapeExpression,invokePartial:c,programs:[],program:function(a,b,c){var d=this.programs[a];return c?d=g(a,b,c):d||(d=this.programs[a]=g(a,b)),d},merge:function(a,b){var c=a||b;return a&&b&&a!==b&&(c={},k.extend(c,b),k.extend(c,a)),c},programWithDepth:b.VM.programWithDepth,noop:b.VM.noop,compilerInfo:null};return function(c,e){e=e||{};var f,g,h=e.partial?e:b;e.partial||(f=e.helpers,g=e.partials);var i=a.call(d,h,c,f,g,e.data);return e.partial||b.VM.checkRevision(d.compilerInfo),i}}function f(a,b,c){var d=Array.prototype.slice.call(arguments,3),e=function(a,e){return e=e||{},b.apply(this,[a,e.data||c].concat(d))};return e.program=a,e.depth=d.length,e}function g(a,b,c){var d=function(a,d){return d=d||{},b(a,d.data||c)};return d.program=a,d.depth=0,d}function h(a,b,c,d,e,f){var g={partial:!0,helpers:d,partials:e,data:f};if(void 0===a)throw new l("The partial "+b+" could not be found");return a instanceof Function?a(c,g):void 0}function i(){return""}var j={},k=a,l=b,m=c.COMPILER_REVISION,n=c.REVISION_CHANGES;return j.checkRevision=d,j.template=e,j.programWithDepth=f,j.program=g,j.invokePartial=h,j.noop=i,j}(b,c,d),f=function(a,b,c,d,e){"use strict";var f,g=a,h=b,i=c,j=d,k=e,l=function(){var a=new g.HandlebarsEnvironment;return j.extend(a,g),a.SafeString=h,a.Exception=i,a.Utils=j,a.VM=k,a.template=function(b){return k.template(b,a)},a},m=l();return m.create=l,f=m}(d,a,c,b,e),g=function(a){"use strict";function b(a){a=a||{},this.firstLine=a.first_line,this.firstColumn=a.first_column,this.lastColumn=a.last_column,this.lastLine=a.last_line}var c,d=a,e={ProgramNode:function(a,c,d,f){var g,h;3===arguments.length?(f=d,d=null):2===arguments.length&&(f=c,c=null),b.call(this,f),this.type="program",this.statements=a,this.strip={},d?(h=d[0],h?(g={first_line:h.firstLine,last_line:h.lastLine,last_column:h.lastColumn,first_column:h.firstColumn},this.inverse=new e.ProgramNode(d,c,g)):this.inverse=new e.ProgramNode(d,c),this.strip.right=c.left):c&&(this.strip.left=c.right)},MustacheNode:function(a,c,d,f,g){if(b.call(this,g),this.type="mustache",this.strip=f,null!=d&&d.charAt){var h=d.charAt(3)||d.charAt(2);this.escaped="{"!==h&&"&"!==h}else this.escaped=!!d;this.sexpr=a instanceof e.SexprNode?a:new e.SexprNode(a,c),this.sexpr.isRoot=!0,this.id=this.sexpr.id,this.params=this.sexpr.params,this.hash=this.sexpr.hash,this.eligibleHelper=this.sexpr.eligibleHelper,this.isHelper=this.sexpr.isHelper},SexprNode:function(a,c,d){b.call(this,d),this.type="sexpr",this.hash=c;var e=this.id=a[0],f=this.params=a.slice(1),g=this.eligibleHelper=e.isSimple;this.isHelper=g&&(f.length||c)},PartialNode:function(a,c,d,e){b.call(this,e),this.type="partial",this.partialName=a,this.context=c,this.strip=d},BlockNode:function(a,c,e,f,g){if(b.call(this,g),a.sexpr.id.original!==f.path.original)throw new d(a.sexpr.id.original+" doesn't match "+f.path.original,this);this.type="block",this.mustache=a,this.program=c,this.inverse=e,this.strip={left:a.strip.left,right:f.strip.right},(c||e).strip.left=a.strip.right,(e||c).strip.right=f.strip.left,e&&!c&&(this.isInverse=!0)},ContentNode:function(a,c){b.call(this,c),this.type="content",this.string=a},HashNode:function(a,c){b.call(this,c),this.type="hash",this.pairs=a},IdNode:function(a,c){b.call(this,c),this.type="ID";for(var e="",f=[],g=0,h=0,i=a.length;i>h;h++){var j=a[h].part;if(e+=(a[h].separator||"")+j,".."===j||"."===j||"this"===j){if(f.length>0)throw new d("Invalid path: "+e,this);".."===j?g++:this.isScoped=!0}else f.push(j)}this.original=e,this.parts=f,this.string=f.join("."),this.depth=g,this.isSimple=1===a.length&&!this.isScoped&&0===g,this.stringModeValue=this.string},PartialNameNode:function(a,c){b.call(this,c),this.type="PARTIAL_NAME",this.name=a.original},DataNode:function(a,c){b.call(this,c),this.type="DATA",this.id=a},StringNode:function(a,c){b.call(this,c),this.type="STRING",this.original=this.string=this.stringModeValue=a},IntegerNode:function(a,c){b.call(this,c),this.type="INTEGER",this.original=this.integer=a,this.stringModeValue=Number(a)},BooleanNode:function(a,c){b.call(this,c),this.type="BOOLEAN",this.bool=a,this.stringModeValue="true"===a},CommentNode:function(a,c){b.call(this,c),this.type="comment",this.comment=a}};return c=e}(c),h=function(){"use strict";var a,b=function(){function a(a,b){return{left:"~"===a.charAt(2),right:"~"===b.charAt(0)||"~"===b.charAt(1)}}function b(){this.yy={}}var c={trace:function(){},yy:{},symbols_:{error:2,root:3,statements:4,EOF:5,program:6,simpleInverse:7,statement:8,openInverse:9,closeBlock:10,openBlock:11,mustache:12,partial:13,CONTENT:14,COMMENT:15,OPEN_BLOCK:16,sexpr:17,CLOSE:18,OPEN_INVERSE:19,OPEN_ENDBLOCK:20,path:21,OPEN:22,OPEN_UNESCAPED:23,CLOSE_UNESCAPED:24,OPEN_PARTIAL:25,partialName:26,partial_option0:27,sexpr_repetition0:28,sexpr_option0:29,dataName:30,param:31,STRING:32,INTEGER:33,BOOLEAN:34,OPEN_SEXPR:35,CLOSE_SEXPR:36,hash:37,hash_repetition_plus0:38,hashSegment:39,ID:40,EQUALS:41,DATA:42,pathSegments:43,SEP:44,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",14:"CONTENT",15:"COMMENT",16:"OPEN_BLOCK",18:"CLOSE",19:"OPEN_INVERSE",20:"OPEN_ENDBLOCK",22:"OPEN",23:"OPEN_UNESCAPED",24:"CLOSE_UNESCAPED",25:"OPEN_PARTIAL",32:"STRING",33:"INTEGER",34:"BOOLEAN",35:"OPEN_SEXPR",36:"CLOSE_SEXPR",40:"ID",41:"EQUALS",42:"DATA",44:"SEP"},productions_:[0,[3,2],[3,1],[6,2],[6,3],[6,2],[6,1],[6,1],[6,0],[4,1],[4,2],[8,3],[8,3],[8,1],[8,1],[8,1],[8,1],[11,3],[9,3],[10,3],[12,3],[12,3],[13,4],[7,2],[17,3],[17,1],[31,1],[31,1],[31,1],[31,1],[31,1],[31,3],[37,1],[39,3],[26,1],[26,1],[26,1],[30,2],[21,1],[43,3],[43,1],[27,0],[27,1],[28,0],[28,2],[29,0],[29,1],[38,1],[38,2]],performAction:function(b,c,d,e,f,g){var h=g.length-1;switch(f){case 1:return new e.ProgramNode(g[h-1],this._$);case 2:return new e.ProgramNode([],this._$);case 3:this.$=new e.ProgramNode([],g[h-1],g[h],this._$);break;case 4:this.$=new e.ProgramNode(g[h-2],g[h-1],g[h],this._$);break;case 5:this.$=new e.ProgramNode(g[h-1],g[h],[],this._$);break;case 6:this.$=new e.ProgramNode(g[h],this._$);break;case 7:this.$=new e.ProgramNode([],this._$);break;case 8:this.$=new e.ProgramNode([],this._$);break;case 9:this.$=[g[h]];break;case 10:g[h-1].push(g[h]),this.$=g[h-1];break;case 11:this.$=new e.BlockNode(g[h-2],g[h-1].inverse,g[h-1],g[h],this._$);break;case 12:this.$=new e.BlockNode(g[h-2],g[h-1],g[h-1].inverse,g[h],this._$);break;case 13:this.$=g[h];break;case 14:this.$=g[h];break;case 15:this.$=new e.ContentNode(g[h],this._$);break;case 16:this.$=new e.CommentNode(g[h],this._$);break;case 17:this.$=new e.MustacheNode(g[h-1],null,g[h-2],a(g[h-2],g[h]),this._$);break;case 18:this.$=new e.MustacheNode(g[h-1],null,g[h-2],a(g[h-2],g[h]),this._$);break;case 19:this.$={path:g[h-1],strip:a(g[h-2],g[h])};break;case 20:this.$=new e.MustacheNode(g[h-1],null,g[h-2],a(g[h-2],g[h]),this._$);break;case 21:this.$=new e.MustacheNode(g[h-1],null,g[h-2],a(g[h-2],g[h]),this._$);break;case 22:this.$=new e.PartialNode(g[h-2],g[h-1],a(g[h-3],g[h]),this._$);break;case 23:this.$=a(g[h-1],g[h]);break;case 24:this.$=new e.SexprNode([g[h-2]].concat(g[h-1]),g[h],this._$);break;case 25:this.$=new e.SexprNode([g[h]],null,this._$);break;case 26:this.$=g[h];break;case 27:this.$=new e.StringNode(g[h],this._$);break;case 28:this.$=new e.IntegerNode(g[h],this._$);break;case 29:this.$=new e.BooleanNode(g[h],this._$);break;case 30:this.$=g[h];break;case 31:g[h-1].isHelper=!0,this.$=g[h-1];break;case 32:this.$=new e.HashNode(g[h],this._$);break;case 33:this.$=[g[h-2],g[h]];break;case 34:this.$=new e.PartialNameNode(g[h],this._$);break;case 35:this.$=new e.PartialNameNode(new e.StringNode(g[h],this._$),this._$);break;case 36:this.$=new e.PartialNameNode(new e.IntegerNode(g[h],this._$));break;case 37:this.$=new e.DataNode(g[h],this._$);break;case 38:this.$=new e.IdNode(g[h],this._$);break;case 39:g[h-2].push({part:g[h],separator:g[h-1]}),this.$=g[h-2];break;case 40:this.$=[{part:g[h]}];break;case 43:this.$=[];break;case 44:g[h-1].push(g[h]);break;case 47:this.$=[g[h]];break;case 48:g[h-1].push(g[h])}},table:[{3:1,4:2,5:[1,3],8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],25:[1,15]},{1:[3]},{5:[1,16],8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],25:[1,15]},{1:[2,2]},{5:[2,9],14:[2,9],15:[2,9],16:[2,9],19:[2,9],20:[2,9],22:[2,9],23:[2,9],25:[2,9]},{4:20,6:18,7:19,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,21],20:[2,8],22:[1,13],23:[1,14],25:[1,15]},{4:20,6:22,7:19,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,21],20:[2,8],22:[1,13],23:[1,14],25:[1,15]},{5:[2,13],14:[2,13],15:[2,13],16:[2,13],19:[2,13],20:[2,13],22:[2,13],23:[2,13],25:[2,13]},{5:[2,14],14:[2,14],15:[2,14],16:[2,14],19:[2,14],20:[2,14],22:[2,14],23:[2,14],25:[2,14]},{5:[2,15],14:[2,15],15:[2,15],16:[2,15],19:[2,15],20:[2,15],22:[2,15],23:[2,15],25:[2,15]},{5:[2,16],14:[2,16],15:[2,16],16:[2,16],19:[2,16],20:[2,16],22:[2,16],23:[2,16],25:[2,16]},{17:23,21:24,30:25,40:[1,28],42:[1,27],43:26},{17:29,21:24,30:25,40:[1,28],42:[1,27],43:26},{17:30,21:24,30:25,40:[1,28],42:[1,27],43:26},{17:31,21:24,30:25,40:[1,28],42:[1,27],43:26},{21:33,26:32,32:[1,34],33:[1,35],40:[1,28],43:26},{1:[2,1]},{5:[2,10],14:[2,10],15:[2,10],16:[2,10],19:[2,10],20:[2,10],22:[2,10],23:[2,10],25:[2,10]},{10:36,20:[1,37]},{4:38,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,7],22:[1,13],23:[1,14],25:[1,15]},{7:39,8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,21],20:[2,6],22:[1,13],23:[1,14],25:[1,15]},{17:23,18:[1,40],21:24,30:25,40:[1,28],42:[1,27],43:26},{10:41,20:[1,37]},{18:[1,42]},{18:[2,43],24:[2,43],28:43,32:[2,43],33:[2,43],34:[2,43],35:[2,43],36:[2,43],40:[2,43],42:[2,43]},{18:[2,25],24:[2,25],36:[2,25]},{18:[2,38],24:[2,38],32:[2,38],33:[2,38],34:[2,38],35:[2,38],36:[2,38],40:[2,38],42:[2,38],44:[1,44]},{21:45,40:[1,28],43:26},{18:[2,40],24:[2,40],32:[2,40],33:[2,40],34:[2,40],35:[2,40],36:[2,40],40:[2,40],42:[2,40],44:[2,40]},{18:[1,46]},{18:[1,47]},{24:[1,48]},{18:[2,41],21:50,27:49,40:[1,28],43:26},{18:[2,34],40:[2,34]},{18:[2,35],40:[2,35]},{18:[2,36],40:[2,36]},{5:[2,11],14:[2,11],15:[2,11],16:[2,11],19:[2,11],20:[2,11],22:[2,11],23:[2,11],25:[2,11]},{21:51,40:[1,28],43:26},{8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,3],22:[1,13],23:[1,14],25:[1,15]},{4:52,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,5],22:[1,13],23:[1,14],25:[1,15]},{14:[2,23],15:[2,23],16:[2,23],19:[2,23],20:[2,23],22:[2,23],23:[2,23],25:[2,23]},{5:[2,12],14:[2,12],15:[2,12],16:[2,12],19:[2,12],20:[2,12],22:[2,12],23:[2,12],25:[2,12]},{14:[2,18],15:[2,18],16:[2,18],19:[2,18],20:[2,18],22:[2,18],23:[2,18],25:[2,18]},{18:[2,45],21:56,24:[2,45],29:53,30:60,31:54,32:[1,57],33:[1,58],34:[1,59],35:[1,61],36:[2,45],37:55,38:62,39:63,40:[1,64],42:[1,27],43:26},{40:[1,65]},{18:[2,37],24:[2,37],32:[2,37],33:[2,37],34:[2,37],35:[2,37],36:[2,37],40:[2,37],42:[2,37]},{14:[2,17],15:[2,17],16:[2,17],19:[2,17],20:[2,17],22:[2,17],23:[2,17],25:[2,17]},{5:[2,20],14:[2,20],15:[2,20],16:[2,20],19:[2,20],20:[2,20],22:[2,20],23:[2,20],25:[2,20]},{5:[2,21],14:[2,21],15:[2,21],16:[2,21],19:[2,21],20:[2,21],22:[2,21],23:[2,21],25:[2,21]},{18:[1,66]},{18:[2,42]},{18:[1,67]},{8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],25:[1,15]},{18:[2,24],24:[2,24],36:[2,24]},{18:[2,44],24:[2,44],32:[2,44],33:[2,44],34:[2,44],35:[2,44],36:[2,44],40:[2,44],42:[2,44]},{18:[2,46],24:[2,46],36:[2,46]},{18:[2,26],24:[2,26],32:[2,26],33:[2,26],34:[2,26],35:[2,26],36:[2,26],40:[2,26],42:[2,26]},{18:[2,27],24:[2,27],32:[2,27],33:[2,27],34:[2,27],35:[2,27],36:[2,27],40:[2,27],42:[2,27]},{18:[2,28],24:[2,28],32:[2,28],33:[2,28],34:[2,28],35:[2,28],36:[2,28],40:[2,28],42:[2,28]},{18:[2,29],24:[2,29],32:[2,29],33:[2,29],34:[2,29],35:[2,29],36:[2,29],40:[2,29],42:[2,29]},{18:[2,30],24:[2,30],32:[2,30],33:[2,30],34:[2,30],35:[2,30],36:[2,30],40:[2,30],42:[2,30]},{17:68,21:24,30:25,40:[1,28],42:[1,27],43:26},{18:[2,32],24:[2,32],36:[2,32],39:69,40:[1,70]},{18:[2,47],24:[2,47],36:[2,47],40:[2,47]},{18:[2,40],24:[2,40],32:[2,40],33:[2,40],34:[2,40],35:[2,40],36:[2,40],40:[2,40],41:[1,71],42:[2,40],44:[2,40]},{18:[2,39],24:[2,39],32:[2,39],33:[2,39],34:[2,39],35:[2,39],36:[2,39],40:[2,39],42:[2,39],44:[2,39]},{5:[2,22],14:[2,22],15:[2,22],16:[2,22],19:[2,22],20:[2,22],22:[2,22],23:[2,22],25:[2,22]},{5:[2,19],14:[2,19],15:[2,19],16:[2,19],19:[2,19],20:[2,19],22:[2,19],23:[2,19],25:[2,19]},{36:[1,72]},{18:[2,48],24:[2,48],36:[2,48],40:[2,48]},{41:[1,71]},{21:56,30:60,31:73,32:[1,57],33:[1,58],34:[1,59],35:[1,61],40:[1,28],42:[1,27],43:26},{18:[2,31],24:[2,31],32:[2,31],33:[2,31],34:[2,31],35:[2,31],36:[2,31],40:[2,31],42:[2,31]},{18:[2,33],24:[2,33],36:[2,33],40:[2,33]}],defaultActions:{3:[2,2],16:[2,1],50:[2,42]},parseError:function(a){throw new Error(a)},parse:function(a){function b(){var a;return a=c.lexer.lex()||1,"number"!=typeof a&&(a=c.symbols_[a]||a),a}var c=this,d=[0],e=[null],f=[],g=this.table,h="",i=0,j=0,k=0;this.lexer.setInput(a),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,this.yy.parser=this,"undefined"==typeof this.lexer.yylloc&&(this.lexer.yylloc={});var l=this.lexer.yylloc;f.push(l);var m=this.lexer.options&&this.lexer.options.ranges;"function"==typeof this.yy.parseError&&(this.parseError=this.yy.parseError);for(var n,o,p,q,r,s,t,u,v,w={};;){if(p=d[d.length-1],this.defaultActions[p]?q=this.defaultActions[p]:((null===n||"undefined"==typeof n)&&(n=b()),q=g[p]&&g[p][n]),"undefined"==typeof q||!q.length||!q[0]){var x="";if(!k){v=[];for(s in g[p])this.terminals_[s]&&s>2&&v.push("'"+this.terminals_[s]+"'");x=this.lexer.showPosition?"Parse error on line "+(i+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+v.join(", ")+", got '"+(this.terminals_[n]||n)+"'":"Parse error on line "+(i+1)+": Unexpected "+(1==n?"end of input":"'"+(this.terminals_[n]||n)+"'"),this.parseError(x,{text:this.lexer.match,token:this.terminals_[n]||n,line:this.lexer.yylineno,loc:l,expected:v})}}if(q[0]instanceof Array&&q.length>1)throw new Error("Parse Error: multiple actions possible at state: "+p+", token: "+n);switch(q[0]){case 1:d.push(n),e.push(this.lexer.yytext),f.push(this.lexer.yylloc),d.push(q[1]),n=null,o?(n=o,o=null):(j=this.lexer.yyleng,h=this.lexer.yytext,i=this.lexer.yylineno,l=this.lexer.yylloc,k>0&&k--);break;case 2:if(t=this.productions_[q[1]][1],w.$=e[e.length-t],w._$={first_line:f[f.length-(t||1)].first_line,last_line:f[f.length-1].last_line,first_column:f[f.length-(t||1)].first_column,last_column:f[f.length-1].last_column},m&&(w._$.range=[f[f.length-(t||1)].range[0],f[f.length-1].range[1]]),r=this.performAction.call(w,h,j,i,this.yy,q[1],e,f),"undefined"!=typeof r)return r;t&&(d=d.slice(0,-1*t*2),e=e.slice(0,-1*t),f=f.slice(0,-1*t)),d.push(this.productions_[q[1]][0]),e.push(w.$),f.push(w._$),u=g[d[d.length-2]][d[d.length-1]],d.push(u);break;case 3:return!0}}return!0}},d=function(){var a={EOF:1,parseError:function(a,b){if(!this.yy.parser)throw new Error(a);this.yy.parser.parseError(a,b)},setInput:function(a){return this._input=a,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var a=this._input[0];this.yytext+=a,this.yyleng++,this.offset++,this.match+=a,this.matched+=a;var b=a.match(/(?:\r\n?|\n).*/g);return b?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),a},unput:function(a){var b=a.length,c=a.split(/(?:\r\n?|\n)/g);this._input=a+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-b-1),this.offset-=b;var d=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),c.length-1&&(this.yylineno-=c.length-1);var e=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:c?(c.length===d.length?this.yylloc.first_column:0)+d[d.length-c.length].length-c[0].length:this.yylloc.first_column-b},this.options.ranges&&(this.yylloc.range=[e[0],e[0]+this.yyleng-b]),this},more:function(){return this._more=!0,this},less:function(a){this.unput(this.match.slice(a))},pastInput:function(){var a=this.matched.substr(0,this.matched.length-this.match.length);return(a.length>20?"...":"")+a.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var a=this.match;return a.length<20&&(a+=this._input.substr(0,20-a.length)),(a.substr(0,20)+(a.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var a=this.pastInput(),b=new Array(a.length+1).join("-");return a+this.upcomingInput()+"\n"+b+"^"},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var a,b,c,d,e;this._more||(this.yytext="",this.match="");for(var f=this._currentRules(),g=0;g<f.length&&(c=this._input.match(this.rules[f[g]]),!c||b&&!(c[0].length>b[0].length)||(b=c,d=g,this.options.flex));g++);return b?(e=b[0].match(/(?:\r\n?|\n).*/g),e&&(this.yylineno+=e.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:e?e[e.length-1].length-e[e.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+b[0].length},this.yytext+=b[0],this.match+=b[0],this.matches=b,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._input=this._input.slice(b[0].length),this.matched+=b[0],a=this.performAction.call(this,this.yy,this,f[d],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),a?a:void 0):""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var a=this.next();return"undefined"!=typeof a?a:this.lex()},begin:function(a){this.conditionStack.push(a)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(a){this.begin(a)}};return a.options={},a.performAction=function(a,b,c,d){function e(a,c){return b.yytext=b.yytext.substr(a,b.yyleng-c)}switch(c){case 0:if("\\\\"===b.yytext.slice(-2)?(e(0,1),this.begin("mu")):"\\"===b.yytext.slice(-1)?(e(0,1),this.begin("emu")):this.begin("mu"),b.yytext)return 14;break;case 1:return 14;case 2:return this.popState(),14;case 3:return e(0,4),this.popState(),15;case 4:return 35;case 5:return 36;case 6:return 25;case 7:return 16;case 8:return 20;case 9:return 19;case 10:return 19;case 11:return 23;case 12:return 22;case 13:this.popState(),this.begin("com");break;case 14:return e(3,5),this.popState(),15;case 15:return 22;case 16:return 41;case 17:return 40;case 18:return 40;case 19:return 44;case 20:break;case 21:return this.popState(),24;case 22:return this.popState(),18;case 23:return b.yytext=e(1,2).replace(/\\"/g,'"'),32;case 24:return b.yytext=e(1,2).replace(/\\'/g,"'"),32;case 25:return 42;case 26:return 34;case 27:return 34;case 28:return 33;case 29:return 40;case 30:return b.yytext=e(1,2),40;case 31:return"INVALID";case 32:return 5}},a.rules=[/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:[\s\S]*?--\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{!--)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{(~)?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:-?[0-9]+(?=([~}\s)])))/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)]))))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/],a.conditions={mu:{rules:[4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32],inclusive:!1},emu:{rules:[2],inclusive:!1},com:{rules:[3],inclusive:!1},INITIAL:{rules:[0,1,32],inclusive:!0}},a}();return c.lexer=d,b.prototype=c,c.Parser=b,new b}();return a=b}(),i=function(a,b){"use strict";function c(a){return a.constructor===f.ProgramNode?a:(e.yy=f,e.parse(a))}var d={},e=a,f=b;return d.parser=e,d.parse=c,d}(h,g),j=function(a){"use strict";function b(){}function c(a,b,c){if(null==a||"string"!=typeof a&&a.constructor!==c.AST.ProgramNode)throw new f("You must pass a string or Handlebars AST to Handlebars.precompile. You passed "+a);b=b||{},"data"in b||(b.data=!0);var d=c.parse(a),e=(new c.Compiler).compile(d,b);return(new c.JavaScriptCompiler).compile(e,b)}function d(a,b,c){function d(){var d=c.parse(a),e=(new c.Compiler).compile(d,b),f=(new c.JavaScriptCompiler).compile(e,b,void 0,!0);return c.template(f)}if(null==a||"string"!=typeof a&&a.constructor!==c.AST.ProgramNode)throw new f("You must pass a string or Handlebars AST to Handlebars.compile. You passed "+a);b=b||{},"data"in b||(b.data=!0);var e;return function(a,b){return e||(e=d()),e.call(this,a,b)}}var e={},f=a;return e.Compiler=b,b.prototype={compiler:b,disassemble:function(){for(var a,b,c,d=this.opcodes,e=[],f=0,g=d.length;g>f;f++)if(a=d[f],"DECLARE"===a.opcode)e.push("DECLARE "+a.name+"="+a.value);else{b=[];for(var h=0;h<a.args.length;h++)c=a.args[h],"string"==typeof c&&(c='"'+c.replace("\n","\\n")+'"'),b.push(c);e.push(a.opcode+" "+b.join(" "))}return e.join("\n")},equals:function(a){var b=this.opcodes.length;if(a.opcodes.length!==b)return!1;for(var c=0;b>c;c++){var d=this.opcodes[c],e=a.opcodes[c];if(d.opcode!==e.opcode||d.args.length!==e.args.length)return!1;for(var f=0;f<d.args.length;f++)if(d.args[f]!==e.args[f])return!1}if(b=this.children.length,a.children.length!==b)return!1;for(c=0;b>c;c++)if(!this.children[c].equals(a.children[c]))return!1;return!0},guid:0,compile:function(a,b){this.opcodes=[],this.children=[],this.depths={list:[]},this.options=b;var c=this.options.knownHelpers;if(this.options.knownHelpers={helperMissing:!0,blockHelperMissing:!0,each:!0,"if":!0,unless:!0,"with":!0,log:!0},c)for(var d in c)this.options.knownHelpers[d]=c[d];return this.accept(a)},accept:function(a){var b,c=a.strip||{};return c.left&&this.opcode("strip"),b=this[a.type](a),c.right&&this.opcode("strip"),b},program:function(a){for(var b=a.statements,c=0,d=b.length;d>c;c++)this.accept(b[c]);return this.isSimple=1===d,this.depths.list=this.depths.list.sort(function(a,b){return a-b}),this},compileProgram:function(a){var b,c=(new this.compiler).compile(a,this.options),d=this.guid++;this.usePartial=this.usePartial||c.usePartial,this.children[d]=c;for(var e=0,f=c.depths.list.length;f>e;e++)b=c.depths.list[e],2>b||this.addDepth(b-1);return d},block:function(a){var b=a.mustache,c=a.program,d=a.inverse;c&&(c=this.compileProgram(c)),d&&(d=this.compileProgram(d));var e=b.sexpr,f=this.classifySexpr(e);"helper"===f?this.helperSexpr(e,c,d):"simple"===f?(this.simpleSexpr(e),this.opcode("pushProgram",c),this.opcode("pushProgram",d),this.opcode("emptyHash"),this.opcode("blockValue")):(this.ambiguousSexpr(e,c,d),this.opcode("pushProgram",c),this.opcode("pushProgram",d),this.opcode("emptyHash"),this.opcode("ambiguousBlockValue")),this.opcode("append")},hash:function(a){var b,c,d=a.pairs;this.opcode("pushHash");for(var e=0,f=d.length;f>e;e++)b=d[e],c=b[1],this.options.stringParams?(c.depth&&this.addDepth(c.depth),this.opcode("getContext",c.depth||0),this.opcode("pushStringParam",c.stringModeValue,c.type),"sexpr"===c.type&&this.sexpr(c)):this.accept(c),this.opcode("assignToHash",b[0]);this.opcode("popHash")},partial:function(a){var b=a.partialName;this.usePartial=!0,a.context?this.ID(a.context):this.opcode("push","depth0"),this.opcode("invokePartial",b.name),this.opcode("append")},content:function(a){this.opcode("appendContent",a.string)},mustache:function(a){this.sexpr(a.sexpr),a.escaped&&!this.options.noEscape?this.opcode("appendEscaped"):this.opcode("append")},ambiguousSexpr:function(a,b,c){var d=a.id,e=d.parts[0],f=null!=b||null!=c;this.opcode("getContext",d.depth),this.opcode("pushProgram",b),this.opcode("pushProgram",c),this.opcode("invokeAmbiguous",e,f)},simpleSexpr:function(a){var b=a.id;"DATA"===b.type?this.DATA(b):b.parts.length?this.ID(b):(this.addDepth(b.depth),this.opcode("getContext",b.depth),this.opcode("pushContext")),this.opcode("resolvePossibleLambda")},helperSexpr:function(a,b,c){var d=this.setupFullMustacheParams(a,b,c),e=a.id.parts[0];if(this.options.knownHelpers[e])this.opcode("invokeKnownHelper",d.length,e);else{if(this.options.knownHelpersOnly)throw new f("You specified knownHelpersOnly, but used the unknown helper "+e,a);this.opcode("invokeHelper",d.length,e,a.isRoot)}},sexpr:function(a){var b=this.classifySexpr(a);"simple"===b?this.simpleSexpr(a):"helper"===b?this.helperSexpr(a):this.ambiguousSexpr(a)},ID:function(a){this.addDepth(a.depth),this.opcode("getContext",a.depth);var b=a.parts[0];b?this.opcode("lookupOnContext",a.parts[0]):this.opcode("pushContext");for(var c=1,d=a.parts.length;d>c;c++)this.opcode("lookup",a.parts[c])},DATA:function(a){if(this.options.data=!0,a.id.isScoped||a.id.depth)throw new f("Scoped data references are not supported: "+a.original,a);this.opcode("lookupData");for(var b=a.id.parts,c=0,d=b.length;d>c;c++)this.opcode("lookup",b[c])},STRING:function(a){this.opcode("pushString",a.string)},INTEGER:function(a){this.opcode("pushLiteral",a.integer)},BOOLEAN:function(a){this.opcode("pushLiteral",a.bool)},comment:function(){},opcode:function(a){this.opcodes.push({opcode:a,args:[].slice.call(arguments,1)})},declare:function(a,b){this.opcodes.push({opcode:"DECLARE",name:a,value:b})},addDepth:function(a){0!==a&&(this.depths[a]||(this.depths[a]=!0,this.depths.list.push(a)))},classifySexpr:function(a){var b=a.isHelper,c=a.eligibleHelper,d=this.options;if(c&&!b){var e=a.id.parts[0];d.knownHelpers[e]?b=!0:d.knownHelpersOnly&&(c=!1)}return b?"helper":c?"ambiguous":"simple"},pushParams:function(a){for(var b,c=a.length;c--;)b=a[c],this.options.stringParams?(b.depth&&this.addDepth(b.depth),this.opcode("getContext",b.depth||0),this.opcode("pushStringParam",b.stringModeValue,b.type),"sexpr"===b.type&&this.sexpr(b)):this[b.type](b)},setupFullMustacheParams:function(a,b,c){var d=a.params;return this.pushParams(d),this.opcode("pushProgram",b),this.opcode("pushProgram",c),a.hash?this.hash(a.hash):this.opcode("emptyHash"),d}},e.precompile=c,e.compile=d,e}(c),k=function(a,b){"use strict";function c(a){this.value=a}function d(){}var e,f=a.COMPILER_REVISION,g=a.REVISION_CHANGES,h=a.log,i=b;d.prototype={nameLookup:function(a,b){var c,e;return 0===a.indexOf("depth")&&(c=!0),e=/^[0-9]+$/.test(b)?a+"["+b+"]":d.isValidJavaScriptVariableName(b)?a+"."+b:a+"['"+b+"']",c?"("+a+" && "+e+")":e},compilerInfo:function(){var a=f,b=g[a];return"this.compilerInfo = ["+a+",'"+b+"'];\n"},appendToBuffer:function(a){return this.environment.isSimple?"return "+a+";":{appendToBuffer:!0,content:a,toString:function(){return"buffer += "+a+";"}}},initializeBuffer:function(){return this.quotedString("")},namespace:"Handlebars",compile:function(a,b,c,d){this.environment=a,this.options=b||{},h("debug",this.environment.disassemble()+"\n\n"),this.name=this.environment.name,this.isChild=!!c,this.context=c||{programs:[],environments:[],aliases:{}},this.preamble(),this.stackSlot=0,this.stackVars=[],this.registers={list:[]},this.hashes=[],this.compileStack=[],this.inlineStack=[],this.compileChildren(a,b); | ||
var e,f=a.opcodes;this.i=0;for(var g=f.length;this.i<g;this.i++)e=f[this.i],"DECLARE"===e.opcode?this[e.name]=e.value:this[e.opcode].apply(this,e.args),e.opcode!==this.stripNext&&(this.stripNext=!1);if(this.pushSource(""),this.stackSlot||this.inlineStack.length||this.compileStack.length)throw new i("Compile completed with content left on stack");return this.createFunctionContext(d)},preamble:function(){var a=[];if(this.isChild)a.push("");else{var b=this.namespace,c="helpers = this.merge(helpers, "+b+".helpers);";this.environment.usePartial&&(c=c+" partials = this.merge(partials, "+b+".partials);"),this.options.data&&(c+=" data = data || {};"),a.push(c)}this.environment.isSimple?a.push(""):a.push(", buffer = "+this.initializeBuffer()),this.lastContext=0,this.source=a},createFunctionContext:function(a){var b=this.stackVars.concat(this.registers.list);if(b.length>0&&(this.source[1]=this.source[1]+", "+b.join(", ")),!this.isChild)for(var c in this.context.aliases)this.context.aliases.hasOwnProperty(c)&&(this.source[1]=this.source[1]+", "+c+"="+this.context.aliases[c]);this.source[1]&&(this.source[1]="var "+this.source[1].substring(2)+";"),this.isChild||(this.source[1]+="\n"+this.context.programs.join("\n")+"\n"),this.environment.isSimple||this.pushSource("return buffer;");for(var d=this.isChild?["depth0","data"]:["Handlebars","depth0","helpers","partials","data"],e=0,f=this.environment.depths.list.length;f>e;e++)d.push("depth"+this.environment.depths.list[e]);var g=this.mergeSource();if(this.isChild||(g=this.compilerInfo()+g),a)return d.push(g),Function.apply(this,d);var i="function "+(this.name||"")+"("+d.join(",")+") {\n "+g+"}";return h("debug",i+"\n\n"),i},mergeSource:function(){for(var a,b="",c=0,d=this.source.length;d>c;c++){var e=this.source[c];e.appendToBuffer?a=a?a+"\n + "+e.content:e.content:(a&&(b+="buffer += "+a+";\n ",a=void 0),b+=e+"\n ")}return b},blockValue:function(){this.context.aliases.blockHelperMissing="helpers.blockHelperMissing";var a=["depth0"];this.setupParams(0,a),this.replaceStack(function(b){return a.splice(1,0,b),"blockHelperMissing.call("+a.join(", ")+")"})},ambiguousBlockValue:function(){this.context.aliases.blockHelperMissing="helpers.blockHelperMissing";var a=["depth0"];this.setupParams(0,a);var b=this.topStack();a.splice(1,0,b),this.pushSource("if (!"+this.lastHelper+") { "+b+" = blockHelperMissing.call("+a.join(", ")+"); }")},appendContent:function(a){this.pendingContent&&(a=this.pendingContent+a),this.stripNext&&(a=a.replace(/^\s+/,"")),this.pendingContent=a},strip:function(){this.pendingContent&&(this.pendingContent=this.pendingContent.replace(/\s+$/,"")),this.stripNext="strip"},append:function(){this.flushInline();var a=this.popStack();this.pushSource("if("+a+" || "+a+" === 0) { "+this.appendToBuffer(a)+" }"),this.environment.isSimple&&this.pushSource("else { "+this.appendToBuffer("''")+" }")},appendEscaped:function(){this.context.aliases.escapeExpression="this.escapeExpression",this.pushSource(this.appendToBuffer("escapeExpression("+this.popStack()+")"))},getContext:function(a){this.lastContext!==a&&(this.lastContext=a)},lookupOnContext:function(a){this.push(this.nameLookup("depth"+this.lastContext,a,"context"))},pushContext:function(){this.pushStackLiteral("depth"+this.lastContext)},resolvePossibleLambda:function(){this.context.aliases.functionType='"function"',this.replaceStack(function(a){return"typeof "+a+" === functionType ? "+a+".apply(depth0) : "+a})},lookup:function(a){this.replaceStack(function(b){return b+" == null || "+b+" === false ? "+b+" : "+this.nameLookup(b,a,"context")})},lookupData:function(){this.pushStackLiteral("data")},pushStringParam:function(a,b){this.pushStackLiteral("depth"+this.lastContext),this.pushString(b),"sexpr"!==b&&("string"==typeof a?this.pushString(a):this.pushStackLiteral(a))},emptyHash:function(){this.pushStackLiteral("{}"),this.options.stringParams&&(this.push("{}"),this.push("{}"))},pushHash:function(){this.hash&&this.hashes.push(this.hash),this.hash={values:[],types:[],contexts:[]}},popHash:function(){var a=this.hash;this.hash=this.hashes.pop(),this.options.stringParams&&(this.push("{"+a.contexts.join(",")+"}"),this.push("{"+a.types.join(",")+"}")),this.push("{\n "+a.values.join(",\n ")+"\n }")},pushString:function(a){this.pushStackLiteral(this.quotedString(a))},push:function(a){return this.inlineStack.push(a),a},pushLiteral:function(a){this.pushStackLiteral(a)},pushProgram:function(a){null!=a?this.pushStackLiteral(this.programExpression(a)):this.pushStackLiteral(null)},invokeHelper:function(a,b,c){this.context.aliases.helperMissing="helpers.helperMissing",this.useRegister("helper");var d=this.lastHelper=this.setupHelper(a,b,!0),e=this.nameLookup("depth"+this.lastContext,b,"context"),f="helper = "+d.name+" || "+e;d.paramsInit&&(f+=","+d.paramsInit),this.push("("+f+",helper ? helper.call("+d.callParams+") : helperMissing.call("+d.helperMissingParams+"))"),c||this.flushInline()},invokeKnownHelper:function(a,b){var c=this.setupHelper(a,b);this.push(c.name+".call("+c.callParams+")")},invokeAmbiguous:function(a,b){this.context.aliases.functionType='"function"',this.useRegister("helper"),this.emptyHash();var c=this.setupHelper(0,a,b),d=this.lastHelper=this.nameLookup("helpers",a,"helper"),e=this.nameLookup("depth"+this.lastContext,a,"context"),f=this.nextStack();c.paramsInit&&this.pushSource(c.paramsInit),this.pushSource("if (helper = "+d+") { "+f+" = helper.call("+c.callParams+"); }"),this.pushSource("else { helper = "+e+"; "+f+" = typeof helper === functionType ? helper.call("+c.callParams+") : helper; }")},invokePartial:function(a){var b=[this.nameLookup("partials",a,"partial"),"'"+a+"'",this.popStack(),"helpers","partials"];this.options.data&&b.push("data"),this.context.aliases.self="this",this.push("self.invokePartial("+b.join(", ")+")")},assignToHash:function(a){var b,c,d=this.popStack();this.options.stringParams&&(c=this.popStack(),b=this.popStack());var e=this.hash;b&&e.contexts.push("'"+a+"': "+b),c&&e.types.push("'"+a+"': "+c),e.values.push("'"+a+"': ("+d+")")},compiler:d,compileChildren:function(a,b){for(var c,d,e=a.children,f=0,g=e.length;g>f;f++){c=e[f],d=new this.compiler;var h=this.matchExistingProgram(c);null==h?(this.context.programs.push(""),h=this.context.programs.length,c.index=h,c.name="program"+h,this.context.programs[h]=d.compile(c,b,this.context),this.context.environments[h]=c):(c.index=h,c.name="program"+h)}},matchExistingProgram:function(a){for(var b=0,c=this.context.environments.length;c>b;b++){var d=this.context.environments[b];if(d&&d.equals(a))return b}},programExpression:function(a){if(this.context.aliases.self="this",null==a)return"self.noop";for(var b,c=this.environment.children[a],d=c.depths.list,e=[c.index,c.name,"data"],f=0,g=d.length;g>f;f++)b=d[f],1===b?e.push("depth0"):e.push("depth"+(b-1));return(0===d.length?"self.program(":"self.programWithDepth(")+e.join(", ")+")"},register:function(a,b){this.useRegister(a),this.pushSource(a+" = "+b+";")},useRegister:function(a){this.registers[a]||(this.registers[a]=!0,this.registers.list.push(a))},pushStackLiteral:function(a){return this.push(new c(a))},pushSource:function(a){this.pendingContent&&(this.source.push(this.appendToBuffer(this.quotedString(this.pendingContent))),this.pendingContent=void 0),a&&this.source.push(a)},pushStack:function(a){this.flushInline();var b=this.incrStack();return a&&this.pushSource(b+" = "+a+";"),this.compileStack.push(b),b},replaceStack:function(a){var b,d,e,f="",g=this.isInline();if(g){var h=this.popStack(!0);if(h instanceof c)b=h.value,e=!0;else{d=!this.stackSlot;var i=d?this.incrStack():this.topStackName();f="("+this.push(i)+" = "+h+"),",b=this.topStack()}}else b=this.topStack();var j=a.call(this,b);return g?(e||this.popStack(),d&&this.stackSlot--,this.push("("+f+j+")")):(/^stack/.test(b)||(b=this.nextStack()),this.pushSource(b+" = ("+f+j+");")),b},nextStack:function(){return this.pushStack()},incrStack:function(){return this.stackSlot++,this.stackSlot>this.stackVars.length&&this.stackVars.push("stack"+this.stackSlot),this.topStackName()},topStackName:function(){return"stack"+this.stackSlot},flushInline:function(){var a=this.inlineStack;if(a.length){this.inlineStack=[];for(var b=0,d=a.length;d>b;b++){var e=a[b];e instanceof c?this.compileStack.push(e):this.pushStack(e)}}},isInline:function(){return this.inlineStack.length},popStack:function(a){var b=this.isInline(),d=(b?this.inlineStack:this.compileStack).pop();if(!a&&d instanceof c)return d.value;if(!b){if(!this.stackSlot)throw new i("Invalid stack pop");this.stackSlot--}return d},topStack:function(a){var b=this.isInline()?this.inlineStack:this.compileStack,d=b[b.length-1];return!a&&d instanceof c?d.value:d},quotedString:function(a){return'"'+a.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")+'"'},setupHelper:function(a,b,c){var d=[],e=this.setupParams(a,d,c),f=this.nameLookup("helpers",b,"helper");return{params:d,paramsInit:e,name:f,callParams:["depth0"].concat(d).join(", "),helperMissingParams:c&&["depth0",this.quotedString(b)].concat(d).join(", ")}},setupOptions:function(a,b){var c,d,e,f=[],g=[],h=[];f.push("hash:"+this.popStack()),this.options.stringParams&&(f.push("hashTypes:"+this.popStack()),f.push("hashContexts:"+this.popStack())),d=this.popStack(),e=this.popStack(),(e||d)&&(e||(this.context.aliases.self="this",e="self.noop"),d||(this.context.aliases.self="this",d="self.noop"),f.push("inverse:"+d),f.push("fn:"+e));for(var i=0;a>i;i++)c=this.popStack(),b.push(c),this.options.stringParams&&(h.push(this.popStack()),g.push(this.popStack()));return this.options.stringParams&&(f.push("contexts:["+g.join(",")+"]"),f.push("types:["+h.join(",")+"]")),this.options.data&&f.push("data:data"),f},setupParams:function(a,b,c){var d="{"+this.setupOptions(a,b).join(",")+"}";return c?(this.useRegister("options"),b.push("options"),"options="+d):(b.push(d),"")}};for(var j="break else new var case finally return void catch for switch while continue function this with default if throw delete in try do instanceof typeof abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public let yield".split(" "),k=d.RESERVED_WORDS={},l=0,m=j.length;m>l;l++)k[j[l]]=!0;return d.isValidJavaScriptVariableName=function(a){return!d.RESERVED_WORDS[a]&&/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(a)?!0:!1},e=d}(d,c),l=function(a,b,c,d,e){"use strict";var f,g=a,h=b,i=c.parser,j=c.parse,k=d.Compiler,l=d.compile,m=d.precompile,n=e,o=g.create,p=function(){var a=o();return a.compile=function(b,c){return l(b,c,a)},a.precompile=function(b,c){return m(b,c,a)},a.AST=h,a.Compiler=k,a.JavaScriptCompiler=n,a.Parser=i,a.parse=j,a};return g=p(),g.create=p,f=g}(f,g,i,j,k);return l}(); | ||
this.Handlebars=function(){var a=function(){"use strict";function a(a){this.string=a}var b;return a.prototype.toString=function(){return""+this.string},b=a}(),b=function(a){"use strict";function b(a){return i[a]||"&"}function c(a){for(var b=1;b<arguments.length;b++)for(var c in arguments[b])Object.prototype.hasOwnProperty.call(arguments[b],c)&&(a[c]=arguments[b][c]);return a}function d(a){return a instanceof h?a.toString():a||0===a?(a=""+a,k.test(a)?a.replace(j,b):a):""}function e(a){return a||0===a?n(a)&&0===a.length?!0:!1:!0}function f(a,b){return(a?a+".":"")+b}var g={},h=a,i={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},j=/[&<>"'`]/g,k=/[&<>"'`]/;g.extend=c;var l=Object.prototype.toString;g.toString=l;var m=function(a){return"function"==typeof a};m(/x/)&&(m=function(a){return"function"==typeof a&&"[object Function]"===l.call(a)});var m;g.isFunction=m;var n=Array.isArray||function(a){return a&&"object"==typeof a?"[object Array]"===l.call(a):!1};return g.isArray=n,g.escapeExpression=d,g.isEmpty=e,g.appendContextPath=f,g}(a),c=function(){"use strict";function a(a,b){var d;b&&b.firstLine&&(d=b.firstLine,a+=" - "+d+":"+b.firstColumn);for(var e=Error.prototype.constructor.call(this,a),f=0;f<c.length;f++)this[c[f]]=e[c[f]];d&&(this.lineNumber=d,this.column=b.firstColumn)}var b,c=["description","fileName","lineNumber","message","name","number","stack"];return a.prototype=new Error,b=a}(),d=function(a,b){"use strict";function c(a,b){this.helpers=a||{},this.partials=b||{},d(this)}function d(a){a.registerHelper("helperMissing",function(){if(1===arguments.length)return void 0;throw new h("Missing helper: '"+arguments[arguments.length-1].name+"'")}),a.registerHelper("blockHelperMissing",function(b,c){var d=c.inverse||function(){},e=c.fn;if(m(b)&&(b=b.call(this)),b===!0)return e(this);if(b===!1||null==b)return d(this);if(l(b))return b.length>0?(c.ids&&(c.ids=[c.name]),a.helpers.each(b,c)):d(this);if(c.data&&c.ids){var f=q(c.data);f.contextPath=g.appendContextPath(c.data.contextPath,c.name),c={data:f}}return e(b,c)}),a.registerHelper("each",function(a,b){b||(b=a,a=this);var c,d,e=b.fn,f=b.inverse,h=0,i="";if(b.data&&b.ids&&(d=g.appendContextPath(b.data.contextPath,b.ids[0])+"."),m(a)&&(a=a.call(this)),b.data&&(c=q(b.data)),a&&"object"==typeof a)if(l(a))for(var j=a.length;j>h;h++)c&&(c.index=h,c.first=0===h,c.last=h===a.length-1,d&&(c.contextPath=d+h)),i+=e(a[h],{data:c});else for(var k in a)a.hasOwnProperty(k)&&(c&&(c.key=k,c.index=h,c.first=0===h,d&&(c.contextPath=d+k)),i+=e(a[k],{data:c}),h++);return 0===h&&(i=f(this)),i}),a.registerHelper("if",function(a,b){return m(a)&&(a=a.call(this)),!b.hash.includeZero&&!a||g.isEmpty(a)?b.inverse(this):b.fn(this)}),a.registerHelper("unless",function(b,c){return a.helpers["if"].call(this,b,{fn:c.inverse,inverse:c.fn,hash:c.hash})}),a.registerHelper("with",function(a,b){m(a)&&(a=a.call(this));var c=b.fn;if(!g.isEmpty(a)){if(b.data&&b.ids){var d=q(b.data);d.contextPath=g.appendContextPath(b.data.contextPath,b.ids[0]),b={data:d}}return c(a,b)}}),a.registerHelper("log",function(b,c){var d=c.data&&null!=c.data.level?parseInt(c.data.level,10):1;a.log(d,b)}),a.registerHelper("lookup",function(a,b){return a&&a[b]})}function e(a,b){p.log(a,b)}var f={},g=a,h=b,i="v2.0.0-alpha.1";f.VERSION=i;var j=5;f.COMPILER_REVISION=j;var k={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:"== 1.x.x",5:">= 2.0.0"};f.REVISION_CHANGES=k;var l=g.isArray,m=g.isFunction,n=g.toString,o="[object Object]";f.HandlebarsEnvironment=c,c.prototype={constructor:c,logger:p,log:e,registerHelper:function(a,b,c){if(n.call(a)===o){if(c||b)throw new h("Arg not supported with multiple helpers");g.extend(this.helpers,a)}else c&&(b.not=c),this.helpers[a]=b},unregisterHelper:function(a){delete this.helpers[a]},registerPartial:function(a,b){n.call(a)===o?g.extend(this.partials,a):this.partials[a]=b},unregisterPartial:function(a){delete this.partials[a]}};var p={methodMap:{0:"debug",1:"info",2:"warn",3:"error"},DEBUG:0,INFO:1,WARN:2,ERROR:3,level:3,log:function(a,b){if(p.level<=a){var c=p.methodMap[a];"undefined"!=typeof console&&console[c]&&console[c].call(console,b)}}};f.logger=p,f.log=e;var q=function(a){var b=g.extend({},a);return b._parent=a,b};return f.createFrame=q,f}(b,c),e=function(a,b,c){"use strict";function d(a){var b=a&&a[0]||1,c=m;if(b!==c){if(c>b){var d=n[c],e=n[b];throw new l("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+d+") or downgrade your runtime to an older version ("+e+").")}throw new l("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+a[1]+").")}}function e(a,b){if(!b)throw new l("No environment passed to template");b.VM.checkRevision(a.compiler);var c=function(a,c,d,e,f,g,h){e&&(d=k.extend({},d,e));var i=b.VM.invokePartial.call(this,a,c,d,f,g,h);if(null!=i)return i;if(b.compile){var j={helpers:f,partials:g,data:h};return g[c]=b.compile(a,{data:void 0!==h},b),g[c](d,j)}throw new l("The partial "+c+" could not be compiled when running in runtime-only mode")},d={escapeExpression:k.escapeExpression,invokePartial:c,fn:function(b){return a[b]},programs:[],program:function(a,b){var c=this.programs[a],d=this.fn(a);return b?c=g(this,a,d,b):c||(c=this.programs[a]=g(this,a,d)),c},programWithDepth:b.VM.programWithDepth,initData:function(a,b){return b&&"root"in b||(b=b?o(b):{},b.root=a),b},data:function(a,b){for(;a&&b--;)a=a._parent;return a},merge:function(a,b){var c=a||b;return a&&b&&a!==b&&(c=k.extend({},b,a)),c},noop:b.VM.noop,compilerInfo:a.compiler},e=function(c,e){e=e||{};var f,g,h=e.partial?e:b,i=e.data;return e.partial?(f=d.helpers=e.helpers,g=d.partials=e.partials):(f=d.helpers=d.merge(e.helpers,h.helpers),a.usePartial&&(g=d.partials=d.merge(e.partials,h.partials)),a.useData&&(i=d.initData(c,i))),a.main.call(d,c,f,g,i)};return e.child=function(a){return d.programWithDepth(a)},e}function f(a,b){var c=Array.prototype.slice.call(arguments,2),d=this,e=d.fn(a),f=function(a,f){return f=f||{},e.apply(d,[a,d.helpers,d.partials,f.data||b].concat(c))};return f.program=a,f.depth=c.length,f}function g(a,b,c,d){var e=function(b,e){return e=e||{},c.call(a,b,a.helpers,a.partials,e.data||d)};return e.program=b,e.depth=0,e}function h(a,b,c,d,e,f){var g={partial:!0,helpers:d,partials:e,data:f};if(void 0===a)throw new l("The partial "+b+" could not be found");return a instanceof Function?a(c,g):void 0}function i(){return""}var j={},k=a,l=b,m=c.COMPILER_REVISION,n=c.REVISION_CHANGES,o=c.createFrame;return j.checkRevision=d,j.template=e,j.programWithDepth=f,j.program=g,j.invokePartial=h,j.noop=i,j}(b,c,d),f=function(a,b,c,d,e){"use strict";var f,g=a,h=b,i=c,j=d,k=e,l=function(){var a=new g.HandlebarsEnvironment;return j.extend(a,g),a.SafeString=h,a.Exception=i,a.Utils=j,a.VM=k,a.template=function(b){return k.template(b,a)},a},m=l();return m.create=l,f=m}(d,a,c,b,e),g=function(a){"use strict";function b(a){a=a||{},this.firstLine=a.first_line,this.firstColumn=a.first_column,this.lastColumn=a.last_column,this.lastLine=a.last_line}var c,d=a,e={ProgramNode:function(a,c,d,f){var g,h;3===arguments.length?(f=d,d=null):2===arguments.length&&(f=c,c=null),b.call(this,f),this.type="program",this.statements=a,this.strip={},d?(h=d[0],h?(g={first_line:h.firstLine,last_line:h.lastLine,last_column:h.lastColumn,first_column:h.firstColumn},this.inverse=new e.ProgramNode(d,c,g)):this.inverse=new e.ProgramNode(d,c),this.strip.right=c.left):c&&(this.strip.left=c.right)},MustacheNode:function(a,c,d,f,g){if(b.call(this,g),this.type="mustache",this.strip=f,null!=d&&d.charAt){var h=d.charAt(3)||d.charAt(2);this.escaped="{"!==h&&"&"!==h}else this.escaped=!!d;this.sexpr=a instanceof e.SexprNode?a:new e.SexprNode(a,c),this.sexpr.isRoot=!0,this.id=this.sexpr.id,this.params=this.sexpr.params,this.hash=this.sexpr.hash,this.eligibleHelper=this.sexpr.eligibleHelper,this.isHelper=this.sexpr.isHelper},SexprNode:function(a,c,d){b.call(this,d),this.type="sexpr",this.hash=c;var e=this.id=a[0],f=this.params=a.slice(1);this.isHelper=f.length||c,this.eligibleHelper=this.isHelper||e.isSimple},PartialNode:function(a,c,d,e,f){b.call(this,f),this.type="partial",this.partialName=a,this.context=c,this.hash=d,this.strip=e},BlockNode:function(a,c,e,f,g){if(b.call(this,g),a.sexpr.id.original!==f.path.original)throw new d(a.sexpr.id.original+" doesn't match "+f.path.original,this);this.type="block",this.mustache=a,this.program=c,this.inverse=e,this.strip={left:a.strip.left,right:f.strip.right},(c||e).strip.left=a.strip.right,(e||c).strip.right=f.strip.left,e&&!c&&(this.isInverse=!0)},RawBlockNode:function(a,c,f,g){if(b.call(this,g),a.sexpr.id.original!==f)throw new d(a.sexpr.id.original+" doesn't match "+f,this);c=new e.ContentNode(c,g),this.type="block",this.mustache=a,this.program=new e.ProgramNode([c],g)},ContentNode:function(a,c){b.call(this,c),this.type="content",this.string=a},HashNode:function(a,c){b.call(this,c),this.type="hash",this.pairs=a},IdNode:function(a,c){b.call(this,c),this.type="ID";for(var e="",f=[],g=0,h="",i=0,j=a.length;j>i;i++){var k=a[i].part;if(e+=(a[i].separator||"")+k,".."===k||"."===k||"this"===k){if(f.length>0)throw new d("Invalid path: "+e,this);".."===k?(g++,h+="../"):this.isScoped=!0}else f.push(k)}this.original=e,this.parts=f,this.string=f.join("."),this.depth=g,this.idName=h+this.string,this.isSimple=1===a.length&&!this.isScoped&&0===g,this.stringModeValue=this.string},PartialNameNode:function(a,c){b.call(this,c),this.type="PARTIAL_NAME",this.name=a.original},DataNode:function(a,c){b.call(this,c),this.type="DATA",this.id=a,this.stringModeValue=a.stringModeValue,this.idName="@"+a.stringModeValue},StringNode:function(a,c){b.call(this,c),this.type="STRING",this.original=this.string=this.stringModeValue=a},NumberNode:function(a,c){b.call(this,c),this.type="NUMBER",this.original=this.number=a,this.stringModeValue=Number(a)},BooleanNode:function(a,c){b.call(this,c),this.type="BOOLEAN",this.bool=a,this.stringModeValue="true"===a},CommentNode:function(a,c){b.call(this,c),this.type="comment",this.comment=a}};return c=e}(c),h=function(){"use strict";var a,b=function(){function a(a,b){return{left:"~"===a.charAt(2),right:"~"===b.charAt(0)||"~"===b.charAt(1)}}function b(){this.yy={}}var c={trace:function(){},yy:{},symbols_:{error:2,root:3,statements:4,EOF:5,program:6,simpleInverse:7,statement:8,openRawBlock:9,CONTENT:10,END_RAW_BLOCK:11,openInverse:12,closeBlock:13,openBlock:14,mustache:15,partial:16,COMMENT:17,OPEN_RAW_BLOCK:18,sexpr:19,CLOSE_RAW_BLOCK:20,OPEN_BLOCK:21,CLOSE:22,OPEN_INVERSE:23,OPEN_ENDBLOCK:24,path:25,OPEN:26,OPEN_UNESCAPED:27,CLOSE_UNESCAPED:28,OPEN_PARTIAL:29,partialName:30,param:31,partial_option0:32,partial_option1:33,sexpr_repetition0:34,sexpr_option0:35,dataName:36,STRING:37,NUMBER:38,BOOLEAN:39,OPEN_SEXPR:40,CLOSE_SEXPR:41,hash:42,hash_repetition_plus0:43,hashSegment:44,ID:45,EQUALS:46,DATA:47,pathSegments:48,SEP:49,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",10:"CONTENT",11:"END_RAW_BLOCK",17:"COMMENT",18:"OPEN_RAW_BLOCK",20:"CLOSE_RAW_BLOCK",21:"OPEN_BLOCK",22:"CLOSE",23:"OPEN_INVERSE",24:"OPEN_ENDBLOCK",26:"OPEN",27:"OPEN_UNESCAPED",28:"CLOSE_UNESCAPED",29:"OPEN_PARTIAL",37:"STRING",38:"NUMBER",39:"BOOLEAN",40:"OPEN_SEXPR",41:"CLOSE_SEXPR",45:"ID",46:"EQUALS",47:"DATA",49:"SEP"},productions_:[0,[3,2],[3,1],[6,2],[6,3],[6,2],[6,1],[6,1],[6,0],[4,1],[4,2],[8,3],[8,3],[8,3],[8,1],[8,1],[8,1],[8,1],[9,3],[14,3],[12,3],[13,3],[15,3],[15,3],[16,5],[16,4],[7,2],[19,3],[19,1],[31,1],[31,1],[31,1],[31,1],[31,1],[31,3],[42,1],[44,3],[30,1],[30,1],[30,1],[36,2],[25,1],[48,3],[48,1],[32,0],[32,1],[33,0],[33,1],[34,0],[34,2],[35,0],[35,1],[43,1],[43,2]],performAction:function(b,c,d,e,f,g){var h=g.length-1;switch(f){case 1:return new e.ProgramNode(g[h-1],this._$);case 2:return new e.ProgramNode([],this._$);case 3:this.$=new e.ProgramNode([],g[h-1],g[h],this._$);break;case 4:this.$=new e.ProgramNode(g[h-2],g[h-1],g[h],this._$);break;case 5:this.$=new e.ProgramNode(g[h-1],g[h],[],this._$);break;case 6:this.$=new e.ProgramNode(g[h],this._$);break;case 7:this.$=new e.ProgramNode([],this._$);break;case 8:this.$=new e.ProgramNode([],this._$);break;case 9:this.$=[g[h]];break;case 10:g[h-1].push(g[h]),this.$=g[h-1];break;case 11:this.$=new e.RawBlockNode(g[h-2],g[h-1],g[h],this._$);break;case 12:this.$=new e.BlockNode(g[h-2],g[h-1].inverse,g[h-1],g[h],this._$);break;case 13:this.$=new e.BlockNode(g[h-2],g[h-1],g[h-1].inverse,g[h],this._$);break;case 14:this.$=g[h];break;case 15:this.$=g[h];break;case 16:this.$=new e.ContentNode(g[h],this._$);break;case 17:this.$=new e.CommentNode(g[h],this._$);break;case 18:this.$=new e.MustacheNode(g[h-1],null,"","",this._$);break;case 19:this.$=new e.MustacheNode(g[h-1],null,g[h-2],a(g[h-2],g[h]),this._$);break;case 20:this.$=new e.MustacheNode(g[h-1],null,g[h-2],a(g[h-2],g[h]),this._$);break;case 21:this.$={path:g[h-1],strip:a(g[h-2],g[h])};break;case 22:this.$=new e.MustacheNode(g[h-1],null,g[h-2],a(g[h-2],g[h]),this._$);break;case 23:this.$=new e.MustacheNode(g[h-1],null,g[h-2],a(g[h-2],g[h]),this._$);break;case 24:this.$=new e.PartialNode(g[h-3],g[h-2],g[h-1],a(g[h-4],g[h]),this._$);break;case 25:this.$=new e.PartialNode(g[h-2],void 0,g[h-1],a(g[h-3],g[h]),this._$);break;case 26:this.$=a(g[h-1],g[h]);break;case 27:this.$=new e.SexprNode([g[h-2]].concat(g[h-1]),g[h],this._$);break;case 28:this.$=new e.SexprNode([g[h]],null,this._$);break;case 29:this.$=g[h];break;case 30:this.$=new e.StringNode(g[h],this._$);break;case 31:this.$=new e.NumberNode(g[h],this._$);break;case 32:this.$=new e.BooleanNode(g[h],this._$);break;case 33:this.$=g[h];break;case 34:g[h-1].isHelper=!0,this.$=g[h-1];break;case 35:this.$=new e.HashNode(g[h],this._$);break;case 36:this.$=[g[h-2],g[h]];break;case 37:this.$=new e.PartialNameNode(g[h],this._$);break;case 38:this.$=new e.PartialNameNode(new e.StringNode(g[h],this._$),this._$);break;case 39:this.$=new e.PartialNameNode(new e.NumberNode(g[h],this._$));break;case 40:this.$=new e.DataNode(g[h],this._$);break;case 41:this.$=new e.IdNode(g[h],this._$);break;case 42:g[h-2].push({part:g[h],separator:g[h-1]}),this.$=g[h-2];break;case 43:this.$=[{part:g[h]}];break;case 48:this.$=[];break;case 49:g[h-1].push(g[h]);break;case 52:this.$=[g[h]];break;case 53:g[h-1].push(g[h])}},table:[{3:1,4:2,5:[1,3],8:4,9:5,10:[1,10],12:6,14:7,15:8,16:9,17:[1,11],18:[1,12],21:[1,14],23:[1,13],26:[1,15],27:[1,16],29:[1,17]},{1:[3]},{5:[1,18],8:19,9:5,10:[1,10],12:6,14:7,15:8,16:9,17:[1,11],18:[1,12],21:[1,14],23:[1,13],26:[1,15],27:[1,16],29:[1,17]},{1:[2,2]},{5:[2,9],10:[2,9],17:[2,9],18:[2,9],21:[2,9],23:[2,9],24:[2,9],26:[2,9],27:[2,9],29:[2,9]},{10:[1,20]},{4:23,6:21,7:22,8:4,9:5,10:[1,10],12:6,14:7,15:8,16:9,17:[1,11],18:[1,12],21:[1,14],23:[1,24],24:[2,8],26:[1,15],27:[1,16],29:[1,17]},{4:23,6:25,7:22,8:4,9:5,10:[1,10],12:6,14:7,15:8,16:9,17:[1,11],18:[1,12],21:[1,14],23:[1,24],24:[2,8],26:[1,15],27:[1,16],29:[1,17]},{5:[2,14],10:[2,14],17:[2,14],18:[2,14],21:[2,14],23:[2,14],24:[2,14],26:[2,14],27:[2,14],29:[2,14]},{5:[2,15],10:[2,15],17:[2,15],18:[2,15],21:[2,15],23:[2,15],24:[2,15],26:[2,15],27:[2,15],29:[2,15]},{5:[2,16],10:[2,16],17:[2,16],18:[2,16],21:[2,16],23:[2,16],24:[2,16],26:[2,16],27:[2,16],29:[2,16]},{5:[2,17],10:[2,17],17:[2,17],18:[2,17],21:[2,17],23:[2,17],24:[2,17],26:[2,17],27:[2,17],29:[2,17]},{19:26,25:27,36:28,45:[1,31],47:[1,30],48:29},{19:32,25:27,36:28,45:[1,31],47:[1,30],48:29},{19:33,25:27,36:28,45:[1,31],47:[1,30],48:29},{19:34,25:27,36:28,45:[1,31],47:[1,30],48:29},{19:35,25:27,36:28,45:[1,31],47:[1,30],48:29},{25:37,30:36,37:[1,38],38:[1,39],45:[1,31],48:29},{1:[2,1]},{5:[2,10],10:[2,10],17:[2,10],18:[2,10],21:[2,10],23:[2,10],24:[2,10],26:[2,10],27:[2,10],29:[2,10]},{11:[1,40]},{13:41,24:[1,42]},{4:43,8:4,9:5,10:[1,10],12:6,14:7,15:8,16:9,17:[1,11],18:[1,12],21:[1,14],23:[1,13],24:[2,7],26:[1,15],27:[1,16],29:[1,17]},{7:44,8:19,9:5,10:[1,10],12:6,14:7,15:8,16:9,17:[1,11],18:[1,12],21:[1,14],23:[1,24],24:[2,6],26:[1,15],27:[1,16],29:[1,17]},{19:32,22:[1,45],25:27,36:28,45:[1,31],47:[1,30],48:29},{13:46,24:[1,42]},{20:[1,47]},{20:[2,48],22:[2,48],28:[2,48],34:48,37:[2,48],38:[2,48],39:[2,48],40:[2,48],41:[2,48],45:[2,48],47:[2,48]},{20:[2,28],22:[2,28],28:[2,28],41:[2,28]},{20:[2,41],22:[2,41],28:[2,41],37:[2,41],38:[2,41],39:[2,41],40:[2,41],41:[2,41],45:[2,41],47:[2,41],49:[1,49]},{25:50,45:[1,31],48:29},{20:[2,43],22:[2,43],28:[2,43],37:[2,43],38:[2,43],39:[2,43],40:[2,43],41:[2,43],45:[2,43],47:[2,43],49:[2,43]},{22:[1,51]},{22:[1,52]},{22:[1,53]},{28:[1,54]},{22:[2,46],25:57,31:55,33:56,36:61,37:[1,58],38:[1,59],39:[1,60],40:[1,62],42:63,43:64,44:66,45:[1,65],47:[1,30],48:29},{22:[2,37],37:[2,37],38:[2,37],39:[2,37],40:[2,37],45:[2,37],47:[2,37]},{22:[2,38],37:[2,38],38:[2,38],39:[2,38],40:[2,38],45:[2,38],47:[2,38]},{22:[2,39],37:[2,39],38:[2,39],39:[2,39],40:[2,39],45:[2,39],47:[2,39]},{5:[2,11],10:[2,11],17:[2,11],18:[2,11],21:[2,11],23:[2,11],24:[2,11],26:[2,11],27:[2,11],29:[2,11]},{5:[2,12],10:[2,12],17:[2,12],18:[2,12],21:[2,12],23:[2,12],24:[2,12],26:[2,12],27:[2,12],29:[2,12]},{25:67,45:[1,31],48:29},{8:19,9:5,10:[1,10],12:6,14:7,15:8,16:9,17:[1,11],18:[1,12],21:[1,14],23:[1,13],24:[2,3],26:[1,15],27:[1,16],29:[1,17]},{4:68,8:4,9:5,10:[1,10],12:6,14:7,15:8,16:9,17:[1,11],18:[1,12],21:[1,14],23:[1,13],24:[2,5],26:[1,15],27:[1,16],29:[1,17]},{10:[2,26],17:[2,26],18:[2,26],21:[2,26],23:[2,26],24:[2,26],26:[2,26],27:[2,26],29:[2,26]},{5:[2,13],10:[2,13],17:[2,13],18:[2,13],21:[2,13],23:[2,13],24:[2,13],26:[2,13],27:[2,13],29:[2,13]},{10:[2,18]},{20:[2,50],22:[2,50],25:57,28:[2,50],31:70,35:69,36:61,37:[1,58],38:[1,59],39:[1,60],40:[1,62],41:[2,50],42:71,43:64,44:66,45:[1,65],47:[1,30],48:29},{45:[1,72]},{20:[2,40],22:[2,40],28:[2,40],37:[2,40],38:[2,40],39:[2,40],40:[2,40],41:[2,40],45:[2,40],47:[2,40]},{10:[2,20],17:[2,20],18:[2,20],21:[2,20],23:[2,20],24:[2,20],26:[2,20],27:[2,20],29:[2,20]},{10:[2,19],17:[2,19],18:[2,19],21:[2,19],23:[2,19],24:[2,19],26:[2,19],27:[2,19],29:[2,19]},{5:[2,22],10:[2,22],17:[2,22],18:[2,22],21:[2,22],23:[2,22],24:[2,22],26:[2,22],27:[2,22],29:[2,22]},{5:[2,23],10:[2,23],17:[2,23],18:[2,23],21:[2,23],23:[2,23],24:[2,23],26:[2,23],27:[2,23],29:[2,23]},{22:[2,44],32:73,42:74,43:64,44:66,45:[1,75]},{22:[1,76]},{20:[2,29],22:[2,29],28:[2,29],37:[2,29],38:[2,29],39:[2,29],40:[2,29],41:[2,29],45:[2,29],47:[2,29]},{20:[2,30],22:[2,30],28:[2,30],37:[2,30],38:[2,30],39:[2,30],40:[2,30],41:[2,30],45:[2,30],47:[2,30]},{20:[2,31],22:[2,31],28:[2,31],37:[2,31],38:[2,31],39:[2,31],40:[2,31],41:[2,31],45:[2,31],47:[2,31]},{20:[2,32],22:[2,32],28:[2,32],37:[2,32],38:[2,32],39:[2,32],40:[2,32],41:[2,32],45:[2,32],47:[2,32]},{20:[2,33],22:[2,33],28:[2,33],37:[2,33],38:[2,33],39:[2,33],40:[2,33],41:[2,33],45:[2,33],47:[2,33]},{19:77,25:27,36:28,45:[1,31],47:[1,30],48:29},{22:[2,47]},{20:[2,35],22:[2,35],28:[2,35],41:[2,35],44:78,45:[1,75]},{20:[2,43],22:[2,43],28:[2,43],37:[2,43],38:[2,43],39:[2,43],40:[2,43],41:[2,43],45:[2,43],46:[1,79],47:[2,43],49:[2,43]},{20:[2,52],22:[2,52],28:[2,52],41:[2,52],45:[2,52]},{22:[1,80]},{8:19,9:5,10:[1,10],12:6,14:7,15:8,16:9,17:[1,11],18:[1,12],21:[1,14],23:[1,13],24:[2,4],26:[1,15],27:[1,16],29:[1,17]},{20:[2,27],22:[2,27],28:[2,27],41:[2,27]},{20:[2,49],22:[2,49],28:[2,49],37:[2,49],38:[2,49],39:[2,49],40:[2,49],41:[2,49],45:[2,49],47:[2,49]},{20:[2,51],22:[2,51],28:[2,51],41:[2,51]},{20:[2,42],22:[2,42],28:[2,42],37:[2,42],38:[2,42],39:[2,42],40:[2,42],41:[2,42],45:[2,42],47:[2,42],49:[2,42]},{22:[1,81]},{22:[2,45]},{46:[1,79]},{5:[2,25],10:[2,25],17:[2,25],18:[2,25],21:[2,25],23:[2,25],24:[2,25],26:[2,25],27:[2,25],29:[2,25]},{41:[1,82]},{20:[2,53],22:[2,53],28:[2,53],41:[2,53],45:[2,53]},{25:57,31:83,36:61,37:[1,58],38:[1,59],39:[1,60],40:[1,62],45:[1,31],47:[1,30],48:29},{5:[2,21],10:[2,21],17:[2,21],18:[2,21],21:[2,21],23:[2,21],24:[2,21],26:[2,21],27:[2,21],29:[2,21]},{5:[2,24],10:[2,24],17:[2,24],18:[2,24],21:[2,24],23:[2,24],24:[2,24],26:[2,24],27:[2,24],29:[2,24]},{20:[2,34],22:[2,34],28:[2,34],37:[2,34],38:[2,34],39:[2,34],40:[2,34],41:[2,34],45:[2,34],47:[2,34]},{20:[2,36],22:[2,36],28:[2,36],41:[2,36],45:[2,36]}],defaultActions:{3:[2,2],18:[2,1],47:[2,18],63:[2,47],74:[2,45]},parseError:function(a){throw new Error(a)},parse:function(a){function b(){var a;return a=c.lexer.lex()||1,"number"!=typeof a&&(a=c.symbols_[a]||a),a}var c=this,d=[0],e=[null],f=[],g=this.table,h="",i=0,j=0,k=0;this.lexer.setInput(a),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,this.yy.parser=this,"undefined"==typeof this.lexer.yylloc&&(this.lexer.yylloc={});var l=this.lexer.yylloc;f.push(l);var m=this.lexer.options&&this.lexer.options.ranges;"function"==typeof this.yy.parseError&&(this.parseError=this.yy.parseError);for(var n,o,p,q,r,s,t,u,v,w={};;){if(p=d[d.length-1],this.defaultActions[p]?q=this.defaultActions[p]:((null===n||"undefined"==typeof n)&&(n=b()),q=g[p]&&g[p][n]),"undefined"==typeof q||!q.length||!q[0]){var x="";if(!k){v=[];for(s in g[p])this.terminals_[s]&&s>2&&v.push("'"+this.terminals_[s]+"'");x=this.lexer.showPosition?"Parse error on line "+(i+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+v.join(", ")+", got '"+(this.terminals_[n]||n)+"'":"Parse error on line "+(i+1)+": Unexpected "+(1==n?"end of input":"'"+(this.terminals_[n]||n)+"'"),this.parseError(x,{text:this.lexer.match,token:this.terminals_[n]||n,line:this.lexer.yylineno,loc:l,expected:v})}}if(q[0]instanceof Array&&q.length>1)throw new Error("Parse Error: multiple actions possible at state: "+p+", token: "+n);switch(q[0]){case 1:d.push(n),e.push(this.lexer.yytext),f.push(this.lexer.yylloc),d.push(q[1]),n=null,o?(n=o,o=null):(j=this.lexer.yyleng,h=this.lexer.yytext,i=this.lexer.yylineno,l=this.lexer.yylloc,k>0&&k--);break;case 2:if(t=this.productions_[q[1]][1],w.$=e[e.length-t],w._$={first_line:f[f.length-(t||1)].first_line,last_line:f[f.length-1].last_line,first_column:f[f.length-(t||1)].first_column,last_column:f[f.length-1].last_column},m&&(w._$.range=[f[f.length-(t||1)].range[0],f[f.length-1].range[1]]),r=this.performAction.call(w,h,j,i,this.yy,q[1],e,f),"undefined"!=typeof r)return r;t&&(d=d.slice(0,-1*t*2),e=e.slice(0,-1*t),f=f.slice(0,-1*t)),d.push(this.productions_[q[1]][0]),e.push(w.$),f.push(w._$),u=g[d[d.length-2]][d[d.length-1]],d.push(u);break;case 3:return!0}}return!0}},d=function(){var a={EOF:1,parseError:function(a,b){if(!this.yy.parser)throw new Error(a);this.yy.parser.parseError(a,b)},setInput:function(a){return this._input=a,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var a=this._input[0];this.yytext+=a,this.yyleng++,this.offset++,this.match+=a,this.matched+=a;var b=a.match(/(?:\r\n?|\n).*/g);return b?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),a},unput:function(a){var b=a.length,c=a.split(/(?:\r\n?|\n)/g);this._input=a+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-b-1),this.offset-=b;var d=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),c.length-1&&(this.yylineno-=c.length-1);var e=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:c?(c.length===d.length?this.yylloc.first_column:0)+d[d.length-c.length].length-c[0].length:this.yylloc.first_column-b},this.options.ranges&&(this.yylloc.range=[e[0],e[0]+this.yyleng-b]),this},more:function(){return this._more=!0,this},less:function(a){this.unput(this.match.slice(a))},pastInput:function(){var a=this.matched.substr(0,this.matched.length-this.match.length);return(a.length>20?"...":"")+a.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var a=this.match;return a.length<20&&(a+=this._input.substr(0,20-a.length)),(a.substr(0,20)+(a.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var a=this.pastInput(),b=new Array(a.length+1).join("-");return a+this.upcomingInput()+"\n"+b+"^"},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var a,b,c,d,e;this._more||(this.yytext="",this.match="");for(var f=this._currentRules(),g=0;g<f.length&&(c=this._input.match(this.rules[f[g]]),!c||b&&!(c[0].length>b[0].length)||(b=c,d=g,this.options.flex));g++);return b?(e=b[0].match(/(?:\r\n?|\n).*/g),e&&(this.yylineno+=e.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:e?e[e.length-1].length-e[e.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+b[0].length},this.yytext+=b[0],this.match+=b[0],this.matches=b,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._input=this._input.slice(b[0].length),this.matched+=b[0],a=this.performAction.call(this,this.yy,this,f[d],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),a?a:void 0):""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var a=this.next();return"undefined"!=typeof a?a:this.lex()},begin:function(a){this.conditionStack.push(a)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(a){this.begin(a)}};return a.options={},a.performAction=function(a,b,c,d){function e(a,c){return b.yytext=b.yytext.substr(a,b.yyleng-c)}switch(c){case 0:if("\\\\"===b.yytext.slice(-2)?(e(0,1),this.begin("mu")):"\\"===b.yytext.slice(-1)?(e(0,1),this.begin("emu")):this.begin("mu"),b.yytext)return 10;break;case 1:return 10;case 2:return this.popState(),10;case 3:return b.yytext=b.yytext.substr(5,b.yyleng-9),this.popState(),11;case 4:return 10;case 5:return e(0,4),this.popState(),17;case 6:return 40;case 7:return 41;case 8:return 18;case 9:return this.popState(),this.begin("raw"),20;case 10:return b.yytext=b.yytext.substr(4,b.yyleng-8),this.popState(),"RAW_BLOCK";case 11:return 29;case 12:return 21;case 13:return 24;case 14:return 23;case 15:return 23;case 16:return 27;case 17:return 26;case 18:this.popState(),this.begin("com");break;case 19:return e(3,5),this.popState(),17;case 20:return 26;case 21:return 46;case 22:return 45;case 23:return 45;case 24:return 49;case 25:break;case 26:return this.popState(),28;case 27:return this.popState(),22;case 28:return b.yytext=e(1,2).replace(/\\"/g,'"'),37;case 29:return b.yytext=e(1,2).replace(/\\'/g,"'"),37;case 30:return 47;case 31:return 39;case 32:return 39;case 33:return 38;case 34:return 45;case 35:return b.yytext=e(1,2),45;case 36:return"INVALID";case 37:return 5}},a.rules=[/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/,/^(?:[^\x00]*?(?=(\{\{\{\{\/)))/,/^(?:[\s\S]*?--\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{\{\{)/,/^(?:\}\}\}\})/,/^(?:\{\{\{\{[^\x00]*\}\}\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{!--)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{(~)?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)]))))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/],a.conditions={mu:{rules:[6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37],inclusive:!1},emu:{rules:[2],inclusive:!1},com:{rules:[5],inclusive:!1},raw:{rules:[3,4],inclusive:!1},INITIAL:{rules:[0,1,37],inclusive:!0}},a}();return c.lexer=d,b.prototype=c,c.Parser=b,new b}();return a=b}(),i=function(a,b){"use strict";function c(a){return a.constructor===f.ProgramNode?a:(e.yy=f,e.parse(a))}var d={},e=a,f=b;return d.parser=e,d.parse=c,d}(h,g),j=function(a){"use strict";function b(){}function c(a,b,c){if(null==a||"string"!=typeof a&&a.constructor!==c.AST.ProgramNode)throw new f("You must pass a string or Handlebars AST to Handlebars.precompile. You passed "+a);b=b||{},"data"in b||(b.data=!0);var d=c.parse(a),e=(new c.Compiler).compile(d,b);return(new c.JavaScriptCompiler).compile(e,b)}function d(a,b,c){function d(){var d=c.parse(a),e=(new c.Compiler).compile(d,b),f=(new c.JavaScriptCompiler).compile(e,b,void 0,!0);return c.template(f)}if(null==a||"string"!=typeof a&&a.constructor!==c.AST.ProgramNode)throw new f("You must pass a string or Handlebars AST to Handlebars.compile. You passed "+a);b=b||{},"data"in b||(b.data=!0);var e,g=function(a,b){return e||(e=d()),e.call(this,a,b)};return g.child=function(a){return e||(e=d()),e.child(a)},g}var e={},f=a;return e.Compiler=b,b.prototype={compiler:b,disassemble:function(){for(var a,b,c,d=this.opcodes,e=[],f=0,g=d.length;g>f;f++)if(a=d[f],"DECLARE"===a.opcode)e.push("DECLARE "+a.name+"="+a.value);else{b=[];for(var h=0;h<a.args.length;h++)c=a.args[h],"string"==typeof c&&(c='"'+c.replace("\n","\\n")+'"'),b.push(c);e.push(a.opcode+" "+b.join(" "))}return e.join("\n")},equals:function(a){var b=this.opcodes.length;if(a.opcodes.length!==b)return!1;for(var c=0;b>c;c++){var d=this.opcodes[c],e=a.opcodes[c];if(d.opcode!==e.opcode||d.args.length!==e.args.length)return!1;for(var f=0;f<d.args.length;f++)if(d.args[f]!==e.args[f])return!1}if(b=this.children.length,a.children.length!==b)return!1;for(c=0;b>c;c++)if(!this.children[c].equals(a.children[c]))return!1;return!0},guid:0,compile:function(a,b){this.opcodes=[],this.children=[],this.depths={list:[]},this.options=b,this.stringParams=b.stringParams,this.trackIds=b.trackIds;var c=this.options.knownHelpers;if(this.options.knownHelpers={helperMissing:!0,blockHelperMissing:!0,each:!0,"if":!0,unless:!0,"with":!0,log:!0,lookup:!0},c)for(var d in c)this.options.knownHelpers[d]=c[d];return this.accept(a)},accept:function(a){var b,c=a.strip||{};return c.left&&this.opcode("strip"),b=this[a.type](a),c.right&&this.opcode("strip"),b},program:function(a){for(var b=a.statements,c=0,d=b.length;d>c;c++)this.accept(b[c]);return this.isSimple=1===d,this.depths.list=this.depths.list.sort(function(a,b){return a-b}),this},compileProgram:function(a){var b,c=(new this.compiler).compile(a,this.options),d=this.guid++;this.usePartial=this.usePartial||c.usePartial,this.children[d]=c;for(var e=0,f=c.depths.list.length;f>e;e++)b=c.depths.list[e],2>b||this.addDepth(b-1);return d},block:function(a){var b=a.mustache,c=a.program,d=a.inverse;c&&(c=this.compileProgram(c)),d&&(d=this.compileProgram(d));var e=b.sexpr,f=this.classifySexpr(e);"helper"===f?this.helperSexpr(e,c,d):"simple"===f?(this.simpleSexpr(e),this.opcode("pushProgram",c),this.opcode("pushProgram",d),this.opcode("emptyHash"),this.opcode("blockValue",e.id.original)):(this.ambiguousSexpr(e,c,d),this.opcode("pushProgram",c),this.opcode("pushProgram",d),this.opcode("emptyHash"),this.opcode("ambiguousBlockValue")),this.opcode("append")},hash:function(a){var b,c=a.pairs;this.opcode("pushHash");for(var d=0,e=c.length;e>d;d++)b=c[d],this.pushParam(b[1]),this.opcode("assignToHash",b[0]);this.opcode("popHash")},partial:function(a){var b=a.partialName;this.usePartial=!0,a.hash?this.accept(a.hash):this.opcode("push","undefined"),a.context?this.accept(a.context):this.opcode("push","depth0"),this.opcode("invokePartial",b.name),this.opcode("append")},content:function(a){this.opcode("appendContent",a.string) | ||
},mustache:function(a){this.sexpr(a.sexpr),a.escaped&&!this.options.noEscape?this.opcode("appendEscaped"):this.opcode("append")},ambiguousSexpr:function(a,b,c){var d=a.id,e=d.parts[0],f=null!=b||null!=c;this.opcode("getContext",d.depth),this.opcode("pushProgram",b),this.opcode("pushProgram",c),this.opcode("invokeAmbiguous",e,f)},simpleSexpr:function(a){var b=a.id;"DATA"===b.type?this.DATA(b):b.parts.length?this.ID(b):(this.addDepth(b.depth),this.opcode("getContext",b.depth),this.opcode("pushContext")),this.opcode("resolvePossibleLambda")},helperSexpr:function(a,b,c){var d=this.setupFullMustacheParams(a,b,c),e=a.id,g=e.parts[0];if(this.options.knownHelpers[g])this.opcode("invokeKnownHelper",d.length,g);else{if(this.options.knownHelpersOnly)throw new f("You specified knownHelpersOnly, but used the unknown helper "+g,a);this.ID(e),this.opcode("invokeHelper",d.length,g,a.isRoot)}},sexpr:function(a){var b=this.classifySexpr(a);"simple"===b?this.simpleSexpr(a):"helper"===b?this.helperSexpr(a):this.ambiguousSexpr(a)},ID:function(a){this.addDepth(a.depth),this.opcode("getContext",a.depth);var b=a.parts[0];b?this.opcode("lookupOnContext",a.parts[0]):this.opcode("pushContext");for(var c=1,d=a.parts.length;d>c;c++)this.opcode("lookup",a.parts[c])},DATA:function(a){this.options.data=!0,this.opcode("lookupData",a.id.depth);for(var b=a.id.parts,c=0,d=b.length;d>c;c++)this.opcode("lookup",b[c])},STRING:function(a){this.opcode("pushString",a.string)},NUMBER:function(a){this.opcode("pushLiteral",a.number)},BOOLEAN:function(a){this.opcode("pushLiteral",a.bool)},comment:function(){},opcode:function(a){this.opcodes.push({opcode:a,args:[].slice.call(arguments,1)})},declare:function(a,b){this.opcodes.push({opcode:"DECLARE",name:a,value:b})},addDepth:function(a){0!==a&&(this.depths[a]||(this.depths[a]=!0,this.depths.list.push(a)))},classifySexpr:function(a){var b=a.isHelper,c=a.eligibleHelper,d=this.options;if(c&&!b){var e=a.id.parts[0];d.knownHelpers[e]?b=!0:d.knownHelpersOnly&&(c=!1)}return b?"helper":c?"ambiguous":"simple"},pushParams:function(a){for(var b=a.length;b--;)this.pushParam(a[b])},pushParam:function(a){this.stringParams?(a.depth&&this.addDepth(a.depth),this.opcode("getContext",a.depth||0),this.opcode("pushStringParam",a.stringModeValue,a.type),"sexpr"===a.type&&this.sexpr(a)):(this.trackIds&&this.opcode("pushId",a.type,a.idName||a.stringModeValue),this.accept(a))},setupFullMustacheParams:function(a,b,c){var d=a.params;return this.pushParams(d),this.opcode("pushProgram",b),this.opcode("pushProgram",c),a.hash?this.hash(a.hash):this.opcode("emptyHash"),d}},e.precompile=c,e.compile=d,e}(c),k=function(a,b){"use strict";function c(a){this.value=a}function d(){}var e,f=a.COMPILER_REVISION,g=a.REVISION_CHANGES,h=a.log,i=b;d.prototype={nameLookup:function(a,b){var c,e;return 0===a.indexOf("depth")&&(c=!0),e=d.isValidJavaScriptVariableName(b)?a+"."+b:a+"['"+b+"']",c?"("+a+" && "+e+")":e},compilerInfo:function(){var a=f,b=g[a];return[a,b]},appendToBuffer:function(a){return this.environment.isSimple?"return "+a+";":{appendToBuffer:!0,content:a,toString:function(){return"buffer += "+a+";"}}},initializeBuffer:function(){return this.quotedString("")},namespace:"Handlebars",compile:function(a,b,c,d){this.environment=a,this.options=b||{},this.stringParams=this.options.stringParams,this.trackIds=this.options.trackIds,this.precompile=!d,h("debug",this.environment.disassemble()+"\n\n"),this.name=this.environment.name,this.isChild=!!c,this.context=c||{programs:[],environments:[]},this.preamble(),this.stackSlot=0,this.stackVars=[],this.aliases={},this.registers={list:[]},this.hashes=[],this.compileStack=[],this.inlineStack=[],this.compileChildren(a,b);var e,f=a.opcodes;this.i=0;for(var g=f.length;this.i<g;this.i++)e=f[this.i],"DECLARE"===e.opcode?this[e.name]=e.value:this[e.opcode].apply(this,e.args),e.opcode!==this.stripNext&&(this.stripNext=!1);if(this.pushSource(""),this.stackSlot||this.inlineStack.length||this.compileStack.length)throw new i("Compile completed with content left on stack");var j=this.createFunctionContext(d);if(this.isChild)return j;var k={compiler:this.compilerInfo(),main:j};return this.context.programs.map(function(a,b){a&&(k[b]=a)}),this.environment.usePartial&&(k.usePartial=!0),this.options.data&&(k.useData=!0),d||(k.compiler=JSON.stringify(k.compiler),k=this.objectLiteral(k)),k},preamble:function(){this.lastContext=0,this.source=[]},createFunctionContext:function(a){var b="",c=this.stackVars.concat(this.registers.list);c.length>0&&(b+=", "+c.join(", "));for(var d in this.aliases)this.aliases.hasOwnProperty(d)&&(b+=", "+d+"="+this.aliases[d]);for(var e=["depth0","helpers","partials","data"],f=0,g=this.environment.depths.list.length;g>f;f++)e.push("depth"+this.environment.depths.list[f]);var h=this.mergeSource(b);return a?(e.push(h),Function.apply(this,e)):"function("+e.join(",")+") {\n "+h+"}"},mergeSource:function(a){for(var b,c,d="",e=!this.forceBuffer,f=0,g=this.source.length;g>f;f++){var h=this.source[f];h.appendToBuffer?b=b?b+"\n + "+h.content:h.content:(b&&(d?d+="buffer += "+b+";\n ":(c=!0,d=b+";\n "),b=void 0),d+=h+"\n ",this.environment.isSimple||(e=!1))}return e?(b||!d)&&(d+="return "+(b||'""')+";\n"):(a+=", buffer = "+(c?"":this.initializeBuffer()),d+=b?"return buffer + "+b+";\n":"return buffer;\n"),a&&(d="var "+a.substring(2)+(c?"":";\n ")+d),d},blockValue:function(a){this.aliases.blockHelperMissing="helpers.blockHelperMissing";var b=["depth0"];this.setupParams(a,0,b),this.replaceStack(function(a){return b.splice(1,0,a),"blockHelperMissing.call("+b.join(", ")+")"})},ambiguousBlockValue:function(){this.aliases.blockHelperMissing="helpers.blockHelperMissing";var a=["depth0"];this.setupParams("",0,a,!0),this.flushInline();var b=this.topStack();a.splice(1,0,b),this.pushSource("if (!"+this.lastHelper+") { "+b+" = blockHelperMissing.call("+a.join(", ")+"); }")},appendContent:function(a){this.pendingContent&&(a=this.pendingContent+a),this.stripNext&&(a=a.replace(/^\s+/,"")),this.pendingContent=a},strip:function(){this.pendingContent&&(this.pendingContent=this.pendingContent.replace(/\s+$/,"")),this.stripNext="strip"},append:function(){this.flushInline();var a=this.popStack();this.pushSource("if("+a+" || "+a+" === 0) { "+this.appendToBuffer(a)+" }"),this.environment.isSimple&&this.pushSource("else { "+this.appendToBuffer("''")+" }")},appendEscaped:function(){this.aliases.escapeExpression="this.escapeExpression",this.pushSource(this.appendToBuffer("escapeExpression("+this.popStack()+")"))},getContext:function(a){this.lastContext!==a&&(this.lastContext=a)},lookupOnContext:function(a){this.push(this.nameLookup("depth"+this.lastContext,a,"context"))},pushContext:function(){this.pushStackLiteral("depth"+this.lastContext)},resolvePossibleLambda:function(){this.aliases.functionType='"function"',this.replaceStack(function(a){return"typeof "+a+" === functionType ? "+a+".apply(depth0) : "+a})},lookup:function(a){this.replaceStack(function(b){return b+" == null || "+b+" === false ? "+b+" : "+this.nameLookup(b,a,"context")})},lookupData:function(a){a?this.pushStackLiteral("this.data(data, "+a+")"):this.pushStackLiteral("data")},pushStringParam:function(a,b){this.pushStackLiteral("depth"+this.lastContext),this.pushString(b),"sexpr"!==b&&("string"==typeof a?this.pushString(a):this.pushStackLiteral(a))},emptyHash:function(){this.pushStackLiteral("{}"),this.trackIds&&this.push("{}"),this.stringParams&&(this.push("{}"),this.push("{}"))},pushHash:function(){this.hash&&this.hashes.push(this.hash),this.hash={values:[],types:[],contexts:[],ids:[]}},popHash:function(){var a=this.hash;this.hash=this.hashes.pop(),this.trackIds&&this.push("{"+a.ids.join(",")+"}"),this.stringParams&&(this.push("{"+a.contexts.join(",")+"}"),this.push("{"+a.types.join(",")+"}")),this.push("{\n "+a.values.join(",\n ")+"\n }")},pushString:function(a){this.pushStackLiteral(this.quotedString(a))},push:function(a){return this.inlineStack.push(a),a},pushLiteral:function(a){this.pushStackLiteral(a)},pushProgram:function(a){null!=a?this.pushStackLiteral(this.programExpression(a)):this.pushStackLiteral(null)},invokeHelper:function(a,b,c){this.aliases.helperMissing="helpers.helperMissing",this.useRegister("helper");var d=this.popStack(),e=this.setupHelper(a,b),f="helper = "+e.name+" || "+d+" || helperMissing";e.paramsInit&&(f+=","+e.paramsInit),this.push("("+f+",helper.call("+e.callParams+"))"),c||this.flushInline()},invokeKnownHelper:function(a,b){var c=this.setupHelper(a,b);this.push(c.name+".call("+c.callParams+")")},invokeAmbiguous:function(a,b){this.aliases.functionType='"function"',this.useRegister("helper"),this.emptyHash();var c=this.setupHelper(0,a,b),d=this.lastHelper=this.nameLookup("helpers",a,"helper"),e=this.nameLookup("depth"+this.lastContext,a,"context");this.push("((helper = "+d+" || "+e+(c.paramsInit?"),("+c.paramsInit:"")+"),(typeof helper === functionType ? helper.call("+c.callParams+") : helper))")},invokePartial:function(a){var b=[this.nameLookup("partials",a,"partial"),"'"+a+"'",this.popStack(),this.popStack(),"helpers","partials"];this.options.data&&b.push("data"),this.push("this.invokePartial("+b.join(", ")+")")},assignToHash:function(a){var b,c,d,e=this.popStack();this.trackIds&&(d=this.popStack()),this.stringParams&&(c=this.popStack(),b=this.popStack());var f=this.hash;b&&f.contexts.push("'"+a+"': "+b),c&&f.types.push("'"+a+"': "+c),d&&f.ids.push("'"+a+"': "+d),f.values.push("'"+a+"': ("+e+")")},pushId:function(a,b){"ID"===a||"DATA"===a?this.pushString(b):"sexpr"===a?this.pushStackLiteral("true"):this.pushStackLiteral("null")},compiler:d,compileChildren:function(a,b){for(var c,d,e=a.children,f=0,g=e.length;g>f;f++){c=e[f],d=new this.compiler;var h=this.matchExistingProgram(c);null==h?(this.context.programs.push(""),h=this.context.programs.length,c.index=h,c.name="program"+h,this.context.programs[h]=d.compile(c,b,this.context,!this.precompile),this.context.environments[h]=c):(c.index=h,c.name="program"+h)}},matchExistingProgram:function(a){for(var b=0,c=this.context.environments.length;c>b;b++){var d=this.context.environments[b];if(d&&d.equals(a))return b}},programExpression:function(a){if(null==a)return"this.noop";for(var b,c=this.environment.children[a],d=c.depths.list,e=[c.index,"data"],f=0,g=d.length;g>f;f++)b=d[f],e.push("depth"+(b-1));return(0===d.length?"this.program(":"this.programWithDepth(")+e.join(", ")+")"},register:function(a,b){this.useRegister(a),this.pushSource(a+" = "+b+";")},useRegister:function(a){this.registers[a]||(this.registers[a]=!0,this.registers.list.push(a))},pushStackLiteral:function(a){return this.push(new c(a))},pushSource:function(a){this.pendingContent&&(this.source.push(this.appendToBuffer(this.quotedString(this.pendingContent))),this.pendingContent=void 0),a&&this.source.push(a)},pushStack:function(a){this.flushInline();var b=this.incrStack();return a&&this.pushSource(b+" = "+a+";"),this.compileStack.push(b),b},replaceStack:function(a){var b,d,e,f="",g=this.isInline();if(g){var h=this.popStack(!0);if(h instanceof c)b=h.value,e=!0;else{d=!this.stackSlot;var i=d?this.incrStack():this.topStackName();f="("+this.push(i)+" = "+h+"),",b=this.topStack()}}else b=this.topStack();var j=a.call(this,b);return g?(e||this.popStack(),d&&this.stackSlot--,this.push("("+f+j+")")):(/^stack/.test(b)||(b=this.nextStack()),this.pushSource(b+" = ("+f+j+");")),b},nextStack:function(){return this.pushStack()},incrStack:function(){return this.stackSlot++,this.stackSlot>this.stackVars.length&&this.stackVars.push("stack"+this.stackSlot),this.topStackName()},topStackName:function(){return"stack"+this.stackSlot},flushInline:function(){var a=this.inlineStack;if(a.length){this.inlineStack=[];for(var b=0,d=a.length;d>b;b++){var e=a[b];e instanceof c?this.compileStack.push(e):this.pushStack(e)}}},isInline:function(){return this.inlineStack.length},popStack:function(a){var b=this.isInline(),d=(b?this.inlineStack:this.compileStack).pop();if(!a&&d instanceof c)return d.value;if(!b){if(!this.stackSlot)throw new i("Invalid stack pop");this.stackSlot--}return d},topStack:function(a){var b=this.isInline()?this.inlineStack:this.compileStack,d=b[b.length-1];return!a&&d instanceof c?d.value:d},quotedString:function(a){return'"'+a.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")+'"'},objectLiteral:function(a){var b=[];for(var c in a)a.hasOwnProperty(c)&&b.push(this.quotedString(c)+":"+a[c]);return"{"+b.join(",")+"}"},setupHelper:function(a,b,c){var d=[],e=this.setupParams(b,a,d,c),f=this.nameLookup("helpers",b,"helper");return{params:d,paramsInit:e,name:f,callParams:["depth0"].concat(d).join(", ")}},setupOptions:function(a,b,c){var d,e,f,g={},h=[],i=[],j=[];g.name=this.quotedString(a),g.hash=this.popStack(),this.trackIds&&(g.hashIds=this.popStack()),this.stringParams&&(g.hashTypes=this.popStack(),g.hashContexts=this.popStack()),e=this.popStack(),f=this.popStack(),(f||e)&&(f||(f="this.noop"),e||(e="this.noop"),g.fn=f,g.inverse=e);for(var k=0;b>k;k++)d=this.popStack(),c.push(d),this.trackIds&&j.push(this.popStack()),this.stringParams&&(i.push(this.popStack()),h.push(this.popStack()));return this.trackIds&&(g.ids="["+j.join(",")+"]"),this.stringParams&&(g.types="["+i.join(",")+"]",g.contexts="["+h.join(",")+"]"),this.options.data&&(g.data="data"),g},setupParams:function(a,b,c,d){var e=this.objectLiteral(this.setupOptions(a,b,c));return d?(this.useRegister("options"),c.push("options"),"options="+e):(c.push(e),"")}};for(var j="break else new var case finally return void catch for switch while continue function this with default if throw delete in try do instanceof typeof abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public let yield".split(" "),k=d.RESERVED_WORDS={},l=0,m=j.length;m>l;l++)k[j[l]]=!0;return d.isValidJavaScriptVariableName=function(a){return!d.RESERVED_WORDS[a]&&/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(a)},e=d}(d,c),l=function(a,b,c,d,e){"use strict";var f,g=a,h=b,i=c.parser,j=c.parse,k=d.Compiler,l=d.compile,m=d.precompile,n=e,o=g.create,p=function(){var a=o();return a.compile=function(b,c){return l(b,c,a)},a.precompile=function(b,c){return m(b,c,a)},a.AST=h,a.Compiler=k,a.JavaScriptCompiler=n,a.Parser=i,a.parse=j,a};return g=p(),g.create=p,f=g}(f,g,i,j,k);return l}(); |
/*! | ||
handlebars v1.3.0 | ||
handlebars vv2.0.0-alpha.1 | ||
Copyright (C) 2011 by Yehuda Katz | ||
Copyright (C) 2011-2014 by Yehuda Katz | ||
@@ -66,8 +66,12 @@ Permission is hereby granted, free of charge, to any person obtaining a copy | ||
function extend(obj, value) { | ||
for(var key in value) { | ||
if(Object.prototype.hasOwnProperty.call(value, key)) { | ||
obj[key] = value[key]; | ||
function extend(obj /* , ...source */) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
for (var key in arguments[i]) { | ||
if (Object.prototype.hasOwnProperty.call(arguments[i], key)) { | ||
obj[key] = arguments[i][key]; | ||
} | ||
} | ||
} | ||
return obj; | ||
} | ||
@@ -122,3 +126,7 @@ | ||
__exports__.isEmpty = isEmpty; | ||
__exports__.isEmpty = isEmpty;function appendContextPath(contextPath, id) { | ||
return (contextPath ? contextPath + '.' : '') + id; | ||
} | ||
__exports__.appendContextPath = appendContextPath; | ||
}); | ||
@@ -164,4 +172,4 @@ define( | ||
var VERSION = "1.3.0"; | ||
__exports__.VERSION = VERSION;var COMPILER_REVISION = 4; | ||
var VERSION = "v2.0.0-alpha.1"; | ||
__exports__.VERSION = VERSION;var COMPILER_REVISION = 5; | ||
__exports__.COMPILER_REVISION = COMPILER_REVISION; | ||
@@ -172,3 +180,4 @@ var REVISION_CHANGES = { | ||
3: '== 1.0.0-rc.4', | ||
4: '>= 1.0.0' | ||
4: '== 1.x.x', | ||
5: '>= 2.0.0' | ||
}; | ||
@@ -203,2 +212,5 @@ __exports__.REVISION_CHANGES = REVISION_CHANGES; | ||
}, | ||
unregisterHelper: function(name) { | ||
delete this.helpers[name]; | ||
}, | ||
@@ -211,2 +223,5 @@ registerPartial: function(name, str) { | ||
} | ||
}, | ||
unregisterPartial: function(name) { | ||
delete this.partials[name]; | ||
} | ||
@@ -216,7 +231,9 @@ }; | ||
function registerDefaultHelpers(instance) { | ||
instance.registerHelper('helperMissing', function(arg) { | ||
if(arguments.length === 2) { | ||
instance.registerHelper('helperMissing', function(/* [args, ]options */) { | ||
if(arguments.length === 1) { | ||
// A missing field in a {{foo}} constuct. | ||
return undefined; | ||
} else { | ||
throw new Exception("Missing helper: '" + arg + "'"); | ||
// Someone is actually trying to call something, blow up. | ||
throw new Exception("Missing helper: '" + arguments[arguments.length-1].name + "'"); | ||
} | ||
@@ -236,2 +253,6 @@ }); | ||
if(context.length > 0) { | ||
if (options.ids) { | ||
options.ids = [options.name]; | ||
} | ||
return instance.helpers.each(context, options); | ||
@@ -242,3 +263,9 @@ } else { | ||
} else { | ||
return fn(context); | ||
if (options.data && options.ids) { | ||
var data = createFrame(options.data); | ||
data.contextPath = Utils.appendContextPath(options.data.contextPath, options.name); | ||
options = {data: data}; | ||
} | ||
return fn(context, options); | ||
} | ||
@@ -248,5 +275,16 @@ }); | ||
instance.registerHelper('each', function(context, options) { | ||
// Allow for {{#each}} | ||
if (!options) { | ||
options = context; | ||
context = this; | ||
} | ||
var fn = options.fn, inverse = options.inverse; | ||
var i = 0, ret = "", data; | ||
var contextPath; | ||
if (options.data && options.ids) { | ||
contextPath = Utils.appendContextPath(options.data.contextPath, options.ids[0]) + '.'; | ||
} | ||
if (isFunction(context)) { context = context.call(this); } | ||
@@ -265,2 +303,6 @@ | ||
data.last = (i === (context.length-1)); | ||
if (contextPath) { | ||
data.contextPath = contextPath + i; | ||
} | ||
} | ||
@@ -272,6 +314,10 @@ ret = ret + fn(context[i], { data: data }); | ||
if(context.hasOwnProperty(key)) { | ||
if(data) { | ||
data.key = key; | ||
if(data) { | ||
data.key = key; | ||
data.index = i; | ||
data.first = (i === 0); | ||
if (contextPath) { | ||
data.contextPath = contextPath + key; | ||
} | ||
} | ||
@@ -312,3 +358,13 @@ ret = ret + fn(context[key], {data: data}); | ||
if (!Utils.isEmpty(context)) return options.fn(context); | ||
var fn = options.fn; | ||
if (!Utils.isEmpty(context)) { | ||
if (options.data && options.ids) { | ||
var data = createFrame(options.data); | ||
data.contextPath = Utils.appendContextPath(options.data.contextPath, options.ids[0]); | ||
options = {data:data}; | ||
} | ||
return fn(context, options); | ||
} | ||
}); | ||
@@ -320,2 +376,6 @@ | ||
}); | ||
instance.registerHelper('lookup', function(obj, field, options) { | ||
return obj && obj[field]; | ||
}); | ||
} | ||
@@ -347,5 +407,5 @@ | ||
__exports__.log = log;var createFrame = function(object) { | ||
var obj = {}; | ||
Utils.extend(obj, object); | ||
return obj; | ||
var frame = Utils.extend({}, object); | ||
frame._parent = object; | ||
return frame; | ||
}; | ||
@@ -362,2 +422,3 @@ __exports__.createFrame = createFrame; | ||
var REVISION_CHANGES = __dependency3__.REVISION_CHANGES; | ||
var createFrame = __dependency3__.createFrame; | ||
@@ -391,4 +452,10 @@ function checkRevision(compilerInfo) { | ||
// for external users to override these as psuedo-supported APIs. | ||
var invokePartialWrapper = function(partial, name, context, helpers, partials, data) { | ||
var result = env.VM.invokePartial.apply(this, arguments); | ||
env.VM.checkRevision(templateSpec.compiler); | ||
var invokePartialWrapper = function(partial, name, context, hash, helpers, partials, data) { | ||
if (hash) { | ||
context = Utils.extend({}, context, hash); | ||
} | ||
var result = env.VM.invokePartial.call(this, partial, name, context, helpers, partials, data); | ||
if (result != null) { return result; } | ||
@@ -409,12 +476,33 @@ | ||
invokePartial: invokePartialWrapper, | ||
fn: function(i) { | ||
return templateSpec[i]; | ||
}, | ||
programs: [], | ||
program: function(i, fn, data) { | ||
var programWrapper = this.programs[i]; | ||
program: function(i, data) { | ||
var programWrapper = this.programs[i], | ||
fn = this.fn(i); | ||
if(data) { | ||
programWrapper = program(i, fn, data); | ||
programWrapper = program(this, i, fn, data); | ||
} else if (!programWrapper) { | ||
programWrapper = this.programs[i] = program(i, fn); | ||
programWrapper = this.programs[i] = program(this, i, fn); | ||
} | ||
return programWrapper; | ||
}, | ||
programWithDepth: env.VM.programWithDepth, | ||
initData: function(context, data) { | ||
if (!data || !('root' in data)) { | ||
data = data ? createFrame(data) : {}; | ||
data.root = context; | ||
} | ||
return data; | ||
}, | ||
data: function(data, depth) { | ||
while (data && depth--) { | ||
data = data._parent; | ||
} | ||
return data; | ||
}, | ||
merge: function(param, common) { | ||
@@ -424,40 +512,46 @@ var ret = param || common; | ||
if (param && common && (param !== common)) { | ||
ret = {}; | ||
Utils.extend(ret, common); | ||
Utils.extend(ret, param); | ||
ret = Utils.extend({}, common, param); | ||
} | ||
return ret; | ||
}, | ||
programWithDepth: env.VM.programWithDepth, | ||
noop: env.VM.noop, | ||
compilerInfo: null | ||
compilerInfo: templateSpec.compiler | ||
}; | ||
return function(context, options) { | ||
var ret = function(context, options) { | ||
options = options || {}; | ||
var namespace = options.partial ? options : env, | ||
helpers, | ||
partials; | ||
partials, | ||
data = options.data; | ||
if (!options.partial) { | ||
helpers = options.helpers; | ||
partials = options.partials; | ||
} | ||
var result = templateSpec.call( | ||
container, | ||
namespace, context, | ||
helpers, | ||
partials, | ||
options.data); | ||
helpers = container.helpers = container.merge(options.helpers, namespace.helpers); | ||
if (!options.partial) { | ||
env.VM.checkRevision(container.compilerInfo); | ||
if (templateSpec.usePartial) { | ||
partials = container.partials = container.merge(options.partials, namespace.partials); | ||
} | ||
if (templateSpec.useData) { | ||
data = container.initData(context, data); | ||
} | ||
} else { | ||
helpers = container.helpers = options.helpers; | ||
partials = container.partials = options.partials; | ||
} | ||
return templateSpec.main.call(container, context, helpers, partials, data); | ||
}; | ||
return result; | ||
ret.child = function(i) { | ||
return container.programWithDepth(i); | ||
}; | ||
return ret; | ||
} | ||
__exports__.template = template;function programWithDepth(i, fn, data /*, $depth */) { | ||
var args = Array.prototype.slice.call(arguments, 3); | ||
__exports__.template = template;function programWithDepth(i, data /*, $depth */) { | ||
/*jshint -W040 */ | ||
var args = Array.prototype.slice.call(arguments, 2), | ||
container = this, | ||
fn = container.fn(i); | ||
@@ -467,3 +561,3 @@ var prog = function(context, options) { | ||
return fn.apply(this, [context, options.data || data].concat(args)); | ||
return fn.apply(container, [context, container.helpers, container.partials, options.data || data].concat(args)); | ||
}; | ||
@@ -475,7 +569,7 @@ prog.program = i; | ||
__exports__.programWithDepth = programWithDepth;function program(i, fn, data) { | ||
__exports__.programWithDepth = programWithDepth;function program(container, i, fn, data) { | ||
var prog = function(context, options) { | ||
options = options || {}; | ||
return fn(context, options.data || data); | ||
return fn.call(container, context, container.helpers, container.partials, options.data || data); | ||
}; | ||
@@ -482,0 +576,0 @@ prog.program = i; |
/*! | ||
handlebars v1.3.0 | ||
handlebars vv2.0.0-alpha.1 | ||
Copyright (C) 2011 by Yehuda Katz | ||
Copyright (C) 2011-2014 by Yehuda Katz | ||
@@ -27,2 +27,2 @@ Permission is hereby granted, free of charge, to any person obtaining a copy | ||
*/ | ||
define("handlebars/safe-string",["exports"],function(a){function b(a){this.string=a}b.prototype.toString=function(){return""+this.string},a["default"]=b}),define("handlebars/utils",["./safe-string","exports"],function(a,b){function c(a){return h[a]||"&"}function d(a,b){for(var c in b)Object.prototype.hasOwnProperty.call(b,c)&&(a[c]=b[c])}function e(a){return a instanceof g?a.toString():a||0===a?(a=""+a,j.test(a)?a.replace(i,c):a):""}function f(a){return a||0===a?m(a)&&0===a.length?!0:!1:!0}var g=a["default"],h={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},i=/[&<>"'`]/g,j=/[&<>"'`]/;b.extend=d;var k=Object.prototype.toString;b.toString=k;var l=function(a){return"function"==typeof a};l(/x/)&&(l=function(a){return"function"==typeof a&&"[object Function]"===k.call(a)});var l;b.isFunction=l;var m=Array.isArray||function(a){return a&&"object"==typeof a?"[object Array]"===k.call(a):!1};b.isArray=m,b.escapeExpression=e,b.isEmpty=f}),define("handlebars/exception",["exports"],function(a){function b(a,b){var d;b&&b.firstLine&&(d=b.firstLine,a+=" - "+d+":"+b.firstColumn);for(var e=Error.prototype.constructor.call(this,a),f=0;f<c.length;f++)this[c[f]]=e[c[f]];d&&(this.lineNumber=d,this.column=b.firstColumn)}var c=["description","fileName","lineNumber","message","name","number","stack"];b.prototype=new Error,a["default"]=b}),define("handlebars/base",["./utils","./exception","exports"],function(a,b,c){function d(a,b){this.helpers=a||{},this.partials=b||{},e(this)}function e(a){a.registerHelper("helperMissing",function(a){if(2===arguments.length)return void 0;throw new h("Missing helper: '"+a+"'")}),a.registerHelper("blockHelperMissing",function(b,c){var d=c.inverse||function(){},e=c.fn;return m(b)&&(b=b.call(this)),b===!0?e(this):b===!1||null==b?d(this):l(b)?b.length>0?a.helpers.each(b,c):d(this):e(b)}),a.registerHelper("each",function(a,b){var c,d=b.fn,e=b.inverse,f=0,g="";if(m(a)&&(a=a.call(this)),b.data&&(c=q(b.data)),a&&"object"==typeof a)if(l(a))for(var h=a.length;h>f;f++)c&&(c.index=f,c.first=0===f,c.last=f===a.length-1),g+=d(a[f],{data:c});else for(var i in a)a.hasOwnProperty(i)&&(c&&(c.key=i,c.index=f,c.first=0===f),g+=d(a[i],{data:c}),f++);return 0===f&&(g=e(this)),g}),a.registerHelper("if",function(a,b){return m(a)&&(a=a.call(this)),!b.hash.includeZero&&!a||g.isEmpty(a)?b.inverse(this):b.fn(this)}),a.registerHelper("unless",function(b,c){return a.helpers["if"].call(this,b,{fn:c.inverse,inverse:c.fn,hash:c.hash})}),a.registerHelper("with",function(a,b){return m(a)&&(a=a.call(this)),g.isEmpty(a)?void 0:b.fn(a)}),a.registerHelper("log",function(b,c){var d=c.data&&null!=c.data.level?parseInt(c.data.level,10):1;a.log(d,b)})}function f(a,b){p.log(a,b)}var g=a,h=b["default"],i="1.3.0";c.VERSION=i;var j=4;c.COMPILER_REVISION=j;var k={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:">= 1.0.0"};c.REVISION_CHANGES=k;var l=g.isArray,m=g.isFunction,n=g.toString,o="[object Object]";c.HandlebarsEnvironment=d,d.prototype={constructor:d,logger:p,log:f,registerHelper:function(a,b,c){if(n.call(a)===o){if(c||b)throw new h("Arg not supported with multiple helpers");g.extend(this.helpers,a)}else c&&(b.not=c),this.helpers[a]=b},registerPartial:function(a,b){n.call(a)===o?g.extend(this.partials,a):this.partials[a]=b}};var p={methodMap:{0:"debug",1:"info",2:"warn",3:"error"},DEBUG:0,INFO:1,WARN:2,ERROR:3,level:3,log:function(a,b){if(p.level<=a){var c=p.methodMap[a];"undefined"!=typeof console&&console[c]&&console[c].call(console,b)}}};c.logger=p,c.log=f;var q=function(a){var b={};return g.extend(b,a),b};c.createFrame=q}),define("handlebars/runtime",["./utils","./exception","./base","exports"],function(a,b,c,d){function e(a){var b=a&&a[0]||1,c=m;if(b!==c){if(c>b){var d=n[c],e=n[b];throw new l("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+d+") or downgrade your runtime to an older version ("+e+").")}throw new l("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+a[1]+").")}}function f(a,b){if(!b)throw new l("No environment passed to template");var c=function(a,c,d,e,f,g){var h=b.VM.invokePartial.apply(this,arguments);if(null!=h)return h;if(b.compile){var i={helpers:e,partials:f,data:g};return f[c]=b.compile(a,{data:void 0!==g},b),f[c](d,i)}throw new l("The partial "+c+" could not be compiled when running in runtime-only mode")},d={escapeExpression:k.escapeExpression,invokePartial:c,programs:[],program:function(a,b,c){var d=this.programs[a];return c?d=h(a,b,c):d||(d=this.programs[a]=h(a,b)),d},merge:function(a,b){var c=a||b;return a&&b&&a!==b&&(c={},k.extend(c,b),k.extend(c,a)),c},programWithDepth:b.VM.programWithDepth,noop:b.VM.noop,compilerInfo:null};return function(c,e){e=e||{};var f,g,h=e.partial?e:b;e.partial||(f=e.helpers,g=e.partials);var i=a.call(d,h,c,f,g,e.data);return e.partial||b.VM.checkRevision(d.compilerInfo),i}}function g(a,b,c){var d=Array.prototype.slice.call(arguments,3),e=function(a,e){return e=e||{},b.apply(this,[a,e.data||c].concat(d))};return e.program=a,e.depth=d.length,e}function h(a,b,c){var d=function(a,d){return d=d||{},b(a,d.data||c)};return d.program=a,d.depth=0,d}function i(a,b,c,d,e,f){var g={partial:!0,helpers:d,partials:e,data:f};if(void 0===a)throw new l("The partial "+b+" could not be found");return a instanceof Function?a(c,g):void 0}function j(){return""}var k=a,l=b["default"],m=c.COMPILER_REVISION,n=c.REVISION_CHANGES;d.checkRevision=e,d.template=f,d.programWithDepth=g,d.program=h,d.invokePartial=i,d.noop=j}),define("handlebars.runtime",["./handlebars/base","./handlebars/safe-string","./handlebars/exception","./handlebars/utils","./handlebars/runtime","exports"],function(a,b,c,d,e,f){var g=a,h=b["default"],i=c["default"],j=d,k=e,l=function(){var a=new g.HandlebarsEnvironment;return j.extend(a,g),a.SafeString=h,a.Exception=i,a.Utils=j,a.VM=k,a.template=function(b){return k.template(b,a)},a},m=l();m.create=l,f["default"]=m}); | ||
define("handlebars/safe-string",["exports"],function(a){function b(a){this.string=a}b.prototype.toString=function(){return""+this.string},a["default"]=b}),define("handlebars/utils",["./safe-string","exports"],function(a,b){function c(a){return i[a]||"&"}function d(a){for(var b=1;b<arguments.length;b++)for(var c in arguments[b])Object.prototype.hasOwnProperty.call(arguments[b],c)&&(a[c]=arguments[b][c]);return a}function e(a){return a instanceof h?a.toString():a||0===a?(a=""+a,k.test(a)?a.replace(j,c):a):""}function f(a){return a||0===a?n(a)&&0===a.length?!0:!1:!0}function g(a,b){return(a?a+".":"")+b}var h=a["default"],i={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},j=/[&<>"'`]/g,k=/[&<>"'`]/;b.extend=d;var l=Object.prototype.toString;b.toString=l;var m=function(a){return"function"==typeof a};m(/x/)&&(m=function(a){return"function"==typeof a&&"[object Function]"===l.call(a)});var m;b.isFunction=m;var n=Array.isArray||function(a){return a&&"object"==typeof a?"[object Array]"===l.call(a):!1};b.isArray=n,b.escapeExpression=e,b.isEmpty=f,b.appendContextPath=g}),define("handlebars/exception",["exports"],function(a){function b(a,b){var d;b&&b.firstLine&&(d=b.firstLine,a+=" - "+d+":"+b.firstColumn);for(var e=Error.prototype.constructor.call(this,a),f=0;f<c.length;f++)this[c[f]]=e[c[f]];d&&(this.lineNumber=d,this.column=b.firstColumn)}var c=["description","fileName","lineNumber","message","name","number","stack"];b.prototype=new Error,a["default"]=b}),define("handlebars/base",["./utils","./exception","exports"],function(a,b,c){function d(a,b){this.helpers=a||{},this.partials=b||{},e(this)}function e(a){a.registerHelper("helperMissing",function(){if(1===arguments.length)return void 0;throw new h("Missing helper: '"+arguments[arguments.length-1].name+"'")}),a.registerHelper("blockHelperMissing",function(b,c){var d=c.inverse||function(){},e=c.fn;if(m(b)&&(b=b.call(this)),b===!0)return e(this);if(b===!1||null==b)return d(this);if(l(b))return b.length>0?(c.ids&&(c.ids=[c.name]),a.helpers.each(b,c)):d(this);if(c.data&&c.ids){var f=q(c.data);f.contextPath=g.appendContextPath(c.data.contextPath,c.name),c={data:f}}return e(b,c)}),a.registerHelper("each",function(a,b){b||(b=a,a=this);var c,d,e=b.fn,f=b.inverse,h=0,i="";if(b.data&&b.ids&&(d=g.appendContextPath(b.data.contextPath,b.ids[0])+"."),m(a)&&(a=a.call(this)),b.data&&(c=q(b.data)),a&&"object"==typeof a)if(l(a))for(var j=a.length;j>h;h++)c&&(c.index=h,c.first=0===h,c.last=h===a.length-1,d&&(c.contextPath=d+h)),i+=e(a[h],{data:c});else for(var k in a)a.hasOwnProperty(k)&&(c&&(c.key=k,c.index=h,c.first=0===h,d&&(c.contextPath=d+k)),i+=e(a[k],{data:c}),h++);return 0===h&&(i=f(this)),i}),a.registerHelper("if",function(a,b){return m(a)&&(a=a.call(this)),!b.hash.includeZero&&!a||g.isEmpty(a)?b.inverse(this):b.fn(this)}),a.registerHelper("unless",function(b,c){return a.helpers["if"].call(this,b,{fn:c.inverse,inverse:c.fn,hash:c.hash})}),a.registerHelper("with",function(a,b){m(a)&&(a=a.call(this));var c=b.fn;if(!g.isEmpty(a)){if(b.data&&b.ids){var d=q(b.data);d.contextPath=g.appendContextPath(b.data.contextPath,b.ids[0]),b={data:d}}return c(a,b)}}),a.registerHelper("log",function(b,c){var d=c.data&&null!=c.data.level?parseInt(c.data.level,10):1;a.log(d,b)}),a.registerHelper("lookup",function(a,b){return a&&a[b]})}function f(a,b){p.log(a,b)}var g=a,h=b["default"],i="v2.0.0-alpha.1";c.VERSION=i;var j=5;c.COMPILER_REVISION=j;var k={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:"== 1.x.x",5:">= 2.0.0"};c.REVISION_CHANGES=k;var l=g.isArray,m=g.isFunction,n=g.toString,o="[object Object]";c.HandlebarsEnvironment=d,d.prototype={constructor:d,logger:p,log:f,registerHelper:function(a,b,c){if(n.call(a)===o){if(c||b)throw new h("Arg not supported with multiple helpers");g.extend(this.helpers,a)}else c&&(b.not=c),this.helpers[a]=b},unregisterHelper:function(a){delete this.helpers[a]},registerPartial:function(a,b){n.call(a)===o?g.extend(this.partials,a):this.partials[a]=b},unregisterPartial:function(a){delete this.partials[a]}};var p={methodMap:{0:"debug",1:"info",2:"warn",3:"error"},DEBUG:0,INFO:1,WARN:2,ERROR:3,level:3,log:function(a,b){if(p.level<=a){var c=p.methodMap[a];"undefined"!=typeof console&&console[c]&&console[c].call(console,b)}}};c.logger=p,c.log=f;var q=function(a){var b=g.extend({},a);return b._parent=a,b};c.createFrame=q}),define("handlebars/runtime",["./utils","./exception","./base","exports"],function(a,b,c,d){function e(a){var b=a&&a[0]||1,c=m;if(b!==c){if(c>b){var d=n[c],e=n[b];throw new l("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+d+") or downgrade your runtime to an older version ("+e+").")}throw new l("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+a[1]+").")}}function f(a,b){if(!b)throw new l("No environment passed to template");b.VM.checkRevision(a.compiler);var c=function(a,c,d,e,f,g,h){e&&(d=k.extend({},d,e));var i=b.VM.invokePartial.call(this,a,c,d,f,g,h);if(null!=i)return i;if(b.compile){var j={helpers:f,partials:g,data:h};return g[c]=b.compile(a,{data:void 0!==h},b),g[c](d,j)}throw new l("The partial "+c+" could not be compiled when running in runtime-only mode")},d={escapeExpression:k.escapeExpression,invokePartial:c,fn:function(b){return a[b]},programs:[],program:function(a,b){var c=this.programs[a],d=this.fn(a);return b?c=h(this,a,d,b):c||(c=this.programs[a]=h(this,a,d)),c},programWithDepth:b.VM.programWithDepth,initData:function(a,b){return b&&"root"in b||(b=b?o(b):{},b.root=a),b},data:function(a,b){for(;a&&b--;)a=a._parent;return a},merge:function(a,b){var c=a||b;return a&&b&&a!==b&&(c=k.extend({},b,a)),c},noop:b.VM.noop,compilerInfo:a.compiler},e=function(c,e){e=e||{};var f,g,h=e.partial?e:b,i=e.data;return e.partial?(f=d.helpers=e.helpers,g=d.partials=e.partials):(f=d.helpers=d.merge(e.helpers,h.helpers),a.usePartial&&(g=d.partials=d.merge(e.partials,h.partials)),a.useData&&(i=d.initData(c,i))),a.main.call(d,c,f,g,i)};return e.child=function(a){return d.programWithDepth(a)},e}function g(a,b){var c=Array.prototype.slice.call(arguments,2),d=this,e=d.fn(a),f=function(a,f){return f=f||{},e.apply(d,[a,d.helpers,d.partials,f.data||b].concat(c))};return f.program=a,f.depth=c.length,f}function h(a,b,c,d){var e=function(b,e){return e=e||{},c.call(a,b,a.helpers,a.partials,e.data||d)};return e.program=b,e.depth=0,e}function i(a,b,c,d,e,f){var g={partial:!0,helpers:d,partials:e,data:f};if(void 0===a)throw new l("The partial "+b+" could not be found");return a instanceof Function?a(c,g):void 0}function j(){return""}var k=a,l=b["default"],m=c.COMPILER_REVISION,n=c.REVISION_CHANGES,o=c.createFrame;d.checkRevision=e,d.template=f,d.programWithDepth=g,d.program=h,d.invokePartial=i,d.noop=j}),define("handlebars.runtime",["./handlebars/base","./handlebars/safe-string","./handlebars/exception","./handlebars/utils","./handlebars/runtime","exports"],function(a,b,c,d,e,f){var g=a,h=b["default"],i=c["default"],j=d,k=e,l=function(){var a=new g.HandlebarsEnvironment;return j.extend(a,g),a.SafeString=h,a.Exception=i,a.Utils=j,a.VM=k,a.template=function(b){return k.template(b,a)},a},m=l();m.create=l,f["default"]=m}); |
/*! | ||
handlebars v1.3.0 | ||
handlebars vv2.0.0-alpha.1 | ||
Copyright (C) 2011 by Yehuda Katz | ||
Copyright (C) 2011-2014 by Yehuda Katz | ||
@@ -28,3 +28,3 @@ Permission is hereby granted, free of charge, to any person obtaining a copy | ||
/* exported Handlebars */ | ||
var Handlebars = (function() { | ||
this.Handlebars = (function() { | ||
// handlebars/safe-string.js | ||
@@ -70,8 +70,12 @@ var __module3__ = (function() { | ||
function extend(obj, value) { | ||
for(var key in value) { | ||
if(Object.prototype.hasOwnProperty.call(value, key)) { | ||
obj[key] = value[key]; | ||
function extend(obj /* , ...source */) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
for (var key in arguments[i]) { | ||
if (Object.prototype.hasOwnProperty.call(arguments[i], key)) { | ||
obj[key] = arguments[i][key]; | ||
} | ||
} | ||
} | ||
return obj; | ||
} | ||
@@ -126,3 +130,7 @@ | ||
__exports__.isEmpty = isEmpty; | ||
__exports__.isEmpty = isEmpty;function appendContextPath(contextPath, id) { | ||
return (contextPath ? contextPath + '.' : '') + id; | ||
} | ||
__exports__.appendContextPath = appendContextPath; | ||
return __exports__; | ||
@@ -172,4 +180,4 @@ })(__module3__); | ||
var VERSION = "1.3.0"; | ||
__exports__.VERSION = VERSION;var COMPILER_REVISION = 4; | ||
var VERSION = "v2.0.0-alpha.1"; | ||
__exports__.VERSION = VERSION;var COMPILER_REVISION = 5; | ||
__exports__.COMPILER_REVISION = COMPILER_REVISION; | ||
@@ -180,3 +188,4 @@ var REVISION_CHANGES = { | ||
3: '== 1.0.0-rc.4', | ||
4: '>= 1.0.0' | ||
4: '== 1.x.x', | ||
5: '>= 2.0.0' | ||
}; | ||
@@ -211,2 +220,5 @@ __exports__.REVISION_CHANGES = REVISION_CHANGES; | ||
}, | ||
unregisterHelper: function(name) { | ||
delete this.helpers[name]; | ||
}, | ||
@@ -219,2 +231,5 @@ registerPartial: function(name, str) { | ||
} | ||
}, | ||
unregisterPartial: function(name) { | ||
delete this.partials[name]; | ||
} | ||
@@ -224,7 +239,9 @@ }; | ||
function registerDefaultHelpers(instance) { | ||
instance.registerHelper('helperMissing', function(arg) { | ||
if(arguments.length === 2) { | ||
instance.registerHelper('helperMissing', function(/* [args, ]options */) { | ||
if(arguments.length === 1) { | ||
// A missing field in a {{foo}} constuct. | ||
return undefined; | ||
} else { | ||
throw new Exception("Missing helper: '" + arg + "'"); | ||
// Someone is actually trying to call something, blow up. | ||
throw new Exception("Missing helper: '" + arguments[arguments.length-1].name + "'"); | ||
} | ||
@@ -244,2 +261,6 @@ }); | ||
if(context.length > 0) { | ||
if (options.ids) { | ||
options.ids = [options.name]; | ||
} | ||
return instance.helpers.each(context, options); | ||
@@ -250,3 +271,9 @@ } else { | ||
} else { | ||
return fn(context); | ||
if (options.data && options.ids) { | ||
var data = createFrame(options.data); | ||
data.contextPath = Utils.appendContextPath(options.data.contextPath, options.name); | ||
options = {data: data}; | ||
} | ||
return fn(context, options); | ||
} | ||
@@ -256,5 +283,16 @@ }); | ||
instance.registerHelper('each', function(context, options) { | ||
// Allow for {{#each}} | ||
if (!options) { | ||
options = context; | ||
context = this; | ||
} | ||
var fn = options.fn, inverse = options.inverse; | ||
var i = 0, ret = "", data; | ||
var contextPath; | ||
if (options.data && options.ids) { | ||
contextPath = Utils.appendContextPath(options.data.contextPath, options.ids[0]) + '.'; | ||
} | ||
if (isFunction(context)) { context = context.call(this); } | ||
@@ -273,2 +311,6 @@ | ||
data.last = (i === (context.length-1)); | ||
if (contextPath) { | ||
data.contextPath = contextPath + i; | ||
} | ||
} | ||
@@ -280,6 +322,10 @@ ret = ret + fn(context[i], { data: data }); | ||
if(context.hasOwnProperty(key)) { | ||
if(data) { | ||
data.key = key; | ||
if(data) { | ||
data.key = key; | ||
data.index = i; | ||
data.first = (i === 0); | ||
if (contextPath) { | ||
data.contextPath = contextPath + key; | ||
} | ||
} | ||
@@ -320,3 +366,13 @@ ret = ret + fn(context[key], {data: data}); | ||
if (!Utils.isEmpty(context)) return options.fn(context); | ||
var fn = options.fn; | ||
if (!Utils.isEmpty(context)) { | ||
if (options.data && options.ids) { | ||
var data = createFrame(options.data); | ||
data.contextPath = Utils.appendContextPath(options.data.contextPath, options.ids[0]); | ||
options = {data:data}; | ||
} | ||
return fn(context, options); | ||
} | ||
}); | ||
@@ -328,2 +384,6 @@ | ||
}); | ||
instance.registerHelper('lookup', function(obj, field, options) { | ||
return obj && obj[field]; | ||
}); | ||
} | ||
@@ -355,5 +415,5 @@ | ||
__exports__.log = log;var createFrame = function(object) { | ||
var obj = {}; | ||
Utils.extend(obj, object); | ||
return obj; | ||
var frame = Utils.extend({}, object); | ||
frame._parent = object; | ||
return frame; | ||
}; | ||
@@ -372,2 +432,3 @@ __exports__.createFrame = createFrame; | ||
var REVISION_CHANGES = __dependency3__.REVISION_CHANGES; | ||
var createFrame = __dependency3__.createFrame; | ||
@@ -401,4 +462,10 @@ function checkRevision(compilerInfo) { | ||
// for external users to override these as psuedo-supported APIs. | ||
var invokePartialWrapper = function(partial, name, context, helpers, partials, data) { | ||
var result = env.VM.invokePartial.apply(this, arguments); | ||
env.VM.checkRevision(templateSpec.compiler); | ||
var invokePartialWrapper = function(partial, name, context, hash, helpers, partials, data) { | ||
if (hash) { | ||
context = Utils.extend({}, context, hash); | ||
} | ||
var result = env.VM.invokePartial.call(this, partial, name, context, helpers, partials, data); | ||
if (result != null) { return result; } | ||
@@ -419,12 +486,33 @@ | ||
invokePartial: invokePartialWrapper, | ||
fn: function(i) { | ||
return templateSpec[i]; | ||
}, | ||
programs: [], | ||
program: function(i, fn, data) { | ||
var programWrapper = this.programs[i]; | ||
program: function(i, data) { | ||
var programWrapper = this.programs[i], | ||
fn = this.fn(i); | ||
if(data) { | ||
programWrapper = program(i, fn, data); | ||
programWrapper = program(this, i, fn, data); | ||
} else if (!programWrapper) { | ||
programWrapper = this.programs[i] = program(i, fn); | ||
programWrapper = this.programs[i] = program(this, i, fn); | ||
} | ||
return programWrapper; | ||
}, | ||
programWithDepth: env.VM.programWithDepth, | ||
initData: function(context, data) { | ||
if (!data || !('root' in data)) { | ||
data = data ? createFrame(data) : {}; | ||
data.root = context; | ||
} | ||
return data; | ||
}, | ||
data: function(data, depth) { | ||
while (data && depth--) { | ||
data = data._parent; | ||
} | ||
return data; | ||
}, | ||
merge: function(param, common) { | ||
@@ -434,40 +522,46 @@ var ret = param || common; | ||
if (param && common && (param !== common)) { | ||
ret = {}; | ||
Utils.extend(ret, common); | ||
Utils.extend(ret, param); | ||
ret = Utils.extend({}, common, param); | ||
} | ||
return ret; | ||
}, | ||
programWithDepth: env.VM.programWithDepth, | ||
noop: env.VM.noop, | ||
compilerInfo: null | ||
compilerInfo: templateSpec.compiler | ||
}; | ||
return function(context, options) { | ||
var ret = function(context, options) { | ||
options = options || {}; | ||
var namespace = options.partial ? options : env, | ||
helpers, | ||
partials; | ||
partials, | ||
data = options.data; | ||
if (!options.partial) { | ||
helpers = options.helpers; | ||
partials = options.partials; | ||
} | ||
var result = templateSpec.call( | ||
container, | ||
namespace, context, | ||
helpers, | ||
partials, | ||
options.data); | ||
helpers = container.helpers = container.merge(options.helpers, namespace.helpers); | ||
if (!options.partial) { | ||
env.VM.checkRevision(container.compilerInfo); | ||
if (templateSpec.usePartial) { | ||
partials = container.partials = container.merge(options.partials, namespace.partials); | ||
} | ||
if (templateSpec.useData) { | ||
data = container.initData(context, data); | ||
} | ||
} else { | ||
helpers = container.helpers = options.helpers; | ||
partials = container.partials = options.partials; | ||
} | ||
return templateSpec.main.call(container, context, helpers, partials, data); | ||
}; | ||
return result; | ||
ret.child = function(i) { | ||
return container.programWithDepth(i); | ||
}; | ||
return ret; | ||
} | ||
__exports__.template = template;function programWithDepth(i, fn, data /*, $depth */) { | ||
var args = Array.prototype.slice.call(arguments, 3); | ||
__exports__.template = template;function programWithDepth(i, data /*, $depth */) { | ||
/*jshint -W040 */ | ||
var args = Array.prototype.slice.call(arguments, 2), | ||
container = this, | ||
fn = container.fn(i); | ||
@@ -477,3 +571,3 @@ var prog = function(context, options) { | ||
return fn.apply(this, [context, options.data || data].concat(args)); | ||
return fn.apply(container, [context, container.helpers, container.partials, options.data || data].concat(args)); | ||
}; | ||
@@ -485,7 +579,7 @@ prog.program = i; | ||
__exports__.programWithDepth = programWithDepth;function program(i, fn, data) { | ||
__exports__.programWithDepth = programWithDepth;function program(container, i, fn, data) { | ||
var prog = function(context, options) { | ||
options = options || {}; | ||
return fn(context, options.data || data); | ||
return fn.call(container, context, container.helpers, container.partials, options.data || data); | ||
}; | ||
@@ -492,0 +586,0 @@ prog.program = i; |
/*! | ||
handlebars v1.3.0 | ||
handlebars vv2.0.0-alpha.1 | ||
Copyright (C) 2011 by Yehuda Katz | ||
Copyright (C) 2011-2014 by Yehuda Katz | ||
@@ -27,2 +27,2 @@ Permission is hereby granted, free of charge, to any person obtaining a copy | ||
*/ | ||
var Handlebars=function(){var a=function(){"use strict";function a(a){this.string=a}var b;return a.prototype.toString=function(){return""+this.string},b=a}(),b=function(a){"use strict";function b(a){return h[a]||"&"}function c(a,b){for(var c in b)Object.prototype.hasOwnProperty.call(b,c)&&(a[c]=b[c])}function d(a){return a instanceof g?a.toString():a||0===a?(a=""+a,j.test(a)?a.replace(i,b):a):""}function e(a){return a||0===a?m(a)&&0===a.length?!0:!1:!0}var f={},g=a,h={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},i=/[&<>"'`]/g,j=/[&<>"'`]/;f.extend=c;var k=Object.prototype.toString;f.toString=k;var l=function(a){return"function"==typeof a};l(/x/)&&(l=function(a){return"function"==typeof a&&"[object Function]"===k.call(a)});var l;f.isFunction=l;var m=Array.isArray||function(a){return a&&"object"==typeof a?"[object Array]"===k.call(a):!1};return f.isArray=m,f.escapeExpression=d,f.isEmpty=e,f}(a),c=function(){"use strict";function a(a,b){var d;b&&b.firstLine&&(d=b.firstLine,a+=" - "+d+":"+b.firstColumn);for(var e=Error.prototype.constructor.call(this,a),f=0;f<c.length;f++)this[c[f]]=e[c[f]];d&&(this.lineNumber=d,this.column=b.firstColumn)}var b,c=["description","fileName","lineNumber","message","name","number","stack"];return a.prototype=new Error,b=a}(),d=function(a,b){"use strict";function c(a,b){this.helpers=a||{},this.partials=b||{},d(this)}function d(a){a.registerHelper("helperMissing",function(a){if(2===arguments.length)return void 0;throw new h("Missing helper: '"+a+"'")}),a.registerHelper("blockHelperMissing",function(b,c){var d=c.inverse||function(){},e=c.fn;return m(b)&&(b=b.call(this)),b===!0?e(this):b===!1||null==b?d(this):l(b)?b.length>0?a.helpers.each(b,c):d(this):e(b)}),a.registerHelper("each",function(a,b){var c,d=b.fn,e=b.inverse,f=0,g="";if(m(a)&&(a=a.call(this)),b.data&&(c=q(b.data)),a&&"object"==typeof a)if(l(a))for(var h=a.length;h>f;f++)c&&(c.index=f,c.first=0===f,c.last=f===a.length-1),g+=d(a[f],{data:c});else for(var i in a)a.hasOwnProperty(i)&&(c&&(c.key=i,c.index=f,c.first=0===f),g+=d(a[i],{data:c}),f++);return 0===f&&(g=e(this)),g}),a.registerHelper("if",function(a,b){return m(a)&&(a=a.call(this)),!b.hash.includeZero&&!a||g.isEmpty(a)?b.inverse(this):b.fn(this)}),a.registerHelper("unless",function(b,c){return a.helpers["if"].call(this,b,{fn:c.inverse,inverse:c.fn,hash:c.hash})}),a.registerHelper("with",function(a,b){return m(a)&&(a=a.call(this)),g.isEmpty(a)?void 0:b.fn(a)}),a.registerHelper("log",function(b,c){var d=c.data&&null!=c.data.level?parseInt(c.data.level,10):1;a.log(d,b)})}function e(a,b){p.log(a,b)}var f={},g=a,h=b,i="1.3.0";f.VERSION=i;var j=4;f.COMPILER_REVISION=j;var k={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:">= 1.0.0"};f.REVISION_CHANGES=k;var l=g.isArray,m=g.isFunction,n=g.toString,o="[object Object]";f.HandlebarsEnvironment=c,c.prototype={constructor:c,logger:p,log:e,registerHelper:function(a,b,c){if(n.call(a)===o){if(c||b)throw new h("Arg not supported with multiple helpers");g.extend(this.helpers,a)}else c&&(b.not=c),this.helpers[a]=b},registerPartial:function(a,b){n.call(a)===o?g.extend(this.partials,a):this.partials[a]=b}};var p={methodMap:{0:"debug",1:"info",2:"warn",3:"error"},DEBUG:0,INFO:1,WARN:2,ERROR:3,level:3,log:function(a,b){if(p.level<=a){var c=p.methodMap[a];"undefined"!=typeof console&&console[c]&&console[c].call(console,b)}}};f.logger=p,f.log=e;var q=function(a){var b={};return g.extend(b,a),b};return f.createFrame=q,f}(b,c),e=function(a,b,c){"use strict";function d(a){var b=a&&a[0]||1,c=m;if(b!==c){if(c>b){var d=n[c],e=n[b];throw new l("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+d+") or downgrade your runtime to an older version ("+e+").")}throw new l("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+a[1]+").")}}function e(a,b){if(!b)throw new l("No environment passed to template");var c=function(a,c,d,e,f,g){var h=b.VM.invokePartial.apply(this,arguments);if(null!=h)return h;if(b.compile){var i={helpers:e,partials:f,data:g};return f[c]=b.compile(a,{data:void 0!==g},b),f[c](d,i)}throw new l("The partial "+c+" could not be compiled when running in runtime-only mode")},d={escapeExpression:k.escapeExpression,invokePartial:c,programs:[],program:function(a,b,c){var d=this.programs[a];return c?d=g(a,b,c):d||(d=this.programs[a]=g(a,b)),d},merge:function(a,b){var c=a||b;return a&&b&&a!==b&&(c={},k.extend(c,b),k.extend(c,a)),c},programWithDepth:b.VM.programWithDepth,noop:b.VM.noop,compilerInfo:null};return function(c,e){e=e||{};var f,g,h=e.partial?e:b;e.partial||(f=e.helpers,g=e.partials);var i=a.call(d,h,c,f,g,e.data);return e.partial||b.VM.checkRevision(d.compilerInfo),i}}function f(a,b,c){var d=Array.prototype.slice.call(arguments,3),e=function(a,e){return e=e||{},b.apply(this,[a,e.data||c].concat(d))};return e.program=a,e.depth=d.length,e}function g(a,b,c){var d=function(a,d){return d=d||{},b(a,d.data||c)};return d.program=a,d.depth=0,d}function h(a,b,c,d,e,f){var g={partial:!0,helpers:d,partials:e,data:f};if(void 0===a)throw new l("The partial "+b+" could not be found");return a instanceof Function?a(c,g):void 0}function i(){return""}var j={},k=a,l=b,m=c.COMPILER_REVISION,n=c.REVISION_CHANGES;return j.checkRevision=d,j.template=e,j.programWithDepth=f,j.program=g,j.invokePartial=h,j.noop=i,j}(b,c,d),f=function(a,b,c,d,e){"use strict";var f,g=a,h=b,i=c,j=d,k=e,l=function(){var a=new g.HandlebarsEnvironment;return j.extend(a,g),a.SafeString=h,a.Exception=i,a.Utils=j,a.VM=k,a.template=function(b){return k.template(b,a)},a},m=l();return m.create=l,f=m}(d,a,c,b,e);return f}(); | ||
this.Handlebars=function(){var a=function(){"use strict";function a(a){this.string=a}var b;return a.prototype.toString=function(){return""+this.string},b=a}(),b=function(a){"use strict";function b(a){return i[a]||"&"}function c(a){for(var b=1;b<arguments.length;b++)for(var c in arguments[b])Object.prototype.hasOwnProperty.call(arguments[b],c)&&(a[c]=arguments[b][c]);return a}function d(a){return a instanceof h?a.toString():a||0===a?(a=""+a,k.test(a)?a.replace(j,b):a):""}function e(a){return a||0===a?n(a)&&0===a.length?!0:!1:!0}function f(a,b){return(a?a+".":"")+b}var g={},h=a,i={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},j=/[&<>"'`]/g,k=/[&<>"'`]/;g.extend=c;var l=Object.prototype.toString;g.toString=l;var m=function(a){return"function"==typeof a};m(/x/)&&(m=function(a){return"function"==typeof a&&"[object Function]"===l.call(a)});var m;g.isFunction=m;var n=Array.isArray||function(a){return a&&"object"==typeof a?"[object Array]"===l.call(a):!1};return g.isArray=n,g.escapeExpression=d,g.isEmpty=e,g.appendContextPath=f,g}(a),c=function(){"use strict";function a(a,b){var d;b&&b.firstLine&&(d=b.firstLine,a+=" - "+d+":"+b.firstColumn);for(var e=Error.prototype.constructor.call(this,a),f=0;f<c.length;f++)this[c[f]]=e[c[f]];d&&(this.lineNumber=d,this.column=b.firstColumn)}var b,c=["description","fileName","lineNumber","message","name","number","stack"];return a.prototype=new Error,b=a}(),d=function(a,b){"use strict";function c(a,b){this.helpers=a||{},this.partials=b||{},d(this)}function d(a){a.registerHelper("helperMissing",function(){if(1===arguments.length)return void 0;throw new h("Missing helper: '"+arguments[arguments.length-1].name+"'")}),a.registerHelper("blockHelperMissing",function(b,c){var d=c.inverse||function(){},e=c.fn;if(m(b)&&(b=b.call(this)),b===!0)return e(this);if(b===!1||null==b)return d(this);if(l(b))return b.length>0?(c.ids&&(c.ids=[c.name]),a.helpers.each(b,c)):d(this);if(c.data&&c.ids){var f=q(c.data);f.contextPath=g.appendContextPath(c.data.contextPath,c.name),c={data:f}}return e(b,c)}),a.registerHelper("each",function(a,b){b||(b=a,a=this);var c,d,e=b.fn,f=b.inverse,h=0,i="";if(b.data&&b.ids&&(d=g.appendContextPath(b.data.contextPath,b.ids[0])+"."),m(a)&&(a=a.call(this)),b.data&&(c=q(b.data)),a&&"object"==typeof a)if(l(a))for(var j=a.length;j>h;h++)c&&(c.index=h,c.first=0===h,c.last=h===a.length-1,d&&(c.contextPath=d+h)),i+=e(a[h],{data:c});else for(var k in a)a.hasOwnProperty(k)&&(c&&(c.key=k,c.index=h,c.first=0===h,d&&(c.contextPath=d+k)),i+=e(a[k],{data:c}),h++);return 0===h&&(i=f(this)),i}),a.registerHelper("if",function(a,b){return m(a)&&(a=a.call(this)),!b.hash.includeZero&&!a||g.isEmpty(a)?b.inverse(this):b.fn(this)}),a.registerHelper("unless",function(b,c){return a.helpers["if"].call(this,b,{fn:c.inverse,inverse:c.fn,hash:c.hash})}),a.registerHelper("with",function(a,b){m(a)&&(a=a.call(this));var c=b.fn;if(!g.isEmpty(a)){if(b.data&&b.ids){var d=q(b.data);d.contextPath=g.appendContextPath(b.data.contextPath,b.ids[0]),b={data:d}}return c(a,b)}}),a.registerHelper("log",function(b,c){var d=c.data&&null!=c.data.level?parseInt(c.data.level,10):1;a.log(d,b)}),a.registerHelper("lookup",function(a,b){return a&&a[b]})}function e(a,b){p.log(a,b)}var f={},g=a,h=b,i="v2.0.0-alpha.1";f.VERSION=i;var j=5;f.COMPILER_REVISION=j;var k={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:"== 1.x.x",5:">= 2.0.0"};f.REVISION_CHANGES=k;var l=g.isArray,m=g.isFunction,n=g.toString,o="[object Object]";f.HandlebarsEnvironment=c,c.prototype={constructor:c,logger:p,log:e,registerHelper:function(a,b,c){if(n.call(a)===o){if(c||b)throw new h("Arg not supported with multiple helpers");g.extend(this.helpers,a)}else c&&(b.not=c),this.helpers[a]=b},unregisterHelper:function(a){delete this.helpers[a]},registerPartial:function(a,b){n.call(a)===o?g.extend(this.partials,a):this.partials[a]=b},unregisterPartial:function(a){delete this.partials[a]}};var p={methodMap:{0:"debug",1:"info",2:"warn",3:"error"},DEBUG:0,INFO:1,WARN:2,ERROR:3,level:3,log:function(a,b){if(p.level<=a){var c=p.methodMap[a];"undefined"!=typeof console&&console[c]&&console[c].call(console,b)}}};f.logger=p,f.log=e;var q=function(a){var b=g.extend({},a);return b._parent=a,b};return f.createFrame=q,f}(b,c),e=function(a,b,c){"use strict";function d(a){var b=a&&a[0]||1,c=m;if(b!==c){if(c>b){var d=n[c],e=n[b];throw new l("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+d+") or downgrade your runtime to an older version ("+e+").")}throw new l("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+a[1]+").")}}function e(a,b){if(!b)throw new l("No environment passed to template");b.VM.checkRevision(a.compiler);var c=function(a,c,d,e,f,g,h){e&&(d=k.extend({},d,e));var i=b.VM.invokePartial.call(this,a,c,d,f,g,h);if(null!=i)return i;if(b.compile){var j={helpers:f,partials:g,data:h};return g[c]=b.compile(a,{data:void 0!==h},b),g[c](d,j)}throw new l("The partial "+c+" could not be compiled when running in runtime-only mode")},d={escapeExpression:k.escapeExpression,invokePartial:c,fn:function(b){return a[b]},programs:[],program:function(a,b){var c=this.programs[a],d=this.fn(a);return b?c=g(this,a,d,b):c||(c=this.programs[a]=g(this,a,d)),c},programWithDepth:b.VM.programWithDepth,initData:function(a,b){return b&&"root"in b||(b=b?o(b):{},b.root=a),b},data:function(a,b){for(;a&&b--;)a=a._parent;return a},merge:function(a,b){var c=a||b;return a&&b&&a!==b&&(c=k.extend({},b,a)),c},noop:b.VM.noop,compilerInfo:a.compiler},e=function(c,e){e=e||{};var f,g,h=e.partial?e:b,i=e.data;return e.partial?(f=d.helpers=e.helpers,g=d.partials=e.partials):(f=d.helpers=d.merge(e.helpers,h.helpers),a.usePartial&&(g=d.partials=d.merge(e.partials,h.partials)),a.useData&&(i=d.initData(c,i))),a.main.call(d,c,f,g,i)};return e.child=function(a){return d.programWithDepth(a)},e}function f(a,b){var c=Array.prototype.slice.call(arguments,2),d=this,e=d.fn(a),f=function(a,f){return f=f||{},e.apply(d,[a,d.helpers,d.partials,f.data||b].concat(c))};return f.program=a,f.depth=c.length,f}function g(a,b,c,d){var e=function(b,e){return e=e||{},c.call(a,b,a.helpers,a.partials,e.data||d)};return e.program=b,e.depth=0,e}function h(a,b,c,d,e,f){var g={partial:!0,helpers:d,partials:e,data:f};if(void 0===a)throw new l("The partial "+b+" could not be found");return a instanceof Function?a(c,g):void 0}function i(){return""}var j={},k=a,l=b,m=c.COMPILER_REVISION,n=c.REVISION_CHANGES,o=c.createFrame;return j.checkRevision=d,j.template=e,j.programWithDepth=f,j.program=g,j.invokePartial=h,j.noop=i,j}(b,c,d),f=function(a,b,c,d,e){"use strict";var f,g=a,h=b,i=c,j=d,k=e,l=function(){var a=new g.HandlebarsEnvironment;return j.extend(a,g),a.SafeString=h,a.Exception=i,a.Utils=j,a.VM=k,a.template=function(b){return k.template(b,a)},a},m=l();return m.create=l,f=m}(d,a,c,b,e);return f}(); |
module Utils from "./utils"; | ||
import Exception from "./exception"; | ||
export var VERSION = "1.3.0"; | ||
export var COMPILER_REVISION = 4; | ||
export var VERSION = "v2.0.0-alpha.1"; | ||
export var COMPILER_REVISION = 5; | ||
@@ -11,3 +11,4 @@ export var REVISION_CHANGES = { | ||
3: '== 1.0.0-rc.4', | ||
4: '>= 1.0.0' | ||
4: '== 1.x.x', | ||
5: '>= 2.0.0' | ||
}; | ||
@@ -42,2 +43,5 @@ | ||
}, | ||
unregisterHelper: function(name) { | ||
delete this.helpers[name]; | ||
}, | ||
@@ -50,2 +54,5 @@ registerPartial: function(name, str) { | ||
} | ||
}, | ||
unregisterPartial: function(name) { | ||
delete this.partials[name]; | ||
} | ||
@@ -55,7 +62,9 @@ }; | ||
function registerDefaultHelpers(instance) { | ||
instance.registerHelper('helperMissing', function(arg) { | ||
if(arguments.length === 2) { | ||
instance.registerHelper('helperMissing', function(/* [args, ]options */) { | ||
if(arguments.length === 1) { | ||
// A missing field in a {{foo}} constuct. | ||
return undefined; | ||
} else { | ||
throw new Exception("Missing helper: '" + arg + "'"); | ||
// Someone is actually trying to call something, blow up. | ||
throw new Exception("Missing helper: '" + arguments[arguments.length-1].name + "'"); | ||
} | ||
@@ -75,2 +84,6 @@ }); | ||
if(context.length > 0) { | ||
if (options.ids) { | ||
options.ids = [options.name]; | ||
} | ||
return instance.helpers.each(context, options); | ||
@@ -81,3 +94,9 @@ } else { | ||
} else { | ||
return fn(context); | ||
if (options.data && options.ids) { | ||
var data = createFrame(options.data); | ||
data.contextPath = Utils.appendContextPath(options.data.contextPath, options.name); | ||
options = {data: data}; | ||
} | ||
return fn(context, options); | ||
} | ||
@@ -87,5 +106,16 @@ }); | ||
instance.registerHelper('each', function(context, options) { | ||
// Allow for {{#each}} | ||
if (!options) { | ||
options = context; | ||
context = this; | ||
} | ||
var fn = options.fn, inverse = options.inverse; | ||
var i = 0, ret = "", data; | ||
var contextPath; | ||
if (options.data && options.ids) { | ||
contextPath = Utils.appendContextPath(options.data.contextPath, options.ids[0]) + '.'; | ||
} | ||
if (isFunction(context)) { context = context.call(this); } | ||
@@ -104,2 +134,6 @@ | ||
data.last = (i === (context.length-1)); | ||
if (contextPath) { | ||
data.contextPath = contextPath + i; | ||
} | ||
} | ||
@@ -111,6 +145,10 @@ ret = ret + fn(context[i], { data: data }); | ||
if(context.hasOwnProperty(key)) { | ||
if(data) { | ||
data.key = key; | ||
if(data) { | ||
data.key = key; | ||
data.index = i; | ||
data.first = (i === 0); | ||
if (contextPath) { | ||
data.contextPath = contextPath + key; | ||
} | ||
} | ||
@@ -151,3 +189,13 @@ ret = ret + fn(context[key], {data: data}); | ||
if (!Utils.isEmpty(context)) return options.fn(context); | ||
var fn = options.fn; | ||
if (!Utils.isEmpty(context)) { | ||
if (options.data && options.ids) { | ||
var data = createFrame(options.data); | ||
data.contextPath = Utils.appendContextPath(options.data.contextPath, options.ids[0]); | ||
options = {data:data}; | ||
} | ||
return fn(context, options); | ||
} | ||
}); | ||
@@ -159,2 +207,6 @@ | ||
}); | ||
instance.registerHelper('lookup', function(obj, field, options) { | ||
return obj && obj[field]; | ||
}); | ||
} | ||
@@ -186,5 +238,5 @@ | ||
export var createFrame = function(object) { | ||
var obj = {}; | ||
Utils.extend(obj, object); | ||
return obj; | ||
var frame = Utils.extend({}, object); | ||
frame._parent = object; | ||
return frame; | ||
}; |
@@ -86,11 +86,11 @@ import Exception from "../exception"; | ||
// a mustache is an eligible helper if: | ||
// * its id is simple (a single part, not `this` or `..`) | ||
var eligibleHelper = this.eligibleHelper = id.isSimple; | ||
// a mustache is definitely a helper if: | ||
// * it is an eligible helper, and | ||
// * it has at least one parameter or hash segment | ||
this.isHelper = eligibleHelper && (params.length || hash); | ||
this.isHelper = params.length || hash; | ||
// a mustache is an eligible helper if: | ||
// * its id is simple (a single part, not `this` or `..`) | ||
this.eligibleHelper = this.isHelper || id.isSimple; | ||
// if a mustache is an eligible helper but not a definite | ||
@@ -101,3 +101,3 @@ // helper, it is ambiguous, and will be resolved in a later | ||
PartialNode: function(partialName, context, strip, locInfo) { | ||
PartialNode: function(partialName, context, hash, strip, locInfo) { | ||
LocationInfo.call(this, locInfo); | ||
@@ -107,2 +107,3 @@ this.type = "partial"; | ||
this.context = context; | ||
this.hash = hash; | ||
this.strip = strip; | ||
@@ -136,2 +137,16 @@ }, | ||
RawBlockNode: function(mustache, content, close, locInfo) { | ||
LocationInfo.call(this, locInfo); | ||
if (mustache.sexpr.id.original !== close) { | ||
throw new Exception(mustache.sexpr.id.original + " doesn't match " + close, this); | ||
} | ||
content = new AST.ContentNode(content, locInfo); | ||
this.type = 'block'; | ||
this.mustache = mustache; | ||
this.program = new AST.ProgramNode([content], locInfo); | ||
}, | ||
ContentNode: function(string, locInfo) { | ||
@@ -155,3 +170,4 @@ LocationInfo.call(this, locInfo); | ||
dig = [], | ||
depth = 0; | ||
depth = 0, | ||
depthString = ''; | ||
@@ -167,2 +183,3 @@ for(var i=0,l=parts.length; i<l; i++) { | ||
depth++; | ||
depthString += '../'; | ||
} else { | ||
@@ -180,2 +197,3 @@ this.isScoped = true; | ||
this.depth = depth; | ||
this.idName = depthString + this.string; | ||
@@ -199,2 +217,4 @@ // an ID is simple if it only has one part, and that part is not | ||
this.id = id; | ||
this.stringModeValue = id.stringModeValue; | ||
this.idName = '@' + id.stringModeValue; | ||
}, | ||
@@ -210,8 +230,8 @@ | ||
IntegerNode: function(integer, locInfo) { | ||
NumberNode: function(number, locInfo) { | ||
LocationInfo.call(this, locInfo); | ||
this.type = "INTEGER"; | ||
this.type = "NUMBER"; | ||
this.original = | ||
this.integer = integer; | ||
this.stringModeValue = Number(integer); | ||
this.number = number; | ||
this.stringModeValue = Number(number); | ||
}, | ||
@@ -218,0 +238,0 @@ |
@@ -76,2 +76,4 @@ import Exception from "../exception"; | ||
this.options = options; | ||
this.stringParams = options.stringParams; | ||
this.trackIds = options.trackIds; | ||
@@ -87,3 +89,4 @@ // These changes will propagate to the other compiler components | ||
'with': true, | ||
'log': true | ||
'log': true, | ||
'lookup': true | ||
}; | ||
@@ -174,3 +177,3 @@ if (knownHelpers) { | ||
this.opcode('emptyHash'); | ||
this.opcode('blockValue'); | ||
this.opcode('blockValue', sexpr.id.original); | ||
} else { | ||
@@ -191,3 +194,3 @@ this.ambiguousSexpr(sexpr, program, inverse); | ||
hash: function(hash) { | ||
var pairs = hash.pairs, pair, val; | ||
var pairs = hash.pairs, pair; | ||
@@ -198,20 +201,4 @@ this.opcode('pushHash'); | ||
pair = pairs[i]; | ||
val = pair[1]; | ||
if (this.options.stringParams) { | ||
if(val.depth) { | ||
this.addDepth(val.depth); | ||
} | ||
this.opcode('getContext', val.depth || 0); | ||
this.opcode('pushStringParam', val.stringModeValue, val.type); | ||
if (val.type === 'sexpr') { | ||
// Subexpressions get evaluated and passed in | ||
// in string params mode. | ||
this.sexpr(val); | ||
} | ||
} else { | ||
this.accept(val); | ||
} | ||
this.pushParam(pair[1]); | ||
this.opcode('assignToHash', pair[0]); | ||
@@ -226,5 +213,11 @@ } | ||
if(partial.context) { | ||
this.ID(partial.context); | ||
if (partial.hash) { | ||
this.accept(partial.hash); | ||
} else { | ||
this.opcode('push', 'undefined'); | ||
} | ||
if (partial.context) { | ||
this.accept(partial.context); | ||
} else { | ||
this.opcode('push', 'depth0'); | ||
@@ -283,3 +276,4 @@ } | ||
var params = this.setupFullMustacheParams(sexpr, program, inverse), | ||
name = sexpr.id.parts[0]; | ||
id = sexpr.id, | ||
name = id.parts[0]; | ||
@@ -291,2 +285,3 @@ if (this.options.knownHelpers[name]) { | ||
} else { | ||
this.ID(id); | ||
this.opcode('invokeHelper', params.length, name, sexpr.isRoot); | ||
@@ -326,7 +321,3 @@ } | ||
this.options.data = true; | ||
if (data.id.isScoped || data.id.depth) { | ||
throw new Exception('Scoped data references are not supported: ' + data.original, data); | ||
} | ||
this.opcode('lookupData'); | ||
this.opcode('lookupData', data.id.depth); | ||
var parts = data.id.parts; | ||
@@ -342,4 +333,4 @@ for(var i=0, l=parts.length; i<l; i++) { | ||
INTEGER: function(integer) { | ||
this.opcode('pushLiteral', integer.integer); | ||
NUMBER: function(number) { | ||
this.opcode('pushLiteral', number.number); | ||
}, | ||
@@ -377,2 +368,3 @@ | ||
// if ambiguous, we can possibly resolve the ambiguity now | ||
// An eligible helper is one that does not have a complex path, i.e. `this.foo`, `../foo` etc. | ||
if (isEligible && !isHelper) { | ||
@@ -394,23 +386,27 @@ var name = sexpr.id.parts[0]; | ||
pushParams: function(params) { | ||
var i = params.length, param; | ||
var i = params.length; | ||
while(i--) { | ||
param = params[i]; | ||
this.pushParam(params[i]); | ||
} | ||
}, | ||
if(this.options.stringParams) { | ||
if(param.depth) { | ||
this.addDepth(param.depth); | ||
} | ||
pushParam: function(val) { | ||
if (this.stringParams) { | ||
if(val.depth) { | ||
this.addDepth(val.depth); | ||
} | ||
this.opcode('getContext', val.depth || 0); | ||
this.opcode('pushStringParam', val.stringModeValue, val.type); | ||
this.opcode('getContext', param.depth || 0); | ||
this.opcode('pushStringParam', param.stringModeValue, param.type); | ||
if (param.type === 'sexpr') { | ||
// Subexpressions get evaluated and passed in | ||
// in string params mode. | ||
this.sexpr(param); | ||
} | ||
} else { | ||
this[param.type](param); | ||
if (val.type === 'sexpr') { | ||
// Subexpressions get evaluated and passed in | ||
// in string params mode. | ||
this.sexpr(val); | ||
} | ||
} else { | ||
if (this.trackIds) { | ||
this.opcode('pushId', val.type, val.idName || val.stringModeValue); | ||
} | ||
this.accept(val); | ||
} | ||
@@ -472,3 +468,3 @@ }, | ||
// Template is only compiled on first use and cached after that point. | ||
return function(context, options) { | ||
var ret = function(context, options) { | ||
if (!compiled) { | ||
@@ -479,2 +475,9 @@ compiled = compileInput(); | ||
}; | ||
ret.child = function(i) { | ||
if (!compiled) { | ||
compiled = compileInput(); | ||
} | ||
return compiled.child(i); | ||
}; | ||
return ret; | ||
} |
@@ -20,8 +20,5 @@ import { COMPILER_REVISION, REVISION_CHANGES, log } from "../base"; | ||
if (/^[0-9]+$/.test(name)) { | ||
ret = parent + "[" + name + "]"; | ||
} else if (JavaScriptCompiler.isValidJavaScriptVariableName(name)) { | ||
if (JavaScriptCompiler.isValidJavaScriptVariableName(name)) { | ||
ret = parent + "." + name; | ||
} | ||
else { | ||
} else { | ||
ret = parent + "['" + name + "']"; | ||
@@ -40,3 +37,3 @@ } | ||
versions = REVISION_CHANGES[revision]; | ||
return "this.compilerInfo = ["+revision+",'"+versions+"'];\n"; | ||
return [revision, versions]; | ||
}, | ||
@@ -66,2 +63,5 @@ | ||
this.options = options || {}; | ||
this.stringParams = this.options.stringParams; | ||
this.trackIds = this.options.trackIds; | ||
this.precompile = !asObject; | ||
@@ -74,4 +74,3 @@ log('debug', this.environment.disassemble() + "\n\n"); | ||
programs: [], | ||
environments: [], | ||
aliases: { } | ||
environments: [] | ||
}; | ||
@@ -83,2 +82,3 @@ | ||
this.stackVars = []; | ||
this.aliases = {}; | ||
this.registers = { list: [] }; | ||
@@ -117,62 +117,56 @@ this.hashes = []; | ||
return this.createFunctionContext(asObject); | ||
}, | ||
var fn = this.createFunctionContext(asObject); | ||
if (!this.isChild) { | ||
var ret = { | ||
compiler: this.compilerInfo(), | ||
main: fn | ||
}; | ||
this.context.programs.map(function(program, index) { | ||
if (program) { | ||
ret[index] = program; | ||
} | ||
}); | ||
preamble: function() { | ||
var out = []; | ||
if (this.environment.usePartial) { | ||
ret.usePartial = true; | ||
} | ||
if (this.options.data) { | ||
ret.useData = true; | ||
} | ||
if (!this.isChild) { | ||
var namespace = this.namespace; | ||
if (!asObject) { | ||
ret.compiler = JSON.stringify(ret.compiler); | ||
ret = this.objectLiteral(ret); | ||
} | ||
var copies = "helpers = this.merge(helpers, " + namespace + ".helpers);"; | ||
if (this.environment.usePartial) { copies = copies + " partials = this.merge(partials, " + namespace + ".partials);"; } | ||
if (this.options.data) { copies = copies + " data = data || {};"; } | ||
out.push(copies); | ||
return ret; | ||
} else { | ||
out.push(''); | ||
return fn; | ||
} | ||
}, | ||
if (!this.environment.isSimple) { | ||
out.push(", buffer = " + this.initializeBuffer()); | ||
} else { | ||
out.push(""); | ||
} | ||
preamble: function() { | ||
// track the last context pushed into place to allow skipping the | ||
// getContext opcode when it would be a noop | ||
this.lastContext = 0; | ||
this.source = out; | ||
this.source = []; | ||
}, | ||
createFunctionContext: function(asObject) { | ||
var varDeclarations = ''; | ||
var locals = this.stackVars.concat(this.registers.list); | ||
if(locals.length > 0) { | ||
this.source[1] = this.source[1] + ", " + locals.join(", "); | ||
varDeclarations += ", " + locals.join(", "); | ||
} | ||
// Generate minimizer alias mappings | ||
if (!this.isChild) { | ||
for (var alias in this.context.aliases) { | ||
if (this.context.aliases.hasOwnProperty(alias)) { | ||
this.source[1] = this.source[1] + ', ' + alias + '=' + this.context.aliases[alias]; | ||
} | ||
for (var alias in this.aliases) { | ||
if (this.aliases.hasOwnProperty(alias)) { | ||
varDeclarations += ', ' + alias + '=' + this.aliases[alias]; | ||
} | ||
} | ||
if (this.source[1]) { | ||
this.source[1] = "var " + this.source[1].substring(2) + ";"; | ||
} | ||
var params = ["depth0", "helpers", "partials", "data"]; | ||
// Merge children | ||
if (!this.isChild) { | ||
this.source[1] += '\n' + this.context.programs.join('\n') + '\n'; | ||
} | ||
if (!this.environment.isSimple) { | ||
this.pushSource("return buffer;"); | ||
} | ||
var params = this.isChild ? ["depth0", "data"] : ["Handlebars", "depth0", "helpers", "partials", "data"]; | ||
for(var i=0, l=this.environment.depths.list.length; i<l; i++) { | ||
@@ -183,8 +177,4 @@ params.push("depth" + this.environment.depths.list[i]); | ||
// Perform a second pass over the output to merge content when possible | ||
var source = this.mergeSource(); | ||
var source = this.mergeSource(varDeclarations); | ||
if (!this.isChild) { | ||
source = this.compilerInfo()+source; | ||
} | ||
if (asObject) { | ||
@@ -195,12 +185,11 @@ params.push(source); | ||
} else { | ||
var functionSource = 'function ' + (this.name || '') + '(' + params.join(',') + ') {\n ' + source + '}'; | ||
log('debug', functionSource + "\n\n"); | ||
return functionSource; | ||
return 'function(' + params.join(',') + ') {\n ' + source + '}'; | ||
} | ||
}, | ||
mergeSource: function() { | ||
// WARN: We are not handling the case where buffer is still populated as the source should | ||
// not have buffer append operations as their final action. | ||
mergeSource: function(varDeclarations) { | ||
var source = '', | ||
buffer; | ||
buffer, | ||
appendOnly = !this.forceBuffer, | ||
appendFirst; | ||
for (var i = 0, len = this.source.length; i < len; i++) { | ||
@@ -216,8 +205,35 @@ var line = this.source[i]; | ||
if (buffer) { | ||
source += 'buffer += ' + buffer + ';\n '; | ||
if (!source) { | ||
appendFirst = true; | ||
source = buffer + ';\n '; | ||
} else { | ||
source += 'buffer += ' + buffer + ';\n '; | ||
} | ||
buffer = undefined; | ||
} | ||
source += line + '\n '; | ||
if (!this.environment.isSimple) { | ||
appendOnly = false; | ||
} | ||
} | ||
} | ||
if (appendOnly) { | ||
if (buffer || !source) { | ||
source += 'return ' + (buffer || '""') + ';\n'; | ||
} | ||
} else { | ||
varDeclarations += ", buffer = " + (appendFirst ? '' : this.initializeBuffer()); | ||
if (buffer) { | ||
source += 'return buffer + ' + buffer + ';\n'; | ||
} else { | ||
source += 'return buffer;\n'; | ||
} | ||
} | ||
if (varDeclarations) { | ||
source = 'var ' + varDeclarations.substring(2) + (appendFirst ? '' : ';\n ') + source; | ||
} | ||
return source; | ||
@@ -232,10 +248,10 @@ }, | ||
// The purpose of this opcode is to take a block of the form | ||
// `{{#foo}}...{{/foo}}`, resolve the value of `foo`, and | ||
// `{{#this.foo}}...{{/this.foo}}`, resolve the value of `foo`, and | ||
// replace it on the stack with the result of properly | ||
// invoking blockHelperMissing. | ||
blockValue: function() { | ||
this.context.aliases.blockHelperMissing = 'helpers.blockHelperMissing'; | ||
blockValue: function(name) { | ||
this.aliases.blockHelperMissing = 'helpers.blockHelperMissing'; | ||
var params = ["depth0"]; | ||
this.setupParams(0, params); | ||
this.setupParams(name, 0, params); | ||
@@ -255,7 +271,10 @@ this.replaceStack(function(current) { | ||
ambiguousBlockValue: function() { | ||
this.context.aliases.blockHelperMissing = 'helpers.blockHelperMissing'; | ||
this.aliases.blockHelperMissing = 'helpers.blockHelperMissing'; | ||
// We're being a bit cheeky and reusing the options value from the prior exec | ||
var params = ["depth0"]; | ||
this.setupParams(0, params); | ||
this.setupParams('', 0, params, true); | ||
this.flushInline(); | ||
var current = this.topStack(); | ||
@@ -325,3 +344,3 @@ params.splice(1, 0, current); | ||
appendEscaped: function() { | ||
this.context.aliases.escapeExpression = 'this.escapeExpression'; | ||
this.aliases.escapeExpression = 'this.escapeExpression'; | ||
@@ -373,3 +392,3 @@ this.pushSource(this.appendToBuffer("escapeExpression(" + this.popStack() + ")")); | ||
resolvePossibleLambda: function() { | ||
this.context.aliases.functionType = '"function"'; | ||
this.aliases.functionType = '"function"'; | ||
@@ -400,4 +419,8 @@ this.replaceStack(function(current) { | ||
// Push the data lookup operator | ||
lookupData: function() { | ||
this.pushStackLiteral('data'); | ||
lookupData: function(depth) { | ||
if (!depth) { | ||
this.pushStackLiteral('data'); | ||
} else { | ||
this.pushStackLiteral('this.data(data, ' + depth + ')'); | ||
} | ||
}, | ||
@@ -432,3 +455,6 @@ | ||
if (this.options.stringParams) { | ||
if (this.trackIds) { | ||
this.push('{}'); // hashIds | ||
} | ||
if (this.stringParams) { | ||
this.push('{}'); // hashContexts | ||
@@ -442,3 +468,3 @@ this.push('{}'); // hashTypes | ||
} | ||
this.hash = {values: [], types: [], contexts: []}; | ||
this.hash = {values: [], types: [], contexts: [], ids: []}; | ||
}, | ||
@@ -449,3 +475,6 @@ popHash: function() { | ||
if (this.options.stringParams) { | ||
if (this.trackIds) { | ||
this.push('{' + hash.ids.join(',') + '}'); | ||
} | ||
if (this.stringParams) { | ||
this.push('{' + hash.contexts.join(',') + '}'); | ||
@@ -517,9 +546,9 @@ this.push('{' + hash.types.join(',') + '}'); | ||
invokeHelper: function(paramSize, name, isRoot) { | ||
this.context.aliases.helperMissing = 'helpers.helperMissing'; | ||
this.aliases.helperMissing = 'helpers.helperMissing'; | ||
this.useRegister('helper'); | ||
var helper = this.lastHelper = this.setupHelper(paramSize, name, true); | ||
var nonHelper = this.nameLookup('depth' + this.lastContext, name, 'context'); | ||
var nonHelper = this.popStack(); | ||
var helper = this.setupHelper(paramSize, name); | ||
var lookup = 'helper = ' + helper.name + ' || ' + nonHelper; | ||
var lookup = 'helper = ' + helper.name + ' || ' + nonHelper + ' || helperMissing'; | ||
if (helper.paramsInit) { | ||
@@ -529,8 +558,3 @@ lookup += ',' + helper.paramsInit; | ||
this.push( | ||
'(' | ||
+ lookup | ||
+ ',helper ' | ||
+ '? helper.call(' + helper.callParams + ') ' | ||
+ ': helperMissing.call(' + helper.helperMissingParams + '))'); | ||
this.push('(' + lookup + ',helper.call(' + helper.callParams + '))'); | ||
@@ -570,3 +594,3 @@ // Always flush subexpressions. This is both to prevent the compounding size issue that | ||
invokeAmbiguous: function(name, helperCall) { | ||
this.context.aliases.functionType = '"function"'; | ||
this.aliases.functionType = '"function"'; | ||
this.useRegister('helper'); | ||
@@ -578,11 +602,8 @@ | ||
var helperName = this.lastHelper = this.nameLookup('helpers', name, 'helper'); | ||
var nonHelper = this.nameLookup('depth' + this.lastContext, name, 'context'); | ||
var nextStack = this.nextStack(); | ||
if (helper.paramsInit) { | ||
this.pushSource(helper.paramsInit); | ||
} | ||
this.pushSource('if (helper = ' + helperName + ') { ' + nextStack + ' = helper.call(' + helper.callParams + '); }'); | ||
this.pushSource('else { helper = ' + nonHelper + '; ' + nextStack + ' = typeof helper === functionType ? helper.call(' + helper.callParams + ') : helper; }'); | ||
this.push( | ||
'((helper = ' + helperName + ' || ' + nonHelper | ||
+ (helper.paramsInit ? '),(' + helper.paramsInit : '') + '),' | ||
+ '(typeof helper === functionType ? helper.call(' + helper.callParams + ') : helper))'); | ||
}, | ||
@@ -598,3 +619,3 @@ | ||
invokePartial: function(name) { | ||
var params = [this.nameLookup('partials', name, 'partial'), "'" + name + "'", this.popStack(), "helpers", "partials"]; | ||
var params = [this.nameLookup('partials', name, 'partial'), "'" + name + "'", this.popStack(), this.popStack(), "helpers", "partials"]; | ||
@@ -605,4 +626,3 @@ if (this.options.data) { | ||
this.context.aliases.self = "this"; | ||
this.push("self.invokePartial(" + params.join(", ") + ")"); | ||
this.push("this.invokePartial(" + params.join(", ") + ")"); | ||
}, | ||
@@ -620,5 +640,9 @@ | ||
context, | ||
type; | ||
type, | ||
id; | ||
if (this.options.stringParams) { | ||
if (this.trackIds) { | ||
id = this.popStack(); | ||
} | ||
if (this.stringParams) { | ||
type = this.popStack(); | ||
@@ -635,5 +659,18 @@ context = this.popStack(); | ||
} | ||
if (id) { | ||
hash.ids.push("'" + key + "': " + id); | ||
} | ||
hash.values.push("'" + key + "': (" + value + ")"); | ||
}, | ||
pushId: function(type, name) { | ||
if (type === 'ID' || type === 'DATA') { | ||
this.pushString(name); | ||
} else if (type === 'sexpr') { | ||
this.pushStackLiteral('true'); | ||
} else { | ||
this.pushStackLiteral('null'); | ||
} | ||
}, | ||
// HELPERS | ||
@@ -657,3 +694,3 @@ | ||
child.name = 'program' + index; | ||
this.context.programs[index] = compiler.compile(child, options, this.context); | ||
this.context.programs[index] = compiler.compile(child, options, this.context, !this.precompile); | ||
this.context.environments[index] = child; | ||
@@ -676,6 +713,4 @@ } else { | ||
programExpression: function(guid) { | ||
this.context.aliases.self = "this"; | ||
if(guid == null) { | ||
return "self.noop"; | ||
return 'this.noop'; | ||
} | ||
@@ -686,3 +721,3 @@ | ||
var programParams = [child.index, child.name, "data"]; | ||
var programParams = [child.index, 'data']; | ||
@@ -692,7 +727,6 @@ for(var i=0, l = depths.length; i<l; i++) { | ||
if(depth === 1) { programParams.push("depth0"); } | ||
else { programParams.push("depth" + (depth - 1)); } | ||
programParams.push('depth' + (depth - 1)); | ||
} | ||
return (depths.length === 0 ? "self.program(" : "self.programWithDepth(") + programParams.join(", ") + ")"; | ||
return (depths.length === 0 ? 'this.program(' : 'this.programWithDepth(') + programParams.join(', ') + ')'; | ||
}, | ||
@@ -855,5 +889,17 @@ | ||
setupHelper: function(paramSize, name, missingParams) { | ||
objectLiteral: function(obj) { | ||
var pairs = []; | ||
for (var key in obj) { | ||
if (obj.hasOwnProperty(key)) { | ||
pairs.push(this.quotedString(key) + ':' + obj[key]); | ||
} | ||
} | ||
return '{' + pairs.join(',') + '}'; | ||
}, | ||
setupHelper: function(paramSize, name, blockHelper) { | ||
var params = [], | ||
paramsInit = this.setupParams(paramSize, params, missingParams); | ||
paramsInit = this.setupParams(name, paramSize, params, blockHelper); | ||
var foundHelper = this.nameLookup('helpers', name, 'helper'); | ||
@@ -865,16 +911,19 @@ | ||
name: foundHelper, | ||
callParams: ["depth0"].concat(params).join(", "), | ||
helperMissingParams: missingParams && ["depth0", this.quotedString(name)].concat(params).join(", ") | ||
callParams: ["depth0"].concat(params).join(", ") | ||
}; | ||
}, | ||
setupOptions: function(paramSize, params) { | ||
var options = [], contexts = [], types = [], param, inverse, program; | ||
setupOptions: function(helper, paramSize, params) { | ||
var options = {}, contexts = [], types = [], ids = [], param, inverse, program; | ||
options.push("hash:" + this.popStack()); | ||
options.name = this.quotedString(helper); | ||
options.hash = this.popStack(); | ||
if (this.options.stringParams) { | ||
options.push("hashTypes:" + this.popStack()); | ||
options.push("hashContexts:" + this.popStack()); | ||
if (this.trackIds) { | ||
options.hashIds = this.popStack(); | ||
} | ||
if (this.stringParams) { | ||
options.hashTypes = this.popStack(); | ||
options.hashContexts = this.popStack(); | ||
} | ||
@@ -888,20 +937,21 @@ inverse = this.popStack(); | ||
if (!program) { | ||
this.context.aliases.self = "this"; | ||
program = "self.noop"; | ||
program = 'this.noop'; | ||
} | ||
if (!inverse) { | ||
this.context.aliases.self = "this"; | ||
inverse = "self.noop"; | ||
inverse = 'this.noop'; | ||
} | ||
options.push("inverse:" + inverse); | ||
options.push("fn:" + program); | ||
options.fn = program; | ||
options.inverse = inverse; | ||
} | ||
for(var i=0; i<paramSize; i++) { | ||
for (var i = 0; i < paramSize; i++) { | ||
param = this.popStack(); | ||
params.push(param); | ||
if(this.options.stringParams) { | ||
if (this.trackIds) { | ||
ids.push(this.popStack()); | ||
} | ||
if (this.stringParams) { | ||
types.push(this.popStack()); | ||
@@ -912,9 +962,12 @@ contexts.push(this.popStack()); | ||
if (this.options.stringParams) { | ||
options.push("contexts:[" + contexts.join(",") + "]"); | ||
options.push("types:[" + types.join(",") + "]"); | ||
if (this.trackIds) { | ||
options.ids = "[" + ids.join(",") + "]"; | ||
} | ||
if (this.stringParams) { | ||
options.types = "[" + types.join(",") + "]"; | ||
options.contexts = "[" + contexts.join(",") + "]"; | ||
} | ||
if(this.options.data) { | ||
options.push("data:data"); | ||
if (this.options.data) { | ||
options.data = "data"; | ||
} | ||
@@ -927,4 +980,4 @@ | ||
// to fill in | ||
setupParams: function(paramSize, params, useRegister) { | ||
var options = '{' + this.setupOptions(paramSize, params).join(',') + '}'; | ||
setupParams: function(helperName, paramSize, params, useRegister) { | ||
var options = this.objectLiteral(this.setupOptions(helperName, paramSize, params)); | ||
@@ -967,8 +1020,5 @@ if (useRegister) { | ||
JavaScriptCompiler.isValidJavaScriptVariableName = function(name) { | ||
if(!JavaScriptCompiler.RESERVED_WORDS[name] && /^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(name)) { | ||
return true; | ||
} | ||
return false; | ||
return !JavaScriptCompiler.RESERVED_WORDS[name] && /^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(name); | ||
}; | ||
export default JavaScriptCompiler; |
@@ -6,5 +6,5 @@ /* jshint ignore:start */ | ||
yy: {}, | ||
symbols_: {"error":2,"root":3,"statements":4,"EOF":5,"program":6,"simpleInverse":7,"statement":8,"openInverse":9,"closeBlock":10,"openBlock":11,"mustache":12,"partial":13,"CONTENT":14,"COMMENT":15,"OPEN_BLOCK":16,"sexpr":17,"CLOSE":18,"OPEN_INVERSE":19,"OPEN_ENDBLOCK":20,"path":21,"OPEN":22,"OPEN_UNESCAPED":23,"CLOSE_UNESCAPED":24,"OPEN_PARTIAL":25,"partialName":26,"partial_option0":27,"sexpr_repetition0":28,"sexpr_option0":29,"dataName":30,"param":31,"STRING":32,"INTEGER":33,"BOOLEAN":34,"OPEN_SEXPR":35,"CLOSE_SEXPR":36,"hash":37,"hash_repetition_plus0":38,"hashSegment":39,"ID":40,"EQUALS":41,"DATA":42,"pathSegments":43,"SEP":44,"$accept":0,"$end":1}, | ||
terminals_: {2:"error",5:"EOF",14:"CONTENT",15:"COMMENT",16:"OPEN_BLOCK",18:"CLOSE",19:"OPEN_INVERSE",20:"OPEN_ENDBLOCK",22:"OPEN",23:"OPEN_UNESCAPED",24:"CLOSE_UNESCAPED",25:"OPEN_PARTIAL",32:"STRING",33:"INTEGER",34:"BOOLEAN",35:"OPEN_SEXPR",36:"CLOSE_SEXPR",40:"ID",41:"EQUALS",42:"DATA",44:"SEP"}, | ||
productions_: [0,[3,2],[3,1],[6,2],[6,3],[6,2],[6,1],[6,1],[6,0],[4,1],[4,2],[8,3],[8,3],[8,1],[8,1],[8,1],[8,1],[11,3],[9,3],[10,3],[12,3],[12,3],[13,4],[7,2],[17,3],[17,1],[31,1],[31,1],[31,1],[31,1],[31,1],[31,3],[37,1],[39,3],[26,1],[26,1],[26,1],[30,2],[21,1],[43,3],[43,1],[27,0],[27,1],[28,0],[28,2],[29,0],[29,1],[38,1],[38,2]], | ||
symbols_: {"error":2,"root":3,"statements":4,"EOF":5,"program":6,"simpleInverse":7,"statement":8,"openRawBlock":9,"CONTENT":10,"END_RAW_BLOCK":11,"openInverse":12,"closeBlock":13,"openBlock":14,"mustache":15,"partial":16,"COMMENT":17,"OPEN_RAW_BLOCK":18,"sexpr":19,"CLOSE_RAW_BLOCK":20,"OPEN_BLOCK":21,"CLOSE":22,"OPEN_INVERSE":23,"OPEN_ENDBLOCK":24,"path":25,"OPEN":26,"OPEN_UNESCAPED":27,"CLOSE_UNESCAPED":28,"OPEN_PARTIAL":29,"partialName":30,"param":31,"partial_option0":32,"partial_option1":33,"sexpr_repetition0":34,"sexpr_option0":35,"dataName":36,"STRING":37,"NUMBER":38,"BOOLEAN":39,"OPEN_SEXPR":40,"CLOSE_SEXPR":41,"hash":42,"hash_repetition_plus0":43,"hashSegment":44,"ID":45,"EQUALS":46,"DATA":47,"pathSegments":48,"SEP":49,"$accept":0,"$end":1}, | ||
terminals_: {2:"error",5:"EOF",10:"CONTENT",11:"END_RAW_BLOCK",17:"COMMENT",18:"OPEN_RAW_BLOCK",20:"CLOSE_RAW_BLOCK",21:"OPEN_BLOCK",22:"CLOSE",23:"OPEN_INVERSE",24:"OPEN_ENDBLOCK",26:"OPEN",27:"OPEN_UNESCAPED",28:"CLOSE_UNESCAPED",29:"OPEN_PARTIAL",37:"STRING",38:"NUMBER",39:"BOOLEAN",40:"OPEN_SEXPR",41:"CLOSE_SEXPR",45:"ID",46:"EQUALS",47:"DATA",49:"SEP"}, | ||
productions_: [0,[3,2],[3,1],[6,2],[6,3],[6,2],[6,1],[6,1],[6,0],[4,1],[4,2],[8,3],[8,3],[8,3],[8,1],[8,1],[8,1],[8,1],[9,3],[14,3],[12,3],[13,3],[15,3],[15,3],[16,5],[16,4],[7,2],[19,3],[19,1],[31,1],[31,1],[31,1],[31,1],[31,1],[31,3],[42,1],[44,3],[30,1],[30,1],[30,1],[36,2],[25,1],[48,3],[48,1],[32,0],[32,1],[33,0],[33,1],[34,0],[34,2],[35,0],[35,1],[43,1],[43,2]], | ||
performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) { | ||
@@ -34,74 +34,80 @@ | ||
break; | ||
case 11:this.$ = new yy.BlockNode($$[$0-2], $$[$0-1].inverse, $$[$0-1], $$[$0], this._$); | ||
case 11:this.$ = new yy.RawBlockNode($$[$0-2], $$[$0-1], $$[$0], this._$); | ||
break; | ||
case 12:this.$ = new yy.BlockNode($$[$0-2], $$[$0-1], $$[$0-1].inverse, $$[$0], this._$); | ||
case 12:this.$ = new yy.BlockNode($$[$0-2], $$[$0-1].inverse, $$[$0-1], $$[$0], this._$); | ||
break; | ||
case 13:this.$ = $$[$0]; | ||
case 13:this.$ = new yy.BlockNode($$[$0-2], $$[$0-1], $$[$0-1].inverse, $$[$0], this._$); | ||
break; | ||
case 14:this.$ = $$[$0]; | ||
break; | ||
case 15:this.$ = new yy.ContentNode($$[$0], this._$); | ||
case 15:this.$ = $$[$0]; | ||
break; | ||
case 16:this.$ = new yy.CommentNode($$[$0], this._$); | ||
case 16:this.$ = new yy.ContentNode($$[$0], this._$); | ||
break; | ||
case 17:this.$ = new yy.MustacheNode($$[$0-1], null, $$[$0-2], stripFlags($$[$0-2], $$[$0]), this._$); | ||
case 17:this.$ = new yy.CommentNode($$[$0], this._$); | ||
break; | ||
case 18:this.$ = new yy.MustacheNode($$[$0-1], null, $$[$0-2], stripFlags($$[$0-2], $$[$0]), this._$); | ||
case 18:this.$ = new yy.MustacheNode($$[$0-1], null, '', '', this._$); | ||
break; | ||
case 19:this.$ = {path: $$[$0-1], strip: stripFlags($$[$0-2], $$[$0])}; | ||
case 19:this.$ = new yy.MustacheNode($$[$0-1], null, $$[$0-2], stripFlags($$[$0-2], $$[$0]), this._$); | ||
break; | ||
case 20:this.$ = new yy.MustacheNode($$[$0-1], null, $$[$0-2], stripFlags($$[$0-2], $$[$0]), this._$); | ||
break; | ||
case 21:this.$ = new yy.MustacheNode($$[$0-1], null, $$[$0-2], stripFlags($$[$0-2], $$[$0]), this._$); | ||
case 21:this.$ = {path: $$[$0-1], strip: stripFlags($$[$0-2], $$[$0])}; | ||
break; | ||
case 22:this.$ = new yy.PartialNode($$[$0-2], $$[$0-1], stripFlags($$[$0-3], $$[$0]), this._$); | ||
case 22:this.$ = new yy.MustacheNode($$[$0-1], null, $$[$0-2], stripFlags($$[$0-2], $$[$0]), this._$); | ||
break; | ||
case 23:this.$ = stripFlags($$[$0-1], $$[$0]); | ||
case 23:this.$ = new yy.MustacheNode($$[$0-1], null, $$[$0-2], stripFlags($$[$0-2], $$[$0]), this._$); | ||
break; | ||
case 24:this.$ = new yy.SexprNode([$$[$0-2]].concat($$[$0-1]), $$[$0], this._$); | ||
case 24:this.$ = new yy.PartialNode($$[$0-3], $$[$0-2], $$[$0-1], stripFlags($$[$0-4], $$[$0]), this._$); | ||
break; | ||
case 25:this.$ = new yy.SexprNode([$$[$0]], null, this._$); | ||
case 25:this.$ = new yy.PartialNode($$[$0-2], undefined, $$[$0-1], stripFlags($$[$0-3], $$[$0]), this._$); | ||
break; | ||
case 26:this.$ = $$[$0]; | ||
case 26:this.$ = stripFlags($$[$0-1], $$[$0]); | ||
break; | ||
case 27:this.$ = new yy.StringNode($$[$0], this._$); | ||
case 27:this.$ = new yy.SexprNode([$$[$0-2]].concat($$[$0-1]), $$[$0], this._$); | ||
break; | ||
case 28:this.$ = new yy.IntegerNode($$[$0], this._$); | ||
case 28:this.$ = new yy.SexprNode([$$[$0]], null, this._$); | ||
break; | ||
case 29:this.$ = new yy.BooleanNode($$[$0], this._$); | ||
case 29:this.$ = $$[$0]; | ||
break; | ||
case 30:this.$ = $$[$0]; | ||
case 30:this.$ = new yy.StringNode($$[$0], this._$); | ||
break; | ||
case 31:$$[$0-1].isHelper = true; this.$ = $$[$0-1]; | ||
case 31:this.$ = new yy.NumberNode($$[$0], this._$); | ||
break; | ||
case 32:this.$ = new yy.HashNode($$[$0], this._$); | ||
case 32:this.$ = new yy.BooleanNode($$[$0], this._$); | ||
break; | ||
case 33:this.$ = [$$[$0-2], $$[$0]]; | ||
case 33:this.$ = $$[$0]; | ||
break; | ||
case 34:this.$ = new yy.PartialNameNode($$[$0], this._$); | ||
case 34:$$[$0-1].isHelper = true; this.$ = $$[$0-1]; | ||
break; | ||
case 35:this.$ = new yy.PartialNameNode(new yy.StringNode($$[$0], this._$), this._$); | ||
case 35:this.$ = new yy.HashNode($$[$0], this._$); | ||
break; | ||
case 36:this.$ = new yy.PartialNameNode(new yy.IntegerNode($$[$0], this._$)); | ||
case 36:this.$ = [$$[$0-2], $$[$0]]; | ||
break; | ||
case 37:this.$ = new yy.DataNode($$[$0], this._$); | ||
case 37:this.$ = new yy.PartialNameNode($$[$0], this._$); | ||
break; | ||
case 38:this.$ = new yy.IdNode($$[$0], this._$); | ||
case 38:this.$ = new yy.PartialNameNode(new yy.StringNode($$[$0], this._$), this._$); | ||
break; | ||
case 39: $$[$0-2].push({part: $$[$0], separator: $$[$0-1]}); this.$ = $$[$0-2]; | ||
case 39:this.$ = new yy.PartialNameNode(new yy.NumberNode($$[$0], this._$)); | ||
break; | ||
case 40:this.$ = [{part: $$[$0]}]; | ||
case 40:this.$ = new yy.DataNode($$[$0], this._$); | ||
break; | ||
case 43:this.$ = []; | ||
case 41:this.$ = new yy.IdNode($$[$0], this._$); | ||
break; | ||
case 44:$$[$0-1].push($$[$0]); | ||
case 42: $$[$0-2].push({part: $$[$0], separator: $$[$0-1]}); this.$ = $$[$0-2]; | ||
break; | ||
case 47:this.$ = [$$[$0]]; | ||
case 43:this.$ = [{part: $$[$0]}]; | ||
break; | ||
case 48:$$[$0-1].push($$[$0]); | ||
case 48:this.$ = []; | ||
break; | ||
case 49:$$[$0-1].push($$[$0]); | ||
break; | ||
case 52:this.$ = [$$[$0]]; | ||
break; | ||
case 53:$$[$0-1].push($$[$0]); | ||
break; | ||
} | ||
}, | ||
table: [{3:1,4:2,5:[1,3],8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],25:[1,15]},{1:[3]},{5:[1,16],8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],25:[1,15]},{1:[2,2]},{5:[2,9],14:[2,9],15:[2,9],16:[2,9],19:[2,9],20:[2,9],22:[2,9],23:[2,9],25:[2,9]},{4:20,6:18,7:19,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,21],20:[2,8],22:[1,13],23:[1,14],25:[1,15]},{4:20,6:22,7:19,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,21],20:[2,8],22:[1,13],23:[1,14],25:[1,15]},{5:[2,13],14:[2,13],15:[2,13],16:[2,13],19:[2,13],20:[2,13],22:[2,13],23:[2,13],25:[2,13]},{5:[2,14],14:[2,14],15:[2,14],16:[2,14],19:[2,14],20:[2,14],22:[2,14],23:[2,14],25:[2,14]},{5:[2,15],14:[2,15],15:[2,15],16:[2,15],19:[2,15],20:[2,15],22:[2,15],23:[2,15],25:[2,15]},{5:[2,16],14:[2,16],15:[2,16],16:[2,16],19:[2,16],20:[2,16],22:[2,16],23:[2,16],25:[2,16]},{17:23,21:24,30:25,40:[1,28],42:[1,27],43:26},{17:29,21:24,30:25,40:[1,28],42:[1,27],43:26},{17:30,21:24,30:25,40:[1,28],42:[1,27],43:26},{17:31,21:24,30:25,40:[1,28],42:[1,27],43:26},{21:33,26:32,32:[1,34],33:[1,35],40:[1,28],43:26},{1:[2,1]},{5:[2,10],14:[2,10],15:[2,10],16:[2,10],19:[2,10],20:[2,10],22:[2,10],23:[2,10],25:[2,10]},{10:36,20:[1,37]},{4:38,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,7],22:[1,13],23:[1,14],25:[1,15]},{7:39,8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,21],20:[2,6],22:[1,13],23:[1,14],25:[1,15]},{17:23,18:[1,40],21:24,30:25,40:[1,28],42:[1,27],43:26},{10:41,20:[1,37]},{18:[1,42]},{18:[2,43],24:[2,43],28:43,32:[2,43],33:[2,43],34:[2,43],35:[2,43],36:[2,43],40:[2,43],42:[2,43]},{18:[2,25],24:[2,25],36:[2,25]},{18:[2,38],24:[2,38],32:[2,38],33:[2,38],34:[2,38],35:[2,38],36:[2,38],40:[2,38],42:[2,38],44:[1,44]},{21:45,40:[1,28],43:26},{18:[2,40],24:[2,40],32:[2,40],33:[2,40],34:[2,40],35:[2,40],36:[2,40],40:[2,40],42:[2,40],44:[2,40]},{18:[1,46]},{18:[1,47]},{24:[1,48]},{18:[2,41],21:50,27:49,40:[1,28],43:26},{18:[2,34],40:[2,34]},{18:[2,35],40:[2,35]},{18:[2,36],40:[2,36]},{5:[2,11],14:[2,11],15:[2,11],16:[2,11],19:[2,11],20:[2,11],22:[2,11],23:[2,11],25:[2,11]},{21:51,40:[1,28],43:26},{8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,3],22:[1,13],23:[1,14],25:[1,15]},{4:52,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,5],22:[1,13],23:[1,14],25:[1,15]},{14:[2,23],15:[2,23],16:[2,23],19:[2,23],20:[2,23],22:[2,23],23:[2,23],25:[2,23]},{5:[2,12],14:[2,12],15:[2,12],16:[2,12],19:[2,12],20:[2,12],22:[2,12],23:[2,12],25:[2,12]},{14:[2,18],15:[2,18],16:[2,18],19:[2,18],20:[2,18],22:[2,18],23:[2,18],25:[2,18]},{18:[2,45],21:56,24:[2,45],29:53,30:60,31:54,32:[1,57],33:[1,58],34:[1,59],35:[1,61],36:[2,45],37:55,38:62,39:63,40:[1,64],42:[1,27],43:26},{40:[1,65]},{18:[2,37],24:[2,37],32:[2,37],33:[2,37],34:[2,37],35:[2,37],36:[2,37],40:[2,37],42:[2,37]},{14:[2,17],15:[2,17],16:[2,17],19:[2,17],20:[2,17],22:[2,17],23:[2,17],25:[2,17]},{5:[2,20],14:[2,20],15:[2,20],16:[2,20],19:[2,20],20:[2,20],22:[2,20],23:[2,20],25:[2,20]},{5:[2,21],14:[2,21],15:[2,21],16:[2,21],19:[2,21],20:[2,21],22:[2,21],23:[2,21],25:[2,21]},{18:[1,66]},{18:[2,42]},{18:[1,67]},{8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],25:[1,15]},{18:[2,24],24:[2,24],36:[2,24]},{18:[2,44],24:[2,44],32:[2,44],33:[2,44],34:[2,44],35:[2,44],36:[2,44],40:[2,44],42:[2,44]},{18:[2,46],24:[2,46],36:[2,46]},{18:[2,26],24:[2,26],32:[2,26],33:[2,26],34:[2,26],35:[2,26],36:[2,26],40:[2,26],42:[2,26]},{18:[2,27],24:[2,27],32:[2,27],33:[2,27],34:[2,27],35:[2,27],36:[2,27],40:[2,27],42:[2,27]},{18:[2,28],24:[2,28],32:[2,28],33:[2,28],34:[2,28],35:[2,28],36:[2,28],40:[2,28],42:[2,28]},{18:[2,29],24:[2,29],32:[2,29],33:[2,29],34:[2,29],35:[2,29],36:[2,29],40:[2,29],42:[2,29]},{18:[2,30],24:[2,30],32:[2,30],33:[2,30],34:[2,30],35:[2,30],36:[2,30],40:[2,30],42:[2,30]},{17:68,21:24,30:25,40:[1,28],42:[1,27],43:26},{18:[2,32],24:[2,32],36:[2,32],39:69,40:[1,70]},{18:[2,47],24:[2,47],36:[2,47],40:[2,47]},{18:[2,40],24:[2,40],32:[2,40],33:[2,40],34:[2,40],35:[2,40],36:[2,40],40:[2,40],41:[1,71],42:[2,40],44:[2,40]},{18:[2,39],24:[2,39],32:[2,39],33:[2,39],34:[2,39],35:[2,39],36:[2,39],40:[2,39],42:[2,39],44:[2,39]},{5:[2,22],14:[2,22],15:[2,22],16:[2,22],19:[2,22],20:[2,22],22:[2,22],23:[2,22],25:[2,22]},{5:[2,19],14:[2,19],15:[2,19],16:[2,19],19:[2,19],20:[2,19],22:[2,19],23:[2,19],25:[2,19]},{36:[1,72]},{18:[2,48],24:[2,48],36:[2,48],40:[2,48]},{41:[1,71]},{21:56,30:60,31:73,32:[1,57],33:[1,58],34:[1,59],35:[1,61],40:[1,28],42:[1,27],43:26},{18:[2,31],24:[2,31],32:[2,31],33:[2,31],34:[2,31],35:[2,31],36:[2,31],40:[2,31],42:[2,31]},{18:[2,33],24:[2,33],36:[2,33],40:[2,33]}], | ||
defaultActions: {3:[2,2],16:[2,1],50:[2,42]}, | ||
table: [{3:1,4:2,5:[1,3],8:4,9:5,10:[1,10],12:6,14:7,15:8,16:9,17:[1,11],18:[1,12],21:[1,14],23:[1,13],26:[1,15],27:[1,16],29:[1,17]},{1:[3]},{5:[1,18],8:19,9:5,10:[1,10],12:6,14:7,15:8,16:9,17:[1,11],18:[1,12],21:[1,14],23:[1,13],26:[1,15],27:[1,16],29:[1,17]},{1:[2,2]},{5:[2,9],10:[2,9],17:[2,9],18:[2,9],21:[2,9],23:[2,9],24:[2,9],26:[2,9],27:[2,9],29:[2,9]},{10:[1,20]},{4:23,6:21,7:22,8:4,9:5,10:[1,10],12:6,14:7,15:8,16:9,17:[1,11],18:[1,12],21:[1,14],23:[1,24],24:[2,8],26:[1,15],27:[1,16],29:[1,17]},{4:23,6:25,7:22,8:4,9:5,10:[1,10],12:6,14:7,15:8,16:9,17:[1,11],18:[1,12],21:[1,14],23:[1,24],24:[2,8],26:[1,15],27:[1,16],29:[1,17]},{5:[2,14],10:[2,14],17:[2,14],18:[2,14],21:[2,14],23:[2,14],24:[2,14],26:[2,14],27:[2,14],29:[2,14]},{5:[2,15],10:[2,15],17:[2,15],18:[2,15],21:[2,15],23:[2,15],24:[2,15],26:[2,15],27:[2,15],29:[2,15]},{5:[2,16],10:[2,16],17:[2,16],18:[2,16],21:[2,16],23:[2,16],24:[2,16],26:[2,16],27:[2,16],29:[2,16]},{5:[2,17],10:[2,17],17:[2,17],18:[2,17],21:[2,17],23:[2,17],24:[2,17],26:[2,17],27:[2,17],29:[2,17]},{19:26,25:27,36:28,45:[1,31],47:[1,30],48:29},{19:32,25:27,36:28,45:[1,31],47:[1,30],48:29},{19:33,25:27,36:28,45:[1,31],47:[1,30],48:29},{19:34,25:27,36:28,45:[1,31],47:[1,30],48:29},{19:35,25:27,36:28,45:[1,31],47:[1,30],48:29},{25:37,30:36,37:[1,38],38:[1,39],45:[1,31],48:29},{1:[2,1]},{5:[2,10],10:[2,10],17:[2,10],18:[2,10],21:[2,10],23:[2,10],24:[2,10],26:[2,10],27:[2,10],29:[2,10]},{11:[1,40]},{13:41,24:[1,42]},{4:43,8:4,9:5,10:[1,10],12:6,14:7,15:8,16:9,17:[1,11],18:[1,12],21:[1,14],23:[1,13],24:[2,7],26:[1,15],27:[1,16],29:[1,17]},{7:44,8:19,9:5,10:[1,10],12:6,14:7,15:8,16:9,17:[1,11],18:[1,12],21:[1,14],23:[1,24],24:[2,6],26:[1,15],27:[1,16],29:[1,17]},{19:32,22:[1,45],25:27,36:28,45:[1,31],47:[1,30],48:29},{13:46,24:[1,42]},{20:[1,47]},{20:[2,48],22:[2,48],28:[2,48],34:48,37:[2,48],38:[2,48],39:[2,48],40:[2,48],41:[2,48],45:[2,48],47:[2,48]},{20:[2,28],22:[2,28],28:[2,28],41:[2,28]},{20:[2,41],22:[2,41],28:[2,41],37:[2,41],38:[2,41],39:[2,41],40:[2,41],41:[2,41],45:[2,41],47:[2,41],49:[1,49]},{25:50,45:[1,31],48:29},{20:[2,43],22:[2,43],28:[2,43],37:[2,43],38:[2,43],39:[2,43],40:[2,43],41:[2,43],45:[2,43],47:[2,43],49:[2,43]},{22:[1,51]},{22:[1,52]},{22:[1,53]},{28:[1,54]},{22:[2,46],25:57,31:55,33:56,36:61,37:[1,58],38:[1,59],39:[1,60],40:[1,62],42:63,43:64,44:66,45:[1,65],47:[1,30],48:29},{22:[2,37],37:[2,37],38:[2,37],39:[2,37],40:[2,37],45:[2,37],47:[2,37]},{22:[2,38],37:[2,38],38:[2,38],39:[2,38],40:[2,38],45:[2,38],47:[2,38]},{22:[2,39],37:[2,39],38:[2,39],39:[2,39],40:[2,39],45:[2,39],47:[2,39]},{5:[2,11],10:[2,11],17:[2,11],18:[2,11],21:[2,11],23:[2,11],24:[2,11],26:[2,11],27:[2,11],29:[2,11]},{5:[2,12],10:[2,12],17:[2,12],18:[2,12],21:[2,12],23:[2,12],24:[2,12],26:[2,12],27:[2,12],29:[2,12]},{25:67,45:[1,31],48:29},{8:19,9:5,10:[1,10],12:6,14:7,15:8,16:9,17:[1,11],18:[1,12],21:[1,14],23:[1,13],24:[2,3],26:[1,15],27:[1,16],29:[1,17]},{4:68,8:4,9:5,10:[1,10],12:6,14:7,15:8,16:9,17:[1,11],18:[1,12],21:[1,14],23:[1,13],24:[2,5],26:[1,15],27:[1,16],29:[1,17]},{10:[2,26],17:[2,26],18:[2,26],21:[2,26],23:[2,26],24:[2,26],26:[2,26],27:[2,26],29:[2,26]},{5:[2,13],10:[2,13],17:[2,13],18:[2,13],21:[2,13],23:[2,13],24:[2,13],26:[2,13],27:[2,13],29:[2,13]},{10:[2,18]},{20:[2,50],22:[2,50],25:57,28:[2,50],31:70,35:69,36:61,37:[1,58],38:[1,59],39:[1,60],40:[1,62],41:[2,50],42:71,43:64,44:66,45:[1,65],47:[1,30],48:29},{45:[1,72]},{20:[2,40],22:[2,40],28:[2,40],37:[2,40],38:[2,40],39:[2,40],40:[2,40],41:[2,40],45:[2,40],47:[2,40]},{10:[2,20],17:[2,20],18:[2,20],21:[2,20],23:[2,20],24:[2,20],26:[2,20],27:[2,20],29:[2,20]},{10:[2,19],17:[2,19],18:[2,19],21:[2,19],23:[2,19],24:[2,19],26:[2,19],27:[2,19],29:[2,19]},{5:[2,22],10:[2,22],17:[2,22],18:[2,22],21:[2,22],23:[2,22],24:[2,22],26:[2,22],27:[2,22],29:[2,22]},{5:[2,23],10:[2,23],17:[2,23],18:[2,23],21:[2,23],23:[2,23],24:[2,23],26:[2,23],27:[2,23],29:[2,23]},{22:[2,44],32:73,42:74,43:64,44:66,45:[1,75]},{22:[1,76]},{20:[2,29],22:[2,29],28:[2,29],37:[2,29],38:[2,29],39:[2,29],40:[2,29],41:[2,29],45:[2,29],47:[2,29]},{20:[2,30],22:[2,30],28:[2,30],37:[2,30],38:[2,30],39:[2,30],40:[2,30],41:[2,30],45:[2,30],47:[2,30]},{20:[2,31],22:[2,31],28:[2,31],37:[2,31],38:[2,31],39:[2,31],40:[2,31],41:[2,31],45:[2,31],47:[2,31]},{20:[2,32],22:[2,32],28:[2,32],37:[2,32],38:[2,32],39:[2,32],40:[2,32],41:[2,32],45:[2,32],47:[2,32]},{20:[2,33],22:[2,33],28:[2,33],37:[2,33],38:[2,33],39:[2,33],40:[2,33],41:[2,33],45:[2,33],47:[2,33]},{19:77,25:27,36:28,45:[1,31],47:[1,30],48:29},{22:[2,47]},{20:[2,35],22:[2,35],28:[2,35],41:[2,35],44:78,45:[1,75]},{20:[2,43],22:[2,43],28:[2,43],37:[2,43],38:[2,43],39:[2,43],40:[2,43],41:[2,43],45:[2,43],46:[1,79],47:[2,43],49:[2,43]},{20:[2,52],22:[2,52],28:[2,52],41:[2,52],45:[2,52]},{22:[1,80]},{8:19,9:5,10:[1,10],12:6,14:7,15:8,16:9,17:[1,11],18:[1,12],21:[1,14],23:[1,13],24:[2,4],26:[1,15],27:[1,16],29:[1,17]},{20:[2,27],22:[2,27],28:[2,27],41:[2,27]},{20:[2,49],22:[2,49],28:[2,49],37:[2,49],38:[2,49],39:[2,49],40:[2,49],41:[2,49],45:[2,49],47:[2,49]},{20:[2,51],22:[2,51],28:[2,51],41:[2,51]},{20:[2,42],22:[2,42],28:[2,42],37:[2,42],38:[2,42],39:[2,42],40:[2,42],41:[2,42],45:[2,42],47:[2,42],49:[2,42]},{22:[1,81]},{22:[2,45]},{46:[1,79]},{5:[2,25],10:[2,25],17:[2,25],18:[2,25],21:[2,25],23:[2,25],24:[2,25],26:[2,25],27:[2,25],29:[2,25]},{41:[1,82]},{20:[2,53],22:[2,53],28:[2,53],41:[2,53],45:[2,53]},{25:57,31:83,36:61,37:[1,58],38:[1,59],39:[1,60],40:[1,62],45:[1,31],47:[1,30],48:29},{5:[2,21],10:[2,21],17:[2,21],18:[2,21],21:[2,21],23:[2,21],24:[2,21],26:[2,21],27:[2,21],29:[2,21]},{5:[2,24],10:[2,24],17:[2,24],18:[2,24],21:[2,24],23:[2,24],24:[2,24],26:[2,24],27:[2,24],29:[2,24]},{20:[2,34],22:[2,34],28:[2,34],37:[2,34],38:[2,34],39:[2,34],40:[2,34],41:[2,34],45:[2,34],47:[2,34]},{20:[2,36],22:[2,36],28:[2,36],41:[2,36],45:[2,36]}], | ||
defaultActions: {3:[2,2],18:[2,1],47:[2,18],63:[2,47],74:[2,45]}, | ||
parseError: function parseError(str, hash) { | ||
@@ -412,76 +418,98 @@ throw new Error(str); | ||
} | ||
if(yy_.yytext) return 14; | ||
if(yy_.yytext) return 10; | ||
break; | ||
case 1:return 14; | ||
case 1:return 10; | ||
break; | ||
case 2: | ||
this.popState(); | ||
return 14; | ||
return 10; | ||
break; | ||
case 3:strip(0,4); this.popState(); return 15; | ||
case 3: | ||
yy_.yytext = yy_.yytext.substr(5, yy_.yyleng-9); | ||
this.popState(); | ||
return 11; | ||
break; | ||
case 4:return 35; | ||
case 4: return 10; | ||
break; | ||
case 5:return 36; | ||
case 5:strip(0,4); this.popState(); return 17; | ||
break; | ||
case 6:return 25; | ||
case 6:return 40; | ||
break; | ||
case 7:return 16; | ||
case 7:return 41; | ||
break; | ||
case 8:return 20; | ||
case 8: return 18; | ||
break; | ||
case 9:return 19; | ||
case 9: | ||
this.popState(); | ||
this.begin('raw'); | ||
return 20; | ||
break; | ||
case 10:return 19; | ||
case 10: | ||
yy_.yytext = yy_.yytext.substr(4, yy_.yyleng-8); | ||
this.popState(); | ||
return 'RAW_BLOCK'; | ||
break; | ||
case 11:return 23; | ||
case 11:return 29; | ||
break; | ||
case 12:return 22; | ||
case 12:return 21; | ||
break; | ||
case 13:this.popState(); this.begin('com'); | ||
case 13:return 24; | ||
break; | ||
case 14:strip(3,5); this.popState(); return 15; | ||
case 14:return 23; | ||
break; | ||
case 15:return 22; | ||
case 15:return 23; | ||
break; | ||
case 16:return 41; | ||
case 16:return 27; | ||
break; | ||
case 17:return 40; | ||
case 17:return 26; | ||
break; | ||
case 18:return 40; | ||
case 18:this.popState(); this.begin('com'); | ||
break; | ||
case 19:return 44; | ||
case 19:strip(3,5); this.popState(); return 17; | ||
break; | ||
case 20:// ignore whitespace | ||
case 20:return 26; | ||
break; | ||
case 21:this.popState(); return 24; | ||
case 21:return 46; | ||
break; | ||
case 22:this.popState(); return 18; | ||
case 22:return 45; | ||
break; | ||
case 23:yy_.yytext = strip(1,2).replace(/\\"/g,'"'); return 32; | ||
case 23:return 45; | ||
break; | ||
case 24:yy_.yytext = strip(1,2).replace(/\\'/g,"'"); return 32; | ||
case 24:return 49; | ||
break; | ||
case 25:return 42; | ||
case 25:// ignore whitespace | ||
break; | ||
case 26:return 34; | ||
case 26:this.popState(); return 28; | ||
break; | ||
case 27:return 34; | ||
case 27:this.popState(); return 22; | ||
break; | ||
case 28:return 33; | ||
case 28:yy_.yytext = strip(1,2).replace(/\\"/g,'"'); return 37; | ||
break; | ||
case 29:return 40; | ||
case 29:yy_.yytext = strip(1,2).replace(/\\'/g,"'"); return 37; | ||
break; | ||
case 30:yy_.yytext = strip(1,2); return 40; | ||
case 30:return 47; | ||
break; | ||
case 31:return 'INVALID'; | ||
case 31:return 39; | ||
break; | ||
case 32:return 5; | ||
case 32:return 39; | ||
break; | ||
case 33:return 38; | ||
break; | ||
case 34:return 45; | ||
break; | ||
case 35:yy_.yytext = strip(1,2); return 45; | ||
break; | ||
case 36:return 'INVALID'; | ||
break; | ||
case 37:return 5; | ||
break; | ||
} | ||
}; | ||
lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:[\s\S]*?--\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{!--)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{(~)?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:-?[0-9]+(?=([~}\s)])))/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)]))))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/]; | ||
lexer.conditions = {"mu":{"rules":[4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32],"inclusive":false},"emu":{"rules":[2],"inclusive":false},"com":{"rules":[3],"inclusive":false},"INITIAL":{"rules":[0,1,32],"inclusive":true}}; | ||
lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/,/^(?:[^\x00]*?(?=(\{\{\{\{\/)))/,/^(?:[\s\S]*?--\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{\{\{)/,/^(?:\}\}\}\})/,/^(?:\{\{\{\{[^\x00]*\}\}\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{!--)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{(~)?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)]))))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/]; | ||
lexer.conditions = {"mu":{"rules":[6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37],"inclusive":false},"emu":{"rules":[2],"inclusive":false},"com":{"rules":[5],"inclusive":false},"raw":{"rules":[3,4],"inclusive":false},"INITIAL":{"rules":[0,1,37],"inclusive":true}}; | ||
return lexer;})() | ||
@@ -488,0 +516,0 @@ parser.lexer = lexer; |
@@ -85,3 +85,8 @@ import Visitor from "./visitor"; | ||
var content = this.accept(partial.partialName); | ||
if(partial.context) { content = content + " " + this.accept(partial.context); } | ||
if(partial.context) { | ||
content += " " + this.accept(partial.context); | ||
} | ||
if (partial.hash) { | ||
content += " " + this.accept(partial.hash); | ||
} | ||
return this.pad("{{> " + content + " }}"); | ||
@@ -107,4 +112,4 @@ }; | ||
PrintVisitor.prototype.INTEGER = function(integer) { | ||
return "INTEGER{" + integer.integer + "}"; | ||
PrintVisitor.prototype.NUMBER = function(number) { | ||
return "NUMBER{" + number.number + "}"; | ||
}; | ||
@@ -111,0 +116,0 @@ |
module Utils from "./utils"; | ||
import Exception from "./exception"; | ||
import { COMPILER_REVISION, REVISION_CHANGES } from "./base"; | ||
import { COMPILER_REVISION, REVISION_CHANGES, createFrame } from "./base"; | ||
@@ -32,4 +32,10 @@ export function checkRevision(compilerInfo) { | ||
// for external users to override these as psuedo-supported APIs. | ||
var invokePartialWrapper = function(partial, name, context, helpers, partials, data) { | ||
var result = env.VM.invokePartial.apply(this, arguments); | ||
env.VM.checkRevision(templateSpec.compiler); | ||
var invokePartialWrapper = function(partial, name, context, hash, helpers, partials, data) { | ||
if (hash) { | ||
context = Utils.extend({}, context, hash); | ||
} | ||
var result = env.VM.invokePartial.call(this, partial, name, context, helpers, partials, data); | ||
if (result != null) { return result; } | ||
@@ -50,12 +56,33 @@ | ||
invokePartial: invokePartialWrapper, | ||
fn: function(i) { | ||
return templateSpec[i]; | ||
}, | ||
programs: [], | ||
program: function(i, fn, data) { | ||
var programWrapper = this.programs[i]; | ||
program: function(i, data) { | ||
var programWrapper = this.programs[i], | ||
fn = this.fn(i); | ||
if(data) { | ||
programWrapper = program(i, fn, data); | ||
programWrapper = program(this, i, fn, data); | ||
} else if (!programWrapper) { | ||
programWrapper = this.programs[i] = program(i, fn); | ||
programWrapper = this.programs[i] = program(this, i, fn); | ||
} | ||
return programWrapper; | ||
}, | ||
programWithDepth: env.VM.programWithDepth, | ||
initData: function(context, data) { | ||
if (!data || !('root' in data)) { | ||
data = data ? createFrame(data) : {}; | ||
data.root = context; | ||
} | ||
return data; | ||
}, | ||
data: function(data, depth) { | ||
while (data && depth--) { | ||
data = data._parent; | ||
} | ||
return data; | ||
}, | ||
merge: function(param, common) { | ||
@@ -65,40 +92,46 @@ var ret = param || common; | ||
if (param && common && (param !== common)) { | ||
ret = {}; | ||
Utils.extend(ret, common); | ||
Utils.extend(ret, param); | ||
ret = Utils.extend({}, common, param); | ||
} | ||
return ret; | ||
}, | ||
programWithDepth: env.VM.programWithDepth, | ||
noop: env.VM.noop, | ||
compilerInfo: null | ||
compilerInfo: templateSpec.compiler | ||
}; | ||
return function(context, options) { | ||
var ret = function(context, options) { | ||
options = options || {}; | ||
var namespace = options.partial ? options : env, | ||
helpers, | ||
partials; | ||
partials, | ||
data = options.data; | ||
if (!options.partial) { | ||
helpers = options.helpers; | ||
partials = options.partials; | ||
} | ||
var result = templateSpec.call( | ||
container, | ||
namespace, context, | ||
helpers, | ||
partials, | ||
options.data); | ||
helpers = container.helpers = container.merge(options.helpers, namespace.helpers); | ||
if (!options.partial) { | ||
env.VM.checkRevision(container.compilerInfo); | ||
if (templateSpec.usePartial) { | ||
partials = container.partials = container.merge(options.partials, namespace.partials); | ||
} | ||
if (templateSpec.useData) { | ||
data = container.initData(context, data); | ||
} | ||
} else { | ||
helpers = container.helpers = options.helpers; | ||
partials = container.partials = options.partials; | ||
} | ||
return templateSpec.main.call(container, context, helpers, partials, data); | ||
}; | ||
return result; | ||
ret.child = function(i) { | ||
return container.programWithDepth(i); | ||
}; | ||
return ret; | ||
} | ||
export function programWithDepth(i, fn, data /*, $depth */) { | ||
var args = Array.prototype.slice.call(arguments, 3); | ||
export function programWithDepth(i, data /*, $depth */) { | ||
/*jshint -W040 */ | ||
var args = Array.prototype.slice.call(arguments, 2), | ||
container = this, | ||
fn = container.fn(i); | ||
@@ -108,3 +141,3 @@ var prog = function(context, options) { | ||
return fn.apply(this, [context, options.data || data].concat(args)); | ||
return fn.apply(container, [context, container.helpers, container.partials, options.data || data].concat(args)); | ||
}; | ||
@@ -116,7 +149,7 @@ prog.program = i; | ||
export function program(i, fn, data) { | ||
export function program(container, i, fn, data) { | ||
var prog = function(context, options) { | ||
options = options || {}; | ||
return fn(context, options.data || data); | ||
return fn.call(container, context, container.helpers, container.partials, options.data || data); | ||
}; | ||
@@ -123,0 +156,0 @@ prog.program = i; |
@@ -20,8 +20,12 @@ /*jshint -W004 */ | ||
export function extend(obj, value) { | ||
for(var key in value) { | ||
if(Object.prototype.hasOwnProperty.call(value, key)) { | ||
obj[key] = value[key]; | ||
export function extend(obj /* , ...source */) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
for (var key in arguments[i]) { | ||
if (Object.prototype.hasOwnProperty.call(arguments[i], key)) { | ||
obj[key] = arguments[i][key]; | ||
} | ||
} | ||
} | ||
return obj; | ||
} | ||
@@ -75,1 +79,5 @@ | ||
} | ||
export function appendContextPath(contextPath, id) { | ||
return (contextPath ? contextPath + '.' : '') + id; | ||
} |
{ | ||
"name": "handlebars", | ||
"barename": "handlebars", | ||
"version": "1.3.0", | ||
"version": "v2.0.0-alpha.1", | ||
"description": "Handlebars provides the power necessary to let you build semantic templates effectively with no frustration", | ||
@@ -46,3 +46,3 @@ "homepage": "http://www.handlebarsjs.com/", | ||
"grunt-saucelabs": "~4.1.2", | ||
"es6-module-packager": "0.x", | ||
"es6-module-packager": "1.x", | ||
"jison": "~0.3.0", | ||
@@ -49,0 +49,0 @@ "keen.io": "0.0.3", |
@@ -5,4 +5,38 @@ # Release Notes | ||
[Commits](https://github.com/wycats/handlebars.js/compare/v1.3.0...master) | ||
[Commits](https://github.com/wycats/handlebars.js/compare/v2.0.0-alpha.1...master) | ||
## v2.0.0-alpha.1 - February 10th, 2014 | ||
- [#182](https://github.com/wycats/handlebars.js/pull/182) - Allow passing hash parameters to partials ([@kpdecker](https://api.github.com/users/kpdecker)) | ||
- [#392](https://github.com/wycats/handlebars.js/pull/392) - Access to root context in partials and helpers ([@kpdecker](https://api.github.com/users/kpdecker)) | ||
- [#472](https://github.com/wycats/handlebars.js/issues/472) - Helpers cannot have decimal parameters ([@kayleg](https://api.github.com/users/kayleg)) | ||
- [#569](https://github.com/wycats/handlebars.js/pull/569) - Unable to lookup array values using @index ([@kpdecker](https://api.github.com/users/kpdecker)) | ||
- [#491](https://github.com/wycats/handlebars.js/pull/491) - For nested helpers: get the @ variables of the outer helper from the inner one ([@kpdecker](https://api.github.com/users/kpdecker)) | ||
- [#669](https://github.com/wycats/handlebars.js/issues/669) - Ability to unregister a helper ([@dbachrach](https://api.github.com/users/dbachrach)) | ||
- [#730](https://github.com/wycats/handlebars.js/pull/730) - Raw block helpers ([@kpdecker](https://api.github.com/users/kpdecker)) | ||
- [#634](https://github.com/wycats/handlebars.js/pull/634) - It would be great to have the helper name passed to `blockHelperMissing` ([@kpdecker](https://api.github.com/users/kpdecker)) | ||
- [#729](https://github.com/wycats/handlebars.js/pull/729) - Convert template spec to object literal ([@kpdecker](https://api.github.com/users/kpdecker)) | ||
- [#658](https://github.com/wycats/handlebars.js/issues/658) - Depthed helpers do not work after an upgrade from 1.0.0 ([@xibxor](https://api.github.com/users/xibxor)) | ||
- [#671](https://github.com/wycats/handlebars.js/issues/671) - Crashes on no-parameter {{#each}} ([@stepancheg](https://api.github.com/users/stepancheg)) | ||
- [#689](https://github.com/wycats/handlebars.js/issues/689) - broken template precompilation ([@AAS](https://api.github.com/users/AAS)) | ||
- [#698](https://github.com/wycats/handlebars.js/pull/698) - Fix parser generation under windows ([@osiris43](https://api.github.com/users/osiris43)) | ||
- [#699](https://github.com/wycats/handlebars.js/issues/699) - @DATA not compiles to invalid JS in stringParams mode ([@kpdecker](https://api.github.com/users/kpdecker)) | ||
- [#705](https://github.com/wycats/handlebars.js/issues/705) - 1.3.0 can not be wrapped in an IIFE ([@craigteegarden](https://api.github.com/users/craigteegarden)) | ||
- [#706](https://github.com/wycats/handlebars.js/pull/706) - README: Use with helper instead of relying on blockHelperMissing ([@scottgonzalez](https://api.github.com/users/scottgonzalez)) | ||
- [#700](https://github.com/wycats/handlebars.js/pull/700) - Remove redundant conditions ([@blakeembrey](https://api.github.com/users/blakeembrey)) | ||
- [#704](https://github.com/wycats/handlebars.js/pull/704) - JavaScript Compiler Cleanup ([@blakeembrey](https://api.github.com/users/blakeembrey)) | ||
Compatibility notes: | ||
- `helperMissing` helper no longer has the indexed name argument. Helper name is now available via `options.name`. | ||
- Precompiler output has changed, which breaks compatibility with prior versions of the runtime and precompiled output. | ||
- `JavaScriptCompiler.compilerInfo` now returns generic objects rather than javascript source. | ||
- AST changes | ||
- INTEGER -> NUMBER | ||
- Additional PartialNode hash parameter | ||
- New RawBlockNode type | ||
- Data frames now have a `_parent` field. This is internal but is enumerable for performance/compatability reasons. | ||
[Commits](https://github.com/wycats/handlebars.js/compare/v1.3.0...v2.0.0-alpha.1) | ||
## v1.3.0 - January 1st, 2014 | ||
@@ -9,0 +43,0 @@ - [#690](https://github.com/wycats/handlebars.js/pull/690) - Added support for subexpressions ([@machty](https://api.github.com/users/machty)) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
682223
14190
470
1
3