├── .gitignore ├── web ├── favicon.ico ├── images │ ├── logo.png │ ├── noise.png │ ├── stripes.png │ └── small-hogan-icon.png ├── builds │ ├── 1.0.4 │ │ ├── template-1.0.4.min.js │ │ ├── hogan-1.0.4.min.js │ │ ├── hogan-1.0.4.min.amd.js │ │ ├── hogan-1.0.4.min.common.js │ │ ├── hogan-1.0.4.min.mustache.js │ │ └── template-1.0.4.js │ ├── 2.0.0 │ │ ├── template-2.0.0.min.js │ │ ├── hogan-2.0.0.min.js │ │ ├── hogan-2.0.0.min.amd.js │ │ ├── hogan-2.0.0.min.common.js │ │ ├── hogan-2.0.0.min.mustache.js │ │ └── template-2.0.0.js │ ├── 1.0.5 │ │ ├── template-1.0.5.min.js │ │ ├── hogan-1.0.5.min.js │ │ ├── hogan-1.0.5.min.amd.js │ │ ├── hogan-1.0.5.min.common.js │ │ ├── hogan-1.0.5.min.mustache.js │ │ └── template-1.0.5.js │ ├── 3.0.2 │ │ ├── template-3.0.2.min.js │ │ ├── hogan-3.0.2.min.js │ │ └── hogan-3.0.2.min.amd.js │ ├── 3.0.1 │ │ ├── hogan.template-3.0.1.min.js │ │ ├── hogan.template-3.0.1.min.amd.js │ │ ├── hogan.template-3.0.1.min.common.js │ │ ├── hogan.template-3.0.1.min.mustache.js │ │ ├── hogan-3.0.1.min.js │ │ ├── hogan-3.0.1.min.amd.js │ │ └── hogan-3.0.1.min.common.js │ ├── 1.0.3 │ │ └── hogan.min.js │ └── 1.0.0 │ │ └── hogan.min.js ├── 1.0.0 │ └── hogan.min.js ├── index.html.mustache └── stylesheets │ └── layout.css ├── test ├── html │ └── list.html ├── templates │ └── list.mustache ├── phantom-js-loader.js ├── index.html ├── run.js ├── spec.js ├── specWithGet.js ├── hulk.js └── mustache.js ├── .npmignore ├── .travis.yml ├── .gitmodules ├── .editorconfig ├── wrappers ├── js.mustache ├── amd.js.mustache ├── common.js.mustache └── mustache.js.mustache ├── package.json ├── component.json ├── lib └── hogan.js ├── tools ├── web_templates.js └── release.js ├── Makefile ├── README.md └── bin └── hulk /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | -------------------------------------------------------------------------------- /web/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaelhelmick/hogan.js/master/web/favicon.ico -------------------------------------------------------------------------------- /web/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaelhelmick/hogan.js/master/web/images/logo.png -------------------------------------------------------------------------------- /web/images/noise.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaelhelmick/hogan.js/master/web/images/noise.png -------------------------------------------------------------------------------- /web/images/stripes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaelhelmick/hogan.js/master/web/images/stripes.png -------------------------------------------------------------------------------- /test/html/list.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /web/images/small-hogan-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaelhelmick/hogan.js/master/web/images/small-hogan-icon.png -------------------------------------------------------------------------------- /test/templates/list.mustache: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | test 2 | tools 3 | web/1.0.0 4 | web/images 5 | web/stylesheets 6 | web/favicon.ico 7 | web/index.html.mustache 8 | wrappers 9 | Makefile 10 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - 0.6 4 | before_script: 5 | - "git submodule update --init" 6 | - "export DISPLAY=:99.0" 7 | - "sh -e /etc/init.d/xvfb start" 8 | - "phantomjs test/phantom-js-loader.js" 9 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "test/spec"] 2 | path = test/spec 3 | url = https://github.com/mustache/spec.git 4 | [submodule "test/qunit-logging"] 5 | path = test/qunit-logging 6 | url = git://github.com/keithamus/qunit-logging.git 7 | [submodule "test/qunit"] 8 | path = test/qunit 9 | url = git://github.com/jquery/qunit.git 10 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # This file is for unifying the coding style for different editors and IDEs 2 | # editorconfig.org 3 | 4 | root = true 5 | 6 | [*] 7 | end_of_line = lf 8 | charset = utf-8 9 | insert_final_newline = true 10 | trim_trailing_whitespace = true 11 | indent_style = space 12 | indent_size = 2 13 | max_line_length = 80 14 | 15 | [Makefile] 16 | indent_style = tab 17 | -------------------------------------------------------------------------------- /test/phantom-js-loader.js: -------------------------------------------------------------------------------- 1 | var fs = require('fs'), 2 | page = new WebPage(), 3 | file = fs.absolute('test/index.html'); 4 | 5 | page.onConsoleMessage = function(msg) { 6 | console.log(msg); 7 | if (/^Tests completed in/.test(msg)) { 8 | phantom.exit(page.evaluate(function () { 9 | if (window.QUnit && QUnit.config && QUnit.config.stats) { 10 | return QUnit.config.stats.bad || 0; 11 | } 12 | return 1; 13 | })); 14 | } 15 | }; 16 | 17 | page.open('file://' + file, function (status) { 18 | if (status !== 'success') { 19 | console.log("FAIL to load the address: " + status); 20 | phantom.exit(1); 21 | } 22 | }); 23 | -------------------------------------------------------------------------------- /wrappers/js.mustache: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2011 Twitter, Inc. 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | {{{template}}} 17 | {{{compiler}}} 18 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hogan.js" 3 | , "description": "A mustache compiler." 4 | , "version": "3.0.2" 5 | , "keywords": ["mustache", "template"] 6 | , "main": "./lib/hogan.js" 7 | , "homepage": "http://twitter.github.com/hogan.js/" 8 | , "author": "Twitter Inc." 9 | , "repository": { 10 | "type": "git" 11 | , "url": "https://github.com/twitter/hogan.js.git" 12 | } 13 | , "license": "Apache-2.0" 14 | , "dependencies" : { 15 | "nopt" : "1.0.10" 16 | , "mkdirp": "0.3.0" 17 | } 18 | , "devDependencies": { 19 | "uglify-js": "2.x" 20 | , "jsdom": "0.3.4" 21 | , "step": "0.0.5" 22 | , "rimraf": "2.0.1" 23 | } 24 | , "bin" : { "hulk" : "./bin/hulk" } 25 | } 26 | -------------------------------------------------------------------------------- /component.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hogan.js" 3 | , "description": "A mustache compiler." 4 | , "version": "3.0.2" 5 | , "keywords": ["mustache", "template"] 6 | , "main": "lib/hogan.js" 7 | , "scripts": [ 8 | "lib/compiler.js", 9 | "lib/hogan.js", 10 | "lib/template.js" 11 | ] 12 | , "homepage": "http://twitter.github.com/hogan.js/" 13 | , "author": "Twitter Inc." 14 | , "repository": { 15 | "type": "git" 16 | , "url": "https://github.com/twitter/hogan.js.git" 17 | } 18 | , "licenses": [ 19 | { "type": "Apache-2.0" 20 | , "url": "http://www.apache.org/licenses/LICENSE-2.0" 21 | } 22 | ] 23 | , "ignore" : [ 24 | "tools" 25 | ,"wrappers" 26 | ,".*" 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /wrappers/amd.js.mustache: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2011 Twitter, Inc. 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | {{{template}}} 17 | {{{compiler}}} 18 | 19 | if (typeof define === 'function' && define.amd) { 20 | define(Hogan); 21 | } 22 | -------------------------------------------------------------------------------- /wrappers/common.js.mustache: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2011 Twitter, Inc. 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | {{{template}}} 17 | {{{compiler}}} 18 | 19 | if (typeof module !== 'undefined' && module.exports) { 20 | module.exports = Hogan; 21 | } 22 | -------------------------------------------------------------------------------- /test/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Hogan.js Test Suite 4 | 5 | 6 | 7 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |

Hogan.js

20 |

21 |
22 |

