Comparing version 0.12.1 to 0.12.2
0.12.2 / 2011-06-16 | ||
================== | ||
* Fixed `make test` | ||
* Fixed block comments | ||
0.12.1 / 2011-06-04 | ||
@@ -3,0 +9,0 @@ ================== |
@@ -275,2 +275,3 @@ | ||
visitBlockComment: function(comment){ | ||
if (!comment.buffer) return; | ||
if (0 == comment.val.indexOf('if')) { | ||
@@ -277,0 +278,0 @@ this.buffer('<!--[' + comment.val + ']>'); |
@@ -22,3 +22,3 @@ | ||
exports.version = '0.12.1'; | ||
exports.version = '0.12.2'; | ||
@@ -25,0 +25,0 @@ /** |
@@ -162,15 +162,2 @@ | ||
/** | ||
* Block comment | ||
*/ | ||
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. | ||
@@ -181,3 +168,3 @@ */ | ||
var captures; | ||
if (captures = /^ *\/\/(-)?([^\n]+)/.exec(this.input)) { | ||
if (captures = /^ *\/\/(-)?([^\n]*)/.exec(this.input)) { | ||
this.consume(captures[0].length); | ||
@@ -535,3 +522,2 @@ var tok = this.tok('comment', captures[2]); | ||
|| this.comment() | ||
|| this.blockComment() | ||
|| this.colon() | ||
@@ -538,0 +524,0 @@ || this.text(); |
@@ -19,8 +19,10 @@ | ||
* @param {Block} block | ||
* @param {Boolean} buffer | ||
* @api public | ||
*/ | ||
var BlockComment = module.exports = function BlockComment(val, block) { | ||
var BlockComment = module.exports = function BlockComment(val, block, buffer) { | ||
this.block = block; | ||
this.val = val; | ||
this.buffer = buffer; | ||
}; | ||
@@ -27,0 +29,0 @@ |
@@ -170,4 +170,2 @@ | ||
return this.parseComment(); | ||
case 'block-comment': | ||
return this.parseBlockComment(); | ||
case 'text': | ||
@@ -214,15 +212,3 @@ return this.parseText(); | ||
}, | ||
/** | ||
* block comment | ||
*/ | ||
parseBlockComment: function(){ | ||
var tok = this.expect('block-comment') | ||
, node = new nodes.BlockComment(tok.val, this.parseBlock()); | ||
node.line = this.line(); | ||
return node; | ||
}, | ||
/** | ||
@@ -234,3 +220,10 @@ * comment | ||
var tok = this.expect('comment') | ||
, node = new nodes.Comment(tok.val, tok.buffer); | ||
, node; | ||
if ('indent' == this.peek().type) { | ||
node = new nodes.BlockComment(tok.val, this.parseBlock(), tok.buffer); | ||
} else { | ||
node = new nodes.Comment(tok.val, tok.buffer); | ||
} | ||
node.line = this.line(); | ||
@@ -237,0 +230,0 @@ return node; |
{ | ||
"name": "jade", | ||
"description": "Jade template engine", | ||
"version": "0.12.1", | ||
"version": "0.12.2", | ||
"author": "TJ Holowaychuk <tj@vision-media.ca>", | ||
@@ -6,0 +6,0 @@ "repository": "git://github.com/visionmedia/jade", |
@@ -10,39 +10,4 @@ | ||
jade.filters.conditionals = function(block, compiler){ | ||
return new Visitor(block).compile(); | ||
}; | ||
function Visitor(node) { | ||
this.node = node; | ||
} | ||
Visitor.prototype.__proto__ = Compiler.prototype; | ||
Visitor.prototype.visit = function(node){ | ||
if (node.name != 'else') this.line(node); | ||
this.visitNode(node); | ||
}; | ||
Visitor.prototype.visitTag = function(node){ | ||
switch (node.name) { | ||
case 'if': | ||
// First text -> line | ||
var condition = node.text[0] | ||
, block = node.block; | ||
node = new nodes.Code('if (' + condition + ')'); | ||
node.block = block; | ||
this.visit(node); | ||
break; | ||
case 'else': | ||
var block = node.block; | ||
node = new nodes.Code('else'); | ||
node.block = block; | ||
node.instrumentLineNumber = false; | ||
this.visit(node); | ||
break; | ||
default: | ||
Compiler.prototype.visitTag.call(this, node); | ||
} | ||
}; | ||
var locals = { | ||
@@ -49,0 +14,0 @@ first: 'tj' |
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
154630
3918