happstack-yui-7373.5.2: bundle/handlebars-base/handlebars-base-coverage.js
/*
YUI 3.7.3 (build 5687)
Copyright 2012 Yahoo! Inc. All rights reserved.
Licensed under the BSD License.
http://yuilibrary.com/license/
*/
if (typeof _yuitest_coverage == "undefined"){
_yuitest_coverage = {};
_yuitest_coverline = function(src, line){
var coverage = _yuitest_coverage[src];
if (!coverage.lines[line]){
coverage.calledLines++;
}
coverage.lines[line]++;
};
_yuitest_coverfunc = function(src, name, line){
var coverage = _yuitest_coverage[src],
funcId = name + ":" + line;
if (!coverage.functions[funcId]){
coverage.calledFunctions++;
}
coverage.functions[funcId]++;
};
}
_yuitest_coverage["build/handlebars-base/handlebars-base.js"] = {
lines: {},
functions: {},
coveredLines: 0,
calledLines: 0,
coveredFunctions: 0,
calledFunctions: 0,
path: "build/handlebars-base/handlebars-base.js",
code: []
};
_yuitest_coverage["build/handlebars-base/handlebars-base.js"].code=["YUI.add('handlebars-base', function (Y, NAME) {","","/*!","Handlebars.js - Copyright (C) 2011 Yehuda Katz","https://raw.github.com/wycats/handlebars.js/master/LICENSE","*/","/* THIS FILE IS GENERATED BY A BUILD SCRIPT - DO NOT EDIT! */","","// BEGIN(BROWSER)","","/*jshint eqnull:true*/","var Handlebars = {};","","Handlebars.VERSION = \"1.0.beta.5\";","","Handlebars.helpers = {};","Handlebars.partials = {};","","Handlebars.registerHelper = function(name, fn, inverse) {"," if(inverse) { fn.not = inverse; }"," this.helpers[name] = fn;","};","","Handlebars.registerPartial = function(name, str) {"," this.partials[name] = str;","};","","Handlebars.registerHelper('helperMissing', function(arg) {"," if(arguments.length === 2) {"," return undefined;"," } else {"," throw new Error(\"Could not find property '\" + arg + \"'\");"," }","});","","var toString = Object.prototype.toString, functionType = \"[object Function]\";","","Handlebars.registerHelper('blockHelperMissing', function(context, options) {"," var inverse = options.inverse || function() {}, fn = options.fn;","",""," var ret = \"\";"," var type = toString.call(context);",""," if(type === functionType) { context = context.call(this); }",""," if(context === true) {"," return fn(this);"," } else if(context === false || context == null) {"," return inverse(this);"," } else if(type === \"[object Array]\") {"," if(context.length > 0) {"," for(var i=0, j=context.length; i<j; i++) {"," ret = ret + fn(context[i]);"," }"," } else {"," ret = inverse(this);"," }"," return ret;"," } else {"," return fn(context);"," }","});","","Handlebars.registerHelper('each', function(context, options) {"," var fn = options.fn, inverse = options.inverse;"," var ret = \"\";",""," if(context && context.length > 0) {"," for(var i=0, j=context.length; i<j; i++) {"," ret = ret + fn(context[i]);"," }"," } else {"," ret = inverse(this);"," }"," return ret;","});","","Handlebars.registerHelper('if', function(context, options) {"," var type = toString.call(context);"," if(type === functionType) { context = context.call(this); }",""," if(!context || Handlebars.Utils.isEmpty(context)) {"," return options.inverse(this);"," } else {"," return options.fn(this);"," }","});","","Handlebars.registerHelper('unless', function(context, options) {"," var fn = options.fn, inverse = options.inverse;"," options.fn = inverse;"," options.inverse = fn;",""," return Handlebars.helpers['if'].call(this, context, options);","});","","Handlebars.registerHelper('with', function(context, options) {"," return options.fn(context);","});","","Handlebars.registerHelper('log', function(context) {"," Handlebars.log(context);","});","","// END(BROWSER)","// This file provides a YUI-specific implementation of Handlebars' lib/utils.js","// file. Handlebars unfortunately creates enclosed references to its utils, so","// we have to maintain a complete fork of this file rather than just overriding","// specific parts.","","var Lang = Y.Lang;","","Handlebars.Exception = function (message) {"," var error = Error.prototype.constructor.apply(this, arguments),"," key;",""," for (key in error) {"," if (error.hasOwnProperty(key)) {"," this[key] = error[key];"," }"," }",""," this.message = error.message;","};","","Handlebars.Exception.prototype = new Error();","","Handlebars.SafeString = function (string) {"," this.string = string;","};","","Handlebars.SafeString.prototype.toString = function () {"," return this.string.toString();","};","","Handlebars.Utils = {"," escapeExpression: function (string) {"," // Skip escaping for empty strings."," if (string === '') {"," return string;"," }",""," // Don't escape SafeStrings, since they're already (presumed to be)"," // safe."," if (string instanceof Handlebars.SafeString) {"," return string.toString();"," } else if (string === false || !Lang.isValue(string)) {"," return '';"," }",""," // Unlike Handlebars' escaping implementation, Y.Escape.html() will"," // double-escape existing & entities. This seems much less"," // surprising than avoiding double-escaping, especially since"," // a lack of double-escaping would make it impossible to use Handlebars"," // for things like displaying escaped code snippets."," return Y.Escape.html(string);"," },",""," isEmpty: function (value) {"," if (value === false"," || !Lang.isValue(value)"," || (Lang.isArray(value) && !value.length)) {",""," return true;"," }",""," return false;"," }","};","/* THIS FILE IS GENERATED BY A BUILD SCRIPT - DO NOT EDIT! */","","// BEGIN(BROWSER)","Handlebars.VM = {"," template: function(templateSpec) {"," // Just add water"," var container = {"," escapeExpression: Handlebars.Utils.escapeExpression,"," invokePartial: Handlebars.VM.invokePartial,"," programs: [],"," program: function(i, fn, data) {"," var programWrapper = this.programs[i];"," if(data) {"," return Handlebars.VM.program(fn, data);"," } else if(programWrapper) {"," return programWrapper;"," } else {"," programWrapper = this.programs[i] = Handlebars.VM.program(fn);"," return programWrapper;"," }"," },"," programWithDepth: Handlebars.VM.programWithDepth,"," noop: Handlebars.VM.noop"," };",""," return function(context, options) {"," options = options || {};"," return templateSpec.call(container, Handlebars, context, options.helpers, options.partials, options.data);"," };"," },",""," programWithDepth: function(fn, data, $depth) {"," var args = Array.prototype.slice.call(arguments, 2);",""," return function(context, options) {"," options = options || {};",""," return fn.apply(this, [context, options.data || data].concat(args));"," };"," },"," program: function(fn, data) {"," return function(context, options) {"," options = options || {};",""," return fn(context, options.data || data);"," };"," },"," noop: function() { return \"\"; },"," invokePartial: function(partial, name, context, helpers, partials, data) {"," var options = { helpers: helpers, partials: partials, data: data };",""," if(partial === undefined) {"," throw new Handlebars.Exception(\"The partial \" + name + \" could not be found\");"," } else if(partial instanceof Function) {"," return partial(context, options);"," } else if (!Handlebars.compile) {"," throw new Handlebars.Exception(\"The partial \" + name + \" could not be compiled when running in runtime-only mode\");"," } else {"," partials[name] = Handlebars.compile(partial);"," return partials[name](context, options);"," }"," }","};","","Handlebars.template = Handlebars.VM.template;","","// END(BROWSER)","// This file contains YUI-specific wrapper code and overrides for the","// handlebars-base module.","","/**","Handlebars is a simple template language inspired by Mustache.","","This is a YUI port of the original Handlebars project, which can be found at","<https://github.com/wycats/handlebars.js>.","","@module handlebars","@main handlebars","@since 3.5.0","*/","","/**","Provides basic Handlebars template rendering functionality. Use this module when","you only need to render pre-compiled templates.","","@module handlebars","@submodule handlebars-base","*/","","/**","Handlebars is a simple template language inspired by Mustache.","","This is a YUI port of the original Handlebars project, which can be found at","<https://github.com/wycats/handlebars.js>.","","@class Handlebars","@since 3.5.0","*/","Y.Handlebars = Handlebars;","","Handlebars.VERSION += '-yui';","","// The rest of this file is just API docs for methods defined in Handlebars","// itself.","","/**","Registers a helper function that will be made available to all templates.","","Helper functions receive the current template context as the `this` object, and","can also receive arguments passed by the template.","","@example",""," Y.Handlebars.registerHelper('linkify', function () {"," return '<a href=\"' + Y.Escape.html(this.url) + '\">' +"," Y.Escape.html(this.text) + '</a>';"," });",""," var source = '<ul>{{#links}}<li>{{{linkify}}}</li>{{/links}}</ul>';",""," Y.Handlebars.render(source, {"," links: ["," {url: '/foo', text: 'Foo'},"," {url: '/bar', text: 'Bar'},"," {url: '/baz', text: 'Baz'}"," ]"," });","","@method registerHelper","@param {String} name Name of this helper.","@param {Function} fn Helper function.","@param {Boolean} [inverse=false] If `true`, this helper will be considered an"," \"inverse\" helper, like \"unless\". This means it will only be called if the"," expression given in the template evaluates to a false or empty value.","*/","","/**","Registers a partial that will be made available to all templates.","","A partial is another template that can be used to render part of a larger","template. For example, a website with a common header and footer across all its","pages might use a template for each page, which would call shared partials to","render the headers and footers.","","Partials may be specified as uncompiled template strings or as compiled template","functions.","","@example",""," Y.Handlebars.registerPartial('header', '<h1>{{title}}</h1>');"," Y.Handlebars.registerPartial('footer', 'Copyright (c) 2011 by Me.');",""," var source = '{{> header}} <p>Mustaches are awesome!</p> {{> footer}}';",""," Y.Handlebars.render(source, {title: 'My Page About Mustaches'});","","@method registerPartial","@param {String} name Name of this partial.","@param {Function|String} partial Template string or compiled template function.","*/","","/**","Converts a precompiled template into a renderable template function.","","@example",""," <script src=\"precompiled-template.js\"></script>"," <script>"," YUI().use('handlebars-base', function (Y) {"," // Convert the precompiled template function into a renderable template"," // function."," var template = Y.Handlebars.template(precompiledTemplate);",""," // Render it."," template({pie: 'Pumpkin'});"," });"," </script>","","@method template","@param {Function} template Precompiled Handlebars template function.","@return {Function} Compiled template function.","*/","","","}, '3.7.3', {\"requires\": [\"escape\"]});"];
_yuitest_coverage["build/handlebars-base/handlebars-base.js"].lines = {"1":0,"12":0,"14":0,"16":0,"17":0,"19":0,"20":0,"21":0,"24":0,"25":0,"28":0,"29":0,"30":0,"32":0,"36":0,"38":0,"39":0,"42":0,"43":0,"45":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"57":0,"59":0,"61":0,"65":0,"66":0,"67":0,"69":0,"70":0,"71":0,"74":0,"76":0,"79":0,"80":0,"81":0,"83":0,"84":0,"86":0,"90":0,"91":0,"92":0,"93":0,"95":0,"98":0,"99":0,"102":0,"103":0,"112":0,"114":0,"115":0,"118":0,"119":0,"120":0,"124":0,"127":0,"129":0,"130":0,"133":0,"134":0,"137":0,"140":0,"141":0,"146":0,"147":0,"148":0,"149":0,"157":0,"161":0,"165":0,"168":0,"174":0,"177":0,"182":0,"183":0,"184":0,"185":0,"186":0,"188":0,"189":0,"196":0,"197":0,"198":0,"203":0,"205":0,"206":0,"208":0,"212":0,"213":0,"215":0,"218":0,"220":0,"222":0,"223":0,"224":0,"225":0,"226":0,"227":0,"229":0,"230":0,"235":0,"269":0,"271":0};
_yuitest_coverage["build/handlebars-base/handlebars-base.js"].functions = {"registerHelper:19":0,"registerPartial:24":0,"(anonymous 2):28":0,"(anonymous 3):38":0,"(anonymous 5):65":0,"(anonymous 6):79":0,"(anonymous 7):90":0,"(anonymous 8):98":0,"(anonymous 9):102":0,"Exception:114":0,"SafeString:129":0,"toString:133":0,"escapeExpression:138":0,"isEmpty:160":0,"program:181":0,"(anonymous 10):196":0,"template:175":0,"(anonymous 11):205":0,"programWithDepth:202":0,"(anonymous 12):212":0,"program:211":0,"noop:218":0,"invokePartial:219":0,"(anonymous 1):1":0};
_yuitest_coverage["build/handlebars-base/handlebars-base.js"].coveredLines = 109;
_yuitest_coverage["build/handlebars-base/handlebars-base.js"].coveredFunctions = 24;
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 1);
YUI.add('handlebars-base', function (Y, NAME) {
/*!
Handlebars.js - Copyright (C) 2011 Yehuda Katz
https://raw.github.com/wycats/handlebars.js/master/LICENSE
*/
/* THIS FILE IS GENERATED BY A BUILD SCRIPT - DO NOT EDIT! */
// BEGIN(BROWSER)
/*jshint eqnull:true*/
_yuitest_coverfunc("build/handlebars-base/handlebars-base.js", "(anonymous 1)", 1);
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 12);
var Handlebars = {};
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 14);
Handlebars.VERSION = "1.0.beta.5";
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 16);
Handlebars.helpers = {};
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 17);
Handlebars.partials = {};
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 19);
Handlebars.registerHelper = function(name, fn, inverse) {
_yuitest_coverfunc("build/handlebars-base/handlebars-base.js", "registerHelper", 19);
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 20);
if(inverse) { fn.not = inverse; }
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 21);
this.helpers[name] = fn;
};
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 24);
Handlebars.registerPartial = function(name, str) {
_yuitest_coverfunc("build/handlebars-base/handlebars-base.js", "registerPartial", 24);
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 25);
this.partials[name] = str;
};
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 28);
Handlebars.registerHelper('helperMissing', function(arg) {
_yuitest_coverfunc("build/handlebars-base/handlebars-base.js", "(anonymous 2)", 28);
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 29);
if(arguments.length === 2) {
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 30);
return undefined;
} else {
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 32);
throw new Error("Could not find property '" + arg + "'");
}
});
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 36);
var toString = Object.prototype.toString, functionType = "[object Function]";
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 38);
Handlebars.registerHelper('blockHelperMissing', function(context, options) {
_yuitest_coverfunc("build/handlebars-base/handlebars-base.js", "(anonymous 3)", 38);
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 39);
var inverse = options.inverse || function() {}, fn = options.fn;
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 42);
var ret = "";
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 43);
var type = toString.call(context);
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 45);
if(type === functionType) { context = context.call(this); }
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 47);
if(context === true) {
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 48);
return fn(this);
} else {_yuitest_coverline("build/handlebars-base/handlebars-base.js", 49);
if(context === false || context == null) {
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 50);
return inverse(this);
} else {_yuitest_coverline("build/handlebars-base/handlebars-base.js", 51);
if(type === "[object Array]") {
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 52);
if(context.length > 0) {
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 53);
for(var i=0, j=context.length; i<j; i++) {
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 54);
ret = ret + fn(context[i]);
}
} else {
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 57);
ret = inverse(this);
}
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 59);
return ret;
} else {
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 61);
return fn(context);
}}}
});
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 65);
Handlebars.registerHelper('each', function(context, options) {
_yuitest_coverfunc("build/handlebars-base/handlebars-base.js", "(anonymous 5)", 65);
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 66);
var fn = options.fn, inverse = options.inverse;
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 67);
var ret = "";
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 69);
if(context && context.length > 0) {
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 70);
for(var i=0, j=context.length; i<j; i++) {
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 71);
ret = ret + fn(context[i]);
}
} else {
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 74);
ret = inverse(this);
}
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 76);
return ret;
});
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 79);
Handlebars.registerHelper('if', function(context, options) {
_yuitest_coverfunc("build/handlebars-base/handlebars-base.js", "(anonymous 6)", 79);
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 80);
var type = toString.call(context);
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 81);
if(type === functionType) { context = context.call(this); }
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 83);
if(!context || Handlebars.Utils.isEmpty(context)) {
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 84);
return options.inverse(this);
} else {
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 86);
return options.fn(this);
}
});
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 90);
Handlebars.registerHelper('unless', function(context, options) {
_yuitest_coverfunc("build/handlebars-base/handlebars-base.js", "(anonymous 7)", 90);
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 91);
var fn = options.fn, inverse = options.inverse;
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 92);
options.fn = inverse;
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 93);
options.inverse = fn;
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 95);
return Handlebars.helpers['if'].call(this, context, options);
});
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 98);
Handlebars.registerHelper('with', function(context, options) {
_yuitest_coverfunc("build/handlebars-base/handlebars-base.js", "(anonymous 8)", 98);
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 99);
return options.fn(context);
});
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 102);
Handlebars.registerHelper('log', function(context) {
_yuitest_coverfunc("build/handlebars-base/handlebars-base.js", "(anonymous 9)", 102);
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 103);
Handlebars.log(context);
});
// END(BROWSER)
// This file provides a YUI-specific implementation of Handlebars' lib/utils.js
// file. Handlebars unfortunately creates enclosed references to its utils, so
// we have to maintain a complete fork of this file rather than just overriding
// specific parts.
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 112);
var Lang = Y.Lang;
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 114);
Handlebars.Exception = function (message) {
_yuitest_coverfunc("build/handlebars-base/handlebars-base.js", "Exception", 114);
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 115);
var error = Error.prototype.constructor.apply(this, arguments),
key;
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 118);
for (key in error) {
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 119);
if (error.hasOwnProperty(key)) {
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 120);
this[key] = error[key];
}
}
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 124);
this.message = error.message;
};
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 127);
Handlebars.Exception.prototype = new Error();
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 129);
Handlebars.SafeString = function (string) {
_yuitest_coverfunc("build/handlebars-base/handlebars-base.js", "SafeString", 129);
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 130);
this.string = string;
};
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 133);
Handlebars.SafeString.prototype.toString = function () {
_yuitest_coverfunc("build/handlebars-base/handlebars-base.js", "toString", 133);
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 134);
return this.string.toString();
};
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 137);
Handlebars.Utils = {
escapeExpression: function (string) {
// Skip escaping for empty strings.
_yuitest_coverfunc("build/handlebars-base/handlebars-base.js", "escapeExpression", 138);
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 140);
if (string === '') {
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 141);
return string;
}
// Don't escape SafeStrings, since they're already (presumed to be)
// safe.
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 146);
if (string instanceof Handlebars.SafeString) {
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 147);
return string.toString();
} else {_yuitest_coverline("build/handlebars-base/handlebars-base.js", 148);
if (string === false || !Lang.isValue(string)) {
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 149);
return '';
}}
// Unlike Handlebars' escaping implementation, Y.Escape.html() will
// double-escape existing & entities. This seems much less
// surprising than avoiding double-escaping, especially since
// a lack of double-escaping would make it impossible to use Handlebars
// for things like displaying escaped code snippets.
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 157);
return Y.Escape.html(string);
},
isEmpty: function (value) {
_yuitest_coverfunc("build/handlebars-base/handlebars-base.js", "isEmpty", 160);
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 161);
if (value === false
|| !Lang.isValue(value)
|| (Lang.isArray(value) && !value.length)) {
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 165);
return true;
}
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 168);
return false;
}
};
/* THIS FILE IS GENERATED BY A BUILD SCRIPT - DO NOT EDIT! */
// BEGIN(BROWSER)
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 174);
Handlebars.VM = {
template: function(templateSpec) {
// Just add water
_yuitest_coverfunc("build/handlebars-base/handlebars-base.js", "template", 175);
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 177);
var container = {
escapeExpression: Handlebars.Utils.escapeExpression,
invokePartial: Handlebars.VM.invokePartial,
programs: [],
program: function(i, fn, data) {
_yuitest_coverfunc("build/handlebars-base/handlebars-base.js", "program", 181);
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 182);
var programWrapper = this.programs[i];
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 183);
if(data) {
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 184);
return Handlebars.VM.program(fn, data);
} else {_yuitest_coverline("build/handlebars-base/handlebars-base.js", 185);
if(programWrapper) {
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 186);
return programWrapper;
} else {
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 188);
programWrapper = this.programs[i] = Handlebars.VM.program(fn);
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 189);
return programWrapper;
}}
},
programWithDepth: Handlebars.VM.programWithDepth,
noop: Handlebars.VM.noop
};
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 196);
return function(context, options) {
_yuitest_coverfunc("build/handlebars-base/handlebars-base.js", "(anonymous 10)", 196);
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 197);
options = options || {};
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 198);
return templateSpec.call(container, Handlebars, context, options.helpers, options.partials, options.data);
};
},
programWithDepth: function(fn, data, $depth) {
_yuitest_coverfunc("build/handlebars-base/handlebars-base.js", "programWithDepth", 202);
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 203);
var args = Array.prototype.slice.call(arguments, 2);
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 205);
return function(context, options) {
_yuitest_coverfunc("build/handlebars-base/handlebars-base.js", "(anonymous 11)", 205);
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 206);
options = options || {};
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 208);
return fn.apply(this, [context, options.data || data].concat(args));
};
},
program: function(fn, data) {
_yuitest_coverfunc("build/handlebars-base/handlebars-base.js", "program", 211);
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 212);
return function(context, options) {
_yuitest_coverfunc("build/handlebars-base/handlebars-base.js", "(anonymous 12)", 212);
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 213);
options = options || {};
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 215);
return fn(context, options.data || data);
};
},
noop: function() { _yuitest_coverfunc("build/handlebars-base/handlebars-base.js", "noop", 218);
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 218);
return ""; },
invokePartial: function(partial, name, context, helpers, partials, data) {
_yuitest_coverfunc("build/handlebars-base/handlebars-base.js", "invokePartial", 219);
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 220);
var options = { helpers: helpers, partials: partials, data: data };
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 222);
if(partial === undefined) {
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 223);
throw new Handlebars.Exception("The partial " + name + " could not be found");
} else {_yuitest_coverline("build/handlebars-base/handlebars-base.js", 224);
if(partial instanceof Function) {
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 225);
return partial(context, options);
} else {_yuitest_coverline("build/handlebars-base/handlebars-base.js", 226);
if (!Handlebars.compile) {
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 227);
throw new Handlebars.Exception("The partial " + name + " could not be compiled when running in runtime-only mode");
} else {
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 229);
partials[name] = Handlebars.compile(partial);
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 230);
return partials[name](context, options);
}}}
}
};
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 235);
Handlebars.template = Handlebars.VM.template;
// END(BROWSER)
// This file contains YUI-specific wrapper code and overrides for the
// handlebars-base module.
/**
Handlebars is a simple template language inspired by Mustache.
This is a YUI port of the original Handlebars project, which can be found at
<https://github.com/wycats/handlebars.js>.
@module handlebars
@main handlebars
@since 3.5.0
*/
/**
Provides basic Handlebars template rendering functionality. Use this module when
you only need to render pre-compiled templates.
@module handlebars
@submodule handlebars-base
*/
/**
Handlebars is a simple template language inspired by Mustache.
This is a YUI port of the original Handlebars project, which can be found at
<https://github.com/wycats/handlebars.js>.
@class Handlebars
@since 3.5.0
*/
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 269);
Y.Handlebars = Handlebars;
_yuitest_coverline("build/handlebars-base/handlebars-base.js", 271);
Handlebars.VERSION += '-yui';
// The rest of this file is just API docs for methods defined in Handlebars
// itself.
/**
Registers a helper function that will be made available to all templates.
Helper functions receive the current template context as the `this` object, and
can also receive arguments passed by the template.
@example
Y.Handlebars.registerHelper('linkify', function () {
return '<a href="' + Y.Escape.html(this.url) + '">' +
Y.Escape.html(this.text) + '</a>';
});
var source = '<ul>{{#links}}<li>{{{linkify}}}</li>{{/links}}</ul>';
Y.Handlebars.render(source, {
links: [
{url: '/foo', text: 'Foo'},
{url: '/bar', text: 'Bar'},
{url: '/baz', text: 'Baz'}
]
});
@method registerHelper
@param {String} name Name of this helper.
@param {Function} fn Helper function.
@param {Boolean} [inverse=false] If `true`, this helper will be considered an
"inverse" helper, like "unless". This means it will only be called if the
expression given in the template evaluates to a false or empty value.
*/
/**
Registers a partial that will be made available to all templates.
A partial is another template that can be used to render part of a larger
template. For example, a website with a common header and footer across all its
pages might use a template for each page, which would call shared partials to
render the headers and footers.
Partials may be specified as uncompiled template strings or as compiled template
functions.
@example
Y.Handlebars.registerPartial('header', '<h1>{{title}}</h1>');
Y.Handlebars.registerPartial('footer', 'Copyright (c) 2011 by Me.');
var source = '{{> header}} <p>Mustaches are awesome!</p> {{> footer}}';
Y.Handlebars.render(source, {title: 'My Page About Mustaches'});
@method registerPartial
@param {String} name Name of this partial.
@param {Function|String} partial Template string or compiled template function.
*/
/**
Converts a precompiled template into a renderable template function.
@example
<script src="precompiled-template.js"></script>
<script>
YUI().use('handlebars-base', function (Y) {
// Convert the precompiled template function into a renderable template
// function.
var template = Y.Handlebars.template(precompiledTemplate);
// Render it.
template({pie: 'Pumpkin'});
});
</script>
@method template
@param {Function} template Precompiled Handlebars template function.
@return {Function} Compiled template function.
*/
}, '3.7.3', {"requires": ["escape"]});