23 |
    24 |
    25 | 26 | 27 | -------------------------------------------------------------------------------- /lib/hogan.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Twitter, Inc. 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | // This file is for use with Node.js. See dist/ for browser files. 17 | 18 | var Hogan = require('./compiler'); 19 | Hogan.Template = require('./template').Template; 20 | Hogan.template = Hogan.Template; 21 | module.exports = Hogan; 22 | -------------------------------------------------------------------------------- /tools/web_templates.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Twitter, Inc. 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | var Hogan = require(__dirname + '/../lib/hogan.js'); 17 | var fs = require('fs'); 18 | var path = require('path'); 19 | 20 | // Substitute variables in the homepage with values from package.json 21 | var homeTemplatePath = __dirname + '/../build/gh-pages/index.html.mustache'; 22 | var contextPath = __dirname + '/../package.json'; 23 | 24 | var homepage = fs.readFileSync(homeTemplatePath).toString(); 25 | var context = JSON.parse(fs.readFileSync(contextPath).toString()); 26 | 27 | var template = Hogan.compile(homepage); 28 | 29 | fs.writeFileSync(path.dirname(homeTemplatePath) + '/index.html', 30 | template.render(context)); 31 | 32 | fs.unlinkSync(homeTemplatePath); -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | REPO = git@github.com:twitter/hogan.js.git 2 | BUILD := build 3 | VERSION = ${shell node -e 'console.log(JSON.parse(require("fs").readFileSync("package.json").toString()).version);'} 4 | 5 | # 6 | # Run command line tests 7 | # 8 | phantom: 9 | @ echo 'Running phantom.js QUnit tests.' 10 | @ node test/run.js test/index.html 11 | 12 | # 13 | # Run hulk tests 14 | # 15 | hulk: 16 | @ echo 'Running hulk tests.' 17 | @ node test/hulk.js 18 | 19 | # 20 | # Run Mustache spec tests 21 | # 22 | spec: 23 | @ echo 'Running spec tests.' 24 | @ node test/spec.js 25 | @ node test/specWithGet.js 26 | 27 | test: phantom hulk spec 28 | @ echo "Testing complete.\n" 29 | 30 | # 31 | # Run benchmark 32 | # 33 | benchmark: 34 | @ node benchmark/console/index.js 35 | 36 | clean: 37 | @ rm -rf dist/* 38 | 39 | dist: 40 | @ mkdir dist 41 | @ node tools/release.js 42 | 43 | # 44 | # Make a new version of Hogan from the current dev version. 45 | # 46 | release: clean test dist 47 | @ echo "Creating a new version of Hogan." 48 | @ mkdir -p web/builds/$(VERSION) 49 | @ cp dist/*.* web/builds/$(VERSION)/. 50 | # 51 | # Make the gh-pages website 52 | # 53 | # This target builds the hogan.js github website using hogan.js. 54 | # 55 | # cd into build/gh-pages to check in the new site. 56 | # 57 | GH_PAGES = $(BUILD)/gh-pages 58 | web: | pages 59 | @cp -R web/* $(GH_PAGES) 60 | @@ node tools/web_templates.js 61 | @echo 62 | @echo "Website built in $(GH_PAGES)." 63 | 64 | # 65 | # Checkout the gh-pages branch. 66 | # 67 | pages: | $(BUILD) 68 | @if [ ! -d "$(GH_PAGES)" ]; then \ 69 | git clone -b gh-pages $(REPO) $(GH_PAGES); \ 70 | rm -rf $(GH_PAGES)/*; \ 71 | fi; 72 | @mkdir -p $(GH_PAGES)/images 73 | 74 | $(BUILD): 75 | mkdir -p $(BUILD) 76 | 77 | .PHONY: test spec benchmark web release 78 | -------------------------------------------------------------------------------- /test/run.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | var fs = require('fs'); 4 | var path = require('path'); 5 | var jsdom = require('jsdom').jsdom; 6 | var step = require('step'); 7 | 8 | step(function() { 9 | var group = this.group(); 10 | process.argv.slice(2).forEach(function(file) { 11 | run(file, group()); 12 | }); 13 | }, function(err, runs) { 14 | if (err) throw err; 15 | var failed = 0; 16 | runs.forEach(function(run) { 17 | failed += report(run); 18 | }); 19 | if (failed) console.log(failed + ' failed'); 20 | process.exit(Number(!!failed)); 21 | }); 22 | 23 | function run(file, callback) { 24 | var self = this; 25 | fs.readFile(file, function(err, buffer) { 26 | if (err) throw err; 27 | var html = buffer.toString(); 28 | var url = path.resolve('.', path.dirname(file)); 29 | var window = jsdom(html, null, {url: url + '/'}).createWindow(); 30 | // silence QUnit error logging 31 | if (window.console) { 32 | window.console.error = window.console.warn = function(){}; 33 | } 34 | window.onload = function(){ 35 | window.QUnit.done = function() { 36 | callback(null, {file: file, window: window}); 37 | }; 38 | }; 39 | }); 40 | } 41 | 42 | function report(run) { 43 | var window = run.window, file = run.file, jQuery = window.jQuery; 44 | jQuery('#qunit-tests > .fail').each(function(i, el) { 45 | el = jQuery(el); 46 | console.log(el.find('.test-name').text()); 47 | el.find('> ol > .fail', this).each(function(i, el) { 48 | el = jQuery(el); 49 | console.log('\t' + el.find('.test-message').text()); 50 | console.log('\t\t' + el.find('.test-expected').text()); 51 | console.log('\t\t' + el.find('.test-actual').text()); 52 | console.log('\t\t' + el.find('.test-source').text()); 53 | }); 54 | }); 55 | return +jQuery('#qunit-testresult .failed').text(); 56 | } 57 | -------------------------------------------------------------------------------- /wrappers/mustache.js.mustache: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2011 Twitter, Inc. 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | // A wrapper for compatibility with Mustache.js, quirks and all 17 | 18 | {{{template}}} 19 | {{{compiler}}} 20 | 21 | var Mustache = (function (Hogan) { 22 | 23 | // Mustache.js has non-spec partial context behavior 24 | function mustachePartial(name, context, partials, indent) { 25 | var partialScope = this.f(name, context, partials, 0); 26 | var cx = context; 27 | if (partialScope) { 28 | cx = cx.concat(partialScope); 29 | } 30 | 31 | return Hogan.Template.prototype.rp.call(this, name, cx, partials, indent); 32 | } 33 | 34 | var HoganTemplateWrapper = function(renderFunc, text, compiler){ 35 | this.rp = mustachePartial; 36 | Hogan.Template.call(this, renderFunc, text, compiler); 37 | }; 38 | HoganTemplateWrapper.prototype = Hogan.Template.prototype; 39 | 40 | // Add a wrapper for Hogan's generate method. Mustache and Hogan keep 41 | // separate caches, and Mustache returns wrapped templates. 42 | var wrapper; 43 | var HoganWrapper = function(){ 44 | this.cache = {}; 45 | this.generate = function(code, text, options) { 46 | return new HoganTemplateWrapper(new Function('c', 'p', 'i', code), text, wrapper); 47 | } 48 | }; 49 | HoganWrapper.prototype = Hogan; 50 | wrapper = new HoganWrapper(); 51 | 52 | return { 53 | to_html: function(text, data, partials, sendFun) { 54 | var template = wrapper.compile(text); 55 | var result = template.render(data, partials); 56 | if (!sendFun) { 57 | return result; 58 | } 59 | 60 | sendFun(result); 61 | } 62 | } 63 | 64 | })(Hogan); 65 | -------------------------------------------------------------------------------- /web/builds/1.0.4/template-1.0.4.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @preserve Copyright 2012 Twitter, Inc. 3 | * @license http://www.apache.org/licenses/LICENSE-2.0.txt 4 | */ 5 | var Hogan={};(function(a,b){function i(a){return a=String(a===null||a===undefined?"":a),h.test(a)?a.replace(c,"&").replace(d,"<").replace(e,">").replace(f,"'").replace(g,"""):a}a.Template=function(a,c,d,e){this.r=a||this.r,this.c=d,this.options=e,this.text=c||"",this.buf=b?[]:""},a.Template.prototype={r:function(a,b,c){return""},v:i,render:function(b,c,d){return this.ri([b],c||{},d)},ri:function(a,b,c){return this.r(a,b,c)},rp:function(a,b,c,d){var e=c[a];return e?(this.c&&typeof e=="string"&&(e=this.c.compile(e,this.options)),e.ri(b,c,d)):""},rs:function(a,b,c){var d=a[a.length-1];if(!j(d)){c(a,b,this);return}for(var e=0;e=0;h--){f=b[h];if(f&&typeof f=="object"&&a in f){e=f[a],g=!0;break}}return g?(!d&&typeof e=="function"&&(e=this.lv(e,b,c)),e):d?!1:""},ho:function(a,b,c,d,e){var f=this.c,g=a.call(b,d,function(a){return f.compile(a,{delimiters:e}).render(b,c)});return this.b(f.compile(g.toString(),{delimiters:e}).render(b,c)),!1},b:b?function(a){this.buf.push(a)}:function(a){this.buf+=a},fl:b?function(){var a=this.buf.join("");return this.buf=[],a}:function(){var a=this.buf;return this.buf="",a},ls:function(a,b,c,d,e,f,g){var h=b[b.length-1],i=null;if(!d&&this.c&&a.length>0)return this.ho(a,h,c,this.text.substring(e,f),g);i=a.call(h);if(typeof i=="function"){if(d)return!0;if(this.c)return this.ho(i,h,c,this.text.substring(e,f),g)}return i},lv:function(a,b,c){var d=b[b.length-1],e=a.call(d);return typeof e=="function"&&(e=e.call(d)),e=e.toString(),this.c&&~e.indexOf("{{")?this.c.compile(e).render(d,c):e}};var c=/&/g,d=//g,f=/\'/g,g=/\"/g,h=/[&<>\"\']/,j=Array.isArray||function(a){return Object.prototype.toString.call(a)==="[object Array]"}})(typeof exports!="undefined"?exports:Hogan) -------------------------------------------------------------------------------- /web/builds/2.0.0/template-2.0.0.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @preserve Copyright 2012 Twitter, Inc. 3 | * @license http://www.apache.org/licenses/LICENSE-2.0.txt 4 | */ 5 | var Hogan={};(function(a,b){function i(a){return String(a===null||a===undefined?"":a)}function j(a){return a=i(a),h.test(a)?a.replace(c,"&").replace(d,"<").replace(e,">").replace(f,"'").replace(g,"""):a}a.Template=function(a,c,d,e){this.r=a||this.r,this.c=d,this.options=e,this.text=c||"",this.buf=b?[]:""},a.Template.prototype={r:function(a,b,c){return""},v:j,t:i,render:function(b,c,d){return this.ri([b],c||{},d)},ri:function(a,b,c){return this.r(a,b,c)},rp:function(a,b,c,d){var e=c[a];return e?(this.c&&typeof e=="string"&&(e=this.c.compile(e,this.options)),e.ri(b,c,d)):""},rs:function(a,b,c){var d=a[a.length-1];if(!k(d)){c(a,b,this);return}for(var e=0;e=0;h--){f=b[h];if(f&&typeof f=="object"&&a in f){e=f[a],g=!0;break}}return g?(!d&&typeof e=="function"&&(e=this.lv(e,b,c)),e):d?!1:""},ho:function(a,b,c,d,e){var f=this.c,g=this.options;g.delimiters=e;var d=a.call(b,d);return d=d==null?String(d):d.toString(),this.b(f.compile(d,g).render(b,c)),!1},b:b?function(a){this.buf.push(a)}:function(a){this.buf+=a},fl:b?function(){var a=this.buf.join("");return this.buf=[],a}:function(){var a=this.buf;return this.buf="",a},ls:function(a,b,c,d,e,f,g){var h=b[b.length-1],i=null;if(!d&&this.c&&a.length>0)return this.ho(a,h,c,this.text.substring(e,f),g);i=a.call(h);if(typeof i=="function"){if(d)return!0;if(this.c)return this.ho(i,h,c,this.text.substring(e,f),g)}return i},lv:function(a,b,c){var d=b[b.length-1],e=a.call(d);if(typeof e=="function"){e=i(e.call(d));if(this.c&&~e.indexOf("{{"))return this.c.compile(e,this.options).render(d,c)}return i(e)}};var c=/&/g,d=//g,f=/\'/g,g=/\"/g,h=/[&<>\"\']/,k=Array.isArray||function(a){return Object.prototype.toString.call(a)==="[object Array]"}})(typeof exports!="undefined"?exports:Hogan) -------------------------------------------------------------------------------- /web/builds/1.0.5/template-1.0.5.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @preserve Copyright 2012 Twitter, Inc. 3 | * @license http://www.apache.org/licenses/LICENSE-2.0.txt 4 | */ 5 | var Hogan={};(function(a,b){function i(a){return String(a===null||a===undefined?"":a)}function j(a){return a=i(a),h.test(a)?a.replace(c,"&").replace(d,"<").replace(e,">").replace(f,"'").replace(g,"""):a}a.Template=function(a,c,d,e){this.r=a||this.r,this.c=d,this.options=e,this.text=c||"",this.buf=b?[]:""},a.Template.prototype={r:function(a,b,c){return""},v:j,t:i,render:function(b,c,d){return this.ri([b],c||{},d)},ri:function(a,b,c){return this.r(a,b,c)},rp:function(a,b,c,d){var e=c[a];return e?(this.c&&typeof e=="string"&&(e=this.c.compile(e,this.options)),e.ri(b,c,d)):""},rs:function(a,b,c){var d=a[a.length-1];if(!k(d)){c(a,b,this);return}for(var e=0;e=0;h--){f=b[h];if(f&&typeof f=="object"&&a in f){e=f[a],g=!0;break}}return g?(!d&&typeof e=="function"&&(e=this.lv(e,b,c)),e):d?!1:""},ho:function(a,b,c,d,e){var f=this.c,g=this.options;g.delimiters=e;var h=a.call(b,d,function(a){return f.compile(a,g).render(b,c)});return this.b(f.compile(h.toString(),g).render(b,c)),!1},b:b?function(a){this.buf.push(a)}:function(a){this.buf+=a},fl:b?function(){var a=this.buf.join("");return this.buf=[],a}:function(){var a=this.buf;return this.buf="",a},ls:function(a,b,c,d,e,f,g){var h=b[b.length-1],i=null;if(!d&&this.c&&a.length>0)return this.ho(a,h,c,this.text.substring(e,f),g);i=a.call(h);if(typeof i=="function"){if(d)return!0;if(this.c)return this.ho(i,h,c,this.text.substring(e,f),g)}return i},lv:function(a,b,c){var d=b[b.length-1],e=a.call(d);return typeof e=="function"&&(e=e.call(d)),e=i(e),this.c&&~e.indexOf("{{")?this.c.compile(e,this.options).render(d,c):e}};var c=/&/g,d=//g,f=/\'/g,g=/\"/g,h=/[&<>\"\']/,k=Array.isArray||function(a){return Object.prototype.toString.call(a)==="[object Array]"}})(typeof exports!="undefined"?exports:Hogan) -------------------------------------------------------------------------------- /test/spec.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Twitter, Inc. 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | var Hogan = Hogan || require('../lib/hogan'); 17 | var doc = this["document"]; 18 | var fs = require('fs'); 19 | var path = require('path'); 20 | 21 | var passed = 0; 22 | var failed = 0; 23 | 24 | if (!this["output"]) { 25 | var output = function (string) { 26 | return doc ? doc.write(string + '
    ') : console.log(string); 27 | }; 28 | } 29 | 30 | function runTest(tests) { 31 | tests.forEach(function(test) { 32 | var partials = {}; 33 | for (var i in test.partials) { 34 | partials[i] = Hogan.compile(test.partials[i]); 35 | } 36 | var t = Hogan.compile(test.template); 37 | 38 | if (test.data.lambda) { 39 | var func = (new Function ('return ' + test.data.lambda.js)()); 40 | test.data.lambda = function() { return func; }; 41 | } 42 | 43 | var s = t.render(test.data, partials); 44 | is(s, test.expected, test.name + ': ' + test.desc); 45 | }); 46 | } 47 | 48 | var testDir = path.join(__dirname, 'spec/specs'); 49 | var files = fs.readdirSync(testDir) 50 | .filter(function(f) { return f.indexOf('.json') > 0; }) 51 | .map(function(f) { return testDir + '/' + f}); 52 | 53 | for (var i = 0; i < files.length; i++) { 54 | var test = JSON.parse(fs.readFileSync(files[i]).toString()); 55 | runTest(test.tests); 56 | } 57 | 58 | function is(got, expected, msg) { 59 | if (got === expected) { 60 | output("OK: " + msg); 61 | ++passed; 62 | } else { 63 | output("FAIL: " + msg); 64 | output("Expected |" + expected + "|"); 65 | output(" Got |" + got + "|"); 66 | ++failed; 67 | } 68 | } 69 | 70 | function complete() { 71 | output("\nTests Complete"); 72 | output("--------------"); 73 | output("Passed: " + passed); 74 | output("Failed: " + failed); 75 | output("\n"); 76 | } 77 | 78 | complete(); 79 | -------------------------------------------------------------------------------- /tools/release.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Twitter, Inc. 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | var fs = require('fs'); 17 | var path = require('path'); 18 | var Hogan = require(__dirname + '/../lib/hogan'); 19 | var minlicense = '/**\n* @preserve Copyright 2012 Twitter, Inc.\n* @license http://www.apache.org/licenses/LICENSE-2.0.txt\n*/\n'; 20 | 21 | function read(path) { 22 | return fs.readFileSync(path).toString() 23 | } 24 | 25 | // Good enough for little js files 26 | function copy(src, dst) { 27 | return fs.writeFileSync(dst, read(src)); 28 | } 29 | 30 | function uglify(src, dst) { 31 | var UglifyJS = require("uglify-js"); 32 | fs.writeFileSync(dst, minlicense + UglifyJS.minify(src).code); 33 | } 34 | 35 | var packageJSON = JSON.parse(read(__dirname + '/../package.json')); 36 | 37 | var version = packageJSON.version; 38 | 39 | function removeFirstComment(text) { 40 | return text.substring(text.indexOf('*/') + 2); 41 | } 42 | 43 | var context = { 44 | template: removeFirstComment(read(__dirname + '/../lib/template.js')), 45 | compiler: removeFirstComment(read(__dirname + '/../lib/compiler.js')) 46 | }; 47 | 48 | var wrapperPath = '/../wrappers/'; 49 | var wrappers = fs.readdirSync(__dirname + wrapperPath).map(function(f) { 50 | return __dirname + wrapperPath + f; 51 | }); 52 | 53 | var distPath = __dirname + '/../dist/'; 54 | wrappers.forEach(function(wrapper) { 55 | var tail = path.basename(wrapper, '.mustache'); 56 | var target = distPath + 'hogan-' + version + '.' + tail; 57 | var uglified = distPath + 'hogan-' + version + '.min.' + tail; 58 | fs.writeFileSync(target, Hogan.compile(read(wrapper)).render(context)); 59 | uglify(target, uglified); 60 | }); 61 | 62 | // Also release Hogan.Template on its own. 63 | var templateTarget = distPath + 'template-' + version + '.js'; 64 | fs.writeFileSync(templateTarget, read(__dirname + '/../lib/template.js')); 65 | uglify(templateTarget, distPath + 'template-' + version + '.min.js'); 66 | -------------------------------------------------------------------------------- /test/specWithGet.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Twitter, Inc. 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | var Hogan = Hogan || require('../lib/hogan'); 17 | var doc = this["document"]; 18 | var fs = require('fs'); 19 | 20 | var passed = 0; 21 | var failed = 0; 22 | 23 | if (!this["output"]) { 24 | var output = function (string) { 25 | return doc ? doc.write(string + '
    ') : console.log(string); 26 | }; 27 | } 28 | 29 | function runTest(tests) { 30 | tests.forEach(function(test) { 31 | var partials = {}; 32 | for (var i in test.partials) { 33 | partials[i] = Hogan.compile(test.partials[i], {modelGet: true}); 34 | } 35 | var t = Hogan.compile(test.template, {modelGet: true}); 36 | 37 | if (test.data.lambda) { 38 | var func = (new Function ('return ' + test.data.lambda.js)()); 39 | test.data.lambda = function() { return func; }; 40 | } 41 | 42 | var dataWrapper = { 43 | get: function (key) { 44 | return test.data[key]; 45 | } 46 | }; 47 | 48 | var s = t.render(dataWrapper, partials); 49 | is(s, test.expected, test.name + ': ' + test.desc); 50 | }); 51 | } 52 | 53 | var testDir = './test/spec/specs'; 54 | var files = fs.readdirSync(testDir) 55 | .filter(function(f) { return f.indexOf('.json') > 0; }) 56 | .map(function(f) { return testDir + '/' + f}); 57 | 58 | for (var i = 0; i < files.length; i++) { 59 | var test = JSON.parse(fs.readFileSync(files[i]).toString()); 60 | runTest(test.tests); 61 | } 62 | 63 | function is(got, expected, msg) { 64 | if (got === expected) { 65 | output("OK: " + msg); 66 | ++passed; 67 | } else { 68 | output("FAIL: " + msg); 69 | output("Expected |" + expected + "|"); 70 | output(" Got |" + got + "|"); 71 | ++failed; 72 | } 73 | } 74 | 75 | function complete() { 76 | output("\nTests Complete"); 77 | output("--------------"); 78 | output("Passed: " + passed); 79 | output("Failed: " + failed); 80 | output("\n"); 81 | } 82 | 83 | complete(); 84 | -------------------------------------------------------------------------------- /test/hulk.js: -------------------------------------------------------------------------------- 1 | var exec = require('child_process').exec 2 | , assert = require('assert') 3 | , fs = require('fs') 4 | , rimraf = require('rimraf') 5 | , path = require('path') 6 | , Hogan = require('../lib/hogan.js'); 7 | 8 | 9 | // help text 10 | exec('node bin/hulk', function (error, stdout, stderr) { 11 | if (error) throw error; 12 | assert(typeof stdout == 'string', 'it should have help text.'); 13 | assert(/USAGE/.test(stdout), 'has USAGE text'); 14 | assert(/NOTE/.test(stdout), 'has NOTE text about wildcard'); 15 | }); 16 | 17 | // wrapper options: --wrapper amd 18 | exec('node bin/hulk --wrapper amd test/templates/*', function (error, stdout, stderr) { 19 | if (error) throw error; 20 | var define = function (name, dep, template) { 21 | template = template(Hogan); 22 | assert(/list$/.test(name), 'name path ends in list'); 23 | assert(dep[0] === 'hogan.js', 'Make sure the "hogan" dependency is passed'); 24 | assert(typeof template == 'object', 'defined a templates.list object'); 25 | assert(typeof template.r == 'function', 'defined a templates.list.r function'); 26 | }; 27 | eval(stdout); 28 | }); 29 | 30 | // wrapper options: --outputdir 31 | exec('node bin/hulk --outputdir dist/foo test/templates/*', function (error, stdout, stderr) { 32 | if (error) throw error; 33 | assert(fs.existsSync('dist/foo'), 'dist/foo directory created'); 34 | assert(fs.existsSync('dist/foo/list.js'), 'dist/foo/list.js file created'); 35 | rimraf.sync('dist'); 36 | }); 37 | 38 | // templates wildcard 39 | exec('node bin/hulk test/templates/*', function (error, stdout, stderr) { 40 | if (error) throw error; 41 | eval(stdout); 42 | assert(typeof templates == 'object', 'defineed a templates object'); 43 | assert(typeof templates.list == 'object', 'defined a templates.list object'); 44 | assert(typeof templates.list.r == 'function', 'defined a templates.list.r function'); 45 | assert(templates.list.r() == '
      \n
    • \n
    • \n
    • \n
    • \n
    • \n
    • \n
    '); 46 | }); 47 | 48 | // templates wildcard w/ extension 49 | exec('node bin/hulk test/templates/*.mustache', function (error, stdout, stderr) { 50 | if (error) throw error; 51 | eval(stdout); 52 | assert(typeof templates == 'object', 'defineed a templates object'); 53 | assert(typeof templates.list == 'object', 'defined a templates.list object'); 54 | assert(typeof templates.list.r == 'function', 'defined a templates.list.r function'); 55 | assert(templates.list.r() == '
      \n
    • \n
    • \n
    • \n
    • \n
    • \n
    • \n
    '); 56 | }); 57 | 58 | // templates single file 59 | exec('node bin/hulk test/templates/list.mustache', function (error, stdout, stderr) { 60 | if (error) throw error; 61 | eval(stdout); 62 | assert(typeof templates == 'object', 'defineed a templates object'); 63 | assert(typeof templates.list == 'object', 'defined a templates.list object'); 64 | assert(typeof templates.list.r == 'function', 'defined a templates.list.r function'); 65 | assert(templates.list.r() == '
      \n
    • \n
    • \n
    • \n
    • \n
    • \n
    • \n
    '); 66 | }); -------------------------------------------------------------------------------- /test/mustache.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Twitter, Inc. 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | var doc = this['document']; 17 | var fs = require('fs'); 18 | 19 | var passed = 0; 20 | var failed = 0; 21 | 22 | if (!this['output']) { 23 | var output = function (string) { 24 | return doc ? doc.write(string + '
    ') : console.log(string); 25 | }; 26 | } 27 | 28 | var Hogan = require(__dirname + '/../lib/hogan'); 29 | var template = fs.readFileSync(__dirname + '/../lib/template.js').toString(); 30 | var compiler = fs.readFileSync(__dirname + '/../lib/compiler.js').toString(); 31 | var mustache_wrapper = fs.readFileSync(__dirname + '/../wrappers/mustache.js.mustache').toString(); 32 | 33 | // Create a Mustache.js emulator from the distribution template 34 | var engines = (new Function(Hogan.compile(mustache_wrapper).render({template: template, compiler: compiler}) + 35 | '; return {Hogan: Hogan, Mustache: Mustache};'))(); 36 | 37 | var Mustache = engines.Mustache; 38 | var Hogan2 = engines.Hogan; 39 | 40 | 41 | // sanity check 42 | is(Mustache.hasOwnProperty('to_html'), true, 'Mustache has to_html method.'); 43 | 44 | // Check for Mustache.js partial resolution behavior. 45 | var context = { 46 | foo: 'bar', 47 | mypartial: { 48 | baz: 'qux' 49 | } 50 | } 51 | var text = 'abc {{foo}} def {{>mypartial}} ghi'; 52 | var partialText = '{{baz}}'; 53 | var s = Mustache.to_html(text, context, {'mypartial': partialText}); 54 | is(s, 'abc bar def qux ghi', 'Correct emulation of Mustache.js partial-name-in-context resolution.'); 55 | 56 | // Now check to see that the Hogan resolution is unaffected. 57 | var t = Hogan2.compile(text); 58 | s = t.render(context, {'mypartial': partialText}); 59 | is(s, 'abc bar def ghi', 'Hogan behavior not changed by Mustache.js emulation.'); 60 | 61 | // Check for sendFun behavior 62 | var buf = ""; 63 | function send(s) { 64 | buf += "-FOO " + s + " FOO-"; 65 | } 66 | var s = Mustache.to_html(text, context, {'mypartial': partialText}, send); 67 | is(buf, '-FOO abc bar def qux ghi FOO-', 'Correct emulation of Mustache.js sendFun.'); 68 | 69 | 70 | function is(got, expected, msg) { 71 | if (got === expected) { 72 | output("OK: " + msg); 73 | ++passed; 74 | } else { 75 | output("FAIL: " + msg); 76 | output("Expected |" + expected + "|"); 77 | output(" Got |" + got + "|"); 78 | ++failed; 79 | } 80 | } 81 | 82 | function complete() { 83 | output("\nTests Complete"); 84 | output("--------------"); 85 | output("Passed: " + passed); 86 | output("Failed: " + failed); 87 | output("\n"); 88 | } 89 | 90 | complete(); -------------------------------------------------------------------------------- /web/builds/3.0.2/template-3.0.2.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @preserve Copyright 2012 Twitter, Inc. 3 | * @license http://www.apache.org/licenses/LICENSE-2.0.txt 4 | */ 5 | var Hogan={};!function(t){function i(t,i,s){var e;return i&&"object"==typeof i&&(void 0!==i[t]?e=i[t]:s&&i.get&&"function"==typeof i.get&&(e=i.get(t))),e}function s(t,i,s,e,n,r){function o(){}function u(){}o.prototype=t,u.prototype=t.subs;var a,c=new o;c.subs=new u,c.subsText={},c.buf="",e=e||{},c.stackSubs=e,c.subsText=r;for(a in i)e[a]||(e[a]=i[a]);for(a in e)c.subs[a]=e[a];n=n||{},c.stackPartials=n;for(a in s)n[a]||(n[a]=s[a]);for(a in n)c.partials[a]=n[a];return c}function e(t){return String(null===t||void 0===t?"":t)}function n(t){return t=e(t),h.test(t)?t.replace(r,"&").replace(o,"<").replace(u,">").replace(a,"'").replace(c,"""):t}t.Template=function(t,i,s,e){t=t||{},this.r=t.code||this.r,this.c=s,this.options=e||{},this.text=i||"",this.partials=t.partials||{},this.subs=t.subs||{},this.buf=""},t.Template.prototype={r:function(){return""},v:n,t:e,render:function(t,i,s){return this.ri([t],i||{},s)},ri:function(t,i,s){return this.r(t,i,s)},ep:function(t,i){var e=this.partials[t],n=i[e.name];if(e.instance&&e.base==n)return e.instance;if("string"==typeof n){if(!this.c)throw new Error("No compiler available.");n=this.c.compile(n,this.options)}if(!n)return null;if(this.partials[t].base=n,e.subs){i.stackText||(i.stackText={});for(key in e.subs)i.stackText[key]||(i.stackText[key]=void 0!==this.activeSub&&i.stackText[this.activeSub]?i.stackText[this.activeSub]:this.text);n=s(n,e.subs,e.partials,this.stackSubs,this.stackPartials,i.stackText)}return this.partials[t].instance=n,n},rp:function(t,i,s,e){var n=this.ep(t,s);return n?n.ri(i,s,e):""},rs:function(t,i,s){var e=t[t.length-1];if(!f(e))return void s(t,i,this);for(var n=0;n=0;c--)if(o=s[c],r=i(t,o,a),void 0!==r){u=!0;break}return u?(n||"function"!=typeof r||(r=this.mv(r,s,e)),r):n?!1:""},ls:function(t,i,s,n,r){var o=this.options.delimiters;return this.options.delimiters=r,this.b(this.ct(e(t.call(i,n)),i,s)),this.options.delimiters=o,!1},ct:function(t,i,s){if(this.options.disableLambda)throw new Error("Lambda features disabled.");return this.c.compile(t,this.options).render(i,s)},b:function(t){this.buf+=t},fl:function(){var t=this.buf;return this.buf="",t},ms:function(t,i,s,e,n,r,o){var u,a=i[i.length-1],c=t.call(a);return"function"==typeof c?e?!0:(u=this.activeSub&&this.subsText&&this.subsText[this.activeSub]?this.subsText[this.activeSub]:this.text,this.ls(c,a,s,u.substring(n,r),o)):c},mv:function(t,i,s){var n=i[i.length-1],r=t.call(n);return"function"==typeof r?this.ct(e(r.call(n)),n,s):r},sub:function(t,i,s,e){var n=this.subs[t];n&&(this.activeSub=t,n(i,s,this,e),this.activeSub=!1)}};var r=/&/g,o=//g,a=/\'/g,c=/\"/g,h=/[&<>\"\']/,f=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}}("undefined"!=typeof exports?exports:Hogan); -------------------------------------------------------------------------------- /web/builds/3.0.1/hogan.template-3.0.1.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @preserve Copyright 2012 Twitter, Inc. 3 | * @license http://www.apache.org/licenses/LICENSE-2.0.txt 4 | */ 5 | var Hogan={};(function(e){function t(e,t,n){var r,i;return t&&typeof t=="object"&&(t[e]!=null?r=t[e]:n&&t.get&&typeof t.get=="function"&&(r=t.get(e))),r}function n(e,t,n,r,i,s){function o(){}function u(){}o.prototype=e,u.prototype=e.subs;var a,f=new o;f.subs=new u,f.subsText={},f.buf="",r=r||{},f.stackSubs=r,f.subsText=s;for(a in t)r[a]||(r[a]=t[a]);for(a in r)f.subs[a]=r[a];i=i||{},f.stackPartials=i;for(a in n)i[a]||(i[a]=n[a]);for(a in i)f.partials[a]=i[a];return f}function f(e){return String(e===null||e===undefined?"":e)}function l(e){return e=f(e),a.test(e)?e.replace(r,"&").replace(i,"<").replace(s,">").replace(o,"'").replace(u,"""):e}e.Template=function(e,t,n,r){e=e||{},this.r=e.code||this.r,this.c=n,this.options=r||{},this.text=t||"",this.partials=e.partials||{},this.subs=e.subs||{},this.buf=""},e.Template.prototype={r:function(e,t,n){return""},v:l,t:f,render:function(t,n,r){return this.ri([t],n||{},r)},ri:function(e,t,n){return this.r(e,t,n)},ep:function(e,t){var r=this.partials[e],i=t[r.name];if(r.instance&&r.base==i)return r.instance;if(typeof i=="string"){if(!this.c)throw new Error("No compiler available.");i=this.c.compile(i,this.options)}if(!i)return null;this.partials[e].base=i;if(r.subs){t.stackText||(t.stackText={});for(key in r.subs)t.stackText[key]||(t.stackText[key]=this.activeSub!==undefined&&t.stackText[this.activeSub]?t.stackText[this.activeSub]:this.text);i=n(i,r.subs,r.partials,this.stackSubs,this.stackPartials,t.stackText)}return this.partials[e].instance=i,i},rp:function(e,t,n,r){var i=this.ep(e,n);return i?i.ri(t,n,r):""},rs:function(e,t,n){var r=e[e.length-1];if(!c(r)){n(e,t,this);return}for(var i=0;i=0;f--){o=n[f],s=t(e,o,a);if(s!=null){u=!0;break}}return u?(!i&&typeof s=="function"&&(s=this.mv(s,n,r)),s):i?!1:""},ls:function(e,t,n,r,i){var s=this.options.delimiters;return this.options.delimiters=i,this.b(this.ct(f(e.call(t,r)),t,n)),this.options.delimiters=s,!1},ct:function(e,t,n){if(this.options.disableLambda)throw new Error("Lambda features disabled.");return this.c.compile(e,this.options).render(t,n)},b:function(e){this.buf+=e},fl:function(){var e=this.buf;return this.buf="",e},ms:function(e,t,n,r,i,s,o){var u,a=t[t.length-1],f=e.call(a);return typeof f=="function"?r?!0:(u=this.activeSub&&this.subsText&&this.subsText[this.activeSub]?this.subsText[this.activeSub]:this.text,this.ls(f,a,n,u.substring(i,s),o)):f},mv:function(e,t,n){var r=t[t.length-1],i=e.call(r);return typeof i=="function"?this.ct(f(i.call(r)),r,n):i},sub:function(e,t,n,r){var i=this.subs[e];i&&(this.activeSub=e,i(t,n,this,r),this.activeSub=!1)}};var r=/&/g,i=//g,o=/\'/g,u=/\"/g,a=/[&<>\"\']/,c=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"}})(typeof exports!="undefined"?exports:Hogan) -------------------------------------------------------------------------------- /web/builds/3.0.1/hogan.template-3.0.1.min.amd.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @preserve Copyright 2012 Twitter, Inc. 3 | * @license http://www.apache.org/licenses/LICENSE-2.0.txt 4 | */ 5 | var Hogan={};(function(e){function t(e,t,n){var r,i;return t&&typeof t=="object"&&(t[e]!=null?r=t[e]:n&&t.get&&typeof t.get=="function"&&(r=t.get(e))),r}function n(e,t,n,r,i,s){function o(){}function u(){}o.prototype=e,u.prototype=e.subs;var a,f=new o;f.subs=new u,f.subsText={},f.buf="",r=r||{},f.stackSubs=r,f.subsText=s;for(a in t)r[a]||(r[a]=t[a]);for(a in r)f.subs[a]=r[a];i=i||{},f.stackPartials=i;for(a in n)i[a]||(i[a]=n[a]);for(a in i)f.partials[a]=i[a];return f}function f(e){return String(e===null||e===undefined?"":e)}function l(e){return e=f(e),a.test(e)?e.replace(r,"&").replace(i,"<").replace(s,">").replace(o,"'").replace(u,"""):e}e.Template=function(e,t,n,r){e=e||{},this.r=e.code||this.r,this.c=n,this.options=r||{},this.text=t||"",this.partials=e.partials||{},this.subs=e.subs||{},this.buf=""},e.Template.prototype={r:function(e,t,n){return""},v:l,t:f,render:function(t,n,r){return this.ri([t],n||{},r)},ri:function(e,t,n){return this.r(e,t,n)},ep:function(e,t){var r=this.partials[e],i=t[r.name];if(r.instance&&r.base==i)return r.instance;if(typeof i=="string"){if(!this.c)throw new Error("No compiler available.");i=this.c.compile(i,this.options)}if(!i)return null;this.partials[e].base=i;if(r.subs){t.stackText||(t.stackText={});for(key in r.subs)t.stackText[key]||(t.stackText[key]=this.activeSub!==undefined&&t.stackText[this.activeSub]?t.stackText[this.activeSub]:this.text);i=n(i,r.subs,r.partials,this.stackSubs,this.stackPartials,t.stackText)}return this.partials[e].instance=i,i},rp:function(e,t,n,r){var i=this.ep(e,n);return i?i.ri(t,n,r):""},rs:function(e,t,n){var r=e[e.length-1];if(!c(r)){n(e,t,this);return}for(var i=0;i=0;f--){o=n[f],s=t(e,o,a);if(s!=null){u=!0;break}}return u?(!i&&typeof s=="function"&&(s=this.mv(s,n,r)),s):i?!1:""},ls:function(e,t,n,r,i){var s=this.options.delimiters;return this.options.delimiters=i,this.b(this.ct(f(e.call(t,r)),t,n)),this.options.delimiters=s,!1},ct:function(e,t,n){if(this.options.disableLambda)throw new Error("Lambda features disabled.");return this.c.compile(e,this.options).render(t,n)},b:function(e){this.buf+=e},fl:function(){var e=this.buf;return this.buf="",e},ms:function(e,t,n,r,i,s,o){var u,a=t[t.length-1],f=e.call(a);return typeof f=="function"?r?!0:(u=this.activeSub&&this.subsText&&this.subsText[this.activeSub]?this.subsText[this.activeSub]:this.text,this.ls(f,a,n,u.substring(i,s),o)):f},mv:function(e,t,n){var r=t[t.length-1],i=e.call(r);return typeof i=="function"?this.ct(f(i.call(r)),r,n):i},sub:function(e,t,n,r){var i=this.subs[e];i&&(this.activeSub=e,i(t,n,this,r),this.activeSub=!1)}};var r=/&/g,i=//g,o=/\'/g,u=/\"/g,a=/[&<>\"\']/,c=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"}})(typeof exports!="undefined"?exports:Hogan),typeof define=="function"&&define.amd&&define(Hogan) -------------------------------------------------------------------------------- /web/builds/3.0.1/hogan.template-3.0.1.min.common.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @preserve Copyright 2012 Twitter, Inc. 3 | * @license http://www.apache.org/licenses/LICENSE-2.0.txt 4 | */ 5 | var Hogan={};(function(e){function t(e,t,n){var r,i;return t&&typeof t=="object"&&(t[e]!=null?r=t[e]:n&&t.get&&typeof t.get=="function"&&(r=t.get(e))),r}function n(e,t,n,r,i,s){function o(){}function u(){}o.prototype=e,u.prototype=e.subs;var a,f=new o;f.subs=new u,f.subsText={},f.buf="",r=r||{},f.stackSubs=r,f.subsText=s;for(a in t)r[a]||(r[a]=t[a]);for(a in r)f.subs[a]=r[a];i=i||{},f.stackPartials=i;for(a in n)i[a]||(i[a]=n[a]);for(a in i)f.partials[a]=i[a];return f}function f(e){return String(e===null||e===undefined?"":e)}function l(e){return e=f(e),a.test(e)?e.replace(r,"&").replace(i,"<").replace(s,">").replace(o,"'").replace(u,"""):e}e.Template=function(e,t,n,r){e=e||{},this.r=e.code||this.r,this.c=n,this.options=r||{},this.text=t||"",this.partials=e.partials||{},this.subs=e.subs||{},this.buf=""},e.Template.prototype={r:function(e,t,n){return""},v:l,t:f,render:function(t,n,r){return this.ri([t],n||{},r)},ri:function(e,t,n){return this.r(e,t,n)},ep:function(e,t){var r=this.partials[e],i=t[r.name];if(r.instance&&r.base==i)return r.instance;if(typeof i=="string"){if(!this.c)throw new Error("No compiler available.");i=this.c.compile(i,this.options)}if(!i)return null;this.partials[e].base=i;if(r.subs){t.stackText||(t.stackText={});for(key in r.subs)t.stackText[key]||(t.stackText[key]=this.activeSub!==undefined&&t.stackText[this.activeSub]?t.stackText[this.activeSub]:this.text);i=n(i,r.subs,r.partials,this.stackSubs,this.stackPartials,t.stackText)}return this.partials[e].instance=i,i},rp:function(e,t,n,r){var i=this.ep(e,n);return i?i.ri(t,n,r):""},rs:function(e,t,n){var r=e[e.length-1];if(!c(r)){n(e,t,this);return}for(var i=0;i=0;f--){o=n[f],s=t(e,o,a);if(s!=null){u=!0;break}}return u?(!i&&typeof s=="function"&&(s=this.mv(s,n,r)),s):i?!1:""},ls:function(e,t,n,r,i){var s=this.options.delimiters;return this.options.delimiters=i,this.b(this.ct(f(e.call(t,r)),t,n)),this.options.delimiters=s,!1},ct:function(e,t,n){if(this.options.disableLambda)throw new Error("Lambda features disabled.");return this.c.compile(e,this.options).render(t,n)},b:function(e){this.buf+=e},fl:function(){var e=this.buf;return this.buf="",e},ms:function(e,t,n,r,i,s,o){var u,a=t[t.length-1],f=e.call(a);return typeof f=="function"?r?!0:(u=this.activeSub&&this.subsText&&this.subsText[this.activeSub]?this.subsText[this.activeSub]:this.text,this.ls(f,a,n,u.substring(i,s),o)):f},mv:function(e,t,n){var r=t[t.length-1],i=e.call(r);return typeof i=="function"?this.ct(f(i.call(r)),r,n):i},sub:function(e,t,n,r){var i=this.subs[e];i&&(this.activeSub=e,i(t,n,this,r),this.activeSub=!1)}};var r=/&/g,i=//g,o=/\'/g,u=/\"/g,a=/[&<>\"\']/,c=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"}})(typeof exports!="undefined"?exports:Hogan),typeof module!="undefined"&&module.exports&&(module.exports=Hogan) -------------------------------------------------------------------------------- /web/builds/3.0.1/hogan.template-3.0.1.min.mustache.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @preserve Copyright 2012 Twitter, Inc. 3 | * @license http://www.apache.org/licenses/LICENSE-2.0.txt 4 | */ 5 | var Hogan={};(function(e){function t(e,t,n){var r,i;return t&&typeof t=="object"&&(t[e]!=null?r=t[e]:n&&t.get&&typeof t.get=="function"&&(r=t.get(e))),r}function n(e,t,n,r,i,s){function o(){}function u(){}o.prototype=e,u.prototype=e.subs;var a,f=new o;f.subs=new u,f.subsText={},f.buf="",r=r||{},f.stackSubs=r,f.subsText=s;for(a in t)r[a]||(r[a]=t[a]);for(a in r)f.subs[a]=r[a];i=i||{},f.stackPartials=i;for(a in n)i[a]||(i[a]=n[a]);for(a in i)f.partials[a]=i[a];return f}function f(e){return String(e===null||e===undefined?"":e)}function l(e){return e=f(e),a.test(e)?e.replace(r,"&").replace(i,"<").replace(s,">").replace(o,"'").replace(u,"""):e}e.Template=function(e,t,n,r){e=e||{},this.r=e.code||this.r,this.c=n,this.options=r||{},this.text=t||"",this.partials=e.partials||{},this.subs=e.subs||{},this.buf=""},e.Template.prototype={r:function(e,t,n){return""},v:l,t:f,render:function(t,n,r){return this.ri([t],n||{},r)},ri:function(e,t,n){return this.r(e,t,n)},ep:function(e,t){var r=this.partials[e],i=t[r.name];if(r.instance&&r.base==i)return r.instance;if(typeof i=="string"){if(!this.c)throw new Error("No compiler available.");i=this.c.compile(i,this.options)}if(!i)return null;this.partials[e].base=i;if(r.subs){t.stackText||(t.stackText={});for(key in r.subs)t.stackText[key]||(t.stackText[key]=this.activeSub!==undefined&&t.stackText[this.activeSub]?t.stackText[this.activeSub]:this.text);i=n(i,r.subs,r.partials,this.stackSubs,this.stackPartials,t.stackText)}return this.partials[e].instance=i,i},rp:function(e,t,n,r){var i=this.ep(e,n);return i?i.ri(t,n,r):""},rs:function(e,t,n){var r=e[e.length-1];if(!c(r)){n(e,t,this);return}for(var i=0;i=0;f--){o=n[f],s=t(e,o,a);if(s!=null){u=!0;break}}return u?(!i&&typeof s=="function"&&(s=this.mv(s,n,r)),s):i?!1:""},ls:function(e,t,n,r,i){var s=this.options.delimiters;return this.options.delimiters=i,this.b(this.ct(f(e.call(t,r)),t,n)),this.options.delimiters=s,!1},ct:function(e,t,n){if(this.options.disableLambda)throw new Error("Lambda features disabled.");return this.c.compile(e,this.options).render(t,n)},b:function(e){this.buf+=e},fl:function(){var e=this.buf;return this.buf="",e},ms:function(e,t,n,r,i,s,o){var u,a=t[t.length-1],f=e.call(a);return typeof f=="function"?r?!0:(u=this.activeSub&&this.subsText&&this.subsText[this.activeSub]?this.subsText[this.activeSub]:this.text,this.ls(f,a,n,u.substring(i,s),o)):f},mv:function(e,t,n){var r=t[t.length-1],i=e.call(r);return typeof i=="function"?this.ct(f(i.call(r)),r,n):i},sub:function(e,t,n,r){var i=this.subs[e];i&&(this.activeSub=e,i(t,n,this,r),this.activeSub=!1)}};var r=/&/g,i=//g,o=/\'/g,u=/\"/g,a=/[&<>\"\']/,c=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"}})(typeof exports!="undefined"?exports:Hogan);var Mustache=function(e){function t(t,n,r,i){var s=this.f(t,n,r,0),o=n;return s&&(o=o.concat(s)),e.Template.prototype.rp.call(this,t,o,r,i)}var n=function(n,r,i){this.rp=t,e.Template.call(this,n,r,i)};n.prototype=e.Template.prototype;var r,i=function(){this.cache={},this.generate=function(e,t,i){return new n(new Function("c","p","i",e),t,r)}};return i.prototype=e,r=new i,{to_html:function(e,t,n,i){var s=r.compile(e),o=s.render(t,n);if(!i)return o;i(o)}}}(Hogan) -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Hogan.js - A mustache compiler. [![Build Status](https://secure.travis-ci.org/twitter/hogan.js.png)](http://travis-ci.org/twitter/hogan.js) 2 | 3 | [Hogan.js](http://twitter.github.io/hogan.js/) is a compiler for the 4 | [Mustache](http://mustache.github.io/) templating language. For information 5 | on Mustache, see the [manpage](http://mustache.github.com/mustache.5.html) and 6 | the [spec](https://github.com/mustache/spec). 7 | 8 | ## Basics 9 | 10 | Hogan compiles templates to HoganTemplate objects, which have a render method. 11 | 12 | ```js 13 | var data = { 14 | screenName: "dhg", 15 | }; 16 | 17 | var template = Hogan.compile("Follow @{{screenName}}."); 18 | var output = template.render(data); 19 | 20 | // prints "Follow @dhg." 21 | console.log(output); 22 | ``` 23 | 24 | ## Features 25 | 26 | Hogan is fast--try it on your workload. 27 | 28 | Hogan has separate scanning, parsing and code generation phases. This way it's 29 | possible to add new features without touching the scanner at all, and many 30 | different code generation techniques can be tried without changing the parser. 31 | 32 | Hogan exposes scan and parse methods. These can be useful for 33 | pre-processing templates on the server. 34 | 35 | ```js 36 | var text = "{{^check}}{{#i18n}}No{{/i18n}}{{/check}}"; 37 | text += "{{#check}}{{#i18n}}Yes{{/i18n}}{{/check}}"; 38 | var tree = Hogan.parse(Hogan.scan(text)); 39 | 40 | // outputs "# check" 41 | console.log(tree[0].tag + " " + tree[0].name); 42 | 43 | // outputs "Yes" 44 | console.log(tree[1].nodes[0].nodes[0]); 45 | ``` 46 | 47 | It's also possible to use HoganTemplate objects without the Hogan compiler 48 | present. That means you can pre-compile your templates on the server, and 49 | avoid shipping the compiler. However, the optional lambda features from the 50 | Mustache spec require the compiler and the original template source to be present. 51 | 52 | Hogan also supports [template inheritance](https://github.com/mustache/spec/pull/75), 53 | and maintains compatibility with other implementations like [mustache.java](https://github.com/spullara/mustache.java), 54 | [mustache.php](https://github.com/bobthecow/mustache.php), and [GRMustache](https://github.com/groue/GRMustache) 55 | 56 | ## Why Hogan.js? 57 | 58 | Why another templating library? 59 | 60 | Hogan.js was written to meet three templating library requirements: good 61 | performance, standalone template objects, and a parser API. 62 | 63 | # Install 64 | 65 | ## Node.js 66 | 67 | ``` 68 | npm install hogan.js 69 | ``` 70 | 71 | ## component 72 | 73 | ``` 74 | component install twitter/hogan.js 75 | ``` 76 | 77 | ## Compilation options 78 | 79 | The second argument to Hogan.compile is an options hash. 80 | 81 | ```js 82 | var text = "my <%example%> template." 83 | Hogan.compile(text, {delimiters: '<% %>'}); 84 | ``` 85 | 86 | There are currently four valid options. 87 | 88 | asString: return the compiled template as a string. This feature is used 89 | by hulk to produce strings containing pre-compiled templates. 90 | 91 | sectionTags: allow custom tags that require opening and closing tags, and 92 | treat them as though they were section tags. 93 | 94 | ```js 95 | var text = "my {{_foo}}example{{/foo}} template." 96 | Hogan.compile(text, { sectionTags: [{o: '_foo', c: 'foo'}]}); 97 | ``` 98 | 99 | The value is an array of object with o and c fields that indicate names 100 | for custom section tags. The example above allows parsing of {{_foo}}{{/foo}}. 101 | 102 | delimiters: A string that overrides the default delimiters. Example: "<% %>". 103 | 104 | disableLambda: disables the higher-order sections / lambda-replace features of Mustache. 105 | 106 | ## Issues 107 | 108 | Have a bug? Please create an issue here on GitHub! 109 | 110 | https://github.com/twitter/hogan.js/issues 111 | 112 | ## Versioning 113 | 114 | For transparency and insight into our release cycle, releases will be numbered with the follow format: 115 | 116 | `..` 117 | 118 | And constructed with the following guidelines: 119 | 120 | * Breaking backwards compatibility bumps the major 121 | * New additions without breaking backwards compatibility bumps the minor 122 | * Bug fixes and misc changes bump the patch 123 | 124 | For more information on semantic versioning, please visit http://semver.org/. 125 | 126 | ## Testing 127 | 128 | To run the tests you first need to update all git submodules. 129 | 130 | $ git submodule init 131 | $ git submodule update 132 | 133 | Unit tests are written using [QUnit](http://qunitjs.com/). To run them, open `test/index.html` 134 | in a browser. 135 | 136 | Use [node](http://nodejs.org/) to run all tests from the 137 | [mustache spec](https://github.com/mustache/spec). 138 | 139 | $ node test/spec.js 140 | 141 | ## Authors 142 | 143 | **Robert Sayre** 144 | 145 | + http://github.com/sayrer 146 | 147 | **Jacob Thornton** 148 | 149 | + http://github.com/fat 150 | 151 | ## License 152 | 153 | Copyright 2011 Twitter, Inc. 154 | 155 | Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0 156 | -------------------------------------------------------------------------------- /web/builds/1.0.3/hogan.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @preserve Copyright 2012 Twitter, Inc. 3 | * @license http://www.apache.org/licenses/LICENSE-2.0.txt 4 | */ 5 | var HoganTemplate=function(){function a(a){this.text=a}function h(a){return a=String(a===null?"":a),g.test(a)?a.replace(b,"&").replace(c,"<").replace(d,">").replace(e,"'").replace(f,"""):a}a.prototype={r:function(a,b,c){return""},v:h,render:function(b,c,d){return this.r(b,c,d)},rp:function(a,b,c,d){var e=c[a];return e?e.r(b,c,d):""},rs:function(a,b,c){var d="",e=a[a.length-1];if(!i(e))return d=c(a,b);for(var f=0;f=0;h--){f=b[h];if(f&&typeof f=="object"&&a in f){e=f[a],g=!0;break}}return g?(!d&&typeof e=="function"&&(e=this.lv(e,b,c)),e):d?!1:""},ho:function(a,b,c,d,e){var f=a.call(b,d,function(a){return Hogan.compile(a,{delimiters:e}).render(b,c)}),g=Hogan.compile(f.toString(),{delimiters:e}).render(b,c);return this.b=g,!1},b:"",ls:function(a,b,c,d,e,f){var g=b[b.length-1],h=a.call(g);return a.length>0?this.ho(a,g,c,this.text.substring(d,e),f):typeof h=="function"?this.ho(h,g,c,this.text.substring(d,e),f):h},lv:function(a,b,c){var d=b[b.length-1];return Hogan.compile(a.call(d).toString()).render(d,c)}};var b=/&/g,c=//g,e=/\'/g,f=/\"/g,g=/[&<>\"\']/,i=Array.isArray||function(a){return Object.prototype.toString.call(a)==="[object Array]"};return a}(),Hogan=function(){function g(b,c){function u(){n.length>0&&(o.push(new String(n)),n="")}function v(){var b=!0;for(var c=r;c"&&(d.indent=o[c].toString()),o.splice(c,1));else b||o.push({tag:"\n"});p=!1,r=o.length}function x(a,b){var c="="+t,d=a.indexOf(c,b),e=h(a.substring(a.indexOf("=",b)+1,d)).split(" ");return s=e[0],t=e[1],d+c.length-1}var d=b.length,e=0,g=1,j=2,k=e,l=null,m=null,n="",o=[],p=!1,q=0,r=0,s="{{",t="}}";c&&(c=c.split(" "),s=c[0],t=c[1]);for(q=0;q0){g=a.shift();if(g.tag=="#"||g.tag=="^"||k(g,d))c.push(g),g.nodes=j(a,g.tag,c,d),e.push(g);else{if(g.tag=="/"){if(c.length===0)throw new Error("Closing tag without opener: /"+g.n);f=c.pop();if(g.n!=f.n&&!l(g.n,f.n,d))throw new Error("Nesting error: "+f.n+" vs. "+g.n);return f.end=g.i,e}e.push(g)}}if(c.length>0)throw new Error("missing closing tag: "+c.pop().n);return e}function k(a,b){for(var c=0,d=b.length;c"?b+=s(a[c]):e=="{"||e=="&"?b+=t(a[c].n,o(a[c].n)):e=="\n"?b+=v('"\\n"'+(a.length-1==c?"":" + i")):e=="_v"?b+=u(a[c].n,o(a[c].n)):e===undefined&&(b+=v('"'+n(a[c])+'"'))}return b}function q(a,b,c,d,e,f){return"if(_.s(_."+c+'("'+n(b)+'",c,p,1),'+"c,p,0,"+d+","+e+', "'+f+'")){'+"b += _.rs(c,p,"+'function(c,p){ var b = "";'+p(a)+"return b;});c.pop();}"+'else{b += _.b; _.b = ""};'}function r(a,b,c){return"if (!_.s(_."+c+'("'+n(b)+'",c,p,1),c,p,1,0,0,"")){'+p(a)+"};"}function s(a){return'b += _.rp("'+n(a.n)+'",c[c.length - 1],p,"'+(a.indent||"")+'");'}function t(a,b){return"b += (_."+b+'("'+n(a)+'",c,p,0));'}function u(a,b){return"b += (_.v(_."+b+'("'+n(a)+'",c,p,0)));'}function v(a){return"b += "+a+";"}var a=/\S/,b=/\"/g,c=/\n/g,d=/\r/g,e=/\\/g,f={"#":1,"^":2,"/":3,"!":4,">":5,"<":6,"=":7,_v:8,"{":9,"&":10};return{scan:g,parse:function(a,b){return b=b||{},j(a,"",[],b.sectionTags||[])},cache:{},compile:function(a,b){b=b||{};var c=this.cache[a];return c?c:(c=m(this.parse(g(a,b.delimiters),b),a,b),this.cache[a]=c)}}}();typeof module!="undefined"&&module.exports?(module.exports=Hogan,module.exports.Template=HoganTemplate):typeof define=="function"&&define.amd?define(function(){return Hogan}):typeof exports!="undefined"&&(exports.Hogan=Hogan,exports.HoganTemplate=HoganTemplate) -------------------------------------------------------------------------------- /web/1.0.0/hogan.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Twitter, Inc. 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */var HoganTemplate=function(){function a(a){this.text=a}function h(a){var h=String(a===null?"":a);return g.test(h)?h.replace(b,"&").replace(c,"<").replace(d,">").replace(e,"'").replace(f,"""):h}a.prototype={r:function(a,b){return""},v:h,render:function(a,b){return this.r(a,b)},rp:function(a,b,c,d){var e=c[a];return e?e.render(b,c):""},rs:function(a,b,c){var d="",e=a[a.length-1];if(!i(e))return d=c(a,b),d;for(var f=0;f=0;h--){f=b[h];if(f&&typeof f=="object"&&a in f){e=f[a],g=!0;break}}return g?(!d&&typeof e=="function"&&(e=this.lv(e,b,c)),e):d?!1:""},ho:function(a,b,c,d){var e=a.call(b,d,function(a){return Hogan.compile(a).render(b)}),f=Hogan.compile(e.toString()).render(b,c);return this.b=f,!1},b:"",ls:function(a,b,c,d,e){var f=b[b.length-1];if(a.length>0)return this.ho(a,f,c,this.text.substring(d,e));var g=a.call(f);return typeof g=="function"?this.ho(g,f,c,this.text.substring(d,e)):g},lv:function(a,b,c){var d=b[b.length-1];return Hogan.compile(a.call(d).toString()).render(d,c)}};var b=/&/g,c=//g,e=/\'/g,f=/\"/g,g=/[&<>\"\']/,i=Array.isArray||function(a){return Object.prototype.toString.call(a)==="[object Array]"};return a}(),Hogan=function(){function a(a){function s(){l.length>0&&(m.push(new String(l)),l="")}function t(){var a=!0;for(var b=p;b0){j=a.shift();if(j.tag=="#"||j.tag=="^"||g(j,d))c.push(j),j.nodes=f(a,j.tag,c,d),e.push(j);else{if(j.tag=="/"){if(c.length==0)throw new Error("Closing tag without opener: /"+j.n);i=c.pop();if(j.n!=i.n&&!h(j.n,i.n,d))throw new Error("Nesting error: "+i.n+" vs. "+j.n);return i.end=j.i,e}e.push(j)}}if(c.length>0)throw new Error("missing closing tag: "+c.pop().n);return e}function g(a,b){for(var c=0,d=b.length;c"?b+=s(a[c].n):e=="{"||e=="&"?b+=t(a[c].n,o(a[c].n)):e=="\n"?b+=v("\n"):e=="_v"?b+=u(a[c].n,o(a[c].n)):e===undefined&&(b+=v(a[c]))}return b}function q(a,b,c,d,e){var f="if(_.s(_."+c+'("'+n(b)+'",c,p,1),';return f+="c,p,0,"+d+","+e+")){",f+="b += _.rs(c,p,",f+='function(c,p){ var b = "";',f+=p(a),f+="return b;});c.pop();}",f+='else{b += _.b; _.b = ""};',f}function r(a,b,c){var d="if (!_.s(_."+c+'("'+n(b)+'",c,p,1),c,p,1,0,0)){';return d+=p(a),d+="};",d}function s(a){return'b += _.rp("'+n(a)+'",c[c.length - 1],p);'}function t(a,b){return"b += (_."+b+'("'+n(a)+'",c,p,0));'}function u(a,b){return"b += (_.v(_."+b+'("'+n(a)+'",c,p,0)));'}function v(a){return'b += "'+n(a)+'";'}var c=/\S/,d={"#":1,"^":2,"/":3,"!":4,">":5,"<":6,"=":7,_v:8,"{":9,"&":10},j=/\"/g,k=/\n/g,l=/\r/g,m=/\\/g;return{scan:a,parse:function(a,b){return b=b||{},f(a,"",[],b.sectionTags||[])},cache:{},compile:function(b,c){c=c||{};var d=this.cache[b];return d?d:(d=i(this.parse(a(b),c),b,c),this.cache[b]=d)}}}();typeof module!="undefined"&&module.exports?(module.exports=Hogan,module.exports.Template=HoganTemplate):typeof exports!="undefined"&&(exports.Hogan=Hogan,exports.HoganTemplate=HoganTemplate); -------------------------------------------------------------------------------- /web/builds/1.0.0/hogan.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Twitter, Inc. 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */var HoganTemplate=function(){function a(a){this.text=a}function h(a){var h=String(a===null?"":a);return g.test(h)?h.replace(b,"&").replace(c,"<").replace(d,">").replace(e,"'").replace(f,"""):h}a.prototype={r:function(a,b){return""},v:h,render:function(a,b){return this.r(a,b)},rp:function(a,b,c,d){var e=c[a];return e?e.render(b,c):""},rs:function(a,b,c){var d="",e=a[a.length-1];if(!i(e))return d=c(a,b),d;for(var f=0;f=0;h--){f=b[h];if(f&&typeof f=="object"&&a in f){e=f[a],g=!0;break}}return g?(!d&&typeof e=="function"&&(e=this.lv(e,b,c)),e):d?!1:""},ho:function(a,b,c,d){var e=a.call(b,d,function(a){return Hogan.compile(a).render(b)}),f=Hogan.compile(e.toString()).render(b,c);return this.b=f,!1},b:"",ls:function(a,b,c,d,e){var f=b[b.length-1];if(a.length>0)return this.ho(a,f,c,this.text.substring(d,e));var g=a.call(f);return typeof g=="function"?this.ho(g,f,c,this.text.substring(d,e)):g},lv:function(a,b,c){var d=b[b.length-1];return Hogan.compile(a.call(d).toString()).render(d,c)}};var b=/&/g,c=//g,e=/\'/g,f=/\"/g,g=/[&<>\"\']/,i=Array.isArray||function(a){return Object.prototype.toString.call(a)==="[object Array]"};return a}(),Hogan=function(){function a(a){function s(){l.length>0&&(m.push(new String(l)),l="")}function t(){var a=!0;for(var b=p;b0){j=a.shift();if(j.tag=="#"||j.tag=="^"||g(j,d))c.push(j),j.nodes=f(a,j.tag,c,d),e.push(j);else{if(j.tag=="/"){if(c.length==0)throw new Error("Closing tag without opener: /"+j.n);i=c.pop();if(j.n!=i.n&&!h(j.n,i.n,d))throw new Error("Nesting error: "+i.n+" vs. "+j.n);return i.end=j.i,e}e.push(j)}}if(c.length>0)throw new Error("missing closing tag: "+c.pop().n);return e}function g(a,b){for(var c=0,d=b.length;c"?b+=s(a[c].n):e=="{"||e=="&"?b+=t(a[c].n,o(a[c].n)):e=="\n"?b+=v("\n"):e=="_v"?b+=u(a[c].n,o(a[c].n)):e===undefined&&(b+=v(a[c]))}return b}function q(a,b,c,d,e){var f="if(_.s(_."+c+'("'+n(b)+'",c,p,1),';return f+="c,p,0,"+d+","+e+")){",f+="b += _.rs(c,p,",f+='function(c,p){ var b = "";',f+=p(a),f+="return b;});c.pop();}",f+='else{b += _.b; _.b = ""};',f}function r(a,b,c){var d="if (!_.s(_."+c+'("'+n(b)+'",c,p,1),c,p,1,0,0)){';return d+=p(a),d+="};",d}function s(a){return'b += _.rp("'+n(a)+'",c[c.length - 1],p);'}function t(a,b){return"b += (_."+b+'("'+n(a)+'",c,p,0));'}function u(a,b){return"b += (_.v(_."+b+'("'+n(a)+'",c,p,0)));'}function v(a){return'b += "'+n(a)+'";'}var c=/\S/,d={"#":1,"^":2,"/":3,"!":4,">":5,"<":6,"=":7,_v:8,"{":9,"&":10},j=/\"/g,k=/\n/g,l=/\r/g,m=/\\/g;return{scan:a,parse:function(a,b){return b=b||{},f(a,"",[],b.sectionTags||[])},cache:{},compile:function(b,c){c=c||{};var d=this.cache[b];return d?d:(d=i(this.parse(a(b),c),b,c),this.cache[b]=d)}}}();typeof module!="undefined"&&module.exports?(module.exports=Hogan,module.exports.Template=HoganTemplate):typeof exports!="undefined"&&(exports.Hogan=Hogan,exports.HoganTemplate=HoganTemplate); -------------------------------------------------------------------------------- /web/builds/1.0.4/hogan-1.0.4.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @preserve Copyright 2012 Twitter, Inc. 3 | * @license http://www.apache.org/licenses/LICENSE-2.0.txt 4 | */ 5 | var Hogan={};(function(a,b){function i(a){return a=String(a===null||a===undefined?"":a),h.test(a)?a.replace(c,"&").replace(d,"<").replace(e,">").replace(f,"'").replace(g,"""):a}a.Template=function(a,c,d,e){this.r=a||this.r,this.c=d,this.options=e,this.text=c||"",this.buf=b?[]:""},a.Template.prototype={r:function(a,b,c){return""},v:i,render:function(b,c,d){return this.ri([b],c||{},d)},ri:function(a,b,c){return this.r(a,b,c)},rp:function(a,b,c,d){var e=c[a];return e?(this.c&&typeof e=="string"&&(e=this.c.compile(e,this.options)),e.ri(b,c,d)):""},rs:function(a,b,c){var d=a[a.length-1];if(!j(d)){c(a,b,this);return}for(var e=0;e=0;h--){f=b[h];if(f&&typeof f=="object"&&a in f){e=f[a],g=!0;break}}return g?(!d&&typeof e=="function"&&(e=this.lv(e,b,c)),e):d?!1:""},ho:function(a,b,c,d,e){var f=this.c,g=a.call(b,d,function(a){return f.compile(a,{delimiters:e}).render(b,c)});return this.b(f.compile(g.toString(),{delimiters:e}).render(b,c)),!1},b:b?function(a){this.buf.push(a)}:function(a){this.buf+=a},fl:b?function(){var a=this.buf.join("");return this.buf=[],a}:function(){var a=this.buf;return this.buf="",a},ls:function(a,b,c,d,e,f,g){var h=b[b.length-1],i=null;if(!d&&this.c&&a.length>0)return this.ho(a,h,c,this.text.substring(e,f),g);i=a.call(h);if(typeof i=="function"){if(d)return!0;if(this.c)return this.ho(i,h,c,this.text.substring(e,f),g)}return i},lv:function(a,b,c){var d=b[b.length-1],e=a.call(d);return typeof e=="function"&&(e=e.call(d)),e=e.toString(),this.c&&~e.indexOf("{{")?this.c.compile(e).render(d,c):e}};var c=/&/g,d=//g,f=/\'/g,g=/\"/g,h=/[&<>\"\']/,j=Array.isArray||function(a){return Object.prototype.toString.call(a)==="[object Array]"}})(typeof exports!="undefined"?exports:Hogan),function(a){function h(a){a.n.substr(a.n.length-1)==="}"&&(a.n=a.n.substring(0,a.n.length-1))}function i(a){return a.trim?a.trim():a.replace(/^\s*|\s*$/g,"")}function j(a,b,c){if(b.charAt(c)!=a.charAt(0))return!1;for(var d=1,e=a.length;d0){g=a.shift();if(g.tag=="#"||g.tag=="^"||l(g,d))c.push(g),g.nodes=k(a,g.tag,c,d),e.push(g);else{if(g.tag=="/"){if(c.length===0)throw new Error("Closing tag without opener: /"+g.n);f=c.pop();if(g.n!=f.n&&!m(g.n,f.n,d))throw new Error("Nesting error: "+f.n+" vs. "+g.n);return f.end=g.i,e}e.push(g)}}if(c.length>0)throw new Error("missing closing tag: "+c.pop().n);return e}function l(a,b){for(var c=0,d=b.length;c"?b+=t(a[c]):e=="{"||e=="&"?b+=u(a[c].n,p(a[c].n)):e=="\n"?b+=w('"\\n"'+(a.length-1==c?"":" + i")):e=="_v"?b+=v(a[c].n,p(a[c].n)):e===undefined&&(b+=w('"'+o(a[c])+'"'))}return b}function r(a,b,c,d,e,f){return"if(_.s(_."+c+'("'+o(b)+'",c,p,1),'+"c,p,0,"+d+","+e+',"'+f+'")){'+"_.rs(c,p,"+"function(c,p,_){"+q(a)+"});c.pop();}"}function s(a,b,c){return"if(!_.s(_."+c+'("'+o(b)+'",c,p,1),c,p,1,0,0,"")){'+q(a)+"};"}function t(a){return'_.b(_.rp("'+o(a.n)+'",c,p,"'+(a.indent||"")+'"));'}function u(a,b){return"_.b(_."+b+'("'+o(a)+'",c,p,0));'}function v(a,b){return"_.b(_.v(_."+b+'("'+o(a)+'",c,p,0)));'}function w(a){return"_.b("+a+");"}var b=/\S/,c=/\"/g,d=/\n/g,e=/\r/g,f=/\\/g,g={"#":1,"^":2,"/":3,"!":4,">":5,"<":6,"=":7,_v:8,"{":9,"&":10};a.scan=function(c,d){function w(){p.length>0&&(q.push(new String(p)),p="")}function x(){var a=!0;for(var c=t;c"&&(d.indent=q[c].toString()),q.splice(c,1));else b||q.push({tag:"\n"});r=!1,t=q.length}function z(a,b){var c="="+v,d=a.indexOf(c,b),e=i(a.substring(a.indexOf("=",b)+1,d)).split(" ");return u=e[0],v=e[1],d+c.length-1}var e=c.length,f=0,k=1,l=2,m=f,n=null,o=null,p="",q=[],r=!1,s=0,t=0,u="{{",v="}}";d&&(d=d.split(" "),u=d[0],v=d[1]);for(s=0;s=0;h--){f=b[h];if(f&&typeof f=="object"&&a in f){e=f[a],g=!0;break}}return g?(!d&&typeof e=="function"&&(e=this.lv(e,b,c)),e):d?!1:""},ho:function(a,b,c,d,e){var f=this.c,g=this.options;g.delimiters=e;var d=a.call(b,d);return d=d==null?String(d):d.toString(),this.b(f.compile(d,g).render(b,c)),!1},b:b?function(a){this.buf.push(a)}:function(a){this.buf+=a},fl:b?function(){var a=this.buf.join("");return this.buf=[],a}:function(){var a=this.buf;return this.buf="",a},ls:function(a,b,c,d,e,f,g){var h=b[b.length-1],i=null;if(!d&&this.c&&a.length>0)return this.ho(a,h,c,this.text.substring(e,f),g);i=a.call(h);if(typeof i=="function"){if(d)return!0;if(this.c)return this.ho(i,h,c,this.text.substring(e,f),g)}return i},lv:function(a,b,c){var d=b[b.length-1],e=a.call(d);if(typeof e=="function"){e=i(e.call(d));if(this.c&&~e.indexOf("{{"))return this.c.compile(e,this.options).render(d,c)}return i(e)}};var c=/&/g,d=//g,f=/\'/g,g=/\"/g,h=/[&<>\"\']/,k=Array.isArray||function(a){return Object.prototype.toString.call(a)==="[object Array]"}})(typeof exports!="undefined"?exports:Hogan),function(a){function h(a){a.n.substr(a.n.length-1)==="}"&&(a.n=a.n.substring(0,a.n.length-1))}function i(a){return a.trim?a.trim():a.replace(/^\s*|\s*$/g,"")}function j(a,b,c){if(b.charAt(c)!=a.charAt(0))return!1;for(var d=1,e=a.length;d0){g=a.shift();if(g.tag=="#"||g.tag=="^"||l(g,d))c.push(g),g.nodes=k(a,g.tag,c,d),e.push(g);else{if(g.tag=="/"){if(c.length===0)throw new Error("Closing tag without opener: /"+g.n);f=c.pop();if(g.n!=f.n&&!m(g.n,f.n,d))throw new Error("Nesting error: "+f.n+" vs. "+g.n);return f.end=g.i,e}e.push(g)}}if(c.length>0)throw new Error("missing closing tag: "+c.pop().n);return e}function l(a,b){for(var c=0,d=b.length;c"?b+=s(a[c]):e=="{"||e=="&"?b+=t(a[c].n,o(a[c].n)):e=="\n"?b+=v('"\\n"'+(a.length-1==c?"":" + i")):e=="_v"?b+=u(a[c].n,o(a[c].n)):e===undefined&&(b+=v('"'+n(a[c])+'"'))}return b}function q(a,b,c,d,e,f){return"if(_.s(_."+c+'("'+n(b)+'",c,p,1),'+"c,p,0,"+d+","+e+',"'+f+'")){'+"_.rs(c,p,"+"function(c,p,_){"+p(a)+"});c.pop();}"}function r(a,b,c){return"if(!_.s(_."+c+'("'+n(b)+'",c,p,1),c,p,1,0,0,"")){'+p(a)+"};"}function s(a){return'_.b(_.rp("'+n(a.n)+'",c,p,"'+(a.indent||"")+'"));'}function t(a,b){return"_.b(_.t(_."+b+'("'+n(a)+'",c,p,0)));'}function u(a,b){return"_.b(_.v(_."+b+'("'+n(a)+'",c,p,0)));'}function v(a){return"_.b("+a+");"}var b=/\S/,c=/\"/g,d=/\n/g,e=/\r/g,f=/\\/g,g={"#":1,"^":2,"/":3,"!":4,">":5,"<":6,"=":7,_v:8,"{":9,"&":10};a.scan=function(c,d){function w(){p.length>0&&(q.push(new String(p)),p="")}function x(){var a=!0;for(var c=t;c"&&(d.indent=q[c].toString()),q.splice(c,1));else b||q.push({tag:"\n"});r=!1,t=q.length}function z(a,b){var c="="+v,d=a.indexOf(c,b),e=i(a.substring(a.indexOf("=",b)+1,d)).split(" ");return u=e[0],v=e[1],d+c.length-1}var e=c.length,f=0,k=1,l=2,m=f,n=null,o=null,p="",q=[],r=!1,s=0,t=0,u="{{",v="}}";d&&(d=d.split(" "),u=d[0],v=d[1]);for(s=0;s=0;h--){f=b[h];if(f&&typeof f=="object"&&a in f){e=f[a],g=!0;break}}return g?(!d&&typeof e=="function"&&(e=this.lv(e,b,c)),e):d?!1:""},ho:function(a,b,c,d,e){var f=this.c,g=this.options;g.delimiters=e;var h=a.call(b,d,function(a){return f.compile(a,g).render(b,c)});return this.b(f.compile(h.toString(),g).render(b,c)),!1},b:b?function(a){this.buf.push(a)}:function(a){this.buf+=a},fl:b?function(){var a=this.buf.join("");return this.buf=[],a}:function(){var a=this.buf;return this.buf="",a},ls:function(a,b,c,d,e,f,g){var h=b[b.length-1],i=null;if(!d&&this.c&&a.length>0)return this.ho(a,h,c,this.text.substring(e,f),g);i=a.call(h);if(typeof i=="function"){if(d)return!0;if(this.c)return this.ho(i,h,c,this.text.substring(e,f),g)}return i},lv:function(a,b,c){var d=b[b.length-1],e=a.call(d);return typeof e=="function"&&(e=e.call(d)),e=i(e),this.c&&~e.indexOf("{{")?this.c.compile(e,this.options).render(d,c):e}};var c=/&/g,d=//g,f=/\'/g,g=/\"/g,h=/[&<>\"\']/,k=Array.isArray||function(a){return Object.prototype.toString.call(a)==="[object Array]"}})(typeof exports!="undefined"?exports:Hogan),function(a){function h(a){a.n.substr(a.n.length-1)==="}"&&(a.n=a.n.substring(0,a.n.length-1))}function i(a){return a.trim?a.trim():a.replace(/^\s*|\s*$/g,"")}function j(a,b,c){if(b.charAt(c)!=a.charAt(0))return!1;for(var d=1,e=a.length;d0){g=a.shift();if(g.tag=="#"||g.tag=="^"||l(g,d))c.push(g),g.nodes=k(a,g.tag,c,d),e.push(g);else{if(g.tag=="/"){if(c.length===0)throw new Error("Closing tag without opener: /"+g.n);f=c.pop();if(g.n!=f.n&&!m(g.n,f.n,d))throw new Error("Nesting error: "+f.n+" vs. "+g.n);return f.end=g.i,e}e.push(g)}}if(c.length>0)throw new Error("missing closing tag: "+c.pop().n);return e}function l(a,b){for(var c=0,d=b.length;c"?b+=t(a[c]):e=="{"||e=="&"?b+=u(a[c].n,p(a[c].n)):e=="\n"?b+=w('"\\n"'+(a.length-1==c?"":" + i")):e=="_v"?b+=v(a[c].n,p(a[c].n)):e===undefined&&(b+=w('"'+o(a[c])+'"'))}return b}function r(a,b,c,d,e,f){return"if(_.s(_."+c+'("'+o(b)+'",c,p,1),'+"c,p,0,"+d+","+e+',"'+f+'")){'+"_.rs(c,p,"+"function(c,p,_){"+q(a)+"});c.pop();}"}function s(a,b,c){return"if(!_.s(_."+c+'("'+o(b)+'",c,p,1),c,p,1,0,0,"")){'+q(a)+"};"}function t(a){return'_.b(_.rp("'+o(a.n)+'",c,p,"'+(a.indent||"")+'"));'}function u(a,b){return"_.b(_.t(_."+b+'("'+o(a)+'",c,p,0)));'}function v(a,b){return"_.b(_.v(_."+b+'("'+o(a)+'",c,p,0)));'}function w(a){return"_.b("+a+");"}var b=/\S/,c=/\"/g,d=/\n/g,e=/\r/g,f=/\\/g,g={"#":1,"^":2,"/":3,"!":4,">":5,"<":6,"=":7,_v:8,"{":9,"&":10};a.scan=function(c,d){function w(){p.length>0&&(q.push(new String(p)),p="")}function x(){var a=!0;for(var c=t;c"&&(d.indent=q[c].toString()),q.splice(c,1));else b||q.push({tag:"\n"});r=!1,t=q.length}function z(a,b){var c="="+v,d=a.indexOf(c,b),e=i(a.substring(a.indexOf("=",b)+1,d)).split(" ");return u=e[0],v=e[1],d+c.length-1}var e=c.length,f=0,k=1,l=2,m=f,n=null,o=null,p="",q=[],r=!1,s=0,t=0,u="{{",v="}}";d&&(d=d.split(" "),u=d[0],v=d[1]);for(s=0;s=0;h--){f=b[h];if(f&&typeof f=="object"&&a in f){e=f[a],g=!0;break}}return g?(!d&&typeof e=="function"&&(e=this.lv(e,b,c)),e):d?!1:""},ho:function(a,b,c,d,e){var f=this.c,g=a.call(b,d,function(a){return f.compile(a,{delimiters:e}).render(b,c)});return this.b(f.compile(g.toString(),{delimiters:e}).render(b,c)),!1},b:b?function(a){this.buf.push(a)}:function(a){this.buf+=a},fl:b?function(){var a=this.buf.join("");return this.buf=[],a}:function(){var a=this.buf;return this.buf="",a},ls:function(a,b,c,d,e,f,g){var h=b[b.length-1],i=null;if(!d&&this.c&&a.length>0)return this.ho(a,h,c,this.text.substring(e,f),g);i=a.call(h);if(typeof i=="function"){if(d)return!0;if(this.c)return this.ho(i,h,c,this.text.substring(e,f),g)}return i},lv:function(a,b,c){var d=b[b.length-1],e=a.call(d);return typeof e=="function"&&(e=e.call(d)),e=e.toString(),this.c&&~e.indexOf("{{")?this.c.compile(e).render(d,c):e}};var c=/&/g,d=//g,f=/\'/g,g=/\"/g,h=/[&<>\"\']/,j=Array.isArray||function(a){return Object.prototype.toString.call(a)==="[object Array]"}})(typeof exports!="undefined"?exports:Hogan),function(a){function h(a){a.n.substr(a.n.length-1)==="}"&&(a.n=a.n.substring(0,a.n.length-1))}function i(a){return a.trim?a.trim():a.replace(/^\s*|\s*$/g,"")}function j(a,b,c){if(b.charAt(c)!=a.charAt(0))return!1;for(var d=1,e=a.length;d0){g=a.shift();if(g.tag=="#"||g.tag=="^"||l(g,d))c.push(g),g.nodes=k(a,g.tag,c,d),e.push(g);else{if(g.tag=="/"){if(c.length===0)throw new Error("Closing tag without opener: /"+g.n);f=c.pop();if(g.n!=f.n&&!m(g.n,f.n,d))throw new Error("Nesting error: "+f.n+" vs. "+g.n);return f.end=g.i,e}e.push(g)}}if(c.length>0)throw new Error("missing closing tag: "+c.pop().n);return e}function l(a,b){for(var c=0,d=b.length;c"?b+=t(a[c]):e=="{"||e=="&"?b+=u(a[c].n,p(a[c].n)):e=="\n"?b+=w('"\\n"'+(a.length-1==c?"":" + i")):e=="_v"?b+=v(a[c].n,p(a[c].n)):e===undefined&&(b+=w('"'+o(a[c])+'"'))}return b}function r(a,b,c,d,e,f){return"if(_.s(_."+c+'("'+o(b)+'",c,p,1),'+"c,p,0,"+d+","+e+',"'+f+'")){'+"_.rs(c,p,"+"function(c,p,_){"+q(a)+"});c.pop();}"}function s(a,b,c){return"if(!_.s(_."+c+'("'+o(b)+'",c,p,1),c,p,1,0,0,"")){'+q(a)+"};"}function t(a){return'_.b(_.rp("'+o(a.n)+'",c,p,"'+(a.indent||"")+'"));'}function u(a,b){return"_.b(_."+b+'("'+o(a)+'",c,p,0));'}function v(a,b){return"_.b(_.v(_."+b+'("'+o(a)+'",c,p,0)));'}function w(a){return"_.b("+a+");"}var b=/\S/,c=/\"/g,d=/\n/g,e=/\r/g,f=/\\/g,g={"#":1,"^":2,"/":3,"!":4,">":5,"<":6,"=":7,_v:8,"{":9,"&":10};a.scan=function(c,d){function w(){p.length>0&&(q.push(new String(p)),p="")}function x(){var a=!0;for(var c=t;c"&&(d.indent=q[c].toString()),q.splice(c,1));else b||q.push({tag:"\n"});r=!1,t=q.length}function z(a,b){var c="="+v,d=a.indexOf(c,b),e=i(a.substring(a.indexOf("=",b)+1,d)).split(" ");return u=e[0],v=e[1],d+c.length-1}var e=c.length,f=0,k=1,l=2,m=f,n=null,o=null,p="",q=[],r=!1,s=0,t=0,u="{{",v="}}";d&&(d=d.split(" "),u=d[0],v=d[1]);for(s=0;s=0;h--){f=b[h];if(f&&typeof f=="object"&&a in f){e=f[a],g=!0;break}}return g?(!d&&typeof e=="function"&&(e=this.lv(e,b,c)),e):d?!1:""},ho:function(a,b,c,d,e){var f=this.c,g=this.options;g.delimiters=e;var d=a.call(b,d);return d=d==null?String(d):d.toString(),this.b(f.compile(d,g).render(b,c)),!1},b:b?function(a){this.buf.push(a)}:function(a){this.buf+=a},fl:b?function(){var a=this.buf.join("");return this.buf=[],a}:function(){var a=this.buf;return this.buf="",a},ls:function(a,b,c,d,e,f,g){var h=b[b.length-1],i=null;if(!d&&this.c&&a.length>0)return this.ho(a,h,c,this.text.substring(e,f),g);i=a.call(h);if(typeof i=="function"){if(d)return!0;if(this.c)return this.ho(i,h,c,this.text.substring(e,f),g)}return i},lv:function(a,b,c){var d=b[b.length-1],e=a.call(d);if(typeof e=="function"){e=i(e.call(d));if(this.c&&~e.indexOf("{{"))return this.c.compile(e,this.options).render(d,c)}return i(e)}};var c=/&/g,d=//g,f=/\'/g,g=/\"/g,h=/[&<>\"\']/,k=Array.isArray||function(a){return Object.prototype.toString.call(a)==="[object Array]"}})(typeof exports!="undefined"?exports:Hogan),function(a){function h(a){a.n.substr(a.n.length-1)==="}"&&(a.n=a.n.substring(0,a.n.length-1))}function i(a){return a.trim?a.trim():a.replace(/^\s*|\s*$/g,"")}function j(a,b,c){if(b.charAt(c)!=a.charAt(0))return!1;for(var d=1,e=a.length;d0){g=a.shift();if(g.tag=="#"||g.tag=="^"||l(g,d))c.push(g),g.nodes=k(a,g.tag,c,d),e.push(g);else{if(g.tag=="/"){if(c.length===0)throw new Error("Closing tag without opener: /"+g.n);f=c.pop();if(g.n!=f.n&&!m(g.n,f.n,d))throw new Error("Nesting error: "+f.n+" vs. "+g.n);return f.end=g.i,e}e.push(g)}}if(c.length>0)throw new Error("missing closing tag: "+c.pop().n);return e}function l(a,b){for(var c=0,d=b.length;c"?b+=s(a[c]):e=="{"||e=="&"?b+=t(a[c].n,o(a[c].n)):e=="\n"?b+=v('"\\n"'+(a.length-1==c?"":" + i")):e=="_v"?b+=u(a[c].n,o(a[c].n)):e===undefined&&(b+=v('"'+n(a[c])+'"'))}return b}function q(a,b,c,d,e,f){return"if(_.s(_."+c+'("'+n(b)+'",c,p,1),'+"c,p,0,"+d+","+e+',"'+f+'")){'+"_.rs(c,p,"+"function(c,p,_){"+p(a)+"});c.pop();}"}function r(a,b,c){return"if(!_.s(_."+c+'("'+n(b)+'",c,p,1),c,p,1,0,0,"")){'+p(a)+"};"}function s(a){return'_.b(_.rp("'+n(a.n)+'",c,p,"'+(a.indent||"")+'"));'}function t(a,b){return"_.b(_.t(_."+b+'("'+n(a)+'",c,p,0)));'}function u(a,b){return"_.b(_.v(_."+b+'("'+n(a)+'",c,p,0)));'}function v(a){return"_.b("+a+");"}var b=/\S/,c=/\"/g,d=/\n/g,e=/\r/g,f=/\\/g,g={"#":1,"^":2,"/":3,"!":4,">":5,"<":6,"=":7,_v:8,"{":9,"&":10};a.scan=function(c,d){function w(){p.length>0&&(q.push(new String(p)),p="")}function x(){var a=!0;for(var c=t;c"&&(d.indent=q[c].toString()),q.splice(c,1));else b||q.push({tag:"\n"});r=!1,t=q.length}function z(a,b){var c="="+v,d=a.indexOf(c,b),e=i(a.substring(a.indexOf("=",b)+1,d)).split(" ");return u=e[0],v=e[1],d+c.length-1}var e=c.length,f=0,k=1,l=2,m=f,n=null,o=null,p="",q=[],r=!1,s=0,t=0,u="{{",v="}}";d&&(d=d.split(" "),u=d[0],v=d[1]);for(s=0;s=0;h--){f=b[h];if(f&&typeof f=="object"&&a in f){e=f[a],g=!0;break}}return g?(!d&&typeof e=="function"&&(e=this.lv(e,b,c)),e):d?!1:""},ho:function(a,b,c,d,e){var f=this.c,g=a.call(b,d,function(a){return f.compile(a,{delimiters:e}).render(b,c)});return this.b(f.compile(g.toString(),{delimiters:e}).render(b,c)),!1},b:b?function(a){this.buf.push(a)}:function(a){this.buf+=a},fl:b?function(){var a=this.buf.join("");return this.buf=[],a}:function(){var a=this.buf;return this.buf="",a},ls:function(a,b,c,d,e,f,g){var h=b[b.length-1],i=null;if(!d&&this.c&&a.length>0)return this.ho(a,h,c,this.text.substring(e,f),g);i=a.call(h);if(typeof i=="function"){if(d)return!0;if(this.c)return this.ho(i,h,c,this.text.substring(e,f),g)}return i},lv:function(a,b,c){var d=b[b.length-1],e=a.call(d);return typeof e=="function"&&(e=e.call(d)),e=e.toString(),this.c&&~e.indexOf("{{")?this.c.compile(e).render(d,c):e}};var c=/&/g,d=//g,f=/\'/g,g=/\"/g,h=/[&<>\"\']/,j=Array.isArray||function(a){return Object.prototype.toString.call(a)==="[object Array]"}})(typeof exports!="undefined"?exports:Hogan),function(a){function h(a){a.n.substr(a.n.length-1)==="}"&&(a.n=a.n.substring(0,a.n.length-1))}function i(a){return a.trim?a.trim():a.replace(/^\s*|\s*$/g,"")}function j(a,b,c){if(b.charAt(c)!=a.charAt(0))return!1;for(var d=1,e=a.length;d0){g=a.shift();if(g.tag=="#"||g.tag=="^"||l(g,d))c.push(g),g.nodes=k(a,g.tag,c,d),e.push(g);else{if(g.tag=="/"){if(c.length===0)throw new Error("Closing tag without opener: /"+g.n);f=c.pop();if(g.n!=f.n&&!m(g.n,f.n,d))throw new Error("Nesting error: "+f.n+" vs. "+g.n);return f.end=g.i,e}e.push(g)}}if(c.length>0)throw new Error("missing closing tag: "+c.pop().n);return e}function l(a,b){for(var c=0,d=b.length;c"?b+=t(a[c]):e=="{"||e=="&"?b+=u(a[c].n,p(a[c].n)):e=="\n"?b+=w('"\\n"'+(a.length-1==c?"":" + i")):e=="_v"?b+=v(a[c].n,p(a[c].n)):e===undefined&&(b+=w('"'+o(a[c])+'"'))}return b}function r(a,b,c,d,e,f){return"if(_.s(_."+c+'("'+o(b)+'",c,p,1),'+"c,p,0,"+d+","+e+',"'+f+'")){'+"_.rs(c,p,"+"function(c,p,_){"+q(a)+"});c.pop();}"}function s(a,b,c){return"if(!_.s(_."+c+'("'+o(b)+'",c,p,1),c,p,1,0,0,"")){'+q(a)+"};"}function t(a){return'_.b(_.rp("'+o(a.n)+'",c,p,"'+(a.indent||"")+'"));'}function u(a,b){return"_.b(_."+b+'("'+o(a)+'",c,p,0));'}function v(a,b){return"_.b(_.v(_."+b+'("'+o(a)+'",c,p,0)));'}function w(a){return"_.b("+a+");"}var b=/\S/,c=/\"/g,d=/\n/g,e=/\r/g,f=/\\/g,g={"#":1,"^":2,"/":3,"!":4,">":5,"<":6,"=":7,_v:8,"{":9,"&":10};a.scan=function(c,d){function w(){p.length>0&&(q.push(new String(p)),p="")}function x(){var a=!0;for(var c=t;c"&&(d.indent=q[c].toString()),q.splice(c,1));else b||q.push({tag:"\n"});r=!1,t=q.length}function z(a,b){var c="="+v,d=a.indexOf(c,b),e=i(a.substring(a.indexOf("=",b)+1,d)).split(" ");return u=e[0],v=e[1],d+c.length-1}var e=c.length,f=0,k=1,l=2,m=f,n=null,o=null,p="",q=[],r=!1,s=0,t=0,u="{{",v="}}";d&&(d=d.split(" "),u=d[0],v=d[1]);for(s=0;s=0;h--){f=b[h];if(f&&typeof f=="object"&&a in f){e=f[a],g=!0;break}}return g?(!d&&typeof e=="function"&&(e=this.lv(e,b,c)),e):d?!1:""},ho:function(a,b,c,d,e){var f=this.c,g=this.options;g.delimiters=e;var d=a.call(b,d);return d=d==null?String(d):d.toString(),this.b(f.compile(d,g).render(b,c)),!1},b:b?function(a){this.buf.push(a)}:function(a){this.buf+=a},fl:b?function(){var a=this.buf.join("");return this.buf=[],a}:function(){var a=this.buf;return this.buf="",a},ls:function(a,b,c,d,e,f,g){var h=b[b.length-1],i=null;if(!d&&this.c&&a.length>0)return this.ho(a,h,c,this.text.substring(e,f),g);i=a.call(h);if(typeof i=="function"){if(d)return!0;if(this.c)return this.ho(i,h,c,this.text.substring(e,f),g)}return i},lv:function(a,b,c){var d=b[b.length-1],e=a.call(d);if(typeof e=="function"){e=i(e.call(d));if(this.c&&~e.indexOf("{{"))return this.c.compile(e,this.options).render(d,c)}return i(e)}};var c=/&/g,d=//g,f=/\'/g,g=/\"/g,h=/[&<>\"\']/,k=Array.isArray||function(a){return Object.prototype.toString.call(a)==="[object Array]"}})(typeof exports!="undefined"?exports:Hogan),function(a){function h(a){a.n.substr(a.n.length-1)==="}"&&(a.n=a.n.substring(0,a.n.length-1))}function i(a){return a.trim?a.trim():a.replace(/^\s*|\s*$/g,"")}function j(a,b,c){if(b.charAt(c)!=a.charAt(0))return!1;for(var d=1,e=a.length;d0){g=a.shift();if(g.tag=="#"||g.tag=="^"||l(g,d))c.push(g),g.nodes=k(a,g.tag,c,d),e.push(g);else{if(g.tag=="/"){if(c.length===0)throw new Error("Closing tag without opener: /"+g.n);f=c.pop();if(g.n!=f.n&&!m(g.n,f.n,d))throw new Error("Nesting error: "+f.n+" vs. "+g.n);return f.end=g.i,e}e.push(g)}}if(c.length>0)throw new Error("missing closing tag: "+c.pop().n);return e}function l(a,b){for(var c=0,d=b.length;c"?b+=s(a[c]):e=="{"||e=="&"?b+=t(a[c].n,o(a[c].n)):e=="\n"?b+=v('"\\n"'+(a.length-1==c?"":" + i")):e=="_v"?b+=u(a[c].n,o(a[c].n)):e===undefined&&(b+=v('"'+n(a[c])+'"'))}return b}function q(a,b,c,d,e,f){return"if(_.s(_."+c+'("'+n(b)+'",c,p,1),'+"c,p,0,"+d+","+e+',"'+f+'")){'+"_.rs(c,p,"+"function(c,p,_){"+p(a)+"});c.pop();}"}function r(a,b,c){return"if(!_.s(_."+c+'("'+n(b)+'",c,p,1),c,p,1,0,0,"")){'+p(a)+"};"}function s(a){return'_.b(_.rp("'+n(a.n)+'",c,p,"'+(a.indent||"")+'"));'}function t(a,b){return"_.b(_.t(_."+b+'("'+n(a)+'",c,p,0)));'}function u(a,b){return"_.b(_.v(_."+b+'("'+n(a)+'",c,p,0)));'}function v(a){return"_.b("+a+");"}var b=/\S/,c=/\"/g,d=/\n/g,e=/\r/g,f=/\\/g,g={"#":1,"^":2,"/":3,"!":4,">":5,"<":6,"=":7,_v:8,"{":9,"&":10};a.scan=function(c,d){function w(){p.length>0&&(q.push(new String(p)),p="")}function x(){var a=!0;for(var c=t;c"&&(d.indent=q[c].toString()),q.splice(c,1));else b||q.push({tag:"\n"});r=!1,t=q.length}function z(a,b){var c="="+v,d=a.indexOf(c,b),e=i(a.substring(a.indexOf("=",b)+1,d)).split(" ");return u=e[0],v=e[1],d+c.length-1}var e=c.length,f=0,k=1,l=2,m=f,n=null,o=null,p="",q=[],r=!1,s=0,t=0,u="{{",v="}}";d&&(d=d.split(" "),u=d[0],v=d[1]);for(s=0;s=0;h--){f=b[h];if(f&&typeof f=="object"&&a in f){e=f[a],g=!0;break}}return g?(!d&&typeof e=="function"&&(e=this.lv(e,b,c)),e):d?!1:""},ho:function(a,b,c,d,e){var f=this.c,g=this.options;g.delimiters=e;var h=a.call(b,d,function(a){return f.compile(a,g).render(b,c)});return this.b(f.compile(h.toString(),g).render(b,c)),!1},b:b?function(a){this.buf.push(a)}:function(a){this.buf+=a},fl:b?function(){var a=this.buf.join("");return this.buf=[],a}:function(){var a=this.buf;return this.buf="",a},ls:function(a,b,c,d,e,f,g){var h=b[b.length-1],i=null;if(!d&&this.c&&a.length>0)return this.ho(a,h,c,this.text.substring(e,f),g);i=a.call(h);if(typeof i=="function"){if(d)return!0;if(this.c)return this.ho(i,h,c,this.text.substring(e,f),g)}return i},lv:function(a,b,c){var d=b[b.length-1],e=a.call(d);return typeof e=="function"&&(e=e.call(d)),e=i(e),this.c&&~e.indexOf("{{")?this.c.compile(e,this.options).render(d,c):e}};var c=/&/g,d=//g,f=/\'/g,g=/\"/g,h=/[&<>\"\']/,k=Array.isArray||function(a){return Object.prototype.toString.call(a)==="[object Array]"}})(typeof exports!="undefined"?exports:Hogan),function(a){function h(a){a.n.substr(a.n.length-1)==="}"&&(a.n=a.n.substring(0,a.n.length-1))}function i(a){return a.trim?a.trim():a.replace(/^\s*|\s*$/g,"")}function j(a,b,c){if(b.charAt(c)!=a.charAt(0))return!1;for(var d=1,e=a.length;d0){g=a.shift();if(g.tag=="#"||g.tag=="^"||l(g,d))c.push(g),g.nodes=k(a,g.tag,c,d),e.push(g);else{if(g.tag=="/"){if(c.length===0)throw new Error("Closing tag without opener: /"+g.n);f=c.pop();if(g.n!=f.n&&!m(g.n,f.n,d))throw new Error("Nesting error: "+f.n+" vs. "+g.n);return f.end=g.i,e}e.push(g)}}if(c.length>0)throw new Error("missing closing tag: "+c.pop().n);return e}function l(a,b){for(var c=0,d=b.length;c"?b+=t(a[c]):e=="{"||e=="&"?b+=u(a[c].n,p(a[c].n)):e=="\n"?b+=w('"\\n"'+(a.length-1==c?"":" + i")):e=="_v"?b+=v(a[c].n,p(a[c].n)):e===undefined&&(b+=w('"'+o(a[c])+'"'))}return b}function r(a,b,c,d,e,f){return"if(_.s(_."+c+'("'+o(b)+'",c,p,1),'+"c,p,0,"+d+","+e+',"'+f+'")){'+"_.rs(c,p,"+"function(c,p,_){"+q(a)+"});c.pop();}"}function s(a,b,c){return"if(!_.s(_."+c+'("'+o(b)+'",c,p,1),c,p,1,0,0,"")){'+q(a)+"};"}function t(a){return'_.b(_.rp("'+o(a.n)+'",c,p,"'+(a.indent||"")+'"));'}function u(a,b){return"_.b(_.t(_."+b+'("'+o(a)+'",c,p,0)));'}function v(a,b){return"_.b(_.v(_."+b+'("'+o(a)+'",c,p,0)));'}function w(a){return"_.b("+a+");"}var b=/\S/,c=/\"/g,d=/\n/g,e=/\r/g,f=/\\/g,g={"#":1,"^":2,"/":3,"!":4,">":5,"<":6,"=":7,_v:8,"{":9,"&":10};a.scan=function(c,d){function w(){p.length>0&&(q.push(new String(p)),p="")}function x(){var a=!0;for(var c=t;c"&&(d.indent=q[c].toString()),q.splice(c,1));else b||q.push({tag:"\n"});r=!1,t=q.length}function z(a,b){var c="="+v,d=a.indexOf(c,b),e=i(a.substring(a.indexOf("=",b)+1,d)).split(" ");return u=e[0],v=e[1],d+c.length-1}var e=c.length,f=0,k=1,l=2,m=f,n=null,o=null,p="",q=[],r=!1,s=0,t=0,u="{{",v="}}";d&&(d=d.split(" "),u=d[0],v=d[1]);for(s=0;s=0;h--){f=b[h];if(f&&typeof f=="object"&&a in f){e=f[a],g=!0;break}}return g?(!d&&typeof e=="function"&&(e=this.lv(e,b,c)),e):d?!1:""},ho:function(a,b,c,d,e){var f=this.c,g=this.options;g.delimiters=e;var h=a.call(b,d,function(a){return f.compile(a,g).render(b,c)});return this.b(f.compile(h.toString(),g).render(b,c)),!1},b:b?function(a){this.buf.push(a)}:function(a){this.buf+=a},fl:b?function(){var a=this.buf.join("");return this.buf=[],a}:function(){var a=this.buf;return this.buf="",a},ls:function(a,b,c,d,e,f,g){var h=b[b.length-1],i=null;if(!d&&this.c&&a.length>0)return this.ho(a,h,c,this.text.substring(e,f),g);i=a.call(h);if(typeof i=="function"){if(d)return!0;if(this.c)return this.ho(i,h,c,this.text.substring(e,f),g)}return i},lv:function(a,b,c){var d=b[b.length-1],e=a.call(d);return typeof e=="function"&&(e=e.call(d)),e=i(e),this.c&&~e.indexOf("{{")?this.c.compile(e,this.options).render(d,c):e}};var c=/&/g,d=//g,f=/\'/g,g=/\"/g,h=/[&<>\"\']/,k=Array.isArray||function(a){return Object.prototype.toString.call(a)==="[object Array]"}})(typeof exports!="undefined"?exports:Hogan),function(a){function h(a){a.n.substr(a.n.length-1)==="}"&&(a.n=a.n.substring(0,a.n.length-1))}function i(a){return a.trim?a.trim():a.replace(/^\s*|\s*$/g,"")}function j(a,b,c){if(b.charAt(c)!=a.charAt(0))return!1;for(var d=1,e=a.length;d0){g=a.shift();if(g.tag=="#"||g.tag=="^"||l(g,d))c.push(g),g.nodes=k(a,g.tag,c,d),e.push(g);else{if(g.tag=="/"){if(c.length===0)throw new Error("Closing tag without opener: /"+g.n);f=c.pop();if(g.n!=f.n&&!m(g.n,f.n,d))throw new Error("Nesting error: "+f.n+" vs. "+g.n);return f.end=g.i,e}e.push(g)}}if(c.length>0)throw new Error("missing closing tag: "+c.pop().n);return e}function l(a,b){for(var c=0,d=b.length;c"?b+=t(a[c]):e=="{"||e=="&"?b+=u(a[c].n,p(a[c].n)):e=="\n"?b+=w('"\\n"'+(a.length-1==c?"":" + i")):e=="_v"?b+=v(a[c].n,p(a[c].n)):e===undefined&&(b+=w('"'+o(a[c])+'"'))}return b}function r(a,b,c,d,e,f){return"if(_.s(_."+c+'("'+o(b)+'",c,p,1),'+"c,p,0,"+d+","+e+',"'+f+'")){'+"_.rs(c,p,"+"function(c,p,_){"+q(a)+"});c.pop();}"}function s(a,b,c){return"if(!_.s(_."+c+'("'+o(b)+'",c,p,1),c,p,1,0,0,"")){'+q(a)+"};"}function t(a){return'_.b(_.rp("'+o(a.n)+'",c,p,"'+(a.indent||"")+'"));'}function u(a,b){return"_.b(_.t(_."+b+'("'+o(a)+'",c,p,0)));'}function v(a,b){return"_.b(_.v(_."+b+'("'+o(a)+'",c,p,0)));'}function w(a){return"_.b("+a+");"}var b=/\S/,c=/\"/g,d=/\n/g,e=/\r/g,f=/\\/g,g={"#":1,"^":2,"/":3,"!":4,">":5,"<":6,"=":7,_v:8,"{":9,"&":10};a.scan=function(c,d){function w(){p.length>0&&(q.push(new String(p)),p="")}function x(){var a=!0;for(var c=t;c"&&(d.indent=q[c].toString()),q.splice(c,1));else b||q.push({tag:"\n"});r=!1,t=q.length}function z(a,b){var c="="+v,d=a.indexOf(c,b),e=i(a.substring(a.indexOf("=",b)+1,d)).split(" ");return u=e[0],v=e[1],d+c.length-1}var e=c.length,f=0,k=1,l=2,m=f,n=null,o=null,p="",q=[],r=!1,s=0,t=0,u="{{",v="}}";d&&(d=d.split(" "),u=d[0],v=d[1]);for(s=0;s 2 | 3 | 4 | 5 | 6 | 7 | 8 | 10 | 11 | Hogan.js 12 | 13 | 14 | 15 | 18 | 19 | 21 | 22 | 23 | 24 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 36 | 37 |
    38 |
    39 |
    40 |
    41 |

    Hogan.js

    42 |

    JavaScript templating from Twitter.

    43 | View on Github 44 |
    45 |
    46 |
    47 | 48 | 49 |
    50 |

    Getting started

    51 |

    52 | Hogan.js is a 3.4k JS templating engine developed at Twitter. Use it as a part of your asset packager to compile templates ahead of time or include it in your browser to handle dynamic templates. 53 |

    54 |

    55 | If you're developing with Node.js, just use NPM to add the Hogan package. 56 |

    57 |
    $ npm install hogan.js
    58 |

    59 | Alternatively, drop hogan.js in your browser by adding the following script. 60 |

    61 |
    <script src="http://twitter.github.com/hogan.js/builds/{{version}}/hogan-{{version}}.js"></script>
    62 | 63 |
    64 |
    65 | 66 |
    67 |
    68 |
    69 |
    70 | 71 | 72 |
    73 |

    Templates

    74 |

    75 | Hogan.js was developed against the mustache test suite, so everything that holds true for templates as specified here, is also the case for hogan.js. 76 |

    77 |

    78 | That means you get variables, sections, lambdas, partials, filters, and everything else you've come to expect from mustache templating - only much, much faster. 79 |

    80 |
    81 |
    82 | 83 |
    84 |
    85 |
    86 |
    87 | 88 | 89 |
    90 |

    Compiling

    91 |

    92 | Use hogan.compile() to precompile your templates into vanilla JS. 93 |

    94 |

    95 | It's best to serve your templates precompiled whenever you can (rather than the raw templates), as parsing is the most time consuming operation. 96 |

    97 |

    98 |

    99 |
    100 |
    101 | 102 |
    103 |
    104 |
    105 |
    106 | 107 | 108 |
    109 |

    Rendering

    110 |

    111 | Once compiled, call the render() method with a context and optional partials object. 112 |

    113 |

    114 | If supplying partials, you can compile them ahead of time, or pass string templates.

    115 |

    116 |

    117 |
    118 |
    119 | 120 |
    121 |
    122 |
    123 |
    124 | 125 | 126 | 127 |
    128 |

    Hulk

    129 |

    130 | Hulk is Hogan's command line utility. Use it to easily compile your templates as js files. 131 |

    132 |

    133 | Hulk supports the * wildcard (even on windows) and allows you to target specific file extensions as well.

    134 |

    135 |

    136 |
    137 | 138 |
    139 | 140 |
    141 | 142 | 151 | 152 |
    153 | 154 | 155 | 157 | 158 | 159 | -------------------------------------------------------------------------------- /web/builds/1.0.4/hogan-1.0.4.min.mustache.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @preserve Copyright 2012 Twitter, Inc. 3 | * @license http://www.apache.org/licenses/LICENSE-2.0.txt 4 | */ 5 | var Hogan={};(function(a,b){function i(a){return a=String(a===null||a===undefined?"":a),h.test(a)?a.replace(c,"&").replace(d,"<").replace(e,">").replace(f,"'").replace(g,"""):a}a.Template=function(a,c,d,e){this.r=a||this.r,this.c=d,this.options=e,this.text=c||"",this.buf=b?[]:""},a.Template.prototype={r:function(a,b,c){return""},v:i,render:function(b,c,d){return this.ri([b],c||{},d)},ri:function(a,b,c){return this.r(a,b,c)},rp:function(a,b,c,d){var e=c[a];return e?(this.c&&typeof e=="string"&&(e=this.c.compile(e,this.options)),e.ri(b,c,d)):""},rs:function(a,b,c){var d=a[a.length-1];if(!j(d)){c(a,b,this);return}for(var e=0;e=0;h--){f=b[h];if(f&&typeof f=="object"&&a in f){e=f[a],g=!0;break}}return g?(!d&&typeof e=="function"&&(e=this.lv(e,b,c)),e):d?!1:""},ho:function(a,b,c,d,e){var f=this.c,g=a.call(b,d,function(a){return f.compile(a,{delimiters:e}).render(b,c)});return this.b(f.compile(g.toString(),{delimiters:e}).render(b,c)),!1},b:b?function(a){this.buf.push(a)}:function(a){this.buf+=a},fl:b?function(){var a=this.buf.join("");return this.buf=[],a}:function(){var a=this.buf;return this.buf="",a},ls:function(a,b,c,d,e,f,g){var h=b[b.length-1],i=null;if(!d&&this.c&&a.length>0)return this.ho(a,h,c,this.text.substring(e,f),g);i=a.call(h);if(typeof i=="function"){if(d)return!0;if(this.c)return this.ho(i,h,c,this.text.substring(e,f),g)}return i},lv:function(a,b,c){var d=b[b.length-1],e=a.call(d);return typeof e=="function"&&(e=e.call(d)),e=e.toString(),this.c&&~e.indexOf("{{")?this.c.compile(e).render(d,c):e}};var c=/&/g,d=//g,f=/\'/g,g=/\"/g,h=/[&<>\"\']/,j=Array.isArray||function(a){return Object.prototype.toString.call(a)==="[object Array]"}})(typeof exports!="undefined"?exports:Hogan),function(a){function h(a){a.n.substr(a.n.length-1)==="}"&&(a.n=a.n.substring(0,a.n.length-1))}function i(a){return a.trim?a.trim():a.replace(/^\s*|\s*$/g,"")}function j(a,b,c){if(b.charAt(c)!=a.charAt(0))return!1;for(var d=1,e=a.length;d0){g=a.shift();if(g.tag=="#"||g.tag=="^"||l(g,d))c.push(g),g.nodes=k(a,g.tag,c,d),e.push(g);else{if(g.tag=="/"){if(c.length===0)throw new Error("Closing tag without opener: /"+g.n);f=c.pop();if(g.n!=f.n&&!m(g.n,f.n,d))throw new Error("Nesting error: "+f.n+" vs. "+g.n);return f.end=g.i,e}e.push(g)}}if(c.length>0)throw new Error("missing closing tag: "+c.pop().n);return e}function l(a,b){for(var c=0,d=b.length;c"?b+=t(a[c]):e=="{"||e=="&"?b+=u(a[c].n,p(a[c].n)):e=="\n"?b+=w('"\\n"'+(a.length-1==c?"":" + i")):e=="_v"?b+=v(a[c].n,p(a[c].n)):e===undefined&&(b+=w('"'+o(a[c])+'"'))}return b}function r(a,b,c,d,e,f){return"if(_.s(_."+c+'("'+o(b)+'",c,p,1),'+"c,p,0,"+d+","+e+',"'+f+'")){'+"_.rs(c,p,"+"function(c,p,_){"+q(a)+"});c.pop();}"}function s(a,b,c){return"if(!_.s(_."+c+'("'+o(b)+'",c,p,1),c,p,1,0,0,"")){'+q(a)+"};"}function t(a){return'_.b(_.rp("'+o(a.n)+'",c,p,"'+(a.indent||"")+'"));'}function u(a,b){return"_.b(_."+b+'("'+o(a)+'",c,p,0));'}function v(a,b){return"_.b(_.v(_."+b+'("'+o(a)+'",c,p,0)));'}function w(a){return"_.b("+a+");"}var b=/\S/,c=/\"/g,d=/\n/g,e=/\r/g,f=/\\/g,g={"#":1,"^":2,"/":3,"!":4,">":5,"<":6,"=":7,_v:8,"{":9,"&":10};a.scan=function(c,d){function w(){p.length>0&&(q.push(new String(p)),p="")}function x(){var a=!0;for(var c=t;c"&&(d.indent=q[c].toString()),q.splice(c,1));else b||q.push({tag:"\n"});r=!1,t=q.length}function z(a,b){var c="="+v,d=a.indexOf(c,b),e=i(a.substring(a.indexOf("=",b)+1,d)).split(" ");return u=e[0],v=e[1],d+c.length-1}var e=c.length,f=0,k=1,l=2,m=f,n=null,o=null,p="",q=[],r=!1,s=0,t=0,u="{{",v="}}";d&&(d=d.split(" "),u=d[0],v=d[1]);for(s=0;s=0;h--){f=b[h];if(f&&typeof f=="object"&&a in f){e=f[a],g=!0;break}}return g?(!d&&typeof e=="function"&&(e=this.lv(e,b,c)),e):d?!1:""},ho:function(a,b,c,d,e){var f=this.c,g=this.options;g.delimiters=e;var d=a.call(b,d);return d=d==null?String(d):d.toString(),this.b(f.compile(d,g).render(b,c)),!1},b:b?function(a){this.buf.push(a)}:function(a){this.buf+=a},fl:b?function(){var a=this.buf.join("");return this.buf=[],a}:function(){var a=this.buf;return this.buf="",a},ls:function(a,b,c,d,e,f,g){var h=b[b.length-1],i=null;if(!d&&this.c&&a.length>0)return this.ho(a,h,c,this.text.substring(e,f),g);i=a.call(h);if(typeof i=="function"){if(d)return!0;if(this.c)return this.ho(i,h,c,this.text.substring(e,f),g)}return i},lv:function(a,b,c){var d=b[b.length-1],e=a.call(d);if(typeof e=="function"){e=i(e.call(d));if(this.c&&~e.indexOf("{{"))return this.c.compile(e,this.options).render(d,c)}return i(e)}};var c=/&/g,d=//g,f=/\'/g,g=/\"/g,h=/[&<>\"\']/,k=Array.isArray||function(a){return Object.prototype.toString.call(a)==="[object Array]"}})(typeof exports!="undefined"?exports:Hogan),function(a){function h(a){a.n.substr(a.n.length-1)==="}"&&(a.n=a.n.substring(0,a.n.length-1))}function i(a){return a.trim?a.trim():a.replace(/^\s*|\s*$/g,"")}function j(a,b,c){if(b.charAt(c)!=a.charAt(0))return!1;for(var d=1,e=a.length;d0){g=a.shift();if(g.tag=="#"||g.tag=="^"||l(g,d))c.push(g),g.nodes=k(a,g.tag,c,d),e.push(g);else{if(g.tag=="/"){if(c.length===0)throw new Error("Closing tag without opener: /"+g.n);f=c.pop();if(g.n!=f.n&&!m(g.n,f.n,d))throw new Error("Nesting error: "+f.n+" vs. "+g.n);return f.end=g.i,e}e.push(g)}}if(c.length>0)throw new Error("missing closing tag: "+c.pop().n);return e}function l(a,b){for(var c=0,d=b.length;c"?b+=s(a[c]):e=="{"||e=="&"?b+=t(a[c].n,o(a[c].n)):e=="\n"?b+=v('"\\n"'+(a.length-1==c?"":" + i")):e=="_v"?b+=u(a[c].n,o(a[c].n)):e===undefined&&(b+=v('"'+n(a[c])+'"'))}return b}function q(a,b,c,d,e,f){return"if(_.s(_."+c+'("'+n(b)+'",c,p,1),'+"c,p,0,"+d+","+e+',"'+f+'")){'+"_.rs(c,p,"+"function(c,p,_){"+p(a)+"});c.pop();}"}function r(a,b,c){return"if(!_.s(_."+c+'("'+n(b)+'",c,p,1),c,p,1,0,0,"")){'+p(a)+"};"}function s(a){return'_.b(_.rp("'+n(a.n)+'",c,p,"'+(a.indent||"")+'"));'}function t(a,b){return"_.b(_.t(_."+b+'("'+n(a)+'",c,p,0)));'}function u(a,b){return"_.b(_.v(_."+b+'("'+n(a)+'",c,p,0)));'}function v(a){return"_.b("+a+");"}var b=/\S/,c=/\"/g,d=/\n/g,e=/\r/g,f=/\\/g,g={"#":1,"^":2,"/":3,"!":4,">":5,"<":6,"=":7,_v:8,"{":9,"&":10};a.scan=function(c,d){function w(){p.length>0&&(q.push(new String(p)),p="")}function x(){var a=!0;for(var c=t;c"&&(d.indent=q[c].toString()),q.splice(c,1));else b||q.push({tag:"\n"});r=!1,t=q.length}function z(a,b){var c="="+v,d=a.indexOf(c,b),e=i(a.substring(a.indexOf("=",b)+1,d)).split(" ");return u=e[0],v=e[1],d+c.length-1}var e=c.length,f=0,k=1,l=2,m=f,n=null,o=null,p="",q=[],r=!1,s=0,t=0,u="{{",v="}}";d&&(d=d.split(" "),u=d[0],v=d[1]);for(s=0;s=0;h--){f=b[h];if(f&&typeof f=="object"&&a in f){e=f[a],g=!0;break}}return g?(!d&&typeof e=="function"&&(e=this.lv(e,b,c)),e):d?!1:""},ho:function(a,b,c,d,e){var f=this.c,g=this.options;g.delimiters=e;var h=a.call(b,d,function(a){return f.compile(a,g).render(b,c)});return this.b(f.compile(h.toString(),g).render(b,c)),!1},b:b?function(a){this.buf.push(a)}:function(a){this.buf+=a},fl:b?function(){var a=this.buf.join("");return this.buf=[],a}:function(){var a=this.buf;return this.buf="",a},ls:function(a,b,c,d,e,f,g){var h=b[b.length-1],i=null;if(!d&&this.c&&a.length>0)return this.ho(a,h,c,this.text.substring(e,f),g);i=a.call(h);if(typeof i=="function"){if(d)return!0;if(this.c)return this.ho(i,h,c,this.text.substring(e,f),g)}return i},lv:function(a,b,c){var d=b[b.length-1],e=a.call(d);return typeof e=="function"&&(e=e.call(d)),e=i(e),this.c&&~e.indexOf("{{")?this.c.compile(e,this.options).render(d,c):e}};var c=/&/g,d=//g,f=/\'/g,g=/\"/g,h=/[&<>\"\']/,k=Array.isArray||function(a){return Object.prototype.toString.call(a)==="[object Array]"}})(typeof exports!="undefined"?exports:Hogan),function(a){function h(a){a.n.substr(a.n.length-1)==="}"&&(a.n=a.n.substring(0,a.n.length-1))}function i(a){return a.trim?a.trim():a.replace(/^\s*|\s*$/g,"")}function j(a,b,c){if(b.charAt(c)!=a.charAt(0))return!1;for(var d=1,e=a.length;d0){g=a.shift();if(g.tag=="#"||g.tag=="^"||l(g,d))c.push(g),g.nodes=k(a,g.tag,c,d),e.push(g);else{if(g.tag=="/"){if(c.length===0)throw new Error("Closing tag without opener: /"+g.n);f=c.pop();if(g.n!=f.n&&!m(g.n,f.n,d))throw new Error("Nesting error: "+f.n+" vs. "+g.n);return f.end=g.i,e}e.push(g)}}if(c.length>0)throw new Error("missing closing tag: "+c.pop().n);return e}function l(a,b){for(var c=0,d=b.length;c"?b+=t(a[c]):e=="{"||e=="&"?b+=u(a[c].n,p(a[c].n)):e=="\n"?b+=w('"\\n"'+(a.length-1==c?"":" + i")):e=="_v"?b+=v(a[c].n,p(a[c].n)):e===undefined&&(b+=w('"'+o(a[c])+'"'))}return b}function r(a,b,c,d,e,f){return"if(_.s(_."+c+'("'+o(b)+'",c,p,1),'+"c,p,0,"+d+","+e+',"'+f+'")){'+"_.rs(c,p,"+"function(c,p,_){"+q(a)+"});c.pop();}"}function s(a,b,c){return"if(!_.s(_."+c+'("'+o(b)+'",c,p,1),c,p,1,0,0,"")){'+q(a)+"};"}function t(a){return'_.b(_.rp("'+o(a.n)+'",c,p,"'+(a.indent||"")+'"));'}function u(a,b){return"_.b(_.t(_."+b+'("'+o(a)+'",c,p,0)));'}function v(a,b){return"_.b(_.v(_."+b+'("'+o(a)+'",c,p,0)));'}function w(a){return"_.b("+a+");"}var b=/\S/,c=/\"/g,d=/\n/g,e=/\r/g,f=/\\/g,g={"#":1,"^":2,"/":3,"!":4,">":5,"<":6,"=":7,_v:8,"{":9,"&":10};a.scan=function(c,d){function w(){p.length>0&&(q.push(new String(p)),p="")}function x(){var a=!0;for(var c=t;c"&&(d.indent=q[c].toString()),q.splice(c,1));else b||q.push({tag:"\n"});r=!1,t=q.length}function z(a,b){var c="="+v,d=a.indexOf(c,b),e=i(a.substring(a.indexOf("=",b)+1,d)).split(" ");return u=e[0],v=e[1],d+c.length-1}var e=c.length,f=0,k=1,l=2,m=f,n=null,o=null,p="",q=[],r=!1,s=0,t=0,u="{{",v="}}";d&&(d=d.split(" "),u=d[0],v=d[1]);for(s=0;s= 0; i--) { 134 | v = ctx[i]; 135 | if (v && typeof v == 'object' && key in v) { 136 | val = v[key]; 137 | found = true; 138 | break; 139 | } 140 | } 141 | 142 | if (!found) { 143 | return (returnFound) ? false : ""; 144 | } 145 | 146 | if (!returnFound && typeof val == 'function') { 147 | val = this.lv(val, ctx, partials); 148 | } 149 | 150 | return val; 151 | }, 152 | 153 | // higher order templates 154 | ho: function(val, cx, partials, text, tags) { 155 | var compiler = this.c; 156 | var t = val.call(cx, text, function(t) { 157 | return compiler.compile(t, {delimiters: tags}).render(cx, partials); 158 | }); 159 | this.b(compiler.compile(t.toString(), {delimiters: tags}).render(cx, partials)); 160 | return false; 161 | }, 162 | 163 | // template result buffering 164 | b: (useArrayBuffer) ? function(s) { this.buf.push(s); } : 165 | function(s) { this.buf += s; }, 166 | fl: (useArrayBuffer) ? function() { var r = this.buf.join(''); this.buf = []; return r; } : 167 | function() { var r = this.buf; this.buf = ''; return r; }, 168 | 169 | // lambda replace section 170 | ls: function(val, ctx, partials, inverted, start, end, tags) { 171 | var cx = ctx[ctx.length - 1], 172 | t = null; 173 | 174 | if (!inverted && this.c && val.length > 0) { 175 | return this.ho(val, cx, partials, this.text.substring(start, end), tags); 176 | } 177 | 178 | t = val.call(cx); 179 | 180 | if (typeof t == 'function') { 181 | if (inverted) { 182 | return true; 183 | } else if (this.c) { 184 | return this.ho(t, cx, partials, this.text.substring(start, end), tags); 185 | } 186 | } 187 | 188 | return t; 189 | }, 190 | 191 | // lambda replace variable 192 | lv: function(val, ctx, partials) { 193 | var cx = ctx[ctx.length - 1]; 194 | var result = val.call(cx); 195 | if (typeof result == 'function') { 196 | result = result.call(cx); 197 | } 198 | result = result.toString(); 199 | 200 | if (this.c && ~result.indexOf("{{")) { 201 | return this.c.compile(result).render(cx, partials); 202 | } 203 | 204 | return result; 205 | } 206 | 207 | }; 208 | 209 | var rAmp = /&/g, 210 | rLt = //g, 212 | rApos =/\'/g, 213 | rQuot = /\"/g, 214 | hChars =/[&<>\"\']/; 215 | 216 | function hoganEscape(str) { 217 | str = String((str === null || str === undefined) ? '' : str); 218 | return hChars.test(str) ? 219 | str 220 | .replace(rAmp,'&') 221 | .replace(rLt,'<') 222 | .replace(rGt,'>') 223 | .replace(rApos,''') 224 | .replace(rQuot, '"') : 225 | str; 226 | } 227 | 228 | var isArray = Array.isArray || function(a) { 229 | return Object.prototype.toString.call(a) === '[object Array]'; 230 | }; 231 | 232 | })(typeof exports !== 'undefined' ? exports : Hogan); 233 | 234 | -------------------------------------------------------------------------------- /web/builds/2.0.0/template-2.0.0.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Twitter, Inc. 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | var Hogan = {}; 17 | 18 | (function (Hogan, useArrayBuffer) { 19 | Hogan.Template = function (renderFunc, text, compiler, options) { 20 | this.r = renderFunc || this.r; 21 | this.c = compiler; 22 | this.options = options; 23 | this.text = text || ''; 24 | this.buf = (useArrayBuffer) ? [] : ''; 25 | } 26 | 27 | Hogan.Template.prototype = { 28 | // render: replaced by generated code. 29 | r: function (context, partials, indent) { return ''; }, 30 | 31 | // variable escaping 32 | v: hoganEscape, 33 | 34 | // triple stache 35 | t: coerceToString, 36 | 37 | render: function render(context, partials, indent) { 38 | return this.ri([context], partials || {}, indent); 39 | }, 40 | 41 | // render internal -- a hook for overrides that catches partials too 42 | ri: function (context, partials, indent) { 43 | return this.r(context, partials, indent); 44 | }, 45 | 46 | // tries to find a partial in the curent scope and render it 47 | rp: function(name, context, partials, indent) { 48 | var partial = partials[name]; 49 | 50 | if (!partial) { 51 | return ''; 52 | } 53 | 54 | if (this.c && typeof partial == 'string') { 55 | partial = this.c.compile(partial, this.options); 56 | } 57 | 58 | return partial.ri(context, partials, indent); 59 | }, 60 | 61 | // render a section 62 | rs: function(context, partials, section) { 63 | var tail = context[context.length - 1]; 64 | 65 | if (!isArray(tail)) { 66 | section(context, partials, this); 67 | return; 68 | } 69 | 70 | for (var i = 0; i < tail.length; i++) { 71 | context.push(tail[i]); 72 | section(context, partials, this); 73 | context.pop(); 74 | } 75 | }, 76 | 77 | // maybe start a section 78 | s: function(val, ctx, partials, inverted, start, end, tags) { 79 | var pass; 80 | 81 | if (isArray(val) && val.length === 0) { 82 | return false; 83 | } 84 | 85 | if (typeof val == 'function') { 86 | val = this.ls(val, ctx, partials, inverted, start, end, tags); 87 | } 88 | 89 | pass = (val === '') || !!val; 90 | 91 | if (!inverted && pass && ctx) { 92 | ctx.push((typeof val == 'object') ? val : ctx[ctx.length - 1]); 93 | } 94 | 95 | return pass; 96 | }, 97 | 98 | // find values with dotted names 99 | d: function(key, ctx, partials, returnFound) { 100 | var names = key.split('.'), 101 | val = this.f(names[0], ctx, partials, returnFound), 102 | cx = null; 103 | 104 | if (key === '.' && isArray(ctx[ctx.length - 2])) { 105 | return ctx[ctx.length - 1]; 106 | } 107 | 108 | for (var i = 1; i < names.length; i++) { 109 | if (val && typeof val == 'object' && names[i] in val) { 110 | cx = val; 111 | val = val[names[i]]; 112 | } else { 113 | val = ''; 114 | } 115 | } 116 | 117 | if (returnFound && !val) { 118 | return false; 119 | } 120 | 121 | if (!returnFound && typeof val == 'function') { 122 | ctx.push(cx); 123 | val = this.lv(val, ctx, partials); 124 | ctx.pop(); 125 | } 126 | 127 | return val; 128 | }, 129 | 130 | // find values with normal names 131 | f: function(key, ctx, partials, returnFound) { 132 | var val = false, 133 | v = null, 134 | found = false; 135 | 136 | for (var i = ctx.length - 1; i >= 0; i--) { 137 | v = ctx[i]; 138 | if (v && typeof v == 'object' && key in v) { 139 | val = v[key]; 140 | found = true; 141 | break; 142 | } 143 | } 144 | 145 | if (!found) { 146 | return (returnFound) ? false : ""; 147 | } 148 | 149 | if (!returnFound && typeof val == 'function') { 150 | val = this.lv(val, ctx, partials); 151 | } 152 | 153 | return val; 154 | }, 155 | 156 | // higher order templates 157 | ho: function(val, cx, partials, text, tags) { 158 | var compiler = this.c; 159 | var options = this.options; 160 | options.delimiters = tags; 161 | var text = val.call(cx, text); 162 | text = (text == null) ? String(text) : text.toString(); 163 | this.b(compiler.compile(text, options).render(cx, partials)); 164 | return false; 165 | }, 166 | 167 | // template result buffering 168 | b: (useArrayBuffer) ? function(s) { this.buf.push(s); } : 169 | function(s) { this.buf += s; }, 170 | fl: (useArrayBuffer) ? function() { var r = this.buf.join(''); this.buf = []; return r; } : 171 | function() { var r = this.buf; this.buf = ''; return r; }, 172 | 173 | // lambda replace section 174 | ls: function(val, ctx, partials, inverted, start, end, tags) { 175 | var cx = ctx[ctx.length - 1], 176 | t = null; 177 | 178 | if (!inverted && this.c && val.length > 0) { 179 | return this.ho(val, cx, partials, this.text.substring(start, end), tags); 180 | } 181 | 182 | t = val.call(cx); 183 | 184 | if (typeof t == 'function') { 185 | if (inverted) { 186 | return true; 187 | } else if (this.c) { 188 | return this.ho(t, cx, partials, this.text.substring(start, end), tags); 189 | } 190 | } 191 | 192 | return t; 193 | }, 194 | 195 | // lambda replace variable 196 | lv: function(val, ctx, partials) { 197 | var cx = ctx[ctx.length - 1]; 198 | var result = val.call(cx); 199 | 200 | if (typeof result == 'function') { 201 | result = coerceToString(result.call(cx)); 202 | if (this.c && ~result.indexOf("{\u007B")) { 203 | return this.c.compile(result, this.options).render(cx, partials); 204 | } 205 | } 206 | 207 | return coerceToString(result); 208 | } 209 | 210 | }; 211 | 212 | var rAmp = /&/g, 213 | rLt = //g, 215 | rApos =/\'/g, 216 | rQuot = /\"/g, 217 | hChars =/[&<>\"\']/; 218 | 219 | 220 | function coerceToString(val) { 221 | return String((val === null || val === undefined) ? '' : val); 222 | } 223 | 224 | function hoganEscape(str) { 225 | str = coerceToString(str); 226 | return hChars.test(str) ? 227 | str 228 | .replace(rAmp,'&') 229 | .replace(rLt,'<') 230 | .replace(rGt,'>') 231 | .replace(rApos,''') 232 | .replace(rQuot, '"') : 233 | str; 234 | } 235 | 236 | var isArray = Array.isArray || function(a) { 237 | return Object.prototype.toString.call(a) === '[object Array]'; 238 | }; 239 | 240 | })(typeof exports !== 'undefined' ? exports : Hogan); 241 | 242 | -------------------------------------------------------------------------------- /web/builds/1.0.5/template-1.0.5.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Twitter, Inc. 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | var Hogan = {}; 17 | 18 | (function (Hogan, useArrayBuffer) { 19 | Hogan.Template = function (renderFunc, text, compiler, options) { 20 | this.r = renderFunc || this.r; 21 | this.c = compiler; 22 | this.options = options; 23 | this.text = text || ''; 24 | this.buf = (useArrayBuffer) ? [] : ''; 25 | } 26 | 27 | Hogan.Template.prototype = { 28 | // render: replaced by generated code. 29 | r: function (context, partials, indent) { return ''; }, 30 | 31 | // variable escaping 32 | v: hoganEscape, 33 | 34 | // triple stache 35 | t: coerceToString, 36 | 37 | render: function render(context, partials, indent) { 38 | return this.ri([context], partials || {}, indent); 39 | }, 40 | 41 | // render internal -- a hook for overrides that catches partials too 42 | ri: function (context, partials, indent) { 43 | return this.r(context, partials, indent); 44 | }, 45 | 46 | // tries to find a partial in the curent scope and render it 47 | rp: function(name, context, partials, indent) { 48 | var partial = partials[name]; 49 | 50 | if (!partial) { 51 | return ''; 52 | } 53 | 54 | if (this.c && typeof partial == 'string') { 55 | partial = this.c.compile(partial, this.options); 56 | } 57 | 58 | return partial.ri(context, partials, indent); 59 | }, 60 | 61 | // render a section 62 | rs: function(context, partials, section) { 63 | var tail = context[context.length - 1]; 64 | 65 | if (!isArray(tail)) { 66 | section(context, partials, this); 67 | return; 68 | } 69 | 70 | for (var i = 0; i < tail.length; i++) { 71 | context.push(tail[i]); 72 | section(context, partials, this); 73 | context.pop(); 74 | } 75 | }, 76 | 77 | // maybe start a section 78 | s: function(val, ctx, partials, inverted, start, end, tags) { 79 | var pass; 80 | 81 | if (isArray(val) && val.length === 0) { 82 | return false; 83 | } 84 | 85 | if (typeof val == 'function') { 86 | val = this.ls(val, ctx, partials, inverted, start, end, tags); 87 | } 88 | 89 | pass = (val === '') || !!val; 90 | 91 | if (!inverted && pass && ctx) { 92 | ctx.push((typeof val == 'object') ? val : ctx[ctx.length - 1]); 93 | } 94 | 95 | return pass; 96 | }, 97 | 98 | // find values with dotted names 99 | d: function(key, ctx, partials, returnFound) { 100 | var names = key.split('.'), 101 | val = this.f(names[0], ctx, partials, returnFound), 102 | cx = null; 103 | 104 | if (key === '.' && isArray(ctx[ctx.length - 2])) { 105 | return ctx[ctx.length - 1]; 106 | } 107 | 108 | for (var i = 1; i < names.length; i++) { 109 | if (val && typeof val == 'object' && names[i] in val) { 110 | cx = val; 111 | val = val[names[i]]; 112 | } else { 113 | val = ''; 114 | } 115 | } 116 | 117 | if (returnFound && !val) { 118 | return false; 119 | } 120 | 121 | if (!returnFound && typeof val == 'function') { 122 | ctx.push(cx); 123 | val = this.lv(val, ctx, partials); 124 | ctx.pop(); 125 | } 126 | 127 | return val; 128 | }, 129 | 130 | // find values with normal names 131 | f: function(key, ctx, partials, returnFound) { 132 | var val = false, 133 | v = null, 134 | found = false; 135 | 136 | for (var i = ctx.length - 1; i >= 0; i--) { 137 | v = ctx[i]; 138 | if (v && typeof v == 'object' && key in v) { 139 | val = v[key]; 140 | found = true; 141 | break; 142 | } 143 | } 144 | 145 | if (!found) { 146 | return (returnFound) ? false : ""; 147 | } 148 | 149 | if (!returnFound && typeof val == 'function') { 150 | val = this.lv(val, ctx, partials); 151 | } 152 | 153 | return val; 154 | }, 155 | 156 | // higher order templates 157 | ho: function(val, cx, partials, text, tags) { 158 | var compiler = this.c; 159 | var options = this.options; 160 | options.delimiters = tags; 161 | var t = val.call(cx, text, function(t) { 162 | return compiler.compile(t, options).render(cx, partials); 163 | }); 164 | this.b(compiler.compile(t.toString(), options).render(cx, partials)); 165 | return false; 166 | }, 167 | 168 | // template result buffering 169 | b: (useArrayBuffer) ? function(s) { this.buf.push(s); } : 170 | function(s) { this.buf += s; }, 171 | fl: (useArrayBuffer) ? function() { var r = this.buf.join(''); this.buf = []; return r; } : 172 | function() { var r = this.buf; this.buf = ''; return r; }, 173 | 174 | // lambda replace section 175 | ls: function(val, ctx, partials, inverted, start, end, tags) { 176 | var cx = ctx[ctx.length - 1], 177 | t = null; 178 | 179 | if (!inverted && this.c && val.length > 0) { 180 | return this.ho(val, cx, partials, this.text.substring(start, end), tags); 181 | } 182 | 183 | t = val.call(cx); 184 | 185 | if (typeof t == 'function') { 186 | if (inverted) { 187 | return true; 188 | } else if (this.c) { 189 | return this.ho(t, cx, partials, this.text.substring(start, end), tags); 190 | } 191 | } 192 | 193 | return t; 194 | }, 195 | 196 | // lambda replace variable 197 | lv: function(val, ctx, partials) { 198 | var cx = ctx[ctx.length - 1]; 199 | var result = val.call(cx); 200 | if (typeof result == 'function') { 201 | result = result.call(cx); 202 | } 203 | result = coerceToString(result); 204 | 205 | if (this.c && ~result.indexOf("{\u007B")) { 206 | return this.c.compile(result, this.options).render(cx, partials); 207 | } 208 | 209 | return result; 210 | } 211 | 212 | }; 213 | 214 | var rAmp = /&/g, 215 | rLt = //g, 217 | rApos =/\'/g, 218 | rQuot = /\"/g, 219 | hChars =/[&<>\"\']/; 220 | 221 | 222 | function coerceToString(val) { 223 | return String((val === null || val === undefined) ? '' : val); 224 | } 225 | 226 | function hoganEscape(str) { 227 | str = coerceToString(str); 228 | return hChars.test(str) ? 229 | str 230 | .replace(rAmp,'&') 231 | .replace(rLt,'<') 232 | .replace(rGt,'>') 233 | .replace(rApos,''') 234 | .replace(rQuot, '"') : 235 | str; 236 | } 237 | 238 | var isArray = Array.isArray || function(a) { 239 | return Object.prototype.toString.call(a) === '[object Array]'; 240 | }; 241 | 242 | })(typeof exports !== 'undefined' ? exports : Hogan); 243 | 244 | -------------------------------------------------------------------------------- /web/builds/3.0.1/hogan-3.0.1.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @preserve Copyright 2012 Twitter, Inc. 3 | * @license http://www.apache.org/licenses/LICENSE-2.0.txt 4 | */ 5 | var Hogan={};(function(e){function t(e,t,n){var r,i;return t&&typeof t=="object"&&(t[e]!=null?r=t[e]:n&&t.get&&typeof t.get=="function"&&(r=t.get(e))),r}function n(e,t,n,r,i,s){function o(){}function u(){}o.prototype=e,u.prototype=e.subs;var a,f=new o;f.subs=new u,f.subsText={},f.buf="",r=r||{},f.stackSubs=r,f.subsText=s;for(a in t)r[a]||(r[a]=t[a]);for(a in r)f.subs[a]=r[a];i=i||{},f.stackPartials=i;for(a in n)i[a]||(i[a]=n[a]);for(a in i)f.partials[a]=i[a];return f}function f(e){return String(e===null||e===undefined?"":e)}function l(e){return e=f(e),a.test(e)?e.replace(r,"&").replace(i,"<").replace(s,">").replace(o,"'").replace(u,"""):e}e.Template=function(e,t,n,r){e=e||{},this.r=e.code||this.r,this.c=n,this.options=r||{},this.text=t||"",this.partials=e.partials||{},this.subs=e.subs||{},this.buf=""},e.Template.prototype={r:function(e,t,n){return""},v:l,t:f,render:function(t,n,r){return this.ri([t],n||{},r)},ri:function(e,t,n){return this.r(e,t,n)},ep:function(e,t){var r=this.partials[e],i=t[r.name];if(r.instance&&r.base==i)return r.instance;if(typeof i=="string"){if(!this.c)throw new Error("No compiler available.");i=this.c.compile(i,this.options)}if(!i)return null;this.partials[e].base=i;if(r.subs){t.stackText||(t.stackText={});for(key in r.subs)t.stackText[key]||(t.stackText[key]=this.activeSub!==undefined&&t.stackText[this.activeSub]?t.stackText[this.activeSub]:this.text);i=n(i,r.subs,r.partials,this.stackSubs,this.stackPartials,t.stackText)}return this.partials[e].instance=i,i},rp:function(e,t,n,r){var i=this.ep(e,n);return i?i.ri(t,n,r):""},rs:function(e,t,n){var r=e[e.length-1];if(!c(r)){n(e,t,this);return}for(var i=0;i=0;f--){o=n[f],s=t(e,o,a);if(s!=null){u=!0;break}}return u?(!i&&typeof s=="function"&&(s=this.mv(s,n,r)),s):i?!1:""},ls:function(e,t,n,r,i){var s=this.options.delimiters;return this.options.delimiters=i,this.b(this.ct(f(e.call(t,r)),t,n)),this.options.delimiters=s,!1},ct:function(e,t,n){if(this.options.disableLambda)throw new Error("Lambda features disabled.");return this.c.compile(e,this.options).render(t,n)},b:function(e){this.buf+=e},fl:function(){var e=this.buf;return this.buf="",e},ms:function(e,t,n,r,i,s,o){var u,a=t[t.length-1],f=e.call(a);return typeof f=="function"?r?!0:(u=this.activeSub&&this.subsText&&this.subsText[this.activeSub]?this.subsText[this.activeSub]:this.text,this.ls(f,a,n,u.substring(i,s),o)):f},mv:function(e,t,n){var r=t[t.length-1],i=e.call(r);return typeof i=="function"?this.ct(f(i.call(r)),r,n):i},sub:function(e,t,n,r){var i=this.subs[e];i&&(this.activeSub=e,i(t,n,this,r),this.activeSub=!1)}};var r=/&/g,i=//g,o=/\'/g,u=/\"/g,a=/[&<>\"\']/,c=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"}})(typeof exports!="undefined"?exports:Hogan),function(e){function o(e){e.n.substr(e.n.length-1)==="}"&&(e.n=e.n.substring(0,e.n.length-1))}function u(e){return e.trim?e.trim():e.replace(/^\s*|\s*$/g,"")}function a(e,t,n){if(t.charAt(n)!=e.charAt(0))return!1;for(var r=1,i=e.length;r0){a=t.shift();if(!(!u||u.tag!="<"||a.tag in f))throw new Error("Illegal content in < super tag.");if(e.tags[a.tag]<=e.tags.$||c(a,i))r.push(a),a.nodes=l(t,a.tag,r,i);else{if(a.tag=="/"){if(r.length===0)throw new Error("Closing tag without opener: /"+a.n);o=r.pop();if(a.n!=o.n&&!h(a.n,o.n,i))throw new Error("Nesting error: "+o.n+" vs. "+a.n);return o.end=a.i,s}a.tag=="\n"&&(a.last=t.length==0||t[0].tag=="\n")}s.push(a)}if(r.length>0)throw new Error("missing closing tag: "+r.pop().n);return s}function c(e,t){for(var n=0,r=t.length;n":7,"=":8,_v:9,"{":10,"&":11,_t:12},e.scan=function(r,i){function S(){v.length>0&&(m.push({tag:"_t",text:new String(v)}),v="")}function x(){var n=!0;for(var r=b;r"&&(r.indent=m[n].text.toString()),m.splice(n,1));else t||m.push({tag:"\n"});g=!1,b=m.length}function N(e,t){var n="="+E,r=e.indexOf(n,t),i=u(e.substring(e.indexOf("=",t)+1,r)).split(" ");return w=i[0],E=i[i.length-1],r+n.length-1}var s=r.length,f=0,l=1,c=2,h=f,p=null,d=null,v="",m=[],g=!1,y=0,b=0,w="{{",E="}}";i&&(i=i.split(" "),w=i[0],E=i[1]);for(y=0;y":y,"<":function(t,n){var r={partials:{},code:"",subs:{},inPartial:!0};e.walk(t.nodes,r);var i=n.partials[y(t,n)];i.subs=r.subs,i.partials=r.partials},$:function(t,n){var r={subs:{},code:"",partials:n.partials,prefix:t.n};e.walk(t.nodes,r),n.subs[t.n]=r.code,n.inPartial||(n.code+='t.sub("'+m(t.n)+'",c,p,i);')},"\n":function(e,t){t.code+=w('"\\n"'+(e.last?"":" + i"))},_v:function(e,t){t.code+="t.b(t.v(t."+g(e.n)+'("'+m(e.n)+'",c,p,0)));'},_t:function(e,t){t.code+=w('"'+m(e.text)+'"')},"{":b,"&":b},e.walk=function(t,n){var r;for(var i=0,s=t.length;i=0;c--)if(a=e[c],s=n(t,a,u),void 0!==s){o=!0;break}return o?(r||"function"!=typeof s||(s=this.mv(s,e,i)),s):r?!1:""},ls:function(t,n,e,r,s){var a=this.options.delimiters;return this.options.delimiters=s,this.b(this.ct(i(t.call(n,r)),n,e)),this.options.delimiters=a,!1},ct:function(t,n,e){if(this.options.disableLambda)throw new Error("Lambda features disabled.");return this.c.compile(t,this.options).render(n,e)},b:function(t){this.buf+=t},fl:function(){var t=this.buf;return this.buf="",t},ms:function(t,n,e,i,r,s,a){var o,u=n[n.length-1],c=t.call(u);return"function"==typeof c?i?!0:(o=this.activeSub&&this.subsText&&this.subsText[this.activeSub]?this.subsText[this.activeSub]:this.text,this.ls(c,u,e,o.substring(r,s),a)):c},mv:function(t,n,e){var r=n[n.length-1],s=t.call(r);return"function"==typeof s?this.ct(i(s.call(r)),r,e):s},sub:function(t,n,e,i){var r=this.subs[t];r&&(this.activeSub=t,r(n,e,this,i),this.activeSub=!1)}};var s=/&/g,a=//g,u=/\'/g,c=/\"/g,l=/[&<>\"\']/,f=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}}("undefined"!=typeof exports?exports:Hogan),function(t){function n(t){"}"===t.n.substr(t.n.length-1)&&(t.n=t.n.substring(0,t.n.length-1))}function e(t){return t.trim?t.trim():t.replace(/^\s*|\s*$/g,"")}function i(t,n,e){if(n.charAt(e)!=t.charAt(0))return!1;for(var i=1,r=t.length;r>i;i++)if(n.charAt(e+i)!=t.charAt(i))return!1;return!0}function r(n,e,i,o){var u=[],c=null,l=null,f=null;for(l=i[i.length-1];n.length>0;){if(f=n.shift(),l&&"<"==l.tag&&!(f.tag in k))throw new Error("Illegal content in < super tag.");if(t.tags[f.tag]<=t.tags.$||s(f,o))i.push(f),f.nodes=r(n,f.tag,i,o);else{if("/"==f.tag){if(0===i.length)throw new Error("Closing tag without opener: /"+f.n);if(c=i.pop(),f.n!=c.n&&!a(f.n,c.n,o))throw new Error("Nesting error: "+c.n+" vs. "+f.n);return c.end=f.i,u}"\n"==f.tag&&(f.last=0==n.length||"\n"==n[0].tag)}u.push(f)}if(i.length>0)throw new Error("missing closing tag: "+i.pop().n);return u}function s(t,n){for(var e=0,i=n.length;i>e;e++)if(n[e].o==t.n)return t.tag="#",!0}function a(t,n,e){for(var i=0,r=e.length;r>i;i++)if(e[i].c==t&&e[i].o==n)return!0}function o(t){var n=[];for(var e in t)n.push('"'+c(e)+'": function(c,p,t,i) {'+t[e]+"}");return"{ "+n.join(",")+" }"}function u(t){var n=[];for(var e in t.partials)n.push('"'+c(e)+'":{name:"'+c(t.partials[e].name)+'", '+u(t.partials[e])+"}");return"partials: {"+n.join(",")+"}, subs: "+o(t.subs)}function c(t){return t.replace(m,"\\\\").replace(v,'\\"').replace(b,"\\n").replace(d,"\\r").replace(x,"\\u2028").replace(w,"\\u2029")}function l(t){return~t.indexOf(".")?"d":"f"}function f(t,n){var e="<"+(n.prefix||""),i=e+t.n+y++;return n.partials[i]={name:t.n,partials:{}},n.code+='t.b(t.rp("'+c(i)+'",c,p,"'+(t.indent||"")+'"));',i}function h(t,n){n.code+="t.b(t.t(t."+l(t.n)+'("'+c(t.n)+'",c,p,0)));'}function p(t){return"t.b("+t+");"}var g=/\S/,v=/\"/g,b=/\n/g,d=/\r/g,m=/\\/g,x=/\u2028/,w=/\u2029/;t.tags={"#":1,"^":2,"<":3,$:4,"/":5,"!":6,">":7,"=":8,_v:9,"{":10,"&":11,_t:12},t.scan=function(r,s){function a(){m.length>0&&(x.push({tag:"_t",text:new String(m)}),m="")}function o(){for(var n=!0,e=y;e"==e.tag&&(e.indent=x[i].text.toString()),x.splice(i,1));else n||x.push({tag:"\n"});w=!1,y=x.length}function c(t,n){var i="="+S,r=t.indexOf(i,n),s=e(t.substring(t.indexOf("=",n)+1,r)).split(" ");return T=s[0],S=s[s.length-1],r+i.length-1}var l=r.length,f=0,h=1,p=2,v=f,b=null,d=null,m="",x=[],w=!1,k=0,y=0,T="{{",S="}}";for(s&&(s=s.split(" "),T=s[0],S=s[1]),k=0;l>k;k++)v==f?i(T,r,k)?(--k,a(),v=h):"\n"==r.charAt(k)?u(w):m+=r.charAt(k):v==h?(k+=T.length-1,d=t.tags[r.charAt(k+1)],b=d?r.charAt(k+1):"_v","="==b?(k=c(r,k),v=f):(d&&k++,v=p),w=k):i(S,r,k)?(x.push({tag:b,n:e(m),otag:T,ctag:S,i:"/"==b?w-T.length:k+S.length}),m="",k+=S.length-1,v=f,"{"==b&&("}}"==S?k++:n(x[x.length-1]))):m+=r.charAt(k);return u(w,!0),x};var k={_t:!0,"\n":!0,$:!0,"/":!0};t.stringify=function(n){return"{code: function (c,p,i) { "+t.wrapMain(n.code)+" },"+u(n)+"}"};var y=0;t.generate=function(n,e,i){y=0;var r={code:"",subs:{},partials:{}};return t.walk(n,r),i.asString?this.stringify(r,e,i):this.makeTemplate(r,e,i)},t.wrapMain=function(t){return'var t=this;t.b(i=i||"");'+t+"return t.fl();"},t.template=t.Template,t.makeTemplate=function(t,n,e){var i=this.makePartials(t);return i.code=new Function("c","p","i",this.wrapMain(t.code)),new this.template(i,n,this,e)},t.makePartials=function(t){var n,e={subs:{},partials:t.partials,name:t.name};for(n in e.partials)e.partials[n]=this.makePartials(e.partials[n]);for(n in t.subs)e.subs[n]=new Function("c","p","t","i",t.subs[n]);return e},t.codegen={"#":function(n,e){e.code+="if(t.s(t."+l(n.n)+'("'+c(n.n)+'",c,p,1),c,p,0,'+n.i+","+n.end+',"'+n.otag+" "+n.ctag+'")){t.rs(c,p,function(c,p,t){',t.walk(n.nodes,e),e.code+="});c.pop();}"},"^":function(n,e){e.code+="if(!t.s(t."+l(n.n)+'("'+c(n.n)+'",c,p,1),c,p,1,0,0,"")){',t.walk(n.nodes,e),e.code+="};"},">":f,"<":function(n,e){var i={partials:{},code:"",subs:{},inPartial:!0};t.walk(n.nodes,i);var r=e.partials[f(n,e)];r.subs=i.subs,r.partials=i.partials},$:function(n,e){var i={subs:{},code:"",partials:e.partials,prefix:n.n};t.walk(n.nodes,i),e.subs[n.n]=i.code,e.inPartial||(e.code+='t.sub("'+c(n.n)+'",c,p,i);')},"\n":function(t,n){n.code+=p('"\\n"'+(t.last?"":" + i"))},_v:function(t,n){n.code+="t.b(t.v(t."+l(t.n)+'("'+c(t.n)+'",c,p,0)));'},_t:function(t,n){n.code+=p('"'+c(t.text)+'"')},"{":h,"&":h},t.walk=function(n,e){for(var i,r=0,s=n.length;s>r;r++)i=t.codegen[n[r].tag],i&&i(n[r],e);return e},t.parse=function(t,n,e){return e=e||{},r(t,"",[],e.sectionTags||[])},t.cache={},t.cacheKey=function(t,n){return[t,!!n.asString,!!n.disableLambda,n.delimiters,!!n.modelGet].join("||")},t.compile=function(n,e){e=e||{};var i=t.cacheKey(n,e),r=this.cache[i];if(r){var s=r.partials;for(var a in s)delete s[a].instance;return r}return r=this.generate(this.parse(this.scan(n,e.delimiters),n,e),n,e),this.cache[i]=r}}("undefined"!=typeof exports?exports:Hogan); -------------------------------------------------------------------------------- /web/builds/3.0.1/hogan-3.0.1.min.amd.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @preserve Copyright 2012 Twitter, Inc. 3 | * @license http://www.apache.org/licenses/LICENSE-2.0.txt 4 | */ 5 | var Hogan={};(function(e){function t(e,t,n){var r,i;return t&&typeof t=="object"&&(t[e]!=null?r=t[e]:n&&t.get&&typeof t.get=="function"&&(r=t.get(e))),r}function n(e,t,n,r,i,s){function o(){}function u(){}o.prototype=e,u.prototype=e.subs;var a,f=new o;f.subs=new u,f.subsText={},f.buf="",r=r||{},f.stackSubs=r,f.subsText=s;for(a in t)r[a]||(r[a]=t[a]);for(a in r)f.subs[a]=r[a];i=i||{},f.stackPartials=i;for(a in n)i[a]||(i[a]=n[a]);for(a in i)f.partials[a]=i[a];return f}function f(e){return String(e===null||e===undefined?"":e)}function l(e){return e=f(e),a.test(e)?e.replace(r,"&").replace(i,"<").replace(s,">").replace(o,"'").replace(u,"""):e}e.Template=function(e,t,n,r){e=e||{},this.r=e.code||this.r,this.c=n,this.options=r||{},this.text=t||"",this.partials=e.partials||{},this.subs=e.subs||{},this.buf=""},e.Template.prototype={r:function(e,t,n){return""},v:l,t:f,render:function(t,n,r){return this.ri([t],n||{},r)},ri:function(e,t,n){return this.r(e,t,n)},ep:function(e,t){var r=this.partials[e],i=t[r.name];if(r.instance&&r.base==i)return r.instance;if(typeof i=="string"){if(!this.c)throw new Error("No compiler available.");i=this.c.compile(i,this.options)}if(!i)return null;this.partials[e].base=i;if(r.subs){t.stackText||(t.stackText={});for(key in r.subs)t.stackText[key]||(t.stackText[key]=this.activeSub!==undefined&&t.stackText[this.activeSub]?t.stackText[this.activeSub]:this.text);i=n(i,r.subs,r.partials,this.stackSubs,this.stackPartials,t.stackText)}return this.partials[e].instance=i,i},rp:function(e,t,n,r){var i=this.ep(e,n);return i?i.ri(t,n,r):""},rs:function(e,t,n){var r=e[e.length-1];if(!c(r)){n(e,t,this);return}for(var i=0;i=0;f--){o=n[f],s=t(e,o,a);if(s!=null){u=!0;break}}return u?(!i&&typeof s=="function"&&(s=this.mv(s,n,r)),s):i?!1:""},ls:function(e,t,n,r,i){var s=this.options.delimiters;return this.options.delimiters=i,this.b(this.ct(f(e.call(t,r)),t,n)),this.options.delimiters=s,!1},ct:function(e,t,n){if(this.options.disableLambda)throw new Error("Lambda features disabled.");return this.c.compile(e,this.options).render(t,n)},b:function(e){this.buf+=e},fl:function(){var e=this.buf;return this.buf="",e},ms:function(e,t,n,r,i,s,o){var u,a=t[t.length-1],f=e.call(a);return typeof f=="function"?r?!0:(u=this.activeSub&&this.subsText&&this.subsText[this.activeSub]?this.subsText[this.activeSub]:this.text,this.ls(f,a,n,u.substring(i,s),o)):f},mv:function(e,t,n){var r=t[t.length-1],i=e.call(r);return typeof i=="function"?this.ct(f(i.call(r)),r,n):i},sub:function(e,t,n,r){var i=this.subs[e];i&&(this.activeSub=e,i(t,n,this,r),this.activeSub=!1)}};var r=/&/g,i=//g,o=/\'/g,u=/\"/g,a=/[&<>\"\']/,c=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"}})(typeof exports!="undefined"?exports:Hogan),function(e){function o(e){e.n.substr(e.n.length-1)==="}"&&(e.n=e.n.substring(0,e.n.length-1))}function u(e){return e.trim?e.trim():e.replace(/^\s*|\s*$/g,"")}function a(e,t,n){if(t.charAt(n)!=e.charAt(0))return!1;for(var r=1,i=e.length;r0){a=t.shift();if(!(!u||u.tag!="<"||a.tag in f))throw new Error("Illegal content in < super tag.");if(e.tags[a.tag]<=e.tags.$||c(a,i))r.push(a),a.nodes=l(t,a.tag,r,i);else{if(a.tag=="/"){if(r.length===0)throw new Error("Closing tag without opener: /"+a.n);o=r.pop();if(a.n!=o.n&&!h(a.n,o.n,i))throw new Error("Nesting error: "+o.n+" vs. "+a.n);return o.end=a.i,s}a.tag=="\n"&&(a.last=t.length==0||t[0].tag=="\n")}s.push(a)}if(r.length>0)throw new Error("missing closing tag: "+r.pop().n);return s}function c(e,t){for(var n=0,r=t.length;n":7,"=":8,_v:9,"{":10,"&":11,_t:12},e.scan=function(r,i){function S(){v.length>0&&(m.push({tag:"_t",text:new String(v)}),v="")}function x(){var n=!0;for(var r=b;r"&&(r.indent=m[n].text.toString()),m.splice(n,1));else t||m.push({tag:"\n"});g=!1,b=m.length}function N(e,t){var n="="+E,r=e.indexOf(n,t),i=u(e.substring(e.indexOf("=",t)+1,r)).split(" ");return w=i[0],E=i[i.length-1],r+n.length-1}var s=r.length,f=0,l=1,c=2,h=f,p=null,d=null,v="",m=[],g=!1,y=0,b=0,w="{{",E="}}";i&&(i=i.split(" "),w=i[0],E=i[1]);for(y=0;y":y,"<":function(t,n){var r={partials:{},code:"",subs:{},inPartial:!0};e.walk(t.nodes,r);var i=n.partials[y(t,n)];i.subs=r.subs,i.partials=r.partials},$:function(t,n){var r={subs:{},code:"",partials:n.partials,prefix:t.n};e.walk(t.nodes,r),n.subs[t.n]=r.code,n.inPartial||(n.code+='t.sub("'+m(t.n)+'",c,p,i);')},"\n":function(e,t){t.code+=w('"\\n"'+(e.last?"":" + i"))},_v:function(e,t){t.code+="t.b(t.v(t."+g(e.n)+'("'+m(e.n)+'",c,p,0)));'},_t:function(e,t){t.code+=w('"'+m(e.text)+'"')},"{":b,"&":b},e.walk=function(t,n){var r;for(var i=0,s=t.length;i=0;f--){o=n[f],s=t(e,o,a);if(s!=null){u=!0;break}}return u?(!i&&typeof s=="function"&&(s=this.mv(s,n,r)),s):i?!1:""},ls:function(e,t,n,r,i){var s=this.options.delimiters;return this.options.delimiters=i,this.b(this.ct(f(e.call(t,r)),t,n)),this.options.delimiters=s,!1},ct:function(e,t,n){if(this.options.disableLambda)throw new Error("Lambda features disabled.");return this.c.compile(e,this.options).render(t,n)},b:function(e){this.buf+=e},fl:function(){var e=this.buf;return this.buf="",e},ms:function(e,t,n,r,i,s,o){var u,a=t[t.length-1],f=e.call(a);return typeof f=="function"?r?!0:(u=this.activeSub&&this.subsText&&this.subsText[this.activeSub]?this.subsText[this.activeSub]:this.text,this.ls(f,a,n,u.substring(i,s),o)):f},mv:function(e,t,n){var r=t[t.length-1],i=e.call(r);return typeof i=="function"?this.ct(f(i.call(r)),r,n):i},sub:function(e,t,n,r){var i=this.subs[e];i&&(this.activeSub=e,i(t,n,this,r),this.activeSub=!1)}};var r=/&/g,i=//g,o=/\'/g,u=/\"/g,a=/[&<>\"\']/,c=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"}})(typeof exports!="undefined"?exports:Hogan),function(e){function o(e){e.n.substr(e.n.length-1)==="}"&&(e.n=e.n.substring(0,e.n.length-1))}function u(e){return e.trim?e.trim():e.replace(/^\s*|\s*$/g,"")}function a(e,t,n){if(t.charAt(n)!=e.charAt(0))return!1;for(var r=1,i=e.length;r0){a=t.shift();if(!(!u||u.tag!="<"||a.tag in f))throw new Error("Illegal content in < super tag.");if(e.tags[a.tag]<=e.tags.$||c(a,i))r.push(a),a.nodes=l(t,a.tag,r,i);else{if(a.tag=="/"){if(r.length===0)throw new Error("Closing tag without opener: /"+a.n);o=r.pop();if(a.n!=o.n&&!h(a.n,o.n,i))throw new Error("Nesting error: "+o.n+" vs. "+a.n);return o.end=a.i,s}a.tag=="\n"&&(a.last=t.length==0||t[0].tag=="\n")}s.push(a)}if(r.length>0)throw new Error("missing closing tag: "+r.pop().n);return s}function c(e,t){for(var n=0,r=t.length;n":7,"=":8,_v:9,"{":10,"&":11,_t:12},e.scan=function(r,i){function S(){v.length>0&&(m.push({tag:"_t",text:new String(v)}),v="")}function x(){var n=!0;for(var r=b;r"&&(r.indent=m[n].text.toString()),m.splice(n,1));else t||m.push({tag:"\n"});g=!1,b=m.length}function N(e,t){var n="="+E,r=e.indexOf(n,t),i=u(e.substring(e.indexOf("=",t)+1,r)).split(" ");return w=i[0],E=i[i.length-1],r+n.length-1}var s=r.length,f=0,l=1,c=2,h=f,p=null,d=null,v="",m=[],g=!1,y=0,b=0,w="{{",E="}}";i&&(i=i.split(" "),w=i[0],E=i[1]);for(y=0;y":y,"<":function(t,n){var r={partials:{},code:"",subs:{},inPartial:!0};e.walk(t.nodes,r);var i=n.partials[y(t,n)];i.subs=r.subs,i.partials=r.partials},$:function(t,n){var r={subs:{},code:"",partials:n.partials,prefix:t.n};e.walk(t.nodes,r),n.subs[t.n]=r.code,n.inPartial||(n.code+='t.sub("'+m(t.n)+'",c,p,i);')},"\n":function(e,t){t.code+=w('"\\n"'+(e.last?"":" + i"))},_v:function(e,t){t.code+="t.b(t.v(t."+g(e.n)+'("'+m(e.n)+'",c,p,0)));'},_t:function(e,t){t.code+=w('"'+m(e.text)+'"')},"{":b,"&":b},e.walk=function(t,n){var r;for(var i=0,s=t.length;i=0;c--)if(a=e[c],s=n(t,a,u),void 0!==s){o=!0;break}return o?(r||"function"!=typeof s||(s=this.mv(s,e,i)),s):r?!1:""},ls:function(t,n,e,r,s){var a=this.options.delimiters;return this.options.delimiters=s,this.b(this.ct(i(t.call(n,r)),n,e)),this.options.delimiters=a,!1},ct:function(t,n,e){if(this.options.disableLambda)throw new Error("Lambda features disabled.");return this.c.compile(t,this.options).render(n,e)},b:function(t){this.buf+=t},fl:function(){var t=this.buf;return this.buf="",t},ms:function(t,n,e,i,r,s,a){var o,u=n[n.length-1],c=t.call(u);return"function"==typeof c?i?!0:(o=this.activeSub&&this.subsText&&this.subsText[this.activeSub]?this.subsText[this.activeSub]:this.text,this.ls(c,u,e,o.substring(r,s),a)):c},mv:function(t,n,e){var r=n[n.length-1],s=t.call(r);return"function"==typeof s?this.ct(i(s.call(r)),r,e):s},sub:function(t,n,e,i){var r=this.subs[t];r&&(this.activeSub=t,r(n,e,this,i),this.activeSub=!1)}};var s=/&/g,a=//g,u=/\'/g,c=/\"/g,l=/[&<>\"\']/,f=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}}("undefined"!=typeof exports?exports:Hogan),function(t){function n(t){"}"===t.n.substr(t.n.length-1)&&(t.n=t.n.substring(0,t.n.length-1))}function e(t){return t.trim?t.trim():t.replace(/^\s*|\s*$/g,"")}function i(t,n,e){if(n.charAt(e)!=t.charAt(0))return!1;for(var i=1,r=t.length;r>i;i++)if(n.charAt(e+i)!=t.charAt(i))return!1;return!0}function r(n,e,i,o){var u=[],c=null,l=null,f=null;for(l=i[i.length-1];n.length>0;){if(f=n.shift(),l&&"<"==l.tag&&!(f.tag in k))throw new Error("Illegal content in < super tag.");if(t.tags[f.tag]<=t.tags.$||s(f,o))i.push(f),f.nodes=r(n,f.tag,i,o);else{if("/"==f.tag){if(0===i.length)throw new Error("Closing tag without opener: /"+f.n);if(c=i.pop(),f.n!=c.n&&!a(f.n,c.n,o))throw new Error("Nesting error: "+c.n+" vs. "+f.n);return c.end=f.i,u}"\n"==f.tag&&(f.last=0==n.length||"\n"==n[0].tag)}u.push(f)}if(i.length>0)throw new Error("missing closing tag: "+i.pop().n);return u}function s(t,n){for(var e=0,i=n.length;i>e;e++)if(n[e].o==t.n)return t.tag="#",!0}function a(t,n,e){for(var i=0,r=e.length;r>i;i++)if(e[i].c==t&&e[i].o==n)return!0}function o(t){var n=[];for(var e in t)n.push('"'+c(e)+'": function(c,p,t,i) {'+t[e]+"}");return"{ "+n.join(",")+" }"}function u(t){var n=[];for(var e in t.partials)n.push('"'+c(e)+'":{name:"'+c(t.partials[e].name)+'", '+u(t.partials[e])+"}");return"partials: {"+n.join(",")+"}, subs: "+o(t.subs)}function c(t){return t.replace(m,"\\\\").replace(v,'\\"').replace(b,"\\n").replace(d,"\\r").replace(x,"\\u2028").replace(w,"\\u2029")}function l(t){return~t.indexOf(".")?"d":"f"}function f(t,n){var e="<"+(n.prefix||""),i=e+t.n+y++;return n.partials[i]={name:t.n,partials:{}},n.code+='t.b(t.rp("'+c(i)+'",c,p,"'+(t.indent||"")+'"));',i}function h(t,n){n.code+="t.b(t.t(t."+l(t.n)+'("'+c(t.n)+'",c,p,0)));'}function p(t){return"t.b("+t+");"}var g=/\S/,v=/\"/g,b=/\n/g,d=/\r/g,m=/\\/g,x=/\u2028/,w=/\u2029/;t.tags={"#":1,"^":2,"<":3,$:4,"/":5,"!":6,">":7,"=":8,_v:9,"{":10,"&":11,_t:12},t.scan=function(r,s){function a(){m.length>0&&(x.push({tag:"_t",text:new String(m)}),m="")}function o(){for(var n=!0,e=y;e"==e.tag&&(e.indent=x[i].text.toString()),x.splice(i,1));else n||x.push({tag:"\n"});w=!1,y=x.length}function c(t,n){var i="="+S,r=t.indexOf(i,n),s=e(t.substring(t.indexOf("=",n)+1,r)).split(" ");return T=s[0],S=s[s.length-1],r+i.length-1}var l=r.length,f=0,h=1,p=2,v=f,b=null,d=null,m="",x=[],w=!1,k=0,y=0,T="{{",S="}}";for(s&&(s=s.split(" "),T=s[0],S=s[1]),k=0;l>k;k++)v==f?i(T,r,k)?(--k,a(),v=h):"\n"==r.charAt(k)?u(w):m+=r.charAt(k):v==h?(k+=T.length-1,d=t.tags[r.charAt(k+1)],b=d?r.charAt(k+1):"_v","="==b?(k=c(r,k),v=f):(d&&k++,v=p),w=k):i(S,r,k)?(x.push({tag:b,n:e(m),otag:T,ctag:S,i:"/"==b?w-T.length:k+S.length}),m="",k+=S.length-1,v=f,"{"==b&&("}}"==S?k++:n(x[x.length-1]))):m+=r.charAt(k);return u(w,!0),x};var k={_t:!0,"\n":!0,$:!0,"/":!0};t.stringify=function(n){return"{code: function (c,p,i) { "+t.wrapMain(n.code)+" },"+u(n)+"}"};var y=0;t.generate=function(n,e,i){y=0;var r={code:"",subs:{},partials:{}};return t.walk(n,r),i.asString?this.stringify(r,e,i):this.makeTemplate(r,e,i)},t.wrapMain=function(t){return'var t=this;t.b(i=i||"");'+t+"return t.fl();"},t.template=t.Template,t.makeTemplate=function(t,n,e){var i=this.makePartials(t);return i.code=new Function("c","p","i",this.wrapMain(t.code)),new this.template(i,n,this,e)},t.makePartials=function(t){var n,e={subs:{},partials:t.partials,name:t.name};for(n in e.partials)e.partials[n]=this.makePartials(e.partials[n]);for(n in t.subs)e.subs[n]=new Function("c","p","t","i",t.subs[n]);return e},t.codegen={"#":function(n,e){e.code+="if(t.s(t."+l(n.n)+'("'+c(n.n)+'",c,p,1),c,p,0,'+n.i+","+n.end+',"'+n.otag+" "+n.ctag+'")){t.rs(c,p,function(c,p,t){',t.walk(n.nodes,e),e.code+="});c.pop();}"},"^":function(n,e){e.code+="if(!t.s(t."+l(n.n)+'("'+c(n.n)+'",c,p,1),c,p,1,0,0,"")){',t.walk(n.nodes,e),e.code+="};"},">":f,"<":function(n,e){var i={partials:{},code:"",subs:{},inPartial:!0};t.walk(n.nodes,i);var r=e.partials[f(n,e)];r.subs=i.subs,r.partials=i.partials},$:function(n,e){var i={subs:{},code:"",partials:e.partials,prefix:n.n};t.walk(n.nodes,i),e.subs[n.n]=i.code,e.inPartial||(e.code+='t.sub("'+c(n.n)+'",c,p,i);')},"\n":function(t,n){n.code+=p('"\\n"'+(t.last?"":" + i"))},_v:function(t,n){n.code+="t.b(t.v(t."+l(t.n)+'("'+c(t.n)+'",c,p,0)));'},_t:function(t,n){n.code+=p('"'+c(t.text)+'"')},"{":h,"&":h},t.walk=function(n,e){for(var i,r=0,s=n.length;s>r;r++)i=t.codegen[n[r].tag],i&&i(n[r],e);return e},t.parse=function(t,n,e){return e=e||{},r(t,"",[],e.sectionTags||[])},t.cache={},t.cacheKey=function(t,n){return[t,!!n.asString,!!n.disableLambda,n.delimiters,!!n.modelGet].join("||")},t.compile=function(n,e){e=e||{};var i=t.cacheKey(n,e),r=this.cache[i];if(r){var s=r.partials;for(var a in s)delete s[a].instance;return r}return r=this.generate(this.parse(this.scan(n,e.delimiters),n,e),n,e),this.cache[i]=r}}("undefined"!=typeof exports?exports:Hogan),"function"==typeof define&&define.amd&&define(Hogan); --------------------------------------------------------------------------------