Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add option for languge check skipping #119

Merged
merged 2 commits into from
May 7, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.
5 changes: 4 additions & 1 deletion lib/htmllint.js
Original file line number Diff line number Diff line change
@@ -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 ) ) {
3 changes: 2 additions & 1 deletion tasks/html.js
Original file line number Diff line number Diff line change
@@ -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,