Comparing version 0.8.6 to 0.8.7
0.8.7 / 2011-03-14 | ||
================== | ||
* Added `mkdirs()` to jade(1) | ||
* Added jade(1) stdio support | ||
* Added new features to jade(1), `--watch`, recursive compilation etc [khingebjerg] | ||
* Fixed pipe-less text newlines | ||
* Removed jade(1) `--pipe` flag | ||
0.8.6 / 2011-03-11 | ||
@@ -3,0 +12,0 @@ ================== |
@@ -20,3 +20,3 @@ | ||
exports.version = '0.8.6'; | ||
exports.version = '0.8.7'; | ||
@@ -23,0 +23,0 @@ /** |
@@ -98,3 +98,3 @@ | ||
var fetch = n - this.stash.length; | ||
while (fetch-- > 0) this.stash.push(this.next); | ||
while (fetch-- > 0) this.stash.push(this.next()); | ||
return this.stash[--n]; | ||
@@ -134,3 +134,3 @@ }, | ||
get stashed() { | ||
stashed: function() { | ||
return this.stash.length | ||
@@ -144,3 +144,3 @@ && this.stash.shift(); | ||
get deferred() { | ||
deferred: function() { | ||
return this.deferredTokens.length | ||
@@ -154,3 +154,3 @@ && this.deferredTokens.shift(); | ||
get eos() { | ||
eos: function() { | ||
if (this.input.length) return; | ||
@@ -169,3 +169,3 @@ if (this.indentStack.length) { | ||
get blockComment() { | ||
blockComment: function() { | ||
var captures; | ||
@@ -183,3 +183,3 @@ if (captures = /^\/([^\n]+)/.exec(this.input)) { | ||
get comment() { | ||
comment: function() { | ||
var captures; | ||
@@ -198,3 +198,3 @@ if (captures = /^ *\/\/(-)?([^\n]+)/.exec(this.input)) { | ||
get tag() { | ||
tag: function() { | ||
var captures; | ||
@@ -220,3 +220,3 @@ if (captures = /^(\w[-:\w]*)/.exec(this.input)) { | ||
get filter() { | ||
filter: function() { | ||
return this.scan(/^:(\w+)/, 'filter'); | ||
@@ -229,3 +229,3 @@ }, | ||
get doctype() { | ||
doctype: function() { | ||
return this.scan(/^!!! *(\w+)?/, 'doctype'); | ||
@@ -238,3 +238,3 @@ }, | ||
get id() { | ||
id: function() { | ||
return this.scan(/^#([\w-]+)/, 'id'); | ||
@@ -247,3 +247,3 @@ }, | ||
get className() { | ||
className: function() { | ||
return this.scan(/^\.([\w-]+)/, 'class'); | ||
@@ -256,3 +256,3 @@ }, | ||
get text() { | ||
text: function() { | ||
return this.scan(/^(?:\| ?)?([^\n]+)/, 'text'); | ||
@@ -265,3 +265,3 @@ }, | ||
get each() { | ||
each: function() { | ||
var captures; | ||
@@ -281,3 +281,3 @@ if (captures = /^- *each *(\w+)(?: *, *(\w+))? * in *([^\n]+)/.exec(this.input)) { | ||
get code() { | ||
code: function() { | ||
var captures; | ||
@@ -299,3 +299,3 @@ if (captures = /^(!?=|-)([^\n]+)/.exec(this.input)) { | ||
get attrs() { | ||
attrs: function() { | ||
if ('(' == this.input[0]) { | ||
@@ -411,3 +411,3 @@ var index = this.indexOfDelimiters('(', ')') | ||
get indent() { | ||
indent: function() { | ||
var captures, re; | ||
@@ -446,3 +446,3 @@ | ||
// blank line | ||
if ('\n' == this.input[0]) return this.advance; | ||
if ('\n' == this.input[0]) return this.advance(); | ||
@@ -474,3 +474,3 @@ // outdent | ||
get pipelessText() { | ||
pipelessText: function() { | ||
if (false === this.textPipe) { | ||
@@ -490,3 +490,3 @@ if ('\n' == this.input[0]) return; | ||
get colon() { | ||
colon: function() { | ||
return this.scan(/^: */, ':'); | ||
@@ -503,5 +503,5 @@ }, | ||
get advance(){ | ||
return this.stashed | ||
|| this.next; | ||
advance: function(){ | ||
return this.stashed() | ||
|| this.next(); | ||
}, | ||
@@ -516,20 +516,20 @@ | ||
get next() { | ||
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; | ||
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(); | ||
} | ||
}; |
@@ -62,4 +62,4 @@ | ||
get advance(){ | ||
return this.lexer.advance; | ||
advance: function(){ | ||
return this.lexer.advance(); | ||
}, | ||
@@ -74,3 +74,3 @@ | ||
get peek() { | ||
peek: function() { | ||
return this.lookahead(1); | ||
@@ -86,3 +86,3 @@ }, | ||
get line() { | ||
line: function() { | ||
return this.lexer.lineno; | ||
@@ -112,6 +112,6 @@ }, | ||
var block = new nodes.Block; | ||
block.line = this.line; | ||
while (this.peek.type !== 'eos') { | ||
if (this.peek.type === 'newline') { | ||
this.advance; | ||
block.line = this.line(); | ||
while (this.peek().type !== 'eos') { | ||
if (this.peek().type === 'newline') { | ||
this.advance(); | ||
} else { | ||
@@ -132,6 +132,6 @@ block.push(this.parseExpr()); | ||
expect: function(type){ | ||
if (this.peek.type === type) { | ||
return this.advance; | ||
if (this.peek().type === type) { | ||
return this.advance(); | ||
} else { | ||
throw new Error('expected "' + type + '", but got "' + this.peek.type + '"'); | ||
throw new Error('expected "' + type + '", but got "' + this.peek().type + '"'); | ||
} | ||
@@ -148,4 +148,4 @@ }, | ||
accept: function(type){ | ||
if (this.peek.type === type) { | ||
return this.advance; | ||
if (this.peek().type === type) { | ||
return this.advance(); | ||
} | ||
@@ -167,3 +167,3 @@ }, | ||
parseExpr: function(){ | ||
switch (this.peek.type) { | ||
switch (this.peek().type) { | ||
case 'tag': | ||
@@ -187,3 +187,3 @@ return this.parseTag(); | ||
case 'class': | ||
var tok = this.advance; | ||
var tok = this.advance(); | ||
this.lexer.defer(this.lexer.tok('tag', 'div')); | ||
@@ -193,3 +193,3 @@ this.lexer.defer(tok); | ||
default: | ||
throw new Error('unexpected token "' + this.peek.type + '"'); | ||
throw new Error('unexpected token "' + this.peek().type + '"'); | ||
} | ||
@@ -205,3 +205,3 @@ }, | ||
, node = new nodes.Text(tok.val); | ||
node.line = this.line; | ||
node.line = this.line(); | ||
return node; | ||
@@ -217,4 +217,4 @@ }, | ||
, node = new nodes.Code(tok.val, tok.buffer, tok.escape); | ||
node.line = this.line; | ||
if ('indent' == this.peek.type) { | ||
node.line = this.line(); | ||
if ('indent' == this.peek().type) { | ||
node.block = this.parseBlock(); | ||
@@ -232,3 +232,3 @@ } | ||
, node = new nodes.BlockComment(tok.val, this.parseBlock()); | ||
node.line = this.line; | ||
node.line = this.line(); | ||
return node; | ||
@@ -245,3 +245,3 @@ }, | ||
, node = new nodes.Comment(tok.val, tok.buffer); | ||
node.line = this.line; | ||
node.line = this.line(); | ||
return node; | ||
@@ -257,3 +257,3 @@ }, | ||
, node = new nodes.Doctype(tok.val); | ||
node.line = this.line; | ||
node.line = this.line(); | ||
return node; | ||
@@ -283,3 +283,3 @@ }, | ||
var node = new nodes.Filter(tok.val, block, attrs && attrs.attrs); | ||
node.line = this.line; | ||
node.line = this.line(); | ||
return node; | ||
@@ -295,3 +295,3 @@ }, | ||
, node = new nodes.Each(tok.code, tok.val, tok.key, this.parseBlock()); | ||
node.line = this.line; | ||
node.line = this.line(); | ||
return node; | ||
@@ -305,9 +305,11 @@ }, | ||
parseTextBlock: function(){ | ||
var text = new nodes.Text; | ||
text.line = this.line; | ||
var text = new nodes.Text | ||
, pipeless = false === this.lexer.textPipe; | ||
text.line = this.line(); | ||
this.expect('indent'); | ||
while ('outdent' != this.peek.type) { | ||
switch (this.peek.type) { | ||
while ('outdent' != this.peek().type) { | ||
switch (this.peek().type) { | ||
case 'newline': | ||
this.advance; | ||
if (pipeless) text.push('\\n'); | ||
this.advance(); | ||
break; | ||
@@ -320,3 +322,3 @@ case 'indent': | ||
default: | ||
text.push(this.advance.val); | ||
text.push(this.advance().val); | ||
} | ||
@@ -334,7 +336,7 @@ } | ||
var block = new nodes.Block; | ||
block.line = this.line; | ||
block.line = this.line(); | ||
this.expect('indent'); | ||
while ('outdent' != this.peek.type) { | ||
if ('newline' == this.peek.type) { | ||
this.advance; | ||
while ('outdent' != this.peek().type) { | ||
if ('newline' == this.peek().type) { | ||
this.advance(); | ||
} else { | ||
@@ -353,6 +355,6 @@ block.push(this.parseExpr()); | ||
parseTag: function(){ | ||
var name = this.advance.val | ||
var name = this.advance().val | ||
, tag = new nodes.Tag(name); | ||
tag.line = this.line; | ||
tag.line = this.line(); | ||
@@ -362,10 +364,10 @@ // (attrs | class | id)* | ||
while (true) { | ||
switch (this.peek.type) { | ||
switch (this.peek().type) { | ||
case 'id': | ||
case 'class': | ||
var tok = this.advance; | ||
var tok = this.advance(); | ||
tag.setAttribute(tok.type, "'" + tok.val + "'"); | ||
continue; | ||
case 'attrs': | ||
var obj = this.advance.attrs | ||
var obj = this.advance().attrs | ||
, names = Object.keys(obj); | ||
@@ -384,9 +386,9 @@ for (var i = 0, len = names.length; i < len; ++i) { | ||
// check immediate '.' | ||
if ('.' == this.peek.val) { | ||
if ('.' == this.peek().val) { | ||
tag.textOnly = true; | ||
this.advance; | ||
this.advance(); | ||
} | ||
// (text | code | ':')? | ||
switch (this.peek.type) { | ||
switch (this.peek().type) { | ||
case 'text': | ||
@@ -399,3 +401,3 @@ tag.text = this.parseText(); | ||
case ':': | ||
this.advance; | ||
this.advance(); | ||
tag.block = new nodes.Block; | ||
@@ -407,6 +409,6 @@ tag.block.push(this.parseTag()); | ||
// newline* | ||
while (this.peek.type === 'newline') this.advance; | ||
while (this.peek().type === 'newline') this.advance(); | ||
// Assume newline when tag followed by text | ||
if (this.peek.type === 'text') { | ||
if (this.peek().type === 'text') { | ||
if (tag.text) tag.text.push('\\n'); | ||
@@ -427,3 +429,3 @@ else tag.text = new nodes.Text('\\n'); | ||
// block? | ||
if ('indent' == this.peek.type) { | ||
if ('indent' == this.peek().type) { | ||
if (tag.textOnly) { | ||
@@ -430,0 +432,0 @@ this.lexer.textPipe = false; |
{ | ||
"name": "jade", | ||
"description": "Jade template engine", | ||
"version": "0.8.6", | ||
"version": "0.8.7", | ||
"author": "TJ Holowaychuk <tj@vision-media.ca>", | ||
@@ -6,0 +6,0 @@ "main": "./index.js", |
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
71125
39
1799