Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jade

Package Overview
Dependencies
Maintainers
0
Versions
131
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jade - npm Package Compare versions

Comparing version 0.10.4 to 0.10.5

11

History.md
0.10.5 / 2011-04-26
==================
* Added error context after the lineno
* Added; indicate failing lineno with ">"
* Added `Object.keys()` for the client-side
* Fixed attr strings when containing the opposite quote. Closes 207
* Fixed attr issue with js expressions within strings
* Fixed single-quote filter escape bug. Closes #196
0.10.4 / 2011-04-05

@@ -3,0 +14,0 @@ ==================

112

jade.js

@@ -67,2 +67,15 @@

if (!Object.keys) {
Object.keys = function(obj){
var arr;
for (var key in obj) {
if (obj.hasOwnProperty(key)) {
arr.push(obj);
}
}
return arr;
}
}
if (!String.prototype.trimLeft) {

@@ -74,2 +87,3 @@ String.prototype.trimLeft = function(){

/**

@@ -243,3 +257,4 @@ * Initialize `Compiler` with the given `node`.

} else {
this.buffer(fn(utils.text(filter.block.nodes.join('')), filter.attrs));
var text = filter.block.nodes.join('');
this.buffer(utils.text(fn(text, filter.attrs)));
}

@@ -418,2 +433,3 @@ },

'5': '<!DOCTYPE html>'
, 'html': '<!DOCTYPE html>'
, 'xml': '<?xml version="1.0" encoding="utf-8" ?>'

@@ -544,3 +560,3 @@ , 'default': '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'

exports.version = '0.10.0';
exports.version = '0.10.5';

@@ -664,13 +680,14 @@ /**

function rethrow(err, str, filename, lineno){
var start = lineno - 3 > 0
? lineno - 3
: 0;
var context = 3
, lines = str.split('\n')
, start = Math.max(lineno - context, 0)
, end = Math.min(lines.length, lineno + context);
// Error context
var context = str.split('\n').slice(start, lineno).map(function(line, i){
return ' '
+ (i + start + 1)
+ ". '"
+ line.replace("'", "\\'")
+ "'";
var context = lines.slice(start, end).map(function(line, i){
var curr = i + start + 1;
return (curr == lineno ? ' > ' : ' ')
+ curr
+ '| '
+ line;
}).join('\n');

@@ -866,3 +883,3 @@

this.indentRe = null;
this.textPipe = true;
this.pipeless = false;
};

@@ -1138,2 +1155,3 @@

, val = ''
, quote
, c;

@@ -1173,2 +1191,5 @@

switch (state()) {
case 'key char':
key += c;
break;
case 'val':

@@ -1186,23 +1207,23 @@ case 'expr':

case '(':
states.push('expr');
if ('val' == state()) states.push('expr');
val += c;
break;
case ')':
states.pop();
if ('expr' == state()) states.pop();
val += c;
break;
case '{':
states.push('object');
if ('val' == state()) states.push('object');
val += c;
break;
case '}':
states.pop();
if ('object' == state()) states.pop();
val += c;
break;
case '[':
states.push('array');
if ('val' == state()) states.push('array');
val += c;
break;
case ']':
states.pop();
if ('array' == state()) states.pop();
val += c;

@@ -1212,7 +1233,18 @@ break;

case "'":
if ('key' == state()) break;
'string' == state()
? states.pop()
: states.push('string');
val += c;
switch (state()) {
case 'key':
states.push('key char');
break;
case 'key char':
states.pop();
break;
case 'string':
if (c == quote) states.pop();
val += c;
break;
default:
states.push('string');
val += c;
quote = c;
}
break;

@@ -1222,6 +1254,9 @@ case '':

default:
if ('key' == state()) {
key += c;
} else {
val += c;
switch (state()) {
case 'key':
case 'key char':
key += c;
break;
default:
val += c;
}

@@ -1303,11 +1338,11 @@ }

* Pipe-less text consumed only when
* textPipe is false;
* pipeless is true;
*/
pipelessText: function() {
if (false === this.textPipe) {
if (this.pipeless) {
if ('\n' == this.input[0]) return;
var i = this.input.indexOf('\n')
, str = this.input.substr(0, i);
if (-1 == i) return;
var i = this.input.indexOf('\n');
if (-1 == i) i = this.input.length;
var str = this.input.substr(0, i);
this.consume(str.length);

@@ -1860,3 +1895,3 @@ return this.tok('text', str);

var textOnly = exports.textOnly = ['pre', 'script', 'textarea', 'style'];
var textOnly = exports.textOnly = ['code', 'script', 'textarea', 'style'];

@@ -2085,5 +2120,5 @@ /**

this.lexer.textPipe = false;
this.lexer.pipeless = true;
block = this.parseTextBlock();
this.lexer.textPipe = true;
this.lexer.pipeless = false;

@@ -2128,4 +2163,3 @@ var node = new nodes.Filter(tok.val, block, attrs && attrs.attrs);

parseTextBlock: function(){
var text = new nodes.Text
, pipeless = false === this.lexer.textPipe;
var text = new nodes.Text;
text.line = this.line();

@@ -2252,5 +2286,5 @@ this.expect('indent');

if (tag.textOnly) {
this.lexer.textPipe = false;
this.lexer.pipeless = true;
tag.block = this.parseTextBlock();
this.lexer.textPipe = true;
this.lexer.pipeless = false;
} else {

@@ -2257,0 +2291,0 @@ var block = this.parseBlock();

// CommonJS require()
function require(p){var path=require.resolve(p),mod=require.modules[path];if(!mod)throw new Error('failed to require "'+p+'"');mod.exports||(mod.exports={},mod.call(mod.exports,mod,mod.exports,require.relative(path)));return mod.exports}require.modules={},require.resolve=function(path){var orig=path,reg=path+".js",index=path+"/index.js";return require.modules[reg]&&reg||require.modules[index]&&index||orig},require.register=function(path,fn){require.modules[path]=fn},require.relative=function(parent){return function(p){if("."!=p[0])return require(p);var path=parent.split("/"),segs=p.split("/");path.pop();for(var i=0;i<segs.length;i++){var seg=segs[i];".."==seg?path.pop():"."!=seg&&path.push(seg)}return require(path.join("/"))}},require.register("compiler.js",function(module,exports,require){var nodes=require("./nodes"),filters=require("./filters"),doctypes=require("./doctypes"),selfClosing=require("./self-closing"),utils=require("./utils"),Compiler=module.exports=function Compiler(node,options){this.options=options=options||{},this.node=node};Compiler.prototype={compile:function(){this.buf=["var interp;"],this.visit(this.node);return this.buf.join("\n")},buffer:function(str,esc){esc&&(str=utils.escape(str)),this.buf.push("buf.push('"+str+"');")},line:function(node){node.instrumentLineNumber!==!1&&this.buf.push("__.lineno = "+node.line+";")},visit:function(node){this.line(node);return this.visitNode(node)},visitNode:function(node){return this["visit"+node.constructor.name](node)},visitBlock:function(block){var len=len=block.nodes.length;for(var i=0;i<len;++i)this.visit(block.nodes[i])},visitDoctype:function(doctype){var name=doctype.val;"5"==name&&(this.terse=!0),doctype=doctypes[name||"default"],this.xml=0==doctype.indexOf("<?xml");if(!doctype)throw new Error('unknown doctype "'+name+'"');this.buffer(doctype)},visitTag:function(tag){var name=tag.name;~selfClosing.indexOf(name)&&!this.xml?(this.buffer("<"+name),this.visitAttributes(tag.attrs),this.terse?this.buffer(">"):this.buffer("/>")):(tag.attrs.length?(this.buffer("<"+name),tag.attrs.length&&this.visitAttributes(tag.attrs),this.buffer(">")):this.buffer("<"+name+">"),tag.code&&this.visitCode(tag.code),tag.text&&this.buffer(utils.text(tag.text.nodes[0].trimLeft())),this.escape="pre"==tag.name,this.visit(tag.block),this.buffer("</"+name+">"))},visitFilter:function(filter){var fn=filters[filter.name];if(!fn)throw filter.isASTFilter?new Error('unknown ast filter "'+filter.name+':"'):new Error('unknown filter ":'+filter.name+'"');filter.isASTFilter?this.buf.push(fn(filter.block,this,filter.attrs)):this.buffer(fn(utils.text(filter.block.nodes.join("")),filter.attrs))},visitText:function(text){text=utils.text(text.nodes.join("")),this.escape&&(text=escape(text)),this.buffer(text),this.buffer("\\n")},visitComment:function(comment){!comment.buffer||this.buffer("<!--"+utils.escape(comment.val)+"-->")},visitBlockComment:function(comment){0==comment.val.indexOf("if")?(this.buffer("<!--["+comment.val+"]>"),this.visit(comment.block),this.buffer("<![endif]-->")):(this.buffer("<!--"+comment.val),this.visit(comment.block),this.buffer("-->"))},visitCode:function(code){if(code.buffer){var val=code.val.trimLeft();this.buf.push("var __val__ = "+val),val='null == __val__ ? "" : __val__',code.escape&&(val="escape("+val+")"),this.buf.push("buf.push("+val+");")}else this.buf.push(code.val);code.block&&(code.buffer||this.buf.push("{"),this.visit(code.block),code.buffer||this.buf.push("}"))},visitEach:function(each){this.buf.push("// iterate "+each.obj+"\n"+"(function(){\n"+" if ('number' == typeof "+each.obj+".length) {\n"+" for (var "+each.key+" = 0, $$l = "+each.obj+".length; "+each.key+" < $$l; "+each.key+"++) {\n"+" var "+each.val+" = "+each.obj+"["+each.key+"];\n"),this.visit(each.block),this.buf.push(" }\n } else {\n for (var "+each.key+" in "+each.obj+") {\n"+" if ("+each.obj+".hasOwnProperty("+each.key+")){"+" var "+each.val+" = "+each.obj+"["+each.key+"];\n"),this.visit(each.block),this.buf.push(" }\n"),this.buf.push(" }\n }\n}).call(this);\n")},visitAttributes:function(attrs){var buf=[],classes=[];this.terse&&buf.push("terse: true"),attrs.forEach(function(attr){if(attr.name=="class")classes.push("("+attr.val+")");else{var pair="'"+attr.name+"':("+attr.val+")";buf.push(pair)}}),classes.length&&(classes=classes.join(" + ' ' + "),buf.push("class: "+classes)),this.buf.push("buf.push(attrs({ "+buf.join(", ")+" }));")}};function escape(html){return String(html).replace(/&(?!\w+;)/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}}),require.register("doctypes.js",function(module,exports,require){module.exports={5:"<!DOCTYPE html>",xml:'<?xml version="1.0" encoding="utf-8" ?>',"default":'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',transitional:'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',strict:'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">',frameset:'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">',1.1:'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">',basic:'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">',mobile:'<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.2//EN" "http://www.openmobilealliance.org/tech/DTD/xhtml-mobile12.dtd">'}}),require.register("filters.js",function(module,exports,require){module.exports={cdata:function(str){return"<![CDATA[\\n"+str+"\\n]]>"},sass:function(str){str=str.replace(/\\n/g,"\n");var sass=require("sass").render(str).replace(/\n/g,"\\n");return"<style>"+sass+"</style>"},stylus:function(str){var ret;str=str.replace(/\\n/g,"\n");var stylus=require("stylus");stylus(str).render(function(err,css){if(err)throw err;ret=css.replace(/\n/g,"\\n")});return"<style>"+ret+"</style>"},less:function(str){var ret;str=str.replace(/\\n/g,"\n"),require("less").render(str,function(err,css){if(err)throw err;ret="<style>"+css.replace(/\n/g,"\\n")+"</style>"});return ret},markdown:function(str){var md;try{md=require("markdown")}catch(err){try{md=require("discount")}catch(err){try{md=require("markdown-js")}catch(err){throw new Error("Cannot find markdown library, install markdown or discount")}}}str=str.replace(/\\n/g,"\n");return md.parse(str).replace(/\n/g,"\\n").replace(/'/g,"&#39;")},coffeescript:function(str){str=str.replace(/\\n/g,"\n");var js=require("coffee-script").compile(str).replace(/\n/g,"\\n");return'<script type="text/javascript">\\n'+js+"</script>"}}}),require.register("jade.js",function(module,exports,require){var Parser=require("./parser"),Compiler=require("./compiler");exports.version="0.10.0";var cache=exports.cache={};exports.selfClosing=require("./self-closing"),exports.doctypes=require("./doctypes"),exports.filters=require("./filters"),exports.utils=require("./utils"),exports.Compiler=Compiler,exports.nodes=require("./nodes");function attrs(obj){var buf=[],terse=obj.terse;delete obj.terse;var keys=Object.keys(obj),len=keys.length;if(len){buf.push("");for(var i=0;i<len;++i){var key=keys[i],val=obj[key];typeof val=="boolean"||val===""||val==null?val&&(terse?buf.push(key):buf.push(key+'="'+key+'"')):buf.push(key+'="'+escape(val)+'"')}}return buf.join(" ")}function escape(html){return String(html).replace(/&(?!\w+;)/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function rethrow(err,str,filename,lineno){var start=lineno-3>0?lineno-3:0,context=str.split("\n").slice(start,lineno).map(function(line,i){return" "+(i+start+1)+". '"+line.replace("'","\\'")+"'"}).join("\n");err.path=filename,err.message=(filename||"Jade")+":"+lineno+"\n"+context+"\n\n"+err.message;throw err}function parse(str,options){var filename=options.filename;try{var parser=new Parser(str,filename);options.debug&&parser.debug();var compiler=new(options.compiler||Compiler)(parser.parse(),options),js=compiler.compile();options.debug&&console.log("\nCompiled Function:\n\n%s",js.replace(/^/gm," "));try{return""+attrs.toString()+"\n\n"+escape.toString()+"\n\n"+"var buf = [];\n"+"with (locals || {}) {"+js+"}"+'return buf.join("");'}catch(err){process.compile(js,filename||"Jade");return}}catch(err){rethrow(err,str,filename,parser.lexer.lineno)}}exports.compile=function(str,options){var options=options||{},input=JSON.stringify(str),filename=options.filename?JSON.stringify(options.filename):"undefined",fn=["var __ = { lineno: 1, input: "+input+", filename: "+filename+" };",rethrow.toString(),"try {",parse(String(str),options||{}),"} catch (err) {"," rethrow(err, __.input, __.filename, __.lineno);","}"].join("\n");return new Function("locals",fn)},exports.render=function(str,options){var fn,options=options||{},filename=options.filename;str=String(str);if(options.cache)if(filename)cache[filename]?fn=cache[filename]:fn=cache[filename]=new Function("locals",parse(str,options));else throw new Error("filename is required when using the cache option");else fn=new Function("locals",parse(str,options));try{var locals=options.locals||{},meta={lineno:1};locals.__=meta;return fn.call(options.scope,locals)}catch(err){rethrow(err,str,filename,meta.lineno)}},exports.renderFile=function(path,options,fn){typeof options=="function"&&(fn=options,options={}),options.filename=path;if(options.cache&&cache[path])try{fn(null,exports.render("",options))}catch(err){fn(err)}else fs.readFile(path,"utf8",function(err,str){if(err)return fn(err);try{fn(null,exports.render(str,options))}catch(err){fn(err)}})}}),require.register("lexer.js",function(module,exports,require){var Lexer=module.exports=function Lexer(str){this.input=str.replace(/\r\n|\r/g,"\n"),this.deferredTokens=[],this.lastIndents=0,this.lineno=1,this.stash=[],this.indentStack=[],this.indentRe=null,this.textPipe=!0};Lexer.prototype={tok:function(type,val){return{type:type,line:this.lineno,val:val}},consume:function(len){this.input=this.input.substr(len)},scan:function(regexp,type){var captures;if(captures=regexp.exec(this.input)){this.consume(captures[0].length);return this.tok(type,captures[1])}},defer:function(tok){this.deferredTokens.push(tok)},lookahead:function(n){var fetch=n-this.stash.length;while(fetch-->0)this.stash.push(this.next());return this.stash[--n]},indexOfDelimiters:function(start,end){var str=this.input,nstart=0,nend=0,pos=0;for(var i=0,len=str.length;i<len;++i)if(start==str[i])++nstart;else if(end==str[i]&&++nend==nstart){pos=i;break}return pos},stashed:function(){return this.stash.length&&this.stash.shift()},deferred:function(){return this.deferredTokens.length&&this.deferredTokens.shift()},eos:function(){if(!this.input.length){if(this.indentStack.length){this.indentStack.shift();return this.tok("outdent")}return this.tok("eos")}},blockComment:function(){var captures;if(captures=/^\/([^\n]+)/.exec(this.input)){this.consume(captures[0].length);var tok=this.tok("block-comment",captures[1]);return tok}},comment:function(){var captures;if(captures=/^ *\/\/(-)?([^\n]+)/.exec(this.input)){this.consume(captures[0].length);var tok=this.tok("comment",captures[2]);tok.buffer="-"!=captures[1];return tok}},tag:function(){var captures;if(captures=/^(\w[-:\w]*)/.exec(this.input)){this.consume(captures[0].length);var tok,name=captures[1];if(":"==name[name.length-1]){name=name.slice(0,-1),tok=this.tok("tag",name),this.deferredTokens.push(this.tok(":"));while(" "==this.input[0])this.input=this.input.substr(1)}else tok=this.tok("tag",name);return tok}},filter:function(){return this.scan(/^:(\w+)/,"filter")},doctype:function(){return this.scan(/^!!! *(\w+)?/,"doctype")},id:function(){return this.scan(/^#([\w-]+)/,"id")},className:function(){return this.scan(/^\.([\w-]+)/,"class")},text:function(){return this.scan(/^(?:\| ?)?([^\n]+)/,"text")},each:function(){var captures;if(captures=/^- *each *(\w+)(?: *, *(\w+))? * in *([^\n]+)/.exec(this.input)){this.consume(captures[0].length);var tok=this.tok("each",captures[1]);tok.key=captures[2]||"index",tok.code=captures[3];return tok}},code:function(){var captures;if(captures=/^(!?=|-)([^\n]+)/.exec(this.input)){this.consume(captures[0].length);var flags=captures[1];captures[1]=captures[2];var tok=this.tok("code",captures[1]);tok.escape=flags[0]==="=",tok.buffer=flags[0]==="="||flags[1]==="=";return tok}},attrs:function(){if("("==this.input[0]){var index=this.indexOfDelimiters("(",")"),str=this.input.substr(1,index-1),tok=this.tok("attrs"),len=str.length,states=["key"],key="",val="",c;function state(){return states[states.length-1]}this.consume(index+1),tok.attrs={};function parse(c){switch(c){case",":case"\n":switch(state()){case"expr":case"array":case"string":case"object":val+=c;break;default:states.push("key"),val=val.trim(),key=key.trim();if(""==key)return;tok.attrs[key.replace(/^['"]|['"]$/g,"")]=""==val?!0:val,key=val=""}break;case":":case"=":switch(state()){case"val":case"expr":case"array":case"string":case"object":val+=c;break;default:states.push("val")}break;case"(":states.push("expr"),val+=c;break;case")":states.pop(),val+=c;break;case"{":states.push("object"),val+=c;break;case"}":states.pop(),val+=c;break;case"[":states.push("array"),val+=c;break;case"]":states.pop(),val+=c;break;case'"':case"'":if("key"==state())break;"string"==state()?states.pop():states.push("string"),val+=c;break;case"":break;default:"key"==state()?key+=c:val+=c}}for(var i=0;i<len;++i)parse(str[i]);parse(",");return tok}},indent:function(){var captures,re;this.indentRe?captures=this.indentRe.exec(this.input):(re=/^\n(\t*) */,captures=re.exec(this.input),captures&&!captures[1].length&&(re=/^\n( *)/,captures=re.exec(this.input)),captures&&captures[1].length&&(this.indentRe=re));if(captures){var tok,indents=captures[1].length;++this.lineno,this.consume(indents+1);if(" "==this.input[0]||"\t"==this.input[0])throw new Error("Invalid indentation, you can use tabs or spaces but not both");if("\n"==this.input[0])return this.tok("newline");if(this.indentStack.length&&indents<this.indentStack[0]){while(this.indentStack.length&&this.indentStack[0]>indents)this.stash.push(this.tok("outdent")),this.indentStack.shift();tok=this.stash.pop()}else indents&&indents!=this.indentStack[0]?(this.indentStack.unshift(indents),tok=this.tok("indent")):tok=this.tok("newline");return tok}},pipelessText:function(){if(!1===this.textPipe){if("\n"==this.input[0])return;var i=this.input.indexOf("\n"),str=this.input.substr(0,i);if(-1==i)return;this.consume(str.length);return this.tok("text",str)}},colon:function(){return this.scan(/^: */,":")},advance:function(){return this.stashed()||this.next()},next:function(){return this.deferred()||this.eos()||this.pipelessText()||this.tag()||this.filter()||this.each()||this.code()||this.doctype()||this.id()||this.className()||this.attrs()||this.indent()||this.comment()||this.blockComment()||this.colon()||this.text()}}}),require.register("nodes/block-comment.js",function(module,exports,require){var Node=require("./node"),BlockComment=module.exports=function BlockComment(val,block){this.block=block,this.val=val};BlockComment.prototype=new Node,BlockComment.prototype.constructor=BlockComment}),require.register("nodes/block.js",function(module,exports,require){var Node=require("./node"),Block=module.exports=function Block(node){this.nodes=[],node&&this.push(node)};Block.prototype=new Node,Block.prototype.constructor=Block,Block.prototype.push=function(node){return this.nodes.push(node)},Block.prototype.unshift=function(node){return this.nodes.unshift(node)}}),require.register("nodes/code.js",function(module,exports,require){var Node=require("./node"),Code=module.exports=function Code(val,buffer,escape){this.val=val,this.buffer=buffer,this.escape=escape,/^ *else/.test(val)&&(this.instrumentLineNumber=!1)};Code.prototype=new Node,Code.prototype.constructor=Code}),require.register("nodes/comment.js",function(module,exports,require){var Node=require("./node"),Comment=module.exports=function Comment(val,buffer){this.val=val,this.buffer=buffer};Comment.prototype=new Node,Comment.prototype.constructor=Comment}),require.register("nodes/doctype.js",function(module,exports,require){var Node=require("./node"),Doctype=module.exports=function Doctype(val){this.val=val};Doctype.prototype=new Node,Doctype.prototype.constructor=Doctype}),require.register("nodes/each.js",function(module,exports,require){var Node=require("./node"),Each=module.exports=function Each(obj,val,key,block){this.obj=obj,this.val=val,this.key=key,this.block=block};Each.prototype=new Node,Each.prototype.constructor=Each}),require.register("nodes/filter.js",function(module,exports,require){var Node=require("./node"),Block=require("./block"),Filter=module.exports=function Filter(name,block,attrs){this.name=name,this.block=block,this.attrs=attrs,this.isASTFilter=block instanceof Block};Filter.prototype=new Node,Filter.prototype.constructor=Filter}),require.register("nodes/index.js",function(module,exports,require){exports.Node=require("./node"),exports.Tag=require("./tag"),exports.Code=require("./code"),exports.Each=require("./each"),exports.Text=require("./text"),exports.Block=require("./block"),exports.Filter=require("./filter"),exports.Comment=require("./comment"),exports.BlockComment=require("./block-comment"),exports.Doctype=require("./doctype")}),require.register("nodes/node.js",function(module,exports,require){var Node=module.exports=function(){}}),require.register("nodes/tag.js",function(module,exports,require){var Node=require("./node"),Block=require("./block"),Tag=module.exports=function Tag(name,block){this.name=name,this.attrs=[],this.block=block||new Block};Tag.prototype=new Node,Tag.prototype.constructor=Tag,Tag.prototype.setAttribute=function(name,val){this.attrs.push({name:name,val:val});return this},Tag.prototype.removeAttribute=function(name){for(var i=0,len=this.attrs.length;i<len;++i)this.attrs[i]&&this.attrs[i].name==name&&delete this.attrs[i]},Tag.prototype.getAttribute=function(name){for(var i=0,len=this.attrs.length;i<len;++i)if(this.attrs[i]&&this.attrs[i].name==name)return this.attrs[i].val}}),require.register("nodes/text.js",function(module,exports,require){var Node=require("./node"),Text=module.exports=function Text(line){this.nodes=[],"string"==typeof line&&this.push(line)};Text.prototype=new Node,Text.prototype.constructor=Text,Text.prototype.push=function(node){return this.nodes.push(node)}}),require.register("parser.js",function(module,exports,require){var Lexer=require("./lexer"),nodes=require("./nodes"),Parser=exports=module.exports=function Parser(str,filename){this.input=str,this.lexer=new Lexer(str),this.filename=filename},textOnly=exports.textOnly=["pre","script","textarea","style"];Parser.prototype={debug:function(){var lexer=new Lexer(this.input),tree=require("sys").inspect(this.parse(),!1,12,!0);console.log("\nParse Tree:\n"),console.log(tree),this.lexer=lexer},advance:function(){return this.lexer.advance()},peek:function(){return this.lookahead(1)},line:function(){return this.lexer.lineno},lookahead:function(n){return this.lexer.lookahead(n)},parse:function(){var block=new nodes.Block;block.line=this.line();while("eos"!=this.peek().type)"newline"==this.peek().type?this.advance():block.push(this.parseExpr());return block},expect:function(type){if(this.peek().type===type)return this.advance();throw new Error('expected "'+type+'", but got "'+this.peek().type+'"')},accept:function(type){if(this.peek().type===type)return this.advance()},parseExpr:function(){switch(this.peek().type){case"tag":return this.parseTag();case"doctype":return this.parseDoctype();case"filter":return this.parseFilter();case"comment":return this.parseComment();case"block-comment":return this.parseBlockComment();case"text":return this.parseText();case"each":return this.parseEach();case"code":return this.parseCode();case"id":case"class":var tok=this.advance();this.lexer.defer(this.lexer.tok("tag","div")),this.lexer.defer(tok);return this.parseExpr();default:throw new Error('unexpected token "'+this.peek().type+'"')}},parseText:function(){var tok=this.expect("text"),node=new nodes.Text(tok.val);node.line=this.line();return node},parseCode:function(){var tok=this.expect("code"),node=new nodes.Code(tok.val,tok.buffer,tok.escape);node.line=this.line(),"indent"==this.peek().type&&(node.block=this.parseBlock());return node},parseBlockComment:function(){var tok=this.expect("block-comment"),node=new nodes.BlockComment(tok.val,this.parseBlock());node.line=this.line();return node},parseComment:function(){var tok=this.expect("comment"),node=new nodes.Comment(tok.val,tok.buffer);node.line=this.line();return node},parseDoctype:function(){var tok=this.expect("doctype"),node=new nodes.Doctype(tok.val);node.line=this.line();return node},parseFilter:function(){var block,tok=this.expect("filter"),attrs=this.accept("attrs");this.lexer.textPipe=!1,block=this.parseTextBlock(),this.lexer.textPipe=!0;var node=new nodes.Filter(tok.val,block,attrs&&attrs.attrs);node.line=this.line();return node},parseASTFilter:function(){var block,tok=this.expect("tag"),attrs=this.accept("attrs");this.expect(":"),block=this.parseBlock();var node=new nodes.Filter(tok.val,block,attrs&&attrs.attrs);node.line=this.line();return node},parseEach:function(){var tok=this.expect("each"),node=new nodes.Each(tok.code,tok.val,tok.key,this.parseBlock());node.line=this.line();return node},parseTextBlock:function(){var text=new nodes.Text,pipeless=!1===this.lexer.textPipe;text.line=this.line(),this.expect("indent");while("outdent"!=this.peek().type)switch(this.peek().type){case"newline":text.push("\\n"),this.advance();break;case"indent":text.push("\\n"),text.push(this.parseTextBlock().nodes.map(function(text){return" "+text}).join("")),text.push("\\n");break;default:text.push(this.advance().val)}this.expect("outdent");return text},parseBlock:function(){var block=new nodes.Block;block.line=this.line(),this.expect("indent");while("outdent"!=this.peek().type)"newline"==this.peek().type?this.advance():block.push(this.parseExpr());this.expect("outdent");return block},parseTag:function(){var i=2;"attrs"==this.lookahead(i).type&&++i;if(":"==this.lookahead(i).type&&"indent"==this.lookahead(++i).type)return this.parseASTFilter();var name=this.advance().val,tag=new nodes.Tag(name);tag.line=this.line();out:for(;;)switch(this.peek().type){case"id":case"class":var tok=this.advance();tag.setAttribute(tok.type,"'"+tok.val+"'");continue;case"attrs":var obj=this.advance().attrs,names=Object.keys(obj);for(var i=0,len=names.length;i<len;++i){var name=names[i],val=obj[name];tag.setAttribute(name,val)}continue;default:break out}"."==this.peek().val&&(tag.textOnly=!0,this.advance());switch(this.peek().type){case"text":tag.text=this.parseText();break;case"code":tag.code=this.parseCode();break;case":":this.advance(),tag.block=new nodes.Block,tag.block.push(this.parseTag())}while("newline"==this.peek().type)this.advance();tag.textOnly=tag.textOnly||~textOnly.indexOf(tag.name);if("script"==tag.name){var type=tag.getAttribute("type");type&&"text/javascript"!=type.replace(/^['"]|['"]$/g,"")&&(tag.textOnly=!1)}if("indent"==this.peek().type)if(tag.textOnly)this.lexer.textPipe=!1,tag.block=this.parseTextBlock(),this.lexer.textPipe=!0;else{var block=this.parseBlock();if(tag.block)for(var i=0,len=block.nodes.length;i<len;++i)tag.block.push(block.nodes[i]);else tag.block=block}return tag}}}),require.register("self-closing.js",function(module,exports,require){module.exports=["meta","img","link","input","area","base","col","br","hr"]}),require.register("utils.js",function(module,exports,require){var interpolate=exports.interpolate=function(str){return str.replace(/(\\)?([#!]){(.*?)}/g,function(str,escape,flag,code){return escape?str:"' + "+("!"==flag?"":"escape")+"((interp = "+code.replace(/\\'/g,"'")+") == null ? '' : interp) + '"})},escape=exports.escape=function(str){return str.replace(/'/g,"\\'")};exports.text=function(str){return interpolate(escape(str))}})
function require(p){var path=require.resolve(p),mod=require.modules[path];if(!mod)throw new Error('failed to require "'+p+'"');mod.exports||(mod.exports={},mod.call(mod.exports,mod,mod.exports,require.relative(path)));return mod.exports}require.modules={},require.resolve=function(path){var orig=path,reg=path+".js",index=path+"/index.js";return require.modules[reg]&&reg||require.modules[index]&&index||orig},require.register=function(path,fn){require.modules[path]=fn},require.relative=function(parent){return function(p){if("."!=p[0])return require(p);var path=parent.split("/"),segs=p.split("/");path.pop();for(var i=0;i<segs.length;i++){var seg=segs[i];".."==seg?path.pop():"."!=seg&&path.push(seg)}return require(path.join("/"))}},require.register("compiler.js",function(module,exports,require){var nodes=require("./nodes"),filters=require("./filters"),doctypes=require("./doctypes"),selfClosing=require("./self-closing"),utils=require("./utils");Object.keys||(Object.keys=function(obj){var arr;for(var key in obj)obj.hasOwnProperty(key)&&arr.push(obj);return arr}),String.prototype.trimLeft||(String.prototype.trimLeft=function(){return this.replace(/^\s+/,"")});var Compiler=module.exports=function Compiler(node,options){this.options=options=options||{},this.node=node};Compiler.prototype={compile:function(){this.buf=["var interp;"],this.visit(this.node);return this.buf.join("\n")},buffer:function(str,esc){esc&&(str=utils.escape(str)),this.buf.push("buf.push('"+str+"');")},line:function(node){node.instrumentLineNumber!==!1&&this.buf.push("__.lineno = "+node.line+";")},visit:function(node){this.line(node);return this.visitNode(node)},visitNode:function(node){var name=node.constructor.name||node.constructor.toString().match(/function ([^(\s]+)()/)[1];return this["visit"+name](node)},visitBlock:function(block){var len=len=block.nodes.length;for(var i=0;i<len;++i)this.visit(block.nodes[i])},visitDoctype:function(doctype){var name=doctype.val;"5"==name&&(this.terse=!0),doctype=doctypes[name||"default"],this.xml=0==doctype.indexOf("<?xml");if(!doctype)throw new Error('unknown doctype "'+name+'"');this.buffer(doctype)},visitTag:function(tag){var name=tag.name;~selfClosing.indexOf(name)&&!this.xml?(this.buffer("<"+name),this.visitAttributes(tag.attrs),this.terse?this.buffer(">"):this.buffer("/>")):(tag.attrs.length?(this.buffer("<"+name),tag.attrs.length&&this.visitAttributes(tag.attrs),this.buffer(">")):this.buffer("<"+name+">"),tag.code&&this.visitCode(tag.code),tag.text&&this.buffer(utils.text(tag.text.nodes[0].trimLeft())),this.escape="pre"==tag.name,this.visit(tag.block),this.buffer("</"+name+">"))},visitFilter:function(filter){var fn=filters[filter.name];if(!fn)throw filter.isASTFilter?new Error('unknown ast filter "'+filter.name+':"'):new Error('unknown filter ":'+filter.name+'"');if(filter.isASTFilter)this.buf.push(fn(filter.block,this,filter.attrs));else{var text=filter.block.nodes.join("");this.buffer(utils.text(fn(text,filter.attrs)))}},visitText:function(text){text=utils.text(text.nodes.join("")),this.escape&&(text=escape(text)),this.buffer(text),this.buffer("\\n")},visitComment:function(comment){!comment.buffer||this.buffer("<!--"+utils.escape(comment.val)+"-->")},visitBlockComment:function(comment){0==comment.val.indexOf("if")?(this.buffer("<!--["+comment.val+"]>"),this.visit(comment.block),this.buffer("<![endif]-->")):(this.buffer("<!--"+comment.val),this.visit(comment.block),this.buffer("-->"))},visitCode:function(code){if(code.buffer){var val=code.val.trimLeft();this.buf.push("var __val__ = "+val),val='null == __val__ ? "" : __val__',code.escape&&(val="escape("+val+")"),this.buf.push("buf.push("+val+");")}else this.buf.push(code.val);code.block&&(code.buffer||this.buf.push("{"),this.visit(code.block),code.buffer||this.buf.push("}"))},visitEach:function(each){this.buf.push("// iterate "+each.obj+"\n"+"(function(){\n"+" if ('number' == typeof "+each.obj+".length) {\n"+" for (var "+each.key+" = 0, $$l = "+each.obj+".length; "+each.key+" < $$l; "+each.key+"++) {\n"+" var "+each.val+" = "+each.obj+"["+each.key+"];\n"),this.visit(each.block),this.buf.push(" }\n } else {\n for (var "+each.key+" in "+each.obj+") {\n"+" if ("+each.obj+".hasOwnProperty("+each.key+")){"+" var "+each.val+" = "+each.obj+"["+each.key+"];\n"),this.visit(each.block),this.buf.push(" }\n"),this.buf.push(" }\n }\n}).call(this);\n")},visitAttributes:function(attrs){var buf=[],classes=[];this.terse&&buf.push("terse: true"),attrs.forEach(function(attr){if(attr.name=="class")classes.push("("+attr.val+")");else{var pair="'"+attr.name+"':("+attr.val+")";buf.push(pair)}}),classes.length&&(classes=classes.join(" + ' ' + "),buf.push("class: "+classes)),buf=buf.join(", ").replace("class:",'"class":'),this.buf.push("buf.push(attrs({ "+buf+" }));")}};function escape(html){return String(html).replace(/&(?!\w+;)/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}}),require.register("doctypes.js",function(module,exports,require){module.exports={5:"<!DOCTYPE html>",html:"<!DOCTYPE html>",xml:'<?xml version="1.0" encoding="utf-8" ?>',"default":'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',transitional:'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',strict:'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">',frameset:'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">',1.1:'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">',basic:'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">',mobile:'<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.2//EN" "http://www.openmobilealliance.org/tech/DTD/xhtml-mobile12.dtd">'}}),require.register("filters.js",function(module,exports,require){module.exports={cdata:function(str){return"<![CDATA[\\n"+str+"\\n]]>"},sass:function(str){str=str.replace(/\\n/g,"\n");var sass=require("sass").render(str).replace(/\n/g,"\\n");return"<style>"+sass+"</style>"},stylus:function(str){var ret;str=str.replace(/\\n/g,"\n");var stylus=require("stylus");stylus(str).render(function(err,css){if(err)throw err;ret=css.replace(/\n/g,"\\n")});return"<style>"+ret+"</style>"},less:function(str){var ret;str=str.replace(/\\n/g,"\n"),require("less").render(str,function(err,css){if(err)throw err;ret="<style>"+css.replace(/\n/g,"\\n")+"</style>"});return ret},markdown:function(str){var md;try{md=require("markdown")}catch(err){try{md=require("discount")}catch(err){try{md=require("markdown-js")}catch(err){throw new Error("Cannot find markdown library, install markdown or discount")}}}str=str.replace(/\\n/g,"\n");return md.parse(str).replace(/\n/g,"\\n").replace(/'/g,"&#39;")},coffeescript:function(str){str=str.replace(/\\n/g,"\n");var js=require("coffee-script").compile(str).replace(/\n/g,"\\n");return'<script type="text/javascript">\\n'+js+"</script>"}}}),require.register("jade.js",function(module,exports,require){var Parser=require("./parser"),Compiler=require("./compiler");exports.version="0.10.5";var cache=exports.cache={};exports.selfClosing=require("./self-closing"),exports.doctypes=require("./doctypes"),exports.filters=require("./filters"),exports.utils=require("./utils"),exports.Compiler=Compiler,exports.nodes=require("./nodes");function attrs(obj){var buf=[],terse=obj.terse;delete obj.terse;var keys=Object.keys(obj),len=keys.length;if(len){buf.push("");for(var i=0;i<len;++i){var key=keys[i],val=obj[key];typeof val=="boolean"||val===""||val==null?val&&(terse?buf.push(key):buf.push(key+'="'+key+'"')):buf.push(key+'="'+escape(val)+'"')}}return buf.join(" ")}function escape(html){return String(html).replace(/&(?!\w+;)/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function rethrow(err,str,filename,lineno){var context=3,lines=str.split("\n"),start=Math.max(lineno-context,0),end=Math.min(lines.length,lineno+context),context=lines.slice(start,end).map(function(line,i){var curr=i+start+1;return(curr==lineno?" > ":" ")+curr+"| "+line}).join("\n");err.path=filename,err.message=(filename||"Jade")+":"+lineno+"\n"+context+"\n\n"+err.message;throw err}function parse(str,options){var filename=options.filename;try{var parser=new Parser(str,filename);options.debug&&parser.debug();var compiler=new(options.compiler||Compiler)(parser.parse(),options),js=compiler.compile();options.debug&&console.log("\nCompiled Function:\n\n%s",js.replace(/^/gm," "));try{return""+attrs.toString()+"\n\n"+escape.toString()+"\n\n"+"var buf = [];\n"+"with (locals || {}) {"+js+"}"+'return buf.join("");'}catch(err){process.compile(js,filename||"Jade");return}}catch(err){rethrow(err,str,filename,parser.lexer.lineno)}}exports.compile=function(str,options){var options=options||{},input=JSON.stringify(str),filename=options.filename?JSON.stringify(options.filename):"undefined",fn=["var __ = { lineno: 1, input: "+input+", filename: "+filename+" };",rethrow.toString(),"try {",parse(String(str),options||{}),"} catch (err) {"," rethrow(err, __.input, __.filename, __.lineno);","}"].join("\n");return new Function("locals",fn)},exports.render=function(str,options){var fn,options=options||{},filename=options.filename;str=String(str);if(options.cache)if(filename)cache[filename]?fn=cache[filename]:fn=cache[filename]=new Function("locals",parse(str,options));else throw new Error("filename is required when using the cache option");else fn=new Function("locals",parse(str,options));try{var locals=options.locals||{},meta={lineno:1};locals.__=meta;return fn.call(options.scope,locals)}catch(err){rethrow(err,str,filename,meta.lineno)}},exports.renderFile=function(path,options,fn){typeof options=="function"&&(fn=options,options={}),options.filename=path;if(options.cache&&cache[path])try{fn(null,exports.render("",options))}catch(err){fn(err)}else fs.readFile(path,"utf8",function(err,str){if(err)return fn(err);try{fn(null,exports.render(str,options))}catch(err){fn(err)}})}}),require.register("lexer.js",function(module,exports,require){var Lexer=module.exports=function Lexer(str){this.input=str.replace(/\r\n|\r/g,"\n"),this.deferredTokens=[],this.lastIndents=0,this.lineno=1,this.stash=[],this.indentStack=[],this.indentRe=null,this.pipeless=!1};Lexer.prototype={tok:function(type,val){return{type:type,line:this.lineno,val:val}},consume:function(len){this.input=this.input.substr(len)},scan:function(regexp,type){var captures;if(captures=regexp.exec(this.input)){this.consume(captures[0].length);return this.tok(type,captures[1])}},defer:function(tok){this.deferredTokens.push(tok)},lookahead:function(n){var fetch=n-this.stash.length;while(fetch-->0)this.stash.push(this.next());return this.stash[--n]},indexOfDelimiters:function(start,end){var str=this.input,nstart=0,nend=0,pos=0;for(var i=0,len=str.length;i<len;++i)if(start==str[i])++nstart;else if(end==str[i]&&++nend==nstart){pos=i;break}return pos},stashed:function(){return this.stash.length&&this.stash.shift()},deferred:function(){return this.deferredTokens.length&&this.deferredTokens.shift()},eos:function(){if(!this.input.length){if(this.indentStack.length){this.indentStack.shift();return this.tok("outdent")}return this.tok("eos")}},blockComment:function(){var captures;if(captures=/^\/([^\n]+)/.exec(this.input)){this.consume(captures[0].length);var tok=this.tok("block-comment",captures[1]);return tok}},comment:function(){var captures;if(captures=/^ *\/\/(-)?([^\n]+)/.exec(this.input)){this.consume(captures[0].length);var tok=this.tok("comment",captures[2]);tok.buffer="-"!=captures[1];return tok}},tag:function(){var captures;if(captures=/^(\w[-:\w]*)/.exec(this.input)){this.consume(captures[0].length);var tok,name=captures[1];if(":"==name[name.length-1]){name=name.slice(0,-1),tok=this.tok("tag",name),this.deferredTokens.push(this.tok(":"));while(" "==this.input[0])this.input=this.input.substr(1)}else tok=this.tok("tag",name);return tok}},filter:function(){return this.scan(/^:(\w+)/,"filter")},doctype:function(){return this.scan(/^!!! *(\w+)?/,"doctype")},id:function(){return this.scan(/^#([\w-]+)/,"id")},className:function(){return this.scan(/^\.([\w-]+)/,"class")},text:function(){return this.scan(/^(?:\| ?)?([^\n]+)/,"text")},each:function(){var captures;if(captures=/^- *each *(\w+)(?: *, *(\w+))? * in *([^\n]+)/.exec(this.input)){this.consume(captures[0].length);var tok=this.tok("each",captures[1]);tok.key=captures[2]||"index",tok.code=captures[3];return tok}},code:function(){var captures;if(captures=/^(!?=|-)([^\n]+)/.exec(this.input)){this.consume(captures[0].length);var flags=captures[1];captures[1]=captures[2];var tok=this.tok("code",captures[1]);tok.escape=flags[0]==="=",tok.buffer=flags[0]==="="||flags[1]==="=";return tok}},attrs:function(){if("("==this.input[0]){var index=this.indexOfDelimiters("(",")"),str=this.input.substr(1,index-1),tok=this.tok("attrs"),len=str.length,states=["key"],key="",val="",quote,c;function state(){return states[states.length-1]}this.consume(index+1),tok.attrs={};function parse(c){switch(c){case",":case"\n":switch(state()){case"expr":case"array":case"string":case"object":val+=c;break;default:states.push("key"),val=val.trim(),key=key.trim();if(""==key)return;tok.attrs[key.replace(/^['"]|['"]$/g,"")]=""==val?!0:val,key=val=""}break;case":":case"=":switch(state()){case"key char":key+=c;break;case"val":case"expr":case"array":case"string":case"object":val+=c;break;default:states.push("val")}break;case"(":"val"==state()&&states.push("expr"),val+=c;break;case")":"expr"==state()&&states.pop(),val+=c;break;case"{":"val"==state()&&states.push("object"),val+=c;break;case"}":"object"==state()&&states.pop(),val+=c;break;case"[":"val"==state()&&states.push("array"),val+=c;break;case"]":"array"==state()&&states.pop(),val+=c;break;case'"':case"'":switch(state()){case"key":states.push("key char");break;case"key char":states.pop();break;case"string":c==quote&&states.pop(),val+=c;break;default:states.push("string"),val+=c,quote=c}break;case"":break;default:switch(state()){case"key":case"key char":key+=c;break;default:val+=c}}}for(var i=0;i<len;++i)parse(str[i]);parse(",");return tok}},indent:function(){var captures,re;this.indentRe?captures=this.indentRe.exec(this.input):(re=/^\n(\t*) */,captures=re.exec(this.input),captures&&!captures[1].length&&(re=/^\n( *)/,captures=re.exec(this.input)),captures&&captures[1].length&&(this.indentRe=re));if(captures){var tok,indents=captures[1].length;++this.lineno,this.consume(indents+1);if(" "==this.input[0]||"\t"==this.input[0])throw new Error("Invalid indentation, you can use tabs or spaces but not both");if("\n"==this.input[0])return this.tok("newline");if(this.indentStack.length&&indents<this.indentStack[0]){while(this.indentStack.length&&this.indentStack[0]>indents)this.stash.push(this.tok("outdent")),this.indentStack.shift();tok=this.stash.pop()}else indents&&indents!=this.indentStack[0]?(this.indentStack.unshift(indents),tok=this.tok("indent")):tok=this.tok("newline");return tok}},pipelessText:function(){if(this.pipeless){if("\n"==this.input[0])return;var i=this.input.indexOf("\n");-1==i&&(i=this.input.length);var str=this.input.substr(0,i);this.consume(str.length);return this.tok("text",str)}},colon:function(){return this.scan(/^: */,":")},advance:function(){return this.stashed()||this.next()},next:function(){return this.deferred()||this.eos()||this.pipelessText()||this.tag()||this.filter()||this.each()||this.code()||this.doctype()||this.id()||this.className()||this.attrs()||this.indent()||this.comment()||this.blockComment()||this.colon()||this.text()}}}),require.register("nodes/block-comment.js",function(module,exports,require){var Node=require("./node"),BlockComment=module.exports=function BlockComment(val,block){this.block=block,this.val=val};BlockComment.prototype=new Node,BlockComment.prototype.constructor=BlockComment}),require.register("nodes/block.js",function(module,exports,require){var Node=require("./node"),Block=module.exports=function Block(node){this.nodes=[],node&&this.push(node)};Block.prototype=new Node,Block.prototype.constructor=Block,Block.prototype.push=function(node){return this.nodes.push(node)},Block.prototype.unshift=function(node){return this.nodes.unshift(node)}}),require.register("nodes/code.js",function(module,exports,require){var Node=require("./node"),Code=module.exports=function Code(val,buffer,escape){this.val=val,this.buffer=buffer,this.escape=escape,/^ *else/.test(val)&&(this.instrumentLineNumber=!1)};Code.prototype=new Node,Code.prototype.constructor=Code}),require.register("nodes/comment.js",function(module,exports,require){var Node=require("./node"),Comment=module.exports=function Comment(val,buffer){this.val=val,this.buffer=buffer};Comment.prototype=new Node,Comment.prototype.constructor=Comment}),require.register("nodes/doctype.js",function(module,exports,require){var Node=require("./node"),Doctype=module.exports=function Doctype(val){this.val=val};Doctype.prototype=new Node,Doctype.prototype.constructor=Doctype}),require.register("nodes/each.js",function(module,exports,require){var Node=require("./node"),Each=module.exports=function Each(obj,val,key,block){this.obj=obj,this.val=val,this.key=key,this.block=block};Each.prototype=new Node,Each.prototype.constructor=Each}),require.register("nodes/filter.js",function(module,exports,require){var Node=require("./node"),Block=require("./block"),Filter=module.exports=function Filter(name,block,attrs){this.name=name,this.block=block,this.attrs=attrs,this.isASTFilter=block instanceof Block};Filter.prototype=new Node,Filter.prototype.constructor=Filter}),require.register("nodes/index.js",function(module,exports,require){exports.Node=require("./node"),exports.Tag=require("./tag"),exports.Code=require("./code"),exports.Each=require("./each"),exports.Text=require("./text"),exports.Block=require("./block"),exports.Filter=require("./filter"),exports.Comment=require("./comment"),exports.BlockComment=require("./block-comment"),exports.Doctype=require("./doctype")}),require.register("nodes/node.js",function(module,exports,require){var Node=module.exports=function(){}}),require.register("nodes/tag.js",function(module,exports,require){var Node=require("./node"),Block=require("./block"),Tag=module.exports=function Tag(name,block){this.name=name,this.attrs=[],this.block=block||new Block};Tag.prototype=new Node,Tag.prototype.constructor=Tag,Tag.prototype.setAttribute=function(name,val){this.attrs.push({name:name,val:val});return this},Tag.prototype.removeAttribute=function(name){for(var i=0,len=this.attrs.length;i<len;++i)this.attrs[i]&&this.attrs[i].name==name&&delete this.attrs[i]},Tag.prototype.getAttribute=function(name){for(var i=0,len=this.attrs.length;i<len;++i)if(this.attrs[i]&&this.attrs[i].name==name)return this.attrs[i].val}}),require.register("nodes/text.js",function(module,exports,require){var Node=require("./node"),Text=module.exports=function Text(line){this.nodes=[],"string"==typeof line&&this.push(line)};Text.prototype=new Node,Text.prototype.constructor=Text,Text.prototype.push=function(node){return this.nodes.push(node)}}),require.register("parser.js",function(module,exports,require){var Lexer=require("./lexer"),nodes=require("./nodes"),Parser=exports=module.exports=function Parser(str,filename){this.input=str,this.lexer=new Lexer(str),this.filename=filename},textOnly=exports.textOnly=["code","script","textarea","style"];Parser.prototype={debug:function(){var lexer=new Lexer(this.input),tree=require("sys").inspect(this.parse(),!1,12,!0);console.log("\nParse Tree:\n"),console.log(tree),this.lexer=lexer},advance:function(){return this.lexer.advance()},peek:function(){return this.lookahead(1)},line:function(){return this.lexer.lineno},lookahead:function(n){return this.lexer.lookahead(n)},parse:function(){var block=new nodes.Block;block.line=this.line();while("eos"!=this.peek().type)"newline"==this.peek().type?this.advance():block.push(this.parseExpr());return block},expect:function(type){if(this.peek().type===type)return this.advance();throw new Error('expected "'+type+'", but got "'+this.peek().type+'"')},accept:function(type){if(this.peek().type===type)return this.advance()},parseExpr:function(){switch(this.peek().type){case"tag":return this.parseTag();case"doctype":return this.parseDoctype();case"filter":return this.parseFilter();case"comment":return this.parseComment();case"block-comment":return this.parseBlockComment();case"text":return this.parseText();case"each":return this.parseEach();case"code":return this.parseCode();case"id":case"class":var tok=this.advance();this.lexer.defer(this.lexer.tok("tag","div")),this.lexer.defer(tok);return this.parseExpr();default:throw new Error('unexpected token "'+this.peek().type+'"')}},parseText:function(){var tok=this.expect("text"),node=new nodes.Text(tok.val);node.line=this.line();return node},parseCode:function(){var tok=this.expect("code"),node=new nodes.Code(tok.val,tok.buffer,tok.escape);node.line=this.line(),"indent"==this.peek().type&&(node.block=this.parseBlock());return node},parseBlockComment:function(){var tok=this.expect("block-comment"),node=new nodes.BlockComment(tok.val,this.parseBlock());node.line=this.line();return node},parseComment:function(){var tok=this.expect("comment"),node=new nodes.Comment(tok.val,tok.buffer);node.line=this.line();return node},parseDoctype:function(){var tok=this.expect("doctype"),node=new nodes.Doctype(tok.val);node.line=this.line();return node},parseFilter:function(){var block,tok=this.expect("filter"),attrs=this.accept("attrs");this.lexer.pipeless=!0,block=this.parseTextBlock(),this.lexer.pipeless=!1;var node=new nodes.Filter(tok.val,block,attrs&&attrs.attrs);node.line=this.line();return node},parseASTFilter:function(){var block,tok=this.expect("tag"),attrs=this.accept("attrs");this.expect(":"),block=this.parseBlock();var node=new nodes.Filter(tok.val,block,attrs&&attrs.attrs);node.line=this.line();return node},parseEach:function(){var tok=this.expect("each"),node=new nodes.Each(tok.code,tok.val,tok.key,this.parseBlock());node.line=this.line();return node},parseTextBlock:function(){var text=new nodes.Text;text.line=this.line(),this.expect("indent");while("outdent"!=this.peek().type)switch(this.peek().type){case"newline":text.push("\\n"),this.advance();break;case"indent":text.push("\\n"),text.push(this.parseTextBlock().nodes.map(function(text){return" "+text}).join("")),text.push("\\n");break;default:text.push(this.advance().val)}this.expect("outdent");return text},parseBlock:function(){var block=new nodes.Block;block.line=this.line(),this.expect("indent");while("outdent"!=this.peek().type)"newline"==this.peek().type?this.advance():block.push(this.parseExpr());this.expect("outdent");return block},parseTag:function(){var i=2;"attrs"==this.lookahead(i).type&&++i;if(":"==this.lookahead(i).type&&"indent"==this.lookahead(++i).type)return this.parseASTFilter();var name=this.advance().val,tag=new nodes.Tag(name);tag.line=this.line();out:for(;;)switch(this.peek().type){case"id":case"class":var tok=this.advance();tag.setAttribute(tok.type,"'"+tok.val+"'");continue;case"attrs":var obj=this.advance().attrs,names=Object.keys(obj);for(var i=0,len=names.length;i<len;++i){var name=names[i],val=obj[name];tag.setAttribute(name,val)}continue;default:break out}"."==this.peek().val&&(tag.textOnly=!0,this.advance());switch(this.peek().type){case"text":tag.text=this.parseText();break;case"code":tag.code=this.parseCode();break;case":":this.advance(),tag.block=new nodes.Block,tag.block.push(this.parseTag())}while("newline"==this.peek().type)this.advance();tag.textOnly=tag.textOnly||~textOnly.indexOf(tag.name);if("script"==tag.name){var type=tag.getAttribute("type");type&&"text/javascript"!=type.replace(/^['"]|['"]$/g,"")&&(tag.textOnly=!1)}if("indent"==this.peek().type)if(tag.textOnly)this.lexer.pipeless=!0,tag.block=this.parseTextBlock(),this.lexer.pipeless=!1;else{var block=this.parseBlock();if(tag.block)for(var i=0,len=block.nodes.length;i<len;++i)tag.block.push(block.nodes[i]);else tag.block=block}return tag}}}),require.register("self-closing.js",function(module,exports,require){module.exports=["meta","img","link","input","area","base","col","br","hr"]}),require.register("utils.js",function(module,exports,require){var interpolate=exports.interpolate=function(str){return str.replace(/(\\)?([#!]){(.*?)}/g,function(str,escape,flag,code){return escape?str:"' + "+("!"==flag?"":"escape")+"((interp = "+code.replace(/\\'/g,"'")+") == null ? '' : interp) + '"})},escape=exports.escape=function(str){return str.replace(/'/g,"\\'")};exports.text=function(str){return interpolate(escape(str))}})

@@ -19,2 +19,15 @@

// if browser
//
// if (!Object.keys) {
// Object.keys = function(obj){
// var arr;
// for (var key in obj) {
// if (obj.hasOwnProperty(key)) {
// arr.push(obj);
// }
// }
// return arr;
// }
// }
//
// if (!String.prototype.trimLeft) {

@@ -25,2 +38,3 @@ // String.prototype.trimLeft = function(){

// }
//
// end

@@ -196,3 +210,4 @@

} else {
this.buffer(fn(utils.text(filter.block.nodes.join('')), filter.attrs));
var text = filter.block.nodes.join('');
this.buffer(utils.text(fn(text, filter.attrs)));
}

@@ -199,0 +214,0 @@ },

@@ -22,3 +22,3 @@

exports.version = '0.10.4';
exports.version = '0.10.5';

@@ -142,13 +142,14 @@ /**

function rethrow(err, str, filename, lineno){
var start = lineno - 3 > 0
? lineno - 3
: 0;
var context = 3
, lines = str.split('\n')
, start = Math.max(lineno - context, 0)
, end = Math.min(lines.length, lineno + context);
// Error context
var context = str.split('\n').slice(start, lineno).map(function(line, i){
return ' '
+ (i + start + 1)
+ ". '"
+ line.replace("'", "\\'")
+ "'";
var context = lines.slice(start, end).map(function(line, i){
var curr = i + start + 1;
return (curr == lineno ? ' > ' : ' ')
+ curr
+ '| '
+ line;
}).join('\n');

@@ -155,0 +156,0 @@

@@ -294,2 +294,3 @@

, val = ''
, quote
, c;

@@ -344,23 +345,23 @@

case '(':
states.push('expr');
if ('val' == state()) states.push('expr');
val += c;
break;
case ')':
states.pop();
if ('expr' == state()) states.pop();
val += c;
break;
case '{':
states.push('object');
if ('val' == state()) states.push('object');
val += c;
break;
case '}':
states.pop();
if ('object' == state()) states.pop();
val += c;
break;
case '[':
states.push('array');
if ('val' == state()) states.push('array');
val += c;
break;
case ']':
states.pop();
if ('array' == state()) states.pop();
val += c;

@@ -378,3 +379,3 @@ break;

case 'string':
states.pop();
if (c == quote) states.pop();
val += c;

@@ -385,2 +386,3 @@ break;

val += c;
quote = c;
}

@@ -387,0 +389,0 @@ break;

{
"name": "jade",
"description": "Jade template engine",
"version": "0.10.4",
"version": "0.10.5",
"author": "TJ Holowaychuk <tj@vision-media.ca>",

@@ -6,0 +6,0 @@ "repository": "git://github.com/visionmedia/jade",

@@ -241,6 +241,6 @@

A block comment is the `/` character followed by a block.
A block comment is legal as well:
body
/
//
#content

@@ -247,0 +247,0 @@ h1 Example

@@ -52,5 +52,6 @@

jade.renderFile(__dirname + '/test.jade', { locals: locals }, function(err, html){
var path = __dirname + '/test.jade';
jade.renderFile(path, { filename: path, locals: locals }, function(err, html){
if (err) throw err;
console.log(html);
});

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc