From 5eb7fc34432c21825392857083f95b0aa8436190 Mon Sep 17 00:00:00 2001 From: Nick Schonning Date: Fri, 27 Apr 2018 01:20:20 -0400 Subject: [PATCH 1/2] feat: Add option for languge check skipping --- README.md | 9 ++++++++- lib/htmllint.js | 5 ++++- tasks/html.js | 3 ++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 6f8941d..7911689 100644 --- a/README.md +++ b/README.md @@ -167,6 +167,13 @@ Specify a filepath to output the results of a reporter. If `reporterOutput` is s Set `absoluteFilePathsForReporter` to `true` to use absolute file paths in generated reports. +### `noLangDetect` + +* Type: `Boolean` +* Default: `false` + +Set `noLangDetect` to `true` to [skip the checking of the language of the page](https://github.com/validator/validator#--no-langdetect). + ## Travis CI potential pitfalls Since vnu.jar requires Java 8 environment, you might have trouble setting Travis CI to work with grunt-html. @@ -175,7 +182,7 @@ and the [Travis CI doc page](https://docs.travis-ci.com/user/trusty-ci-environme ## License -Copyright Jörn Zaefferer. +Copyright Jörn Zaefferer. Licensed under the MIT license. [grunt]: http://gruntjs.com/ diff --git a/lib/htmllint.js b/lib/htmllint.js index 177bce8..bfbb9ca 100644 --- a/lib/htmllint.js +++ b/lib/htmllint.js @@ -58,6 +58,9 @@ module.exports = function( config, done ) { } else { args += ' --format json'; } + if ( config.noLangDetect ) { + args += ' --no-langdetect'; + } var invoke = ( config.server ? '-cp' : '-jar' ) + ' "' + jar + '"' + args; // command to call java, increasing the default stack size for ia32 versions of the JRE and using the default setting for x64 versions return 'java ' + ( java.arch === 'ia32' ? '-Xss512k ' : '' ) + invoke + ' ' + chunk; @@ -79,7 +82,7 @@ module.exports = function( config, done ) { var files = config.files.map( path.normalize ); async.mapSeries( chunkify( files, maxChars ), function( chunk, cb ) { - exec( cmd( java, chunk ), { + exec( cmd( java, chunk, config.noLangDetect ), { 'maxBuffer': maxBuffer }, function( error, stdout, stderr ) { if ( error && ( error.code !== 1 || error.killed || error.signal ) ) { diff --git a/tasks/html.js b/tasks/html.js index 3b44c0c..6e49cdc 100644 --- a/tasks/html.js +++ b/tasks/html.js @@ -21,7 +21,8 @@ module.exports = function( grunt ) { files: files, force: false, absoluteFilePathsForReporter: false, - errorlevels: [ 'info', 'warning', 'error' ] + errorlevels: [ 'info', 'warning', 'error' ], + noLangDetect: false } ), force = options.force, reporterOutput = options.reporterOutput, From 52c7290ea1c310506ff9c63f2752ccbd7f18b3e9 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Sat, 28 Apr 2018 01:49:29 +0300 Subject: [PATCH 2/2] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7911689..9e96d7b 100644 --- a/README.md +++ b/README.md @@ -182,7 +182,7 @@ and the [Travis CI doc page](https://docs.travis-ci.com/user/trusty-ci-environme ## License -Copyright Jörn Zaefferer. +Copyright Jörn Zaefferer. Licensed under the MIT license. [grunt]: http://gruntjs.com/