Checker html/validator can be used for xhtml and svg.
This commit is contained in:
parent
0d25f4fb42
commit
f6ec8a411a
@ -107,6 +107,7 @@ SYNTAX CHECKERS BY LANGUAGE *syntastic-checkers-lang*
|
||||
Solidity.................................|syntastic-checkers-solidity|
|
||||
SQL......................................|syntastic-checkers-sql|
|
||||
Stylus...................................|syntastic-checkers-stylus|
|
||||
SVG......................................|syntastic-checkers-svg|
|
||||
|
||||
Tcl......................................|syntastic-checkers-tcl|
|
||||
TeX......................................|syntastic-checkers-tex|
|
||||
@ -3132,6 +3133,13 @@ Sets the "nsfilter" for the parser. See:
|
||||
|
||||
https://wiki.whatwg.org/wiki/Validator.nu_Common_Input_Parameters#nsfilter
|
||||
|
||||
*'g:syntastic_html_validator_schema'*
|
||||
Type: string
|
||||
Default: empty
|
||||
Sets the "schema" for the parser. See:
|
||||
|
||||
https://wiki.whatwg.org/wiki/Validator.nu_Common_Input_Parameters#schema
|
||||
|
||||
*'g:syntastic_html_validator_exec'*
|
||||
Type: string
|
||||
Default: "curl"
|
||||
@ -3153,6 +3161,8 @@ You can lookup the meaning of these codes in cURL's manual:
|
||||
|
||||
http://curl.haxx.se/docs/manpage.html#EXIT
|
||||
|
||||
See also: |syntastic-svg-validator|, |syntastic-xhtml-validator|.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
10. W3 *syntastic-html-w3*
|
||||
|
||||
@ -6563,6 +6573,103 @@ You might also find useful the "vim-stylus" plugin:
|
||||
|
||||
https://github.com/wavded/vim-stylus
|
||||
|
||||
==============================================================================
|
||||
SYNTAX CHECKERS FOR SVG *syntastic-checkers-svg*
|
||||
|
||||
The following checkers are available for SVG (filetype "svg"):
|
||||
|
||||
1. Validator................|syntastic-svg-validator|
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
1. Validator *syntastic-svg-validator*
|
||||
|
||||
Name: validator
|
||||
Maintainer: LCD 47 <lcd047@gmail.com>
|
||||
|
||||
"Validator" is a non-DTD-based HTML linter. See the project's page for
|
||||
details:
|
||||
|
||||
http://validator.github.io/validator/
|
||||
|
||||
As a syntastic linter, you can validate your files against the online service
|
||||
(see https://validator.nu/), or you can install "vnu.jar":
|
||||
|
||||
https://github.com/validator/validator/releases/latest
|
||||
|
||||
then run it as a HTTP server: >
|
||||
$ java -Xss512k -cp /path/to/vnu.jar nu.validator.servlet.Main 8888
|
||||
<
|
||||
Requirement~
|
||||
|
||||
This checker uses cURL:
|
||||
|
||||
http://curl.haxx.se/
|
||||
|
||||
Checker options~
|
||||
|
||||
*'g:syntastic_svg_validator_api'*
|
||||
Type: string
|
||||
Default: "http://validator.nu/"
|
||||
URL of the service to use for checking. Leave it to the default to run the
|
||||
checks against "https://validator.nu/", or set it to "http://localhost:8888/"
|
||||
if you have "vnu.jar" installed, and you're running it as a standalone HTTP
|
||||
server. See:
|
||||
|
||||
http://validator.github.io/validator/#standalone
|
||||
|
||||
*'g:syntastic_svg_validator_parser'*
|
||||
Type: string
|
||||
Default: empty
|
||||
Parser to use. Legal values are: "xml", "xmldtd", "html", "html5", "html4",
|
||||
and "html4tr". References:
|
||||
|
||||
https://wiki.whatwg.org/wiki/Validator.nu_Common_Input_Parameters#parser
|
||||
|
||||
*'g:syntastic_svg_validator_nsfilter'*
|
||||
Type: string
|
||||
Default: empty
|
||||
Sets the "nsfilter" for the parser. See:
|
||||
|
||||
https://wiki.whatwg.org/wiki/Validator.nu_Common_Input_Parameters#nsfilter
|
||||
|
||||
*'g:syntastic_svg_validator_schema'*
|
||||
Type: string
|
||||
Default: empty
|
||||
Sets the "schema" for the parser. See:
|
||||
|
||||
https://wiki.whatwg.org/wiki/Validator.nu_Common_Input_Parameters#schema
|
||||
|
||||
*'g:syntastic_svg_validator_exec'*
|
||||
Type: string
|
||||
Default: "curl"
|
||||
Path to the "cURL" executable. Override it with a full path if your "cURL" is
|
||||
not installed in a standard location.
|
||||
|
||||
This checker doesn't call the "makeprgBuild()" function, and thus it ignores
|
||||
the usual 'g:syntastic_svg_validator_<option>' variables. The only exception
|
||||
is 'g:syntastic_svg_validator_exec', which can be used to override the path
|
||||
to the "cURL" executable.
|
||||
|
||||
Note~
|
||||
|
||||
Non-zero exit codes from "cURL" are typically network errors, and are signaled
|
||||
by syntastic with messages such as: >
|
||||
syntastic: error: checker svg/validator returned abnormal status 26
|
||||
<
|
||||
You can lookup the meaning of these codes in cURL's manual:
|
||||
|
||||
http://curl.haxx.se/docs/manpage.html#EXIT
|
||||
|
||||
Example~
|
||||
>
|
||||
let g:syntastic_svg_validator_parser = 'xml'
|
||||
let g:syntastic_svg_validator_schema =
|
||||
\ 'http://s.validator.nu/svg-xhtml5-rdf-mathml.rnc ' .
|
||||
\ 'http://s.validator.nu/html5/assertions.sch ' .
|
||||
\ 'http://c.validator.nu/all/'
|
||||
<
|
||||
See also: |syntastic-html-validator|, |syntastic-xhtml-validator|.
|
||||
|
||||
==============================================================================
|
||||
SYNTAX CHECKERS FOR TCL *syntastic-checkers-tcl*
|
||||
|
||||
@ -7375,6 +7482,7 @@ The following checkers are available for xHTML (filetype "xhtml"):
|
||||
1. HTML Tidy................|syntastic-xhtml-tidy|
|
||||
2. jshint...................|syntastic-xhtml-jshint|
|
||||
3. proselint................|syntastic-xhtml-proselint|
|
||||
4. Validator................|syntastic-xhtml-validator|
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
1. HTML tidy *syntastic-xhtml-tidy*
|
||||
@ -7470,6 +7578,96 @@ See also: |syntastic-asciidoc-proselint|, |syntastic-help-proselint|,
|
||||
|syntastic-rst-proselint|, |syntastic-tex-proselint|,
|
||||
|syntastic-texinfo-proselint|, |syntastic-text-proselint|.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
4. Validator *syntastic-xhtml-validator*
|
||||
|
||||
Name: validator
|
||||
Maintainer: LCD 47 <lcd047@gmail.com>
|
||||
|
||||
"Validator" is a non-DTD-based HTML linter. See the project's page for
|
||||
details:
|
||||
|
||||
http://validator.github.io/validator/
|
||||
|
||||
As a syntastic linter, you can validate your files against the online service
|
||||
(see https://validator.nu/), or you can install "vnu.jar":
|
||||
|
||||
https://github.com/validator/validator/releases/latest
|
||||
|
||||
then run it as a HTTP server: >
|
||||
$ java -Xss512k -cp /path/to/vnu.jar nu.validator.servlet.Main 8888
|
||||
<
|
||||
Requirement~
|
||||
|
||||
This checker uses cURL:
|
||||
|
||||
http://curl.haxx.se/
|
||||
|
||||
Checker options~
|
||||
|
||||
*'g:syntastic_xhtml_validator_api'*
|
||||
Type: string
|
||||
Default: "http://validator.nu/"
|
||||
URL of the service to use for checking. Leave it to the default to run the
|
||||
checks against "https://validator.nu/", or set it to "http://localhost:8888/"
|
||||
if you have "vnu.jar" installed, and you're running it as a standalone HTTP
|
||||
server. See:
|
||||
|
||||
http://validator.github.io/validator/#standalone
|
||||
|
||||
*'g:syntastic_xhtml_validator_parser'*
|
||||
Type: string
|
||||
Default: empty
|
||||
Parser to use. Legal values are: "xml", "xmldtd", "html", "html5", "html4",
|
||||
and "html4tr". References:
|
||||
|
||||
https://wiki.whatwg.org/wiki/Validator.nu_Common_Input_Parameters#parser
|
||||
|
||||
*'g:syntastic_xhtml_validator_nsfilter'*
|
||||
Type: string
|
||||
Default: empty
|
||||
Sets the "nsfilter" for the parser. See:
|
||||
|
||||
https://wiki.whatwg.org/wiki/Validator.nu_Common_Input_Parameters#nsfilter
|
||||
|
||||
*'g:syntastic_xhtml_validator_schema'*
|
||||
Type: string
|
||||
Default: empty
|
||||
Sets the "schema" for the parser. See:
|
||||
|
||||
https://wiki.whatwg.org/wiki/Validator.nu_Common_Input_Parameters#schema
|
||||
|
||||
*'g:syntastic_xhtml_validator_exec'*
|
||||
Type: string
|
||||
Default: "curl"
|
||||
Path to the "cURL" executable. Override it with a full path if your "cURL" is
|
||||
not installed in a standard location.
|
||||
|
||||
This checker doesn't call the "makeprgBuild()" function, and thus it ignores
|
||||
the usual 'g:syntastic_xhtml_validator_<option>' variables. The only exception
|
||||
is 'g:syntastic_xhtml_validator_exec', which can be used to override the path
|
||||
to the "cURL" executable.
|
||||
|
||||
Note~
|
||||
|
||||
Non-zero exit codes from "cURL" are typically network errors, and are signaled
|
||||
by syntastic with messages such as: >
|
||||
syntastic: error: checker xhtml/validator returned abnormal status 26
|
||||
<
|
||||
You can lookup the meaning of these codes in cURL's manual:
|
||||
|
||||
http://curl.haxx.se/docs/manpage.html#EXIT
|
||||
|
||||
Example~
|
||||
>
|
||||
let g:syntastic_xhtml_validator_parser = 'xmldtd'
|
||||
let g:syntastic_xhtml_validator_schema =
|
||||
\ 'http://s.validator.nu/xhtml5.rnc ' .
|
||||
\ 'http://s.validator.nu/html5/assertions.sch ' .
|
||||
\ 'http://c.validator.nu/all/
|
||||
<
|
||||
See also: |syntastic-html-validator|, |syntastic-svg-validator|.
|
||||
|
||||
==============================================================================
|
||||
SYNTAX CHECKERS FOR XML *syntastic-checkers-xml*
|
||||
|
||||
|
@ -19,7 +19,7 @@ if has('reltime')
|
||||
lockvar! g:_SYNTASTIC_START
|
||||
endif
|
||||
|
||||
let g:_SYNTASTIC_VERSION = '3.9.0-23'
|
||||
let g:_SYNTASTIC_VERSION = '3.9.0-24'
|
||||
lockvar g:_SYNTASTIC_VERSION
|
||||
|
||||
" Sanity checks {{{1
|
||||
|
@ -92,6 +92,7 @@ let s:_DEFAULT_CHECKERS = {
|
||||
\ 'solidity': ['solc'],
|
||||
\ 'sql': ['sqlint'],
|
||||
\ 'stylus': ['stylint'],
|
||||
\ 'svg': [],
|
||||
\ 'tcl': ['nagelfar'],
|
||||
\ 'tex': ['lacheck', 'chktex'],
|
||||
\ 'texinfo': ['makeinfo'],
|
||||
|
@ -15,28 +15,48 @@ if exists('g:loaded_syntastic_html_validator_checker')
|
||||
endif
|
||||
let g:loaded_syntastic_html_validator_checker=1
|
||||
|
||||
if !exists('g:syntastic_html_validator_api')
|
||||
let g:syntastic_html_validator_api = 'https://validator.nu/'
|
||||
endif
|
||||
|
||||
if !exists('g:syntastic_html_validator_parser')
|
||||
let g:syntastic_html_validator_parser = ''
|
||||
endif
|
||||
|
||||
if !exists('g:syntastic_html_validator_nsfilter')
|
||||
let g:syntastic_html_validator_nsfilter = ''
|
||||
endif
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_html_validator_GetLocList() dict
|
||||
" Constants {{{1
|
||||
|
||||
let s:DEFAULTS = {
|
||||
\ 'api': 'https://validator.nu/',
|
||||
\ 'nsfilter': '',
|
||||
\ 'parser': '',
|
||||
\ 'schema': '' }
|
||||
|
||||
let s:CONTENT_TYPE = {
|
||||
\ 'html': 'text/html',
|
||||
\ 'svg': 'image/svg+xml',
|
||||
\ 'xhtm': 'application/xhtml+xml' }
|
||||
|
||||
" }}}1
|
||||
|
||||
" @vimlint(EVL101, 1, l:api)
|
||||
" @vimlint(EVL101, 1, l:nsfilter)
|
||||
" @vimlint(EVL101, 1, l:parser)
|
||||
" @vimlint(EVL101, 1, l:schema)
|
||||
function! SyntaxCheckers_html_validator_GetLocList() dict " {{{1
|
||||
let buf = bufnr('')
|
||||
let type = self.getFiletype()
|
||||
let fname = syntastic#util#shescape(fnamemodify(bufname(buf), ':p'))
|
||||
|
||||
for key in keys(s:DEFAULTS)
|
||||
let l:{key} = syntastic#util#var(type . '_validator_' . key, get(s:DEFAULTS, key))
|
||||
endfor
|
||||
let ctype = get(s:CONTENT_TYPE, type, '')
|
||||
|
||||
" vint: -ProhibitUsingUndeclaredVariable
|
||||
let makeprg = self.getExecEscaped() . ' -q -L -s --compressed -F out=gnu -F asciiquotes=yes' .
|
||||
\ (g:syntastic_html_validator_parser !=# '' ? ' -F parser=' . g:syntastic_html_validator_parser : '') .
|
||||
\ (g:syntastic_html_validator_nsfilter !=# '' ? ' -F nsfilter=' . g:syntastic_html_validator_nsfilter : '') .
|
||||
\ ' -F doc=@' . fname . '\;type=text/html\;filename=' . fname . ' ' . g:syntastic_html_validator_api
|
||||
\ (nsfilter !=# '' ? ' -F nsfilter=' . syntastic#util#shescape(nsfilter) : '') .
|
||||
\ (parser !=# '' ? ' -F parser=' . parser : '') .
|
||||
\ (schema !=# '' ? ' -F schema=' . syntastic#util#shescape(schema) : '') .
|
||||
\ ' -F doc=@' . fname .
|
||||
\ (ctype !=# '' ? '\;type=' . ctype : '') .
|
||||
\ '\;filename=' . fname .
|
||||
\ ' ' . api
|
||||
" vint: ProhibitUsingUndeclaredVariable
|
||||
|
||||
let errorformat =
|
||||
\ '%E"%f":%l: %trror: %m,' .
|
||||
@ -57,7 +77,11 @@ function! SyntaxCheckers_html_validator_GetLocList() dict
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'preprocess': 'validator',
|
||||
\ 'returns': [0] })
|
||||
endfunction
|
||||
endfunction " }}}1
|
||||
" @vimlint(EVL101, 0, l:schema)
|
||||
" @vimlint(EVL101, 0, l:parser)
|
||||
" @vimlint(EVL101, 0, l:nsfilter)
|
||||
" @vimlint(EVL101, 0, l:api)
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'html',
|
||||
|
Loading…
Reference in New Issue
Block a user