Comparing version 0.8.6 to 0.8.7
@@ -93,2 +93,11 @@ | ||
gens.VashMarkupComment = function(node, opts, generate) { | ||
return '' | ||
+ bcwrap('<!--') | ||
+ dbgstart(node, opts) | ||
+ node.values.map(generate).join('') | ||
+ dbgend(node, opts) | ||
+ bcwrap('-->'); | ||
} | ||
gens.VashBlock = function(node, opts, generate) { | ||
@@ -163,2 +172,3 @@ var hasValues = node.values.length > 0; | ||
|| node.parent.type === 'VashMarkupContent' | ||
|| node.parent.type === 'VashMarkupComment' | ||
|| node.parent.type === 'VashMarkupAttribute' | ||
@@ -165,0 +175,0 @@ || node.parent.type === 'VashProgram'; |
@@ -12,2 +12,3 @@ | ||
var MarkupNode = namer(require('./nodes/markup')); | ||
var MarkupCommentNode = namer(require('./nodes/markupcomment')); | ||
var MarkupContentNode = namer(require('./nodes/markupcontent')); | ||
@@ -411,2 +412,14 @@ var MarkupAttributeNode = namer(require('./nodes/markupattribute')); | ||
if (curr.type === tks.HTML_COMMENT_OPEN) { | ||
valueNode = this.openNode(new MarkupCommentNode(), node.values); | ||
updateLoc(valueNode, curr); | ||
return false; | ||
} | ||
if (curr.type === tks.HTML_COMMENT_CLOSE) { | ||
updateLoc(node, curr); | ||
this.closeNode(node); | ||
return false; | ||
} | ||
if (curr.type === tks.AT_COLON && !curr._considerEscaped) { | ||
@@ -537,2 +550,25 @@ this.flag(node, '_waitingForNewline', true); | ||
Parser.prototype.continueMarkupCommentNode = function(node, curr, next) { | ||
var valueNode = node.values[node.values.length-1]; | ||
if (curr.type === tks.HTML_COMMENT_OPEN) { | ||
this.flag(node, '_finishedOpen', true); | ||
this.flag(node, '_waitingForClose', tks.HTML_COMMENT_CLOSE); | ||
updateLoc(node, curr); | ||
valueNode = this.openNode(new MarkupContentNode(), node.values); | ||
return true; | ||
} | ||
if (curr.type === tks.HTML_COMMENT_CLOSE && node._finishedOpen) { | ||
this.flag(node, '_waitingForClose', null); | ||
updateLoc(node, curr); | ||
this.closeNode(node); | ||
return true; | ||
} | ||
valueNode = ensureTextNode(node.values); | ||
appendTextValue(valueNode, curr); | ||
return true; | ||
} | ||
Parser.prototype.continueExpressionNode = function(node, curr, next) { | ||
@@ -539,0 +575,0 @@ var valueNode = node.values[node.values.length-1]; |
@@ -49,2 +49,4 @@ // The order of these is important, as it is the order in which | ||
, 'HTML_TAG_CLOSE', (/^(<\/)/) | ||
, 'HTML_COMMENT_OPEN', (/^(<!--+)/) | ||
, 'HTML_COMMENT_CLOSE', (/^(--+>)/) | ||
, 'LT_SIGN', (/^(<)/) | ||
@@ -56,3 +58,3 @@ , 'GT_SIGN', (/^(>)/) | ||
, 'BITWISE_SHIFT_OPERATOR', (/^(<<|>>>|>>)/) | ||
, 'UNARY_OPERATOR', (/^(delete|typeof|void|\+\+|--|\+|-|~|!)\b/) | ||
, 'UNARY_OPERATOR', (/^(delete\b|typeof\b|void|\+\+|--|\+|-|~|!)/) | ||
, 'RELATIONAL_OPERATOR', (/^(<=|>=|instanceof|in)\b/) // Also <, > | ||
@@ -59,0 +61,0 @@ , 'BINARY_LOGICAL_OPERATOR', (/^(&&|\|\|)\b/) |
{ | ||
"name": "vash", | ||
"description": "Razor syntax for JS templating", | ||
"version": "0.8.6", | ||
"version": "0.8.7", | ||
"author": "Andrew Petersen <senofpeter@gmail.com>", | ||
@@ -6,0 +6,0 @@ "homepage": "https://github.com/kirbysayshi/vash", |
@@ -2059,2 +2059,10 @@ var vows = require('vows') | ||
,'html comments': { | ||
topic: '<!--li><a href="#features">Features</a></li-->' | ||
,'do not break parsing': function(topic) { | ||
var tpl = vash.compile(topic); | ||
assert.equal( tpl(), topic ); | ||
} | ||
} | ||
,'single line comments': { | ||
@@ -2061,0 +2069,0 @@ 'near markup': { |
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
457318
59
10965