Comparing version 0.8.9 to 0.9.0
@@ -27,3 +27,3 @@ !function(e){if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.vash=e()}}(function(){var define,module,exports;return (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(_dereq_,module,exports){ | ||
"description": "Razor syntax for JS templating", | ||
"version": "0.8.9", | ||
"version": "0.9.0", | ||
"author": "Andrew Petersen <senofpeter@gmail.com>", | ||
@@ -30,0 +30,0 @@ "homepage": "https://github.com/kirbysayshi/vash", |
@@ -45,4 +45,4 @@ var Node = module.exports = function MarkupNode() { | ||
if ( | ||
(this._finishedOpen && !this._waitingForFinishedClose) | ||
|| (this._finishedOpen && Node.isVoid(this.name)) | ||
this._finishedOpen | ||
&& (this.isClosed || this.voidClosed) | ||
) { | ||
@@ -49,0 +49,0 @@ return true; |
@@ -37,5 +37,6 @@ | ||
Parser.prototype.decorateError = function(err, line, column) { | ||
err.message = 'at template line ' + line | ||
+ ', column ' + column + ': ' | ||
+ err.message + '\n' | ||
err.message = '' | ||
+ err.message | ||
+ ' at template line ' + line | ||
+ ', column ' + column + '\n\n' | ||
+ 'Context: \n' | ||
@@ -121,9 +122,14 @@ + error.context(this.inputText, line, column, '\n') | ||
var msg; | ||
while(i >= 1) { | ||
// A full AST is always: | ||
// Program, Markup, MarkupContent, ... | ||
while(i >= 2) { | ||
node = this.stack[i]; | ||
if (node.endOk && !node.endOk()) { | ||
msg = 'Found unclosed ' + node.type + '.\n\n' | ||
+ 'Node: ' + JSON.stringify(node, null, ' '); | ||
// Attempt to make the error readable | ||
delete node.values; | ||
msg = 'Found unclosed ' + node.type; | ||
var err = new Error(msg); | ||
err.name = 'UnclosedNodeError'; | ||
throw this.decorateError( | ||
new Error(msg), | ||
err, | ||
node.startloc.line, | ||
@@ -130,0 +136,0 @@ node.startloc.column); |
{ | ||
"name": "vash", | ||
"description": "Razor syntax for JS templating", | ||
"version": "0.8.9", | ||
"version": "0.9.0", | ||
"author": "Andrew Petersen <senofpeter@gmail.com>", | ||
@@ -6,0 +6,0 @@ "homepage": "https://github.com/kirbysayshi/vash", |
@@ -1320,3 +1320,3 @@ var vows = require('vows') | ||
} | ||
,*/'unclosed tag followed by previous closing tag does not bork': { | ||
,*/'unclosed tag followed by previous closing tag': { | ||
topic: function(){ | ||
@@ -1326,4 +1326,4 @@ var str = '<div class="how what">This is content @for(var i = 0; i < 1; i++){ <p>@i </div> }'; | ||
} | ||
,'throws UNMATCHED': function(topic){ | ||
assert.doesNotThrow( function(){ vash.compile(topic)() }, Error ); | ||
,'throws': function(topic){ | ||
assert.throws( function(){ vash.compile(topic)() }, Error ); | ||
} | ||
@@ -1340,7 +1340,8 @@ } | ||
} | ||
,'explicitly unclosed tags': { | ||
,'explicitly unclosed, non-void tags': { | ||
topic: '<a><b><c>' | ||
,'do not become closed': function(topic) { | ||
var tpl = vash.compile(topic); | ||
assert.equal(tpl(), topic); | ||
,'throw': function(topic) { | ||
assert.throws(function() { | ||
var tpl = vash.compile(topic); | ||
}, Error); | ||
} | ||
@@ -1347,0 +1348,0 @@ } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
463957
11178