Comparing version 1.3.3 to 1.3.4
@@ -195,7 +195,10 @@ const htmlEncode = require('../libs/js-htmlencode'); | ||
if (trim && trim !== '^' && !trim.startsWith("at ")) { | ||
if (trim.startsWith('RazorError') || mainInfo.title) | ||
if (trim.startsWith('RazorError') || mainInfo.title){ | ||
style = 'id="error" class="error"'; // the second line is the error description | ||
else | ||
} | ||
else { | ||
mainInfo.errorLine = trim; | ||
style = 'class="error"'; | ||
} | ||
if (mainInfo.title) | ||
@@ -222,3 +225,16 @@ mainInfo.title += '\r\n'; | ||
html = `<ol start='${startLine}'>`; | ||
let isLastData = !data.inner; | ||
let hasErrorCoordinates = data.posRange && data.posRange.start || data.pos; | ||
if (isLastData && !hasErrorCoordinates && mainInfo.errorLine && mainInfo.errorLine.length > 2) { | ||
let occur = data.jshtml.numberOfOccurrences(mainInfo.errorLine); | ||
if (occur.num === 1) { | ||
data.posRange = { | ||
start: occur.pos, | ||
end: occur.pos + mainInfo.errorLine.length | ||
}; | ||
} | ||
} | ||
for (let i = 0; i < lines.length; i++) { | ||
@@ -225,0 +241,0 @@ let line = lines[i]; |
@@ -85,3 +85,3 @@ 'use strict'; | ||
'use strict'; | ||
(function (process, window, global, module, compilePage, compilePageSync, undefined) { | ||
(function (process, window, global, module, compilePage, compilePageSync, navigator, undefined) { | ||
delete Html._js; | ||
@@ -903,3 +903,3 @@ delete Html._vm; | ||
//this.flushPadding(blocks); | ||
this.padding = padding; | ||
this.padding = padding + this.padding; | ||
block.type = blockType.code; | ||
@@ -906,0 +906,0 @@ return this.parseJsBlock(blocks, block, operatorName); |
@@ -9,3 +9,3 @@ //////////////////////////////////////////////// | ||
String.is = function(val){ | ||
String.is = function (val) { | ||
// return typeof val === "string" || val instanceof String; | ||
@@ -72,2 +72,17 @@ return Object.prototype.toString.call(val) === "[object String]"; | ||
String.prototype.numberOfOccurrences = function(str, max = 2) { | ||
let pos = 0, num = 0, idx = 0; | ||
do { | ||
idx = this.indexOf(str, pos); | ||
if (idx !== -1){ | ||
num++; | ||
pos = idx; | ||
} | ||
} while (num < max && idx !== -1); | ||
return { num, pos }; | ||
} | ||
//////////////////////////////////////////////// | ||
@@ -99,4 +114,4 @@ // Char | ||
Char.isIdentifier = function(c){ | ||
Char.isIdentifier = function (c) { | ||
return Char.isLetter(c) || Char.isDigit(c) || '_$'.includes(c); | ||
} |
{ | ||
"name": "raz", | ||
"description": "Razor like HTML template engine for NodeJS Express library based on ASP.NET MVC Razor syntax. Template your views by mixing HTML markup with JavaScript server-side code!", | ||
"version": "1.3.3", | ||
"version": "1.3.4", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "Sergey F.", |
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
131143
2468