Comparing version 0.9.0 to 0.9.1
@@ -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.9.0", | ||
"version": "0.9.1", | ||
"author": "Andrew Petersen <senofpeter@gmail.com>", | ||
@@ -30,0 +30,0 @@ "homepage": "https://github.com/kirbysayshi/vash", |
@@ -281,2 +281,12 @@ | ||
// </VOID | ||
if ( | ||
curr.type === tks.HTML_TAG_CLOSE | ||
&& next | ||
&& next.type === tks.IDENTIFIER | ||
&& MarkupNode.isVoid(next.val) | ||
) { | ||
throw newUnexpectedClosingTagError(this, curr, curr.val + next.val); | ||
} | ||
// </ | ||
@@ -940,2 +950,14 @@ if (curr.type === tks.HTML_TAG_CLOSE) { | ||
} | ||
// This is likely an invalid markup configuration, something like: | ||
// @if(bla) { <img></img> } | ||
// where <img> is an implicit void. Try to help the user in this | ||
// specific case. | ||
if ( | ||
next | ||
&& next.type === tks.IDENTIFIER | ||
&& MarkupNode.isVoid(next.val) | ||
){ | ||
throw newUnexpectedClosingTagError(this, curr, curr.val + next.val); | ||
} | ||
} | ||
@@ -1129,1 +1151,13 @@ | ||
} | ||
function newUnexpectedClosingTagError(parser, tok, tagName) { | ||
var err = new Error('' | ||
+ 'Found a closing tag for a known void HTML element: ' | ||
+ tagName + '.'); | ||
err.name = 'UnexpectedClosingTagError'; | ||
return parser.decorateError( | ||
err, | ||
tok.line, | ||
tok.chr); | ||
} | ||
{ | ||
"name": "vash", | ||
"description": "Razor syntax for JS templating", | ||
"version": "0.9.0", | ||
"version": "0.9.1", | ||
"author": "Andrew Petersen <senofpeter@gmail.com>", | ||
@@ -6,0 +6,0 @@ "homepage": "https://github.com/kirbysayshi/vash", |
@@ -1346,2 +1346,19 @@ var vows = require('vows') | ||
} | ||
,'void tag with closing tag': { | ||
topic: '<img></img>' | ||
,'throws': function(topic) { | ||
assert.throws(function() { | ||
var tpl = vash.compile(topic); | ||
}, Error) | ||
} | ||
} | ||
,'void tag with closing tag surrounded by BLK': { | ||
topic: '@{ <img></img> }' | ||
,'throws': function(topic) { | ||
assert.throws(function() { | ||
var tpl = vash.compile(topic); | ||
}, Error) | ||
} | ||
} | ||
/*,'closing tag within block': { | ||
@@ -1348,0 +1365,0 @@ topic: function(){ |
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
466993
11284