summaryrefslogtreecommitdiffstats
path: root/js/yui3/handlebars-base/handlebars-base-min.js
blob: e55055cad7e63d17b632156e5b5967310c1e013f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
/*
YUI 3.7.3 (build 5687)
Copyright 2012 Yahoo! Inc. All rights reserved.
Licensed under the BSD License.
http://yuilibrary.com/license/
*/
YUI.add("handlebars-base",function(e,t){
/*!
Handlebars.js - Copyright (C) 2011 Yehuda Katz
https://raw.github.com/wycats/handlebars.js/master/LICENSE
*/
;var n={};n.VERSION="1.0.beta.5",n.helpers={},n.partials={},n.registerHelper=function(e,t,n){n&&(t.not=n),this.helpers[e]=t},n.registerPartial=function(e,t){this.partials[e]=t},n.registerHelper("helperMissing",function(e){if(arguments.length===2)return undefined;throw new Error("Could not find property '"+e+"'")});var r=Object.prototype.toString,i="[object Function]";n.registerHelper("blockHelperMissing",function(e,t){var n=t.inverse||function(){},s=t.fn,o="",u=r.call(e);u===i&&(e=e.call(this));if(e===!0)return s(this);if(e===!1||e==null)return n(this);if(u==="[object Array]"){if(e.length>0)for(var a=0,f=e.length;a<f;a++)o+=s(e[a]);else o=n(this);return o}return s(e)}),n.registerHelper("each",function(e,t){var n=t.fn,r=t.inverse,i="";if(e&&e.length>0)for(var s=0,o=e.length;s<o;s++)i+=n(e[s]);else i=r(this);return i}),n.registerHelper("if",function(e,t){var s=r.call(e);return s===i&&(e=e.call(this)),!e||n.Utils.isEmpty(e)?t.inverse(this):t.fn(this)}),n.registerHelper("unless",function(e,t){var r=t.fn,i=t.inverse;return t.fn=i,t.inverse=r,n.helpers["if"].call(this,e,t)}),n.registerHelper("with",function(e,t){return t.fn(e)}),n.registerHelper("log",function(e){n.log(e)});var s=e.Lang;n.Exception=function(e){var t=Error.prototype.constructor.apply(this,arguments),n;for(n in t)t.hasOwnProperty(n)&&(this[n]=t[n]);this.message=t.message},n.Exception.prototype=new Error,n.SafeString=function(e){this.string=e},n.SafeString.prototype.toString=function(){return this.string.toString()},n.Utils={escapeExpression:function(t){return t===""?t:t instanceof n.SafeString?t.toString():t===!1||!s.isValue(t)?"":e.Escape.html(t)},isEmpty:function(e){return e===!1||!s.isValue(e)||s.isArray(e)&&!e.length?!0:!1}},n.VM={template:function(e){var t={escapeExpression:n.Utils.escapeExpression,invokePartial:n.VM.invokePartial,programs:[],program:function(e,t,r){var i=this.programs[e];return r?n.VM.program(t,r):i?i:(i=this.programs[e]=n.VM.program(t),i)},programWithDepth:n.VM.programWithDepth,noop:n.VM.noop};return function(r,i){return i=i||{},e.call(t,n,r,i.helpers,i.partials,i.data)}},programWithDepth:function(e,t,n){var r=Array.prototype.slice.call(arguments,2);return function(n,i){return i=i||{},e.apply(this,[n,i.data||t].concat(r))}},program:function(e,t){return function(n,r){return r=r||{},e(n,r.data||t)}},noop:function(){return""},invokePartial:function(e,t,r,i,s,o){var u={helpers:i,partials:s,data:o};if(e===undefined)throw new n.Exception("The partial "+t+" could not be found");if(e instanceof Function)return e(r,u);if(!n.compile)throw new n.Exception("The partial "+t+" could not be compiled when running in runtime-only mode");return s[t]=n.compile(e),s[t](r,u)}},n.template=n.VM.template,e.Handlebars=n,n.VERSION+="-yui"},"3.7.3",{requires:["escape"]});