gulp-rb-validate-html
Advanced tools
Comparing version 0.0.7 to 0.0.8
38
index.js
@@ -176,3 +176,3 @@ /*jslint node: true*/ | ||
*/ | ||
function checkIndentation(file, indent) { | ||
function checkIndentation(file, indent, checkInTags) { | ||
@@ -183,3 +183,4 @@ var lines = file.split(/\r?\n/), | ||
areacheck = "", | ||
count = 0; | ||
count = 0, | ||
insideTag = false; | ||
@@ -204,6 +205,14 @@ lines.forEach(function (line) { | ||
// if whitespace remains -> wrong format | ||
if (area.length > 0) { | ||
if (area.length > 0 && (checkInTags || !insideTag)) { | ||
validationError('Wrong indentation (line ' + count + '). Use auto formatter', line, 'CI-FE-2001', false); | ||
} | ||
} | ||
// opening tag / closing tag? | ||
if ((line.match(/</g) || []).length > (line.match(/>/g) || []).length) { | ||
insideTag = true; | ||
} else if ((line.match(/</g) || []).length < (line.match(/>/g) || []).length) { | ||
insideTag = false; | ||
} | ||
}); | ||
@@ -238,11 +247,14 @@ } | ||
} | ||
if (typeof options.checkviewport !== 'boolean') { | ||
options.checkviewport = true; | ||
if (typeof options.checkViewport !== 'boolean') { | ||
options.checkViewport = true; | ||
} | ||
if (typeof options.checkindent !== 'boolean') { | ||
options.checkindent = true; | ||
if (typeof options.checkIndent !== 'boolean') { | ||
options.checkIndent = true; | ||
} | ||
if (typeof options.checkremote !== 'boolean') { | ||
options.checkremote = true; | ||
if (typeof options.checkIndentInTags !== 'boolean') { | ||
options.checkIndentInTags = false; | ||
} | ||
if (typeof options.checkRemote !== 'boolean') { | ||
options.checkRemote = true; | ||
} | ||
@@ -261,11 +273,11 @@ var errorOutputList = []; | ||
parseHTML(str, options.checkremote); | ||
parseHTML(str, options.checkRemote); | ||
singleQuotes(str); | ||
bodyStylesheet(str); | ||
if (options.checkindent) { | ||
checkIndentation(str, options.indent); | ||
if (options.checkIndent) { | ||
checkIndentation(str, options.indent, options.checkIndentInTags); | ||
} | ||
if (options.checkviewport) { | ||
if (options.checkViewport) { | ||
checkViewport(str); | ||
@@ -272,0 +284,0 @@ } |
{ | ||
"name": "gulp-rb-validate-html", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"description": "Gulp plugin to validate HTML files according to Web Frontend Guidelines", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -47,4 +47,4 @@ #Installation | ||
indent: '\t', | ||
checkremote: false, | ||
checkviewport: false | ||
checkRemote: false, | ||
checkViewport: false | ||
}); | ||
@@ -65,12 +65,16 @@ | ||
#### checkindent: Boolean (Default: true) | ||
#### checkIndentInTags: Boolean (Default: false) | ||
Set to true to activate indentation checks inside HTML tags (between < and >) | ||
#### checkIndent: Boolean (Default: true) | ||
Set to false to deactivate indentation checks altogether | ||
#### checkremote: Boolean (Default: true) | ||
#### checkRemote: Boolean (Default: true) | ||
Set to false to deactivate all warnings caused by remote resource URLs in HTML code | ||
#### checkviewport: Boolean (Default: true) | ||
#### checkViewport: Boolean (Default: true) | ||
Set to false if the application is not responsive/for mobile devices |
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
12246
249
78