templatizer
Advanced tools
Comparing version 0.3.3 to 0.3.4
@@ -9,2 +9,2 @@ var templatizer = require('../templatizer'); | ||
templatizer([tmplPath, tmplPath2], path.resolve(__dirname, '../test/demo_output_multiple_dirs.js')); | ||
templatizer(tmplPath, path.resolve(__dirname, '../demo_output.js')); | ||
templatizer(tmplPath, path.resolve(__dirname, '../test/demo_output.js')); |
@@ -6,2 +6,5 @@ var colors = require('colors'), | ||
// satisfy jshint | ||
colors; | ||
// test setup | ||
@@ -34,3 +37,3 @@ var data = {users: ['larry', 'curly', 'moe']}; | ||
var templatesNoMixins = require('../test/demo_output_no_mixins'); | ||
var templates = require('../demo_output'); | ||
var templates = require('../test/demo_output'); | ||
@@ -37,0 +40,0 @@ i = ITERATIONS; |
{ | ||
"name": "templatizer", | ||
"description": "Simple solution for compiling jade templates into vanilla JS functions for blazin' fast client-side use.", | ||
"version": "0.3.3", | ||
"version": "0.3.4", | ||
"author": "Henrik Joreteg <henrik@andyet.net>", | ||
@@ -19,5 +19,5 @@ "bugs": "https://github.com/HenrikJoreteg/templatizer/issues", | ||
"escodegen": "0.0.26", | ||
"esprima": "^1.0.4", | ||
"esprima": "^1.2.1", | ||
"falafel": "^0.3.1", | ||
"jade": "^1.3.0", | ||
"jshint": "^2.5.0", | ||
"uglify-js": "^2.4.0", | ||
@@ -30,2 +30,3 @@ "underscore": "^1.5.1", | ||
"colors": "^0.6.0", | ||
"jshint": "^2.5.0", | ||
"precommit-hook": "^0.4.1", | ||
@@ -47,8 +48,9 @@ "yetify": "0.1.0" | ||
"scripts": { | ||
"runtime": "cp node_modules/jade/lib/runtime.js jaderuntime.js", | ||
"copy-runtime": "cp node_modules/jade/lib/runtime.js jaderuntime.js", | ||
"benchmark": "node benchmark/speedtest.js", | ||
"build": "npm run runtime && node benchmark/build-demo.js", | ||
"browserify": "./node_modules/.bin/browserify test/browserify-test.js > test/tests-bundle.js", | ||
"test": "npm run build && npm run browserify && open ./test/index.html && open ./test/browserify.html" | ||
"test": "npm run build && npm run browserify && npm run viewtest", | ||
"viewtest": "open ./test/index.html && open ./test/browserify.html" | ||
} | ||
} |
@@ -106,3 +106,3 @@ # templatizer.js | ||
Check out the `demo_output.js` file for... err... demo output built from the `templates` directory in this project. | ||
Check out the `tests/demo_output.js` file for... err... demo output built from the `templates` directory in this project. | ||
@@ -109,0 +109,0 @@ ## Changelog |
var jade = require('jade'); | ||
var beautify = require('./lib/beautify'); | ||
var jadeAst = require('./lib/jade-ast'); | ||
var simplifyTemplate = require('./lib/simplifyTemplate'); | ||
var transformMixins = require('./lib/transformMixins'); | ||
var renameJadeFn = require('./lib/renameJadeFn'); | ||
var walkdir = require('walkdir'); | ||
@@ -9,2 +11,4 @@ var path = require('path'); | ||
var uglifyjs = require('uglify-js'); | ||
var namedTemplateFn = require('./lib/namedTemplateFn'); | ||
var bracketedName = require('./lib/bracketedName'); | ||
@@ -23,3 +27,3 @@ | ||
} | ||
var parentObjName = 'templatizer'; | ||
var rootName = 'templatizer'; | ||
var folders = []; | ||
@@ -69,3 +73,2 @@ var templates = []; | ||
} | ||
_readTemplates.push(item); | ||
@@ -82,8 +85,6 @@ templates.push(templateDirectory + pathSep + item); | ||
output += '\n// create our folder objects'; | ||
folders.forEach(function (folder) { | ||
var arr = folder.split(pathSep); | ||
output += '\n' + parentObjName + '["' + arr.join('"]["') + '"] = {};'; | ||
}); | ||
output += '\n'; | ||
output += folders.map(function (folder) { | ||
return rootName + bracketedName(folder.split(pathSep)) + ' = {};'; | ||
}).join('\n') + '\n'; | ||
templates.forEach(function (item) { | ||
@@ -100,3 +101,2 @@ var name = path.basename(item, '.jade'); | ||
}(); | ||
var mixinOutput = ''; | ||
@@ -106,25 +106,24 @@ jadeCompileOptions.filename = item; | ||
template = jadeAst.renameFunc(template, dirString); | ||
template = renameJadeFn(template, dirString); | ||
template = simplifyTemplate(template); | ||
var astResult = jadeAst.getMixins({ | ||
template: template, | ||
templateName: name, | ||
dirString: dirString, | ||
parentObjName: parentObjName | ||
}); | ||
var mixins = []; | ||
if (!options.dontTransformMixins) { | ||
mixinOutput = astResult.mixins; | ||
var astResult = transformMixins({ | ||
template: template, | ||
name: name, | ||
dir: dirString, | ||
rootName: rootName | ||
}); | ||
mixins = astResult.mixins; | ||
template = astResult.template; | ||
} | ||
template = jadeAst.simplifyTemplate(template); | ||
output += namedTemplateFn({ | ||
dir: dirString, | ||
rootName: rootName, | ||
fn: template | ||
}); | ||
output += [ | ||
'', | ||
'// ' + dirString.replace(/\./g, pathSep) + '.jade compiled template', | ||
parentObjName + '["' + dirString.replace(/\./g, '"]["') + '"] = ' + template + ';', | ||
'' | ||
].join('\n') + mixinOutput; | ||
output += mixins.join('\n'); | ||
}); | ||
@@ -131,0 +130,0 @@ |
/* globals test, ok */ | ||
var t = require('../demo_output.js'); | ||
var t = require('./demo_output.js'); | ||
var data = { | ||
@@ -5,0 +5,0 @@ users: [{ |
@@ -10,7 +10,5 @@ (function (root, factory) { | ||
}(this, function () { | ||
var jade=function(){function r(r){return null!=r&&""!==r}function n(e){return Array.isArray(e)?e.map(n).filter(r).join(" "):e}var e={};return e.merge=function t(n,e){if(1===arguments.length){for(var a=n[0],s=1;s<n.length;s++)a=t(a,n[s]);return a}var i=n["class"],l=e["class"];(i||l)&&(i=i||[],l=l||[],Array.isArray(i)||(i=[i]),Array.isArray(l)||(l=[l]),n["class"]=i.concat(l).filter(r));for(var o in e)"class"!=o&&(n[o]=e[o]);return n},e.joinClasses=n,e.cls=function(r,t){for(var a=[],s=0;s<r.length;s++)t&&t[s]?a.push(e.escape(n([r[s]]))):a.push(n(r[s]));var i=n(a);return i.length?' class="'+i+'"':""},e.attr=function(r,n,t,a){return"boolean"==typeof n||null==n?n?" "+(a?r:r+'="'+r+'"'):"":0==r.indexOf("data")&&"string"!=typeof n?" "+r+"='"+JSON.stringify(n).replace(/'/g,"'")+"'":t?" "+r+'="'+e.escape(n)+'"':" "+r+'="'+n+'"'},e.attrs=function(r,t){var a=[],s=Object.keys(r);if(s.length)for(var i=0;i<s.length;++i){var l=s[i],o=r[l];"class"==l?(o=n(o))&&a.push(" "+l+'="'+o+'"'):a.push(e.attr(l,o,!1,t))}return a.join("")},e.escape=function(r){var n=String(r).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""");return n===""+r?r:n},e.rethrow=function a(r,n,e,t){if(!(r instanceof Error))throw r;if(!("undefined"==typeof window&&n||t))throw r.message+=" on line "+e,r;try{t=t||require("fs").readFileSync(n,"utf8")}catch(s){a(r,null,e)}var i=3,l=t.split("\n"),o=Math.max(e-i,0),c=Math.min(l.length,e+i),i=l.slice(o,c).map(function(r,n){var t=n+o+1;return(t==e?" > ":" ")+t+"| "+r}).join("\n");throw r.path=n,r.message=(n||"Jade")+":"+e+"\n"+i+"\n\n"+r.message,r},e}(); | ||
var jade=function(){function r(r){return null!=r&&""!==r}function n(e){return Array.isArray(e)?e.map(n).filter(r).join(" "):e}var e={};return e.merge=function t(n,e){if(1===arguments.length){for(var a=n[0],s=1;s<n.length;s++)a=t(a,n[s]);return a}var i=n["class"],l=e["class"];(i||l)&&(i=i||[],l=l||[],Array.isArray(i)||(i=[i]),Array.isArray(l)||(l=[l]),n["class"]=i.concat(l).filter(r));for(var o in e)"class"!=o&&(n[o]=e[o]);return n},e.joinClasses=n,e.cls=function(r,t){for(var a=[],s=0;s<r.length;s++)a.push(t&&t[s]?e.escape(n([r[s]])):n(r[s]));var i=n(a);return i.length?' class="'+i+'"':""},e.attr=function(r,n,t,a){return"boolean"==typeof n||null==n?n?" "+(a?r:r+'="'+r+'"'):"":0==r.indexOf("data")&&"string"!=typeof n?" "+r+"='"+JSON.stringify(n).replace(/'/g,"'")+"'":t?" "+r+'="'+e.escape(n)+'"':" "+r+'="'+n+'"'},e.attrs=function(r,t){var a=[],s=Object.keys(r);if(s.length)for(var i=0;i<s.length;++i){var l=s[i],o=r[l];"class"==l?(o=n(o))&&a.push(" "+l+'="'+o+'"'):a.push(e.attr(l,o,!1,t))}return a.join("")},e.escape=function(r){var n=String(r).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""");return n===""+r?r:n},e.rethrow=function a(r,n,e,t){if(!(r instanceof Error))throw r;if(!("undefined"==typeof window&&n||t))throw r.message+=" on line "+e,r;try{t=t||require("fs").readFileSync(n,"utf8")}catch(s){a(r,null,e)}var i=3,l=t.split("\n"),o=Math.max(e-i,0),c=Math.min(l.length,e+i),i=l.slice(o,c).map(function(r,n){var t=n+o+1;return(t==e?" > ":" ")+t+"| "+r}).join("\n");throw r.path=n,r.message=(n||"Jade")+":"+e+"\n"+i+"\n\n"+r.message,r},e}(); | ||
var templatizer = {}; | ||
// create our folder objects | ||
templatizer["otherfolder"] = {}; | ||
@@ -31,8 +29,64 @@ templatizer["otherfolder"]["deep2"] = {}; | ||
var locals_for_with = locals || {}; | ||
(function (content) { | ||
buf.push('<div class="page-404">' + jade.escape((jade_interp = content || '404') == null ? '' : jade_interp) + '!</div>'); | ||
}('content' in locals_for_with ? locals_for_with.content : typeof content !== 'undefined' ? content : undefined)); | ||
return buf.join(''); | ||
(function(content) { | ||
buf.push('<div class="page-404">' + jade.escape((jade_interp = content || "404") == null ? "" : jade_interp) + "!</div>"); | ||
})("content" in locals_for_with ? locals_for_with.content : typeof content !== "undefined" ? content : undefined); | ||
return buf.join(""); | ||
}; | ||
// mixins.jade compiled template | ||
templatizer["mixins"] = function tmpl_mixins(locals) { | ||
var buf = []; | ||
var jade_mixins = {}; | ||
var jade_interp; | ||
buf.push("<ul>"); | ||
buf.push(templatizer["mixins"]["test"]()); | ||
buf.push("</ul>"); | ||
return buf.join(""); | ||
}; | ||
// mixins.jade:test compiled template | ||
templatizer["mixins"]["test"] = function tmpl_mixins_test(user, index) { | ||
var block = this && this.block, attributes = this && this.attributes || {}, buf = []; | ||
buf.push("<li>test</li>"); | ||
return buf.join(""); | ||
}; | ||
// mixinsWithBlocks.jade compiled template | ||
templatizer["mixinsWithBlocks"] = function tmpl_mixinsWithBlocks(locals) { | ||
var buf = []; | ||
var jade_mixins = {}; | ||
var jade_interp; | ||
buf.push(templatizer["mixinsWithBlocks"]["MyModal"].call({ | ||
block: function(buf) { | ||
buf.push("<p>some body text</p>"); | ||
} | ||
}, "foo")); | ||
return buf.join(""); | ||
}; | ||
// mixinsWithBlocks.jade:MyModal compiled template | ||
templatizer["mixinsWithBlocks"]["MyModal"] = function tmpl_mixinsWithBlocks_MyModal(title) { | ||
var block = this && this.block, attributes = this && this.attributes || {}, buf = []; | ||
buf.push("<h1>" + jade.escape(null == (jade_interp = title) ? "" : jade_interp) + '</h1><div class="body">'); | ||
block && block(buf); | ||
buf.push("</div>"); | ||
return buf.join(""); | ||
}; | ||
// mixinsWithoutBlocks.jade compiled template | ||
templatizer["mixinsWithoutBlocks"] = function tmpl_mixinsWithoutBlocks(locals) { | ||
var buf = []; | ||
var jade_mixins = {}; | ||
var jade_interp; | ||
buf.push(templatizer["mixinsWithoutBlocks"]["MyModal"]("foo")); | ||
return buf.join(""); | ||
}; | ||
// mixinsWithoutBlocks.jade:MyModal compiled template | ||
templatizer["mixinsWithoutBlocks"]["MyModal"] = function tmpl_mixinsWithoutBlocks_MyModal(title) { | ||
var block = this && this.block, attributes = this && this.attributes || {}, buf = []; | ||
buf.push("<h1>" + jade.escape(null == (jade_interp = title) ? "" : jade_interp) + '</h1><div class="body"><p>some body text</p></div>'); | ||
return buf.join(""); | ||
}; | ||
// otherfolder/deep2/deeptweet.jade compiled template | ||
@@ -44,6 +98,6 @@ templatizer["otherfolder"]["deep2"]["deeptweet"] = function tmpl_otherfolder_deep2_deeptweet(locals) { | ||
var locals_for_with = locals || {}; | ||
(function (tweet) { | ||
buf.push('<li class="tweet">' + jade.escape(null == (jade_interp = tweet) ? '' : jade_interp) + '</li>'); | ||
}('tweet' in locals_for_with ? locals_for_with.tweet : typeof tweet !== 'undefined' ? tweet : undefined)); | ||
return buf.join(''); | ||
(function(tweet) { | ||
buf.push('<li class="tweet">' + jade.escape(null == (jade_interp = tweet) ? "" : jade_interp) + "</li>"); | ||
})("tweet" in locals_for_with ? locals_for_with.tweet : typeof tweet !== "undefined" ? tweet : undefined); | ||
return buf.join(""); | ||
}; | ||
@@ -57,6 +111,6 @@ | ||
var locals_for_with = locals || {}; | ||
(function (tweet) { | ||
buf.push('<li class="tweet">' + jade.escape(null == (jade_interp = tweet) ? '' : jade_interp) + '</li>'); | ||
}('tweet' in locals_for_with ? locals_for_with.tweet : typeof tweet !== 'undefined' ? tweet : undefined)); | ||
return buf.join(''); | ||
(function(tweet) { | ||
buf.push('<li class="tweet">' + jade.escape(null == (jade_interp = tweet) ? "" : jade_interp) + "</li>"); | ||
})("tweet" in locals_for_with ? locals_for_with.tweet : typeof tweet !== "undefined" ? tweet : undefined); | ||
return buf.join(""); | ||
}; | ||
@@ -70,11 +124,11 @@ | ||
var locals_for_with = locals || {}; | ||
(function (users) { | ||
buf.push('<ul>'); | ||
(function(users) { | ||
buf.push("<ul>"); | ||
var i = 0; | ||
(function () { | ||
(function() { | ||
var $obj = users; | ||
if ('number' == typeof $obj.length) { | ||
if ("number" == typeof $obj.length) { | ||
for (var $index = 0, $l = $obj.length; $index < $l; $index++) { | ||
var user = $obj[$index]; | ||
buf.push(templatizer.otherfolder.nestedMixin.user_li(user, i)); | ||
buf.push(templatizer["otherfolder"]["nestedMixin"]["user_li"](user, i)); | ||
i++; | ||
@@ -87,10 +141,10 @@ } | ||
var user = $obj[$index]; | ||
buf.push(templatizer.otherfolder.nestedMixin.user_li(user, i)); | ||
buf.push(templatizer["otherfolder"]["nestedMixin"]["user_li"](user, i)); | ||
i++; | ||
} | ||
} | ||
}.call(this)); | ||
buf.push('</ul>'); | ||
}('users' in locals_for_with ? locals_for_with.users : typeof users !== 'undefined' ? users : undefined)); | ||
return buf.join(''); | ||
}).call(this); | ||
buf.push("</ul>"); | ||
})("users" in locals_for_with ? locals_for_with.users : typeof users !== "undefined" ? users : undefined); | ||
return buf.join(""); | ||
}; | ||
@@ -100,3 +154,3 @@ | ||
templatizer["otherfolder"]["nestedMixin"]["user_li"] = function tmpl_otherfolder_nestedMixin_user_li(user, index) { | ||
var block = this && this.block, attributes = this && this.attributes || {}, buf = [], jade_interp; | ||
var block = this && this.block, attributes = this && this.attributes || {}, buf = []; | ||
buf.push("<li" + jade.attr("data-user-id", user.id, true, false) + jade.attr("data-user-index", index, true, false) + ">test</li>"); | ||
@@ -112,6 +166,6 @@ return buf.join(""); | ||
var locals_for_with = locals || {}; | ||
(function (user) { | ||
buf.push('<li class="tweet">' + jade.escape(null == (jade_interp = user) ? '' : jade_interp) + '</li>'); | ||
}('user' in locals_for_with ? locals_for_with.user : typeof user !== 'undefined' ? user : undefined)); | ||
return buf.join(''); | ||
(function(user) { | ||
buf.push('<li class="tweet">' + jade.escape(null == (jade_interp = user) ? "" : jade_interp) + "</li>"); | ||
})("user" in locals_for_with ? locals_for_with.user : typeof user !== "undefined" ? user : undefined); | ||
return buf.join(""); | ||
}; | ||
@@ -125,10 +179,10 @@ | ||
var locals_for_with = locals || {}; | ||
(function (users, _) { | ||
buf.push('<ul>'); | ||
(function () { | ||
(function(users, _) { | ||
buf.push("<ul>"); | ||
(function() { | ||
var $obj = users; | ||
if ('number' == typeof $obj.length) { | ||
if ("number" == typeof $obj.length) { | ||
for (var $index = 0, $l = $obj.length; $index < $l; $index++) { | ||
var user = $obj[$index]; | ||
buf.push('<li>' + jade.escape((jade_interp = _.isObject(user) && _.isString(user.name) ? user.name : '') == null ? '' : jade_interp) + '</li>'); | ||
buf.push("<li>" + jade.escape((jade_interp = _.isObject(user) && _.isString(user.name) ? user.name : "") == null ? "" : jade_interp) + "</li>"); | ||
} | ||
@@ -140,9 +194,9 @@ } else { | ||
var user = $obj[$index]; | ||
buf.push('<li>' + jade.escape((jade_interp = _.isObject(user) && _.isString(user.name) ? user.name : '') == null ? '' : jade_interp) + '</li>'); | ||
buf.push("<li>" + jade.escape((jade_interp = _.isObject(user) && _.isString(user.name) ? user.name : "") == null ? "" : jade_interp) + "</li>"); | ||
} | ||
} | ||
}.call(this)); | ||
buf.push('</ul>'); | ||
}('users' in locals_for_with ? locals_for_with.users : typeof users !== 'undefined' ? users : undefined, '_' in locals_for_with ? locals_for_with._ : typeof _ !== 'undefined' ? _ : undefined)); | ||
return buf.join(''); | ||
}).call(this); | ||
buf.push("</ul>"); | ||
})("users" in locals_for_with ? locals_for_with.users : typeof users !== "undefined" ? users : undefined, "_" in locals_for_with ? locals_for_with._ : typeof _ !== "undefined" ? _ : undefined); | ||
return buf.join(""); | ||
}; | ||
@@ -156,10 +210,10 @@ | ||
var locals_for_with = locals || {}; | ||
(function (users) { | ||
buf.push('<ul>'); | ||
(function () { | ||
(function(users) { | ||
buf.push("<ul>"); | ||
(function() { | ||
var $obj = users; | ||
if ('number' == typeof $obj.length) { | ||
if ("number" == typeof $obj.length) { | ||
for (var $index = 0, $l = $obj.length; $index < $l; $index++) { | ||
var user = $obj[$index]; | ||
buf.push('<li>' + jade.escape(null == (jade_interp = user.name) ? '' : jade_interp) + '</li>'); | ||
buf.push("<li>" + jade.escape(null == (jade_interp = user.name) ? "" : jade_interp) + "</li>"); | ||
} | ||
@@ -171,9 +225,9 @@ } else { | ||
var user = $obj[$index]; | ||
buf.push('<li>' + jade.escape(null == (jade_interp = user.name) ? '' : jade_interp) + '</li>'); | ||
buf.push("<li>" + jade.escape(null == (jade_interp = user.name) ? "" : jade_interp) + "</li>"); | ||
} | ||
} | ||
}.call(this)); | ||
buf.push('</ul>'); | ||
}('users' in locals_for_with ? locals_for_with.users : typeof users !== 'undefined' ? users : undefined)); | ||
return buf.join(''); | ||
}).call(this); | ||
buf.push("</ul>"); | ||
})("users" in locals_for_with ? locals_for_with.users : typeof users !== "undefined" ? users : undefined); | ||
return buf.join(""); | ||
}; | ||
@@ -186,9 +240,9 @@ | ||
var jade_interp; | ||
buf.push('<ul>'); | ||
(function () { | ||
buf.push("<ul>"); | ||
(function() { | ||
var $obj = locals.users; | ||
if ('number' == typeof $obj.length) { | ||
if ("number" == typeof $obj.length) { | ||
for (var $index = 0, $l = $obj.length; $index < $l; $index++) { | ||
var user = $obj[$index]; | ||
buf.push('<li>' + jade.escape(null == (jade_interp = user.name) ? '' : jade_interp) + '</li>'); | ||
buf.push("<li>" + jade.escape(null == (jade_interp = user.name) ? "" : jade_interp) + "</li>"); | ||
} | ||
@@ -200,8 +254,8 @@ } else { | ||
var user = $obj[$index]; | ||
buf.push('<li>' + jade.escape(null == (jade_interp = user.name) ? '' : jade_interp) + '</li>'); | ||
buf.push("<li>" + jade.escape(null == (jade_interp = user.name) ? "" : jade_interp) + "</li>"); | ||
} | ||
} | ||
}.call(this)); | ||
buf.push('</ul>'); | ||
return buf.join(''); | ||
}).call(this); | ||
buf.push("</ul>"); | ||
return buf.join(""); | ||
}; | ||
@@ -215,11 +269,11 @@ | ||
var locals_for_with = locals || {}; | ||
(function (users) { | ||
buf.push('<ul>'); | ||
(function(users) { | ||
buf.push("<ul>"); | ||
var i = 0; | ||
(function () { | ||
(function() { | ||
var $obj = users; | ||
if ('number' == typeof $obj.length) { | ||
if ("number" == typeof $obj.length) { | ||
for (var $index = 0, $l = $obj.length; $index < $l; $index++) { | ||
var user = $obj[$index]; | ||
buf.push(templatizer.usersMixins.user_li(user, i)); | ||
buf.push(templatizer["usersMixins"]["user_li"](user, i)); | ||
i++; | ||
@@ -232,10 +286,10 @@ } | ||
var user = $obj[$index]; | ||
buf.push(templatizer.usersMixins.user_li(user, i)); | ||
buf.push(templatizer["usersMixins"]["user_li"](user, i)); | ||
i++; | ||
} | ||
} | ||
}.call(this)); | ||
buf.push('</ul>'); | ||
}('users' in locals_for_with ? locals_for_with.users : typeof users !== 'undefined' ? users : undefined)); | ||
return buf.join(''); | ||
}).call(this); | ||
buf.push("</ul>"); | ||
})("users" in locals_for_with ? locals_for_with.users : typeof users !== "undefined" ? users : undefined); | ||
return buf.join(""); | ||
}; | ||
@@ -245,5 +299,5 @@ | ||
templatizer["usersMixins"]["user_li"] = function tmpl_usersMixins_user_li(user, index) { | ||
var block = this && this.block, attributes = this && this.attributes || {}, buf = [], jade_interp; | ||
var block = this && this.block, attributes = this && this.attributes || {}, buf = []; | ||
buf.push("<li" + jade.attr("data-user-id", user.id, true, false) + jade.attr("data-user-index", index, true, false) + "><span>Before</span>"); | ||
buf.push(templatizer.usersMixins.user_a(user, index)); | ||
buf.push(templatizer["usersMixins"]["user_a"](user, index)); | ||
buf.push("</li>"); | ||
@@ -253,5 +307,6 @@ return buf.join(""); | ||
// usersMixins.jade:user_a compiled template | ||
templatizer["usersMixins"]["user_a"] = function tmpl_usersMixins_user_a(user, index) { | ||
var block = this && this.block, attributes = this && this.attributes || {}, buf = [], jade_interp; | ||
var block = this && this.block, attributes = this && this.attributes || {}, buf = []; | ||
buf.push("<a" + jade.attr("href", user.url, true, false) + jade.attr("data-user-index", index, true, false) + ">Within " + jade.escape((jade_interp = user.name) == null ? "" : jade_interp) + "</a>"); | ||
@@ -267,10 +322,10 @@ return buf.join(""); | ||
var locals_for_with = locals || {}; | ||
(function (users) { | ||
buf.push('<ul>'); | ||
(function () { | ||
(function(users) { | ||
buf.push("<ul>"); | ||
(function() { | ||
var $obj = users; | ||
if ('number' == typeof $obj.length) { | ||
if ("number" == typeof $obj.length) { | ||
for (var $index = 0, $l = $obj.length; $index < $l; $index++) { | ||
var user = $obj[$index]; | ||
buf.push('<li' + jade.attr('data-user-id', user.id, true, false) + '><span>Before</span><a' + jade.attr('href', user.url, true, false) + '>Within ' + jade.escape((jade_interp = user.name) == null ? '' : jade_interp) + '</a></li>'); | ||
buf.push("<li" + jade.attr("data-user-id", user.id, true, false) + "><span>Before</span><a" + jade.attr("href", user.url, true, false) + ">Within " + jade.escape((jade_interp = user.name) == null ? "" : jade_interp) + "</a></li>"); | ||
} | ||
@@ -282,9 +337,9 @@ } else { | ||
var user = $obj[$index]; | ||
buf.push('<li' + jade.attr('data-user-id', user.id, true, false) + '><span>Before</span><a' + jade.attr('href', user.url, true, false) + '>Within ' + jade.escape((jade_interp = user.name) == null ? '' : jade_interp) + '</a></li>'); | ||
buf.push("<li" + jade.attr("data-user-id", user.id, true, false) + "><span>Before</span><a" + jade.attr("href", user.url, true, false) + ">Within " + jade.escape((jade_interp = user.name) == null ? "" : jade_interp) + "</a></li>"); | ||
} | ||
} | ||
}.call(this)); | ||
buf.push('</ul>'); | ||
}('users' in locals_for_with ? locals_for_with.users : typeof users !== 'undefined' ? users : undefined)); | ||
return buf.join(''); | ||
}).call(this); | ||
buf.push("</ul>"); | ||
})("users" in locals_for_with ? locals_for_with.users : typeof users !== "undefined" ? users : undefined); | ||
return buf.join(""); | ||
}; | ||
@@ -294,3 +349,3 @@ | ||
templatizer["otherfolder"]["othertweet2"] = function tmpl_otherfolder_othertweet2() { | ||
return '<p>test</p>'; | ||
return "<p>test</p>"; | ||
}; | ||
@@ -300,3 +355,3 @@ | ||
templatizer["test"] = function tmpl_test() { | ||
return '<p>test</p>'; | ||
return "<p>test</p>"; | ||
}; | ||
@@ -303,0 +358,0 @@ |
@@ -10,7 +10,5 @@ (function (root, factory) { | ||
}(this, function () { | ||
var jade=function(){function r(r){return null!=r&&""!==r}function n(e){return Array.isArray(e)?e.map(n).filter(r).join(" "):e}var e={};return e.merge=function t(n,e){if(1===arguments.length){for(var a=n[0],s=1;s<n.length;s++)a=t(a,n[s]);return a}var i=n["class"],l=e["class"];(i||l)&&(i=i||[],l=l||[],Array.isArray(i)||(i=[i]),Array.isArray(l)||(l=[l]),n["class"]=i.concat(l).filter(r));for(var o in e)"class"!=o&&(n[o]=e[o]);return n},e.joinClasses=n,e.cls=function(r,t){for(var a=[],s=0;s<r.length;s++)t&&t[s]?a.push(e.escape(n([r[s]]))):a.push(n(r[s]));var i=n(a);return i.length?' class="'+i+'"':""},e.attr=function(r,n,t,a){return"boolean"==typeof n||null==n?n?" "+(a?r:r+'="'+r+'"'):"":0==r.indexOf("data")&&"string"!=typeof n?" "+r+"='"+JSON.stringify(n).replace(/'/g,"'")+"'":t?" "+r+'="'+e.escape(n)+'"':" "+r+'="'+n+'"'},e.attrs=function(r,t){var a=[],s=Object.keys(r);if(s.length)for(var i=0;i<s.length;++i){var l=s[i],o=r[l];"class"==l?(o=n(o))&&a.push(" "+l+'="'+o+'"'):a.push(e.attr(l,o,!1,t))}return a.join("")},e.escape=function(r){var n=String(r).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""");return n===""+r?r:n},e.rethrow=function a(r,n,e,t){if(!(r instanceof Error))throw r;if(!("undefined"==typeof window&&n||t))throw r.message+=" on line "+e,r;try{t=t||require("fs").readFileSync(n,"utf8")}catch(s){a(r,null,e)}var i=3,l=t.split("\n"),o=Math.max(e-i,0),c=Math.min(l.length,e+i),i=l.slice(o,c).map(function(r,n){var t=n+o+1;return(t==e?" > ":" ")+t+"| "+r}).join("\n");throw r.path=n,r.message=(n||"Jade")+":"+e+"\n"+i+"\n\n"+r.message,r},e}(); | ||
var jade=function(){function r(r){return null!=r&&""!==r}function n(e){return Array.isArray(e)?e.map(n).filter(r).join(" "):e}var e={};return e.merge=function t(n,e){if(1===arguments.length){for(var a=n[0],s=1;s<n.length;s++)a=t(a,n[s]);return a}var i=n["class"],l=e["class"];(i||l)&&(i=i||[],l=l||[],Array.isArray(i)||(i=[i]),Array.isArray(l)||(l=[l]),n["class"]=i.concat(l).filter(r));for(var o in e)"class"!=o&&(n[o]=e[o]);return n},e.joinClasses=n,e.cls=function(r,t){for(var a=[],s=0;s<r.length;s++)a.push(t&&t[s]?e.escape(n([r[s]])):n(r[s]));var i=n(a);return i.length?' class="'+i+'"':""},e.attr=function(r,n,t,a){return"boolean"==typeof n||null==n?n?" "+(a?r:r+'="'+r+'"'):"":0==r.indexOf("data")&&"string"!=typeof n?" "+r+"='"+JSON.stringify(n).replace(/'/g,"'")+"'":t?" "+r+'="'+e.escape(n)+'"':" "+r+'="'+n+'"'},e.attrs=function(r,t){var a=[],s=Object.keys(r);if(s.length)for(var i=0;i<s.length;++i){var l=s[i],o=r[l];"class"==l?(o=n(o))&&a.push(" "+l+'="'+o+'"'):a.push(e.attr(l,o,!1,t))}return a.join("")},e.escape=function(r){var n=String(r).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""");return n===""+r?r:n},e.rethrow=function a(r,n,e,t){if(!(r instanceof Error))throw r;if(!("undefined"==typeof window&&n||t))throw r.message+=" on line "+e,r;try{t=t||require("fs").readFileSync(n,"utf8")}catch(s){a(r,null,e)}var i=3,l=t.split("\n"),o=Math.max(e-i,0),c=Math.min(l.length,e+i),i=l.slice(o,c).map(function(r,n){var t=n+o+1;return(t==e?" > ":" ")+t+"| "+r}).join("\n");throw r.path=n,r.message=(n||"Jade")+":"+e+"\n"+i+"\n\n"+r.message,r},e}(); | ||
var templatizer = {}; | ||
// create our folder objects | ||
templatizer["otherfolder"] = {}; | ||
@@ -31,8 +29,55 @@ templatizer["otherfolder"]["deep2"] = {}; | ||
var locals_for_with = locals || {}; | ||
(function (content) { | ||
buf.push('<div class="page-404">' + jade.escape((jade_interp = content || '404') == null ? '' : jade_interp) + '!</div>'); | ||
}('content' in locals_for_with ? locals_for_with.content : typeof content !== 'undefined' ? content : undefined)); | ||
return buf.join(''); | ||
(function(content) { | ||
buf.push('<div class="page-404">' + jade.escape((jade_interp = content || "404") == null ? "" : jade_interp) + "!</div>"); | ||
})("content" in locals_for_with ? locals_for_with.content : typeof content !== "undefined" ? content : undefined); | ||
return buf.join(""); | ||
}; | ||
// mixins.jade compiled template | ||
templatizer["mixins"] = function tmpl_mixins(locals) { | ||
var buf = []; | ||
var jade_mixins = {}; | ||
var jade_interp; | ||
jade_mixins["test"] = function(user, index) { | ||
var block = this && this.block, attributes = this && this.attributes || {}; | ||
buf.push("<li>test</li>"); | ||
}; | ||
buf.push("<ul>"); | ||
jade_mixins["test"](); | ||
buf.push("</ul>"); | ||
return buf.join(""); | ||
}; | ||
// mixinsWithBlocks.jade compiled template | ||
templatizer["mixinsWithBlocks"] = function tmpl_mixinsWithBlocks(locals) { | ||
var buf = []; | ||
var jade_mixins = {}; | ||
var jade_interp; | ||
jade_mixins["MyModal"] = function(title) { | ||
var block = this && this.block, attributes = this && this.attributes || {}; | ||
buf.push("<h1>" + jade.escape(null == (jade_interp = title) ? "" : jade_interp) + '</h1><div class="body">'); | ||
block && block(); | ||
buf.push("</div>"); | ||
}; | ||
jade_mixins["MyModal"].call({ | ||
block: function() { | ||
buf.push("<p>some body text</p>"); | ||
} | ||
}, "foo"); | ||
return buf.join(""); | ||
}; | ||
// mixinsWithoutBlocks.jade compiled template | ||
templatizer["mixinsWithoutBlocks"] = function tmpl_mixinsWithoutBlocks(locals) { | ||
var buf = []; | ||
var jade_mixins = {}; | ||
var jade_interp; | ||
jade_mixins["MyModal"] = function(title) { | ||
var block = this && this.block, attributes = this && this.attributes || {}; | ||
buf.push("<h1>" + jade.escape(null == (jade_interp = title) ? "" : jade_interp) + '</h1><div class="body"><p>some body text</p></div>'); | ||
}; | ||
jade_mixins["MyModal"]("foo"); | ||
return buf.join(""); | ||
}; | ||
// otherfolder/deep2/deeptweet.jade compiled template | ||
@@ -44,6 +89,6 @@ templatizer["otherfolder"]["deep2"]["deeptweet"] = function tmpl_otherfolder_deep2_deeptweet(locals) { | ||
var locals_for_with = locals || {}; | ||
(function (tweet) { | ||
buf.push('<li class="tweet">' + jade.escape(null == (jade_interp = tweet) ? '' : jade_interp) + '</li>'); | ||
}('tweet' in locals_for_with ? locals_for_with.tweet : typeof tweet !== 'undefined' ? tweet : undefined)); | ||
return buf.join(''); | ||
(function(tweet) { | ||
buf.push('<li class="tweet">' + jade.escape(null == (jade_interp = tweet) ? "" : jade_interp) + "</li>"); | ||
})("tweet" in locals_for_with ? locals_for_with.tweet : typeof tweet !== "undefined" ? tweet : undefined); | ||
return buf.join(""); | ||
}; | ||
@@ -57,6 +102,6 @@ | ||
var locals_for_with = locals || {}; | ||
(function (tweet) { | ||
buf.push('<li class="tweet">' + jade.escape(null == (jade_interp = tweet) ? '' : jade_interp) + '</li>'); | ||
}('tweet' in locals_for_with ? locals_for_with.tweet : typeof tweet !== 'undefined' ? tweet : undefined)); | ||
return buf.join(''); | ||
(function(tweet) { | ||
buf.push('<li class="tweet">' + jade.escape(null == (jade_interp = tweet) ? "" : jade_interp) + "</li>"); | ||
})("tweet" in locals_for_with ? locals_for_with.tweet : typeof tweet !== "undefined" ? tweet : undefined); | ||
return buf.join(""); | ||
}; | ||
@@ -70,15 +115,15 @@ | ||
var locals_for_with = locals || {}; | ||
(function (users) { | ||
jade_mixins['user_li'] = function (user, index) { | ||
(function(users) { | ||
jade_mixins["user_li"] = function(user, index) { | ||
var block = this && this.block, attributes = this && this.attributes || {}; | ||
buf.push('<li' + jade.attr('data-user-id', user.id, true, false) + jade.attr('data-user-index', index, true, false) + '>test</li>'); | ||
buf.push("<li" + jade.attr("data-user-id", user.id, true, false) + jade.attr("data-user-index", index, true, false) + ">test</li>"); | ||
}; | ||
buf.push('<ul>'); | ||
buf.push("<ul>"); | ||
var i = 0; | ||
(function () { | ||
(function() { | ||
var $obj = users; | ||
if ('number' == typeof $obj.length) { | ||
if ("number" == typeof $obj.length) { | ||
for (var $index = 0, $l = $obj.length; $index < $l; $index++) { | ||
var user = $obj[$index]; | ||
jade_mixins['user_li'](user, i); | ||
jade_mixins["user_li"](user, i); | ||
i++; | ||
@@ -91,10 +136,10 @@ } | ||
var user = $obj[$index]; | ||
jade_mixins['user_li'](user, i); | ||
jade_mixins["user_li"](user, i); | ||
i++; | ||
} | ||
} | ||
}.call(this)); | ||
buf.push('</ul>'); | ||
}('users' in locals_for_with ? locals_for_with.users : typeof users !== 'undefined' ? users : undefined)); | ||
return buf.join(''); | ||
}).call(this); | ||
buf.push("</ul>"); | ||
})("users" in locals_for_with ? locals_for_with.users : typeof users !== "undefined" ? users : undefined); | ||
return buf.join(""); | ||
}; | ||
@@ -108,6 +153,6 @@ | ||
var locals_for_with = locals || {}; | ||
(function (user) { | ||
buf.push('<li class="tweet">' + jade.escape(null == (jade_interp = user) ? '' : jade_interp) + '</li>'); | ||
}('user' in locals_for_with ? locals_for_with.user : typeof user !== 'undefined' ? user : undefined)); | ||
return buf.join(''); | ||
(function(user) { | ||
buf.push('<li class="tweet">' + jade.escape(null == (jade_interp = user) ? "" : jade_interp) + "</li>"); | ||
})("user" in locals_for_with ? locals_for_with.user : typeof user !== "undefined" ? user : undefined); | ||
return buf.join(""); | ||
}; | ||
@@ -121,10 +166,10 @@ | ||
var locals_for_with = locals || {}; | ||
(function (users, _) { | ||
buf.push('<ul>'); | ||
(function () { | ||
(function(users, _) { | ||
buf.push("<ul>"); | ||
(function() { | ||
var $obj = users; | ||
if ('number' == typeof $obj.length) { | ||
if ("number" == typeof $obj.length) { | ||
for (var $index = 0, $l = $obj.length; $index < $l; $index++) { | ||
var user = $obj[$index]; | ||
buf.push('<li>' + jade.escape((jade_interp = _.isObject(user) && _.isString(user.name) ? user.name : '') == null ? '' : jade_interp) + '</li>'); | ||
buf.push("<li>" + jade.escape((jade_interp = _.isObject(user) && _.isString(user.name) ? user.name : "") == null ? "" : jade_interp) + "</li>"); | ||
} | ||
@@ -136,9 +181,9 @@ } else { | ||
var user = $obj[$index]; | ||
buf.push('<li>' + jade.escape((jade_interp = _.isObject(user) && _.isString(user.name) ? user.name : '') == null ? '' : jade_interp) + '</li>'); | ||
buf.push("<li>" + jade.escape((jade_interp = _.isObject(user) && _.isString(user.name) ? user.name : "") == null ? "" : jade_interp) + "</li>"); | ||
} | ||
} | ||
}.call(this)); | ||
buf.push('</ul>'); | ||
}('users' in locals_for_with ? locals_for_with.users : typeof users !== 'undefined' ? users : undefined, '_' in locals_for_with ? locals_for_with._ : typeof _ !== 'undefined' ? _ : undefined)); | ||
return buf.join(''); | ||
}).call(this); | ||
buf.push("</ul>"); | ||
})("users" in locals_for_with ? locals_for_with.users : typeof users !== "undefined" ? users : undefined, "_" in locals_for_with ? locals_for_with._ : typeof _ !== "undefined" ? _ : undefined); | ||
return buf.join(""); | ||
}; | ||
@@ -152,10 +197,10 @@ | ||
var locals_for_with = locals || {}; | ||
(function (users) { | ||
buf.push('<ul>'); | ||
(function () { | ||
(function(users) { | ||
buf.push("<ul>"); | ||
(function() { | ||
var $obj = users; | ||
if ('number' == typeof $obj.length) { | ||
if ("number" == typeof $obj.length) { | ||
for (var $index = 0, $l = $obj.length; $index < $l; $index++) { | ||
var user = $obj[$index]; | ||
buf.push('<li>' + jade.escape(null == (jade_interp = user.name) ? '' : jade_interp) + '</li>'); | ||
buf.push("<li>" + jade.escape(null == (jade_interp = user.name) ? "" : jade_interp) + "</li>"); | ||
} | ||
@@ -167,9 +212,9 @@ } else { | ||
var user = $obj[$index]; | ||
buf.push('<li>' + jade.escape(null == (jade_interp = user.name) ? '' : jade_interp) + '</li>'); | ||
buf.push("<li>" + jade.escape(null == (jade_interp = user.name) ? "" : jade_interp) + "</li>"); | ||
} | ||
} | ||
}.call(this)); | ||
buf.push('</ul>'); | ||
}('users' in locals_for_with ? locals_for_with.users : typeof users !== 'undefined' ? users : undefined)); | ||
return buf.join(''); | ||
}).call(this); | ||
buf.push("</ul>"); | ||
})("users" in locals_for_with ? locals_for_with.users : typeof users !== "undefined" ? users : undefined); | ||
return buf.join(""); | ||
}; | ||
@@ -182,9 +227,9 @@ | ||
var jade_interp; | ||
buf.push('<ul>'); | ||
(function () { | ||
buf.push("<ul>"); | ||
(function() { | ||
var $obj = locals.users; | ||
if ('number' == typeof $obj.length) { | ||
if ("number" == typeof $obj.length) { | ||
for (var $index = 0, $l = $obj.length; $index < $l; $index++) { | ||
var user = $obj[$index]; | ||
buf.push('<li>' + jade.escape(null == (jade_interp = user.name) ? '' : jade_interp) + '</li>'); | ||
buf.push("<li>" + jade.escape(null == (jade_interp = user.name) ? "" : jade_interp) + "</li>"); | ||
} | ||
@@ -196,8 +241,8 @@ } else { | ||
var user = $obj[$index]; | ||
buf.push('<li>' + jade.escape(null == (jade_interp = user.name) ? '' : jade_interp) + '</li>'); | ||
buf.push("<li>" + jade.escape(null == (jade_interp = user.name) ? "" : jade_interp) + "</li>"); | ||
} | ||
} | ||
}.call(this)); | ||
buf.push('</ul>'); | ||
return buf.join(''); | ||
}).call(this); | ||
buf.push("</ul>"); | ||
return buf.join(""); | ||
}; | ||
@@ -211,21 +256,21 @@ | ||
var locals_for_with = locals || {}; | ||
(function (users) { | ||
jade_mixins['user_li'] = function (user, index) { | ||
(function(users) { | ||
jade_mixins["user_li"] = function(user, index) { | ||
var block = this && this.block, attributes = this && this.attributes || {}; | ||
buf.push('<li' + jade.attr('data-user-id', user.id, true, false) + jade.attr('data-user-index', index, true, false) + '><span>Before</span>'); | ||
jade_mixins['user_a'](user, index); | ||
buf.push('</li>'); | ||
buf.push("<li" + jade.attr("data-user-id", user.id, true, false) + jade.attr("data-user-index", index, true, false) + "><span>Before</span>"); | ||
jade_mixins["user_a"](user, index); | ||
buf.push("</li>"); | ||
}; | ||
jade_mixins['user_a'] = function (user, index) { | ||
jade_mixins["user_a"] = function(user, index) { | ||
var block = this && this.block, attributes = this && this.attributes || {}; | ||
buf.push('<a' + jade.attr('href', user.url, true, false) + jade.attr('data-user-index', index, true, false) + '>Within ' + jade.escape((jade_interp = user.name) == null ? '' : jade_interp) + '</a>'); | ||
buf.push("<a" + jade.attr("href", user.url, true, false) + jade.attr("data-user-index", index, true, false) + ">Within " + jade.escape((jade_interp = user.name) == null ? "" : jade_interp) + "</a>"); | ||
}; | ||
buf.push('<ul>'); | ||
buf.push("<ul>"); | ||
var i = 0; | ||
(function () { | ||
(function() { | ||
var $obj = users; | ||
if ('number' == typeof $obj.length) { | ||
if ("number" == typeof $obj.length) { | ||
for (var $index = 0, $l = $obj.length; $index < $l; $index++) { | ||
var user = $obj[$index]; | ||
jade_mixins['user_li'](user, i); | ||
jade_mixins["user_li"](user, i); | ||
i++; | ||
@@ -238,10 +283,10 @@ } | ||
var user = $obj[$index]; | ||
jade_mixins['user_li'](user, i); | ||
jade_mixins["user_li"](user, i); | ||
i++; | ||
} | ||
} | ||
}.call(this)); | ||
buf.push('</ul>'); | ||
}('users' in locals_for_with ? locals_for_with.users : typeof users !== 'undefined' ? users : undefined)); | ||
return buf.join(''); | ||
}).call(this); | ||
buf.push("</ul>"); | ||
})("users" in locals_for_with ? locals_for_with.users : typeof users !== "undefined" ? users : undefined); | ||
return buf.join(""); | ||
}; | ||
@@ -255,10 +300,10 @@ | ||
var locals_for_with = locals || {}; | ||
(function (users) { | ||
buf.push('<ul>'); | ||
(function () { | ||
(function(users) { | ||
buf.push("<ul>"); | ||
(function() { | ||
var $obj = users; | ||
if ('number' == typeof $obj.length) { | ||
if ("number" == typeof $obj.length) { | ||
for (var $index = 0, $l = $obj.length; $index < $l; $index++) { | ||
var user = $obj[$index]; | ||
buf.push('<li' + jade.attr('data-user-id', user.id, true, false) + '><span>Before</span><a' + jade.attr('href', user.url, true, false) + '>Within ' + jade.escape((jade_interp = user.name) == null ? '' : jade_interp) + '</a></li>'); | ||
buf.push("<li" + jade.attr("data-user-id", user.id, true, false) + "><span>Before</span><a" + jade.attr("href", user.url, true, false) + ">Within " + jade.escape((jade_interp = user.name) == null ? "" : jade_interp) + "</a></li>"); | ||
} | ||
@@ -270,9 +315,9 @@ } else { | ||
var user = $obj[$index]; | ||
buf.push('<li' + jade.attr('data-user-id', user.id, true, false) + '><span>Before</span><a' + jade.attr('href', user.url, true, false) + '>Within ' + jade.escape((jade_interp = user.name) == null ? '' : jade_interp) + '</a></li>'); | ||
buf.push("<li" + jade.attr("data-user-id", user.id, true, false) + "><span>Before</span><a" + jade.attr("href", user.url, true, false) + ">Within " + jade.escape((jade_interp = user.name) == null ? "" : jade_interp) + "</a></li>"); | ||
} | ||
} | ||
}.call(this)); | ||
buf.push('</ul>'); | ||
}('users' in locals_for_with ? locals_for_with.users : typeof users !== 'undefined' ? users : undefined)); | ||
return buf.join(''); | ||
}).call(this); | ||
buf.push("</ul>"); | ||
})("users" in locals_for_with ? locals_for_with.users : typeof users !== "undefined" ? users : undefined); | ||
return buf.join(""); | ||
}; | ||
@@ -279,0 +324,0 @@ |
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
},{}],2:[function(require,module,exports){ | ||
/* globals test, ok */ | ||
var t = require('./demo_output.js'); | ||
var data = { | ||
users: [{ | ||
name: 'larry', | ||
url: 'http://andyet.com', | ||
id: 1 | ||
}, { | ||
name: 'curly', | ||
url: 'http://andbang.com', | ||
id: 2 | ||
}, { | ||
name: 'moe', | ||
url: 'http://talky.io', | ||
id: 3 | ||
}] | ||
}; | ||
module.exports = { | ||
start: function () { | ||
test("Test that templates work when browserified", function () { | ||
var users = t.users, | ||
withLocals = t.usersLocals; | ||
ok(users({users: data.users}) === withLocals({users: data.users})); | ||
}); | ||
} | ||
}; | ||
module.exports.start(); | ||
},{"./demo_output.js":3}],3:[function(require,module,exports){ | ||
(function (root, factory) { | ||
@@ -11,7 +46,5 @@ if (typeof define === 'function' && define.amd) { | ||
}(this, function () { | ||
var jade=function(){function r(r){return null!=r&&""!==r}function n(e){return Array.isArray(e)?e.map(n).filter(r).join(" "):e}var e={};return e.merge=function t(n,e){if(1===arguments.length){for(var a=n[0],s=1;s<n.length;s++)a=t(a,n[s]);return a}var i=n["class"],l=e["class"];(i||l)&&(i=i||[],l=l||[],Array.isArray(i)||(i=[i]),Array.isArray(l)||(l=[l]),n["class"]=i.concat(l).filter(r));for(var o in e)"class"!=o&&(n[o]=e[o]);return n},e.joinClasses=n,e.cls=function(r,t){for(var a=[],s=0;s<r.length;s++)t&&t[s]?a.push(e.escape(n([r[s]]))):a.push(n(r[s]));var i=n(a);return i.length?' class="'+i+'"':""},e.attr=function(r,n,t,a){return"boolean"==typeof n||null==n?n?" "+(a?r:r+'="'+r+'"'):"":0==r.indexOf("data")&&"string"!=typeof n?" "+r+"='"+JSON.stringify(n).replace(/'/g,"'")+"'":t?" "+r+'="'+e.escape(n)+'"':" "+r+'="'+n+'"'},e.attrs=function(r,t){var a=[],s=Object.keys(r);if(s.length)for(var i=0;i<s.length;++i){var l=s[i],o=r[l];"class"==l?(o=n(o))&&a.push(" "+l+'="'+o+'"'):a.push(e.attr(l,o,!1,t))}return a.join("")},e.escape=function(r){var n=String(r).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""");return n===""+r?r:n},e.rethrow=function a(r,n,e,t){if(!(r instanceof Error))throw r;if(!("undefined"==typeof window&&n||t))throw r.message+=" on line "+e,r;try{t=t||require("fs").readFileSync(n,"utf8")}catch(s){a(r,null,e)}var i=3,l=t.split("\n"),o=Math.max(e-i,0),c=Math.min(l.length,e+i),i=l.slice(o,c).map(function(r,n){var t=n+o+1;return(t==e?" > ":" ")+t+"| "+r}).join("\n");throw r.path=n,r.message=(n||"Jade")+":"+e+"\n"+i+"\n\n"+r.message,r},e}(); | ||
var jade=function(){function r(r){return null!=r&&""!==r}function n(e){return Array.isArray(e)?e.map(n).filter(r).join(" "):e}var e={};return e.merge=function t(n,e){if(1===arguments.length){for(var a=n[0],s=1;s<n.length;s++)a=t(a,n[s]);return a}var i=n["class"],l=e["class"];(i||l)&&(i=i||[],l=l||[],Array.isArray(i)||(i=[i]),Array.isArray(l)||(l=[l]),n["class"]=i.concat(l).filter(r));for(var o in e)"class"!=o&&(n[o]=e[o]);return n},e.joinClasses=n,e.cls=function(r,t){for(var a=[],s=0;s<r.length;s++)a.push(t&&t[s]?e.escape(n([r[s]])):n(r[s]));var i=n(a);return i.length?' class="'+i+'"':""},e.attr=function(r,n,t,a){return"boolean"==typeof n||null==n?n?" "+(a?r:r+'="'+r+'"'):"":0==r.indexOf("data")&&"string"!=typeof n?" "+r+"='"+JSON.stringify(n).replace(/'/g,"'")+"'":t?" "+r+'="'+e.escape(n)+'"':" "+r+'="'+n+'"'},e.attrs=function(r,t){var a=[],s=Object.keys(r);if(s.length)for(var i=0;i<s.length;++i){var l=s[i],o=r[l];"class"==l?(o=n(o))&&a.push(" "+l+'="'+o+'"'):a.push(e.attr(l,o,!1,t))}return a.join("")},e.escape=function(r){var n=String(r).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""");return n===""+r?r:n},e.rethrow=function a(r,n,e,t){if(!(r instanceof Error))throw r;if(!("undefined"==typeof window&&n||t))throw r.message+=" on line "+e,r;try{t=t||require("fs").readFileSync(n,"utf8")}catch(s){a(r,null,e)}var i=3,l=t.split("\n"),o=Math.max(e-i,0),c=Math.min(l.length,e+i),i=l.slice(o,c).map(function(r,n){var t=n+o+1;return(t==e?" > ":" ")+t+"| "+r}).join("\n");throw r.path=n,r.message=(n||"Jade")+":"+e+"\n"+i+"\n\n"+r.message,r},e}(); | ||
var templatizer = {}; | ||
// create our folder objects | ||
templatizer["otherfolder"] = {}; | ||
@@ -32,8 +65,64 @@ templatizer["otherfolder"]["deep2"] = {}; | ||
var locals_for_with = locals || {}; | ||
(function (content) { | ||
buf.push('<div class="page-404">' + jade.escape((jade_interp = content || '404') == null ? '' : jade_interp) + '!</div>'); | ||
}('content' in locals_for_with ? locals_for_with.content : typeof content !== 'undefined' ? content : undefined)); | ||
return buf.join(''); | ||
(function(content) { | ||
buf.push('<div class="page-404">' + jade.escape((jade_interp = content || "404") == null ? "" : jade_interp) + "!</div>"); | ||
})("content" in locals_for_with ? locals_for_with.content : typeof content !== "undefined" ? content : undefined); | ||
return buf.join(""); | ||
}; | ||
// mixins.jade compiled template | ||
templatizer["mixins"] = function tmpl_mixins(locals) { | ||
var buf = []; | ||
var jade_mixins = {}; | ||
var jade_interp; | ||
buf.push("<ul>"); | ||
buf.push(templatizer["mixins"]["test"]()); | ||
buf.push("</ul>"); | ||
return buf.join(""); | ||
}; | ||
// mixins.jade:test compiled template | ||
templatizer["mixins"]["test"] = function tmpl_mixins_test(user, index) { | ||
var block = this && this.block, attributes = this && this.attributes || {}, buf = []; | ||
buf.push("<li>test</li>"); | ||
return buf.join(""); | ||
}; | ||
// mixinsWithBlocks.jade compiled template | ||
templatizer["mixinsWithBlocks"] = function tmpl_mixinsWithBlocks(locals) { | ||
var buf = []; | ||
var jade_mixins = {}; | ||
var jade_interp; | ||
buf.push(templatizer["mixinsWithBlocks"]["MyModal"].call({ | ||
block: function(buf) { | ||
buf.push("<p>some body text</p>"); | ||
} | ||
}, "foo")); | ||
return buf.join(""); | ||
}; | ||
// mixinsWithBlocks.jade:MyModal compiled template | ||
templatizer["mixinsWithBlocks"]["MyModal"] = function tmpl_mixinsWithBlocks_MyModal(title) { | ||
var block = this && this.block, attributes = this && this.attributes || {}, buf = []; | ||
buf.push("<h1>" + jade.escape(null == (jade_interp = title) ? "" : jade_interp) + '</h1><div class="body">'); | ||
block && block(buf); | ||
buf.push("</div>"); | ||
return buf.join(""); | ||
}; | ||
// mixinsWithoutBlocks.jade compiled template | ||
templatizer["mixinsWithoutBlocks"] = function tmpl_mixinsWithoutBlocks(locals) { | ||
var buf = []; | ||
var jade_mixins = {}; | ||
var jade_interp; | ||
buf.push(templatizer["mixinsWithoutBlocks"]["MyModal"]("foo")); | ||
return buf.join(""); | ||
}; | ||
// mixinsWithoutBlocks.jade:MyModal compiled template | ||
templatizer["mixinsWithoutBlocks"]["MyModal"] = function tmpl_mixinsWithoutBlocks_MyModal(title) { | ||
var block = this && this.block, attributes = this && this.attributes || {}, buf = []; | ||
buf.push("<h1>" + jade.escape(null == (jade_interp = title) ? "" : jade_interp) + '</h1><div class="body"><p>some body text</p></div>'); | ||
return buf.join(""); | ||
}; | ||
// otherfolder/deep2/deeptweet.jade compiled template | ||
@@ -45,6 +134,6 @@ templatizer["otherfolder"]["deep2"]["deeptweet"] = function tmpl_otherfolder_deep2_deeptweet(locals) { | ||
var locals_for_with = locals || {}; | ||
(function (tweet) { | ||
buf.push('<li class="tweet">' + jade.escape(null == (jade_interp = tweet) ? '' : jade_interp) + '</li>'); | ||
}('tweet' in locals_for_with ? locals_for_with.tweet : typeof tweet !== 'undefined' ? tweet : undefined)); | ||
return buf.join(''); | ||
(function(tweet) { | ||
buf.push('<li class="tweet">' + jade.escape(null == (jade_interp = tweet) ? "" : jade_interp) + "</li>"); | ||
})("tweet" in locals_for_with ? locals_for_with.tweet : typeof tweet !== "undefined" ? tweet : undefined); | ||
return buf.join(""); | ||
}; | ||
@@ -58,6 +147,6 @@ | ||
var locals_for_with = locals || {}; | ||
(function (tweet) { | ||
buf.push('<li class="tweet">' + jade.escape(null == (jade_interp = tweet) ? '' : jade_interp) + '</li>'); | ||
}('tweet' in locals_for_with ? locals_for_with.tweet : typeof tweet !== 'undefined' ? tweet : undefined)); | ||
return buf.join(''); | ||
(function(tweet) { | ||
buf.push('<li class="tweet">' + jade.escape(null == (jade_interp = tweet) ? "" : jade_interp) + "</li>"); | ||
})("tweet" in locals_for_with ? locals_for_with.tweet : typeof tweet !== "undefined" ? tweet : undefined); | ||
return buf.join(""); | ||
}; | ||
@@ -71,11 +160,11 @@ | ||
var locals_for_with = locals || {}; | ||
(function (users) { | ||
buf.push('<ul>'); | ||
(function(users) { | ||
buf.push("<ul>"); | ||
var i = 0; | ||
(function () { | ||
(function() { | ||
var $obj = users; | ||
if ('number' == typeof $obj.length) { | ||
if ("number" == typeof $obj.length) { | ||
for (var $index = 0, $l = $obj.length; $index < $l; $index++) { | ||
var user = $obj[$index]; | ||
buf.push(templatizer.otherfolder.nestedMixin.user_li(user, i)); | ||
buf.push(templatizer["otherfolder"]["nestedMixin"]["user_li"](user, i)); | ||
i++; | ||
@@ -88,10 +177,10 @@ } | ||
var user = $obj[$index]; | ||
buf.push(templatizer.otherfolder.nestedMixin.user_li(user, i)); | ||
buf.push(templatizer["otherfolder"]["nestedMixin"]["user_li"](user, i)); | ||
i++; | ||
} | ||
} | ||
}.call(this)); | ||
buf.push('</ul>'); | ||
}('users' in locals_for_with ? locals_for_with.users : typeof users !== 'undefined' ? users : undefined)); | ||
return buf.join(''); | ||
}).call(this); | ||
buf.push("</ul>"); | ||
})("users" in locals_for_with ? locals_for_with.users : typeof users !== "undefined" ? users : undefined); | ||
return buf.join(""); | ||
}; | ||
@@ -101,3 +190,3 @@ | ||
templatizer["otherfolder"]["nestedMixin"]["user_li"] = function tmpl_otherfolder_nestedMixin_user_li(user, index) { | ||
var block = this && this.block, attributes = this && this.attributes || {}, buf = [], jade_interp; | ||
var block = this && this.block, attributes = this && this.attributes || {}, buf = []; | ||
buf.push("<li" + jade.attr("data-user-id", user.id, true, false) + jade.attr("data-user-index", index, true, false) + ">test</li>"); | ||
@@ -113,6 +202,6 @@ return buf.join(""); | ||
var locals_for_with = locals || {}; | ||
(function (user) { | ||
buf.push('<li class="tweet">' + jade.escape(null == (jade_interp = user) ? '' : jade_interp) + '</li>'); | ||
}('user' in locals_for_with ? locals_for_with.user : typeof user !== 'undefined' ? user : undefined)); | ||
return buf.join(''); | ||
(function(user) { | ||
buf.push('<li class="tweet">' + jade.escape(null == (jade_interp = user) ? "" : jade_interp) + "</li>"); | ||
})("user" in locals_for_with ? locals_for_with.user : typeof user !== "undefined" ? user : undefined); | ||
return buf.join(""); | ||
}; | ||
@@ -126,10 +215,10 @@ | ||
var locals_for_with = locals || {}; | ||
(function (users, _) { | ||
buf.push('<ul>'); | ||
(function () { | ||
(function(users, _) { | ||
buf.push("<ul>"); | ||
(function() { | ||
var $obj = users; | ||
if ('number' == typeof $obj.length) { | ||
if ("number" == typeof $obj.length) { | ||
for (var $index = 0, $l = $obj.length; $index < $l; $index++) { | ||
var user = $obj[$index]; | ||
buf.push('<li>' + jade.escape((jade_interp = _.isObject(user) && _.isString(user.name) ? user.name : '') == null ? '' : jade_interp) + '</li>'); | ||
buf.push("<li>" + jade.escape((jade_interp = _.isObject(user) && _.isString(user.name) ? user.name : "") == null ? "" : jade_interp) + "</li>"); | ||
} | ||
@@ -141,9 +230,9 @@ } else { | ||
var user = $obj[$index]; | ||
buf.push('<li>' + jade.escape((jade_interp = _.isObject(user) && _.isString(user.name) ? user.name : '') == null ? '' : jade_interp) + '</li>'); | ||
buf.push("<li>" + jade.escape((jade_interp = _.isObject(user) && _.isString(user.name) ? user.name : "") == null ? "" : jade_interp) + "</li>"); | ||
} | ||
} | ||
}.call(this)); | ||
buf.push('</ul>'); | ||
}('users' in locals_for_with ? locals_for_with.users : typeof users !== 'undefined' ? users : undefined, '_' in locals_for_with ? locals_for_with._ : typeof _ !== 'undefined' ? _ : undefined)); | ||
return buf.join(''); | ||
}).call(this); | ||
buf.push("</ul>"); | ||
})("users" in locals_for_with ? locals_for_with.users : typeof users !== "undefined" ? users : undefined, "_" in locals_for_with ? locals_for_with._ : typeof _ !== "undefined" ? _ : undefined); | ||
return buf.join(""); | ||
}; | ||
@@ -157,10 +246,10 @@ | ||
var locals_for_with = locals || {}; | ||
(function (users) { | ||
buf.push('<ul>'); | ||
(function () { | ||
(function(users) { | ||
buf.push("<ul>"); | ||
(function() { | ||
var $obj = users; | ||
if ('number' == typeof $obj.length) { | ||
if ("number" == typeof $obj.length) { | ||
for (var $index = 0, $l = $obj.length; $index < $l; $index++) { | ||
var user = $obj[$index]; | ||
buf.push('<li>' + jade.escape(null == (jade_interp = user.name) ? '' : jade_interp) + '</li>'); | ||
buf.push("<li>" + jade.escape(null == (jade_interp = user.name) ? "" : jade_interp) + "</li>"); | ||
} | ||
@@ -172,9 +261,9 @@ } else { | ||
var user = $obj[$index]; | ||
buf.push('<li>' + jade.escape(null == (jade_interp = user.name) ? '' : jade_interp) + '</li>'); | ||
buf.push("<li>" + jade.escape(null == (jade_interp = user.name) ? "" : jade_interp) + "</li>"); | ||
} | ||
} | ||
}.call(this)); | ||
buf.push('</ul>'); | ||
}('users' in locals_for_with ? locals_for_with.users : typeof users !== 'undefined' ? users : undefined)); | ||
return buf.join(''); | ||
}).call(this); | ||
buf.push("</ul>"); | ||
})("users" in locals_for_with ? locals_for_with.users : typeof users !== "undefined" ? users : undefined); | ||
return buf.join(""); | ||
}; | ||
@@ -187,9 +276,9 @@ | ||
var jade_interp; | ||
buf.push('<ul>'); | ||
(function () { | ||
buf.push("<ul>"); | ||
(function() { | ||
var $obj = locals.users; | ||
if ('number' == typeof $obj.length) { | ||
if ("number" == typeof $obj.length) { | ||
for (var $index = 0, $l = $obj.length; $index < $l; $index++) { | ||
var user = $obj[$index]; | ||
buf.push('<li>' + jade.escape(null == (jade_interp = user.name) ? '' : jade_interp) + '</li>'); | ||
buf.push("<li>" + jade.escape(null == (jade_interp = user.name) ? "" : jade_interp) + "</li>"); | ||
} | ||
@@ -201,8 +290,8 @@ } else { | ||
var user = $obj[$index]; | ||
buf.push('<li>' + jade.escape(null == (jade_interp = user.name) ? '' : jade_interp) + '</li>'); | ||
buf.push("<li>" + jade.escape(null == (jade_interp = user.name) ? "" : jade_interp) + "</li>"); | ||
} | ||
} | ||
}.call(this)); | ||
buf.push('</ul>'); | ||
return buf.join(''); | ||
}).call(this); | ||
buf.push("</ul>"); | ||
return buf.join(""); | ||
}; | ||
@@ -216,11 +305,11 @@ | ||
var locals_for_with = locals || {}; | ||
(function (users) { | ||
buf.push('<ul>'); | ||
(function(users) { | ||
buf.push("<ul>"); | ||
var i = 0; | ||
(function () { | ||
(function() { | ||
var $obj = users; | ||
if ('number' == typeof $obj.length) { | ||
if ("number" == typeof $obj.length) { | ||
for (var $index = 0, $l = $obj.length; $index < $l; $index++) { | ||
var user = $obj[$index]; | ||
buf.push(templatizer.usersMixins.user_li(user, i)); | ||
buf.push(templatizer["usersMixins"]["user_li"](user, i)); | ||
i++; | ||
@@ -233,10 +322,10 @@ } | ||
var user = $obj[$index]; | ||
buf.push(templatizer.usersMixins.user_li(user, i)); | ||
buf.push(templatizer["usersMixins"]["user_li"](user, i)); | ||
i++; | ||
} | ||
} | ||
}.call(this)); | ||
buf.push('</ul>'); | ||
}('users' in locals_for_with ? locals_for_with.users : typeof users !== 'undefined' ? users : undefined)); | ||
return buf.join(''); | ||
}).call(this); | ||
buf.push("</ul>"); | ||
})("users" in locals_for_with ? locals_for_with.users : typeof users !== "undefined" ? users : undefined); | ||
return buf.join(""); | ||
}; | ||
@@ -246,5 +335,5 @@ | ||
templatizer["usersMixins"]["user_li"] = function tmpl_usersMixins_user_li(user, index) { | ||
var block = this && this.block, attributes = this && this.attributes || {}, buf = [], jade_interp; | ||
var block = this && this.block, attributes = this && this.attributes || {}, buf = []; | ||
buf.push("<li" + jade.attr("data-user-id", user.id, true, false) + jade.attr("data-user-index", index, true, false) + "><span>Before</span>"); | ||
buf.push(templatizer.usersMixins.user_a(user, index)); | ||
buf.push(templatizer["usersMixins"]["user_a"](user, index)); | ||
buf.push("</li>"); | ||
@@ -254,5 +343,6 @@ return buf.join(""); | ||
// usersMixins.jade:user_a compiled template | ||
templatizer["usersMixins"]["user_a"] = function tmpl_usersMixins_user_a(user, index) { | ||
var block = this && this.block, attributes = this && this.attributes || {}, buf = [], jade_interp; | ||
var block = this && this.block, attributes = this && this.attributes || {}, buf = []; | ||
buf.push("<a" + jade.attr("href", user.url, true, false) + jade.attr("data-user-index", index, true, false) + ">Within " + jade.escape((jade_interp = user.name) == null ? "" : jade_interp) + "</a>"); | ||
@@ -268,10 +358,10 @@ return buf.join(""); | ||
var locals_for_with = locals || {}; | ||
(function (users) { | ||
buf.push('<ul>'); | ||
(function () { | ||
(function(users) { | ||
buf.push("<ul>"); | ||
(function() { | ||
var $obj = users; | ||
if ('number' == typeof $obj.length) { | ||
if ("number" == typeof $obj.length) { | ||
for (var $index = 0, $l = $obj.length; $index < $l; $index++) { | ||
var user = $obj[$index]; | ||
buf.push('<li' + jade.attr('data-user-id', user.id, true, false) + '><span>Before</span><a' + jade.attr('href', user.url, true, false) + '>Within ' + jade.escape((jade_interp = user.name) == null ? '' : jade_interp) + '</a></li>'); | ||
buf.push("<li" + jade.attr("data-user-id", user.id, true, false) + "><span>Before</span><a" + jade.attr("href", user.url, true, false) + ">Within " + jade.escape((jade_interp = user.name) == null ? "" : jade_interp) + "</a></li>"); | ||
} | ||
@@ -283,9 +373,9 @@ } else { | ||
var user = $obj[$index]; | ||
buf.push('<li' + jade.attr('data-user-id', user.id, true, false) + '><span>Before</span><a' + jade.attr('href', user.url, true, false) + '>Within ' + jade.escape((jade_interp = user.name) == null ? '' : jade_interp) + '</a></li>'); | ||
buf.push("<li" + jade.attr("data-user-id", user.id, true, false) + "><span>Before</span><a" + jade.attr("href", user.url, true, false) + ">Within " + jade.escape((jade_interp = user.name) == null ? "" : jade_interp) + "</a></li>"); | ||
} | ||
} | ||
}.call(this)); | ||
buf.push('</ul>'); | ||
}('users' in locals_for_with ? locals_for_with.users : typeof users !== 'undefined' ? users : undefined)); | ||
return buf.join(''); | ||
}).call(this); | ||
buf.push("</ul>"); | ||
})("users" in locals_for_with ? locals_for_with.users : typeof users !== "undefined" ? users : undefined); | ||
return buf.join(""); | ||
}; | ||
@@ -295,37 +385,2 @@ | ||
})); | ||
},{"fs":2}],2:[function(require,module,exports){ | ||
},{}],3:[function(require,module,exports){ | ||
/* globals test, ok */ | ||
var t = require('../demo_output.js'); | ||
var data = { | ||
users: [{ | ||
name: 'larry', | ||
url: 'http://andyet.com', | ||
id: 1 | ||
}, { | ||
name: 'curly', | ||
url: 'http://andbang.com', | ||
id: 2 | ||
}, { | ||
name: 'moe', | ||
url: 'http://talky.io', | ||
id: 3 | ||
}] | ||
}; | ||
module.exports = { | ||
start: function () { | ||
test("Test that templates work when browserified", function () { | ||
var users = t.users, | ||
withLocals = t.usersLocals; | ||
ok(users({users: data.users}) === withLocals({users: data.users})); | ||
}); | ||
} | ||
}; | ||
module.exports.start(); | ||
},{"../demo_output.js":1}]},{},[3]) | ||
},{"fs":1}]},{},[2]) |
@@ -99,2 +99,22 @@ /* globals test, ok, templatizer, templatizer_unaltered, templatizer_multiple_dirs, templatizer_globals */ | ||
ok(users({users: data.users}) === underscoreUsers({users: data.users})); | ||
}); | ||
test("Blocks", function () { | ||
var unalteredBlock = templatizer_unaltered.mixinsWithBlocks(); | ||
var unalteredWithoutBlock = templatizer_unaltered.mixinsWithoutBlocks(); | ||
var withBlock = templatizer.mixinsWithBlocks(); | ||
var withBlockMixin = templatizer.mixinsWithBlocks.MyModal.call({ | ||
block: function (buf) { | ||
buf.push('<p>some body text</p>'); | ||
} | ||
}, 'foo'); | ||
var withoutBlock = templatizer.mixinsWithoutBlocks(); | ||
var withoutBlockMixin = templatizer.mixinsWithoutBlocks.MyModal('foo'); | ||
ok(unalteredBlock === withBlock); | ||
ok(unalteredWithoutBlock === withoutBlock); | ||
ok(withBlock === withoutBlock); | ||
ok(withoutBlockMixin === withoutBlock); | ||
ok(withBlockMixin === withBlock); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
177825
46
4586
5
+ Addedfalafel@^0.3.1
+ Addedfalafel@0.3.1(transitive)
- Removedjshint@^2.5.0
- Removedbalanced-match@1.0.2(transitive)
- Removedbrace-expansion@1.1.11(transitive)
- Removedcli@1.0.1(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removedconsole-browserify@1.1.0(transitive)
- Removedcore-util-is@1.0.3(transitive)
- Removeddate-now@0.1.4(transitive)
- Removeddom-serializer@0.2.2(transitive)
- Removeddomelementtype@1.3.12.3.0(transitive)
- Removeddomhandler@2.3.0(transitive)
- Removeddomutils@1.5.1(transitive)
- Removedentities@1.0.02.2.0(transitive)
- Removedexit@0.1.2(transitive)
- Removedfs.realpath@1.0.0(transitive)
- Removedglob@7.2.3(transitive)
- Removedhtmlparser2@3.8.3(transitive)
- Removedinflight@1.0.6(transitive)
- Removedinherits@2.0.4(transitive)
- Removedisarray@0.0.1(transitive)
- Removedjshint@2.13.6(transitive)
- Removedlodash@4.17.21(transitive)
- Removedminimatch@3.0.83.1.2(transitive)
- Removedonce@1.4.0(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removedreadable-stream@1.1.14(transitive)
- Removedstring_decoder@0.10.31(transitive)
- Removedstrip-json-comments@1.0.4(transitive)
- Removedwrappy@1.0.2(transitive)
Updatedesprima@^1.2.1