Checker html/w3: cleanup.

This commit is contained in:
LCD 47 2019-01-30 22:12:32 +02:00
commit 8c76c0473a
3 changed files with 24 additions and 34 deletions

View File

@ -3197,7 +3197,7 @@ run the checks against "https://validator.w3.org/", or set it to
*'g:syntastic_html_w3_doctype'* *'g:syntastic_html_w3_doctype'*
Type: string Type: string
Default: "" Default: "HTML5"
Name of the document type definition to use for checking. If unspecified, the Name of the document type definition to use for checking. If unspecified, the
type is detected from the file content. Currently supported values for HTML: type is detected from the file content. Currently supported values for HTML:
@ -6697,7 +6697,7 @@ See also: |syntastic-html-validator|, |syntastic-xhtml-validator|.
2. W3 *syntastic-svg-w3* 2. W3 *syntastic-svg-w3*
Name: w3 Name: w3
Maintainer: Martin Grenfell <martin.grenfell@gmail.com> Maintainer: Kevin Locke <kevin@kevinlocke.name>
"W3" is the W3C Markup Validator for SVG. See the project's page for "W3" is the W3C Markup Validator for SVG. See the project's page for
details: details:
@ -6727,10 +6727,9 @@ run the checks against "https://validator.w3.org/", or set it to
*'g:syntastic_svg_w3_doctype'* *'g:syntastic_svg_w3_doctype'*
Type: string Type: string
Default: "SVG 1.1" (if not detected from DTD) Default: "SVG 1.1"
Name of the document type definition to use for checking. If unspecified, the Name of the document type definition to use for checking. Currently supported
type is detected from a Document Type Declaration, if present, or "SVG 1.1" is values for SVG:
used. Currently supported values for SVG:
- SVG 1.0 - SVG 1.0
- SVG 1.1 - SVG 1.1
@ -7768,7 +7767,7 @@ See also: |syntastic-html-validator|, |syntastic-svg-validator|.
5. W3 *syntastic-xhtml-w3* 5. W3 *syntastic-xhtml-w3*
Name: w3 Name: w3
Maintainer: Martin Grenfell <martin.grenfell@gmail.com> Maintainer: Kevin Locke <kevin@kevinlocke.name>
"W3" is the W3C Markup Validator for XHTML. See the project's page for "W3" is the W3C Markup Validator for XHTML. See the project's page for
details: details:
@ -7798,7 +7797,7 @@ run the checks against "https://validator.w3.org/", or set it to
*'g:syntastic_xhtml_w3_doctype'* *'g:syntastic_xhtml_w3_doctype'*
Type: string Type: string
Default: "" Default: "XHTML 1.1"
Name of the document type definition to use for checking. If unspecified, the Name of the document type definition to use for checking. If unspecified, the
type is detected from the file content. Currently supported values for XHTML: type is detected from the file content. Currently supported values for XHTML:

View File

@ -19,7 +19,7 @@ if has('reltime')
lockvar! g:_SYNTASTIC_START lockvar! g:_SYNTASTIC_START
endif endif
let g:_SYNTASTIC_VERSION = '3.9.0-25' let g:_SYNTASTIC_VERSION = '3.9.0-29'
lockvar g:_SYNTASTIC_VERSION lockvar g:_SYNTASTIC_VERSION
" Sanity checks {{{1 " Sanity checks {{{1

View File

@ -21,43 +21,35 @@ set cpo&vim
" Constants {{{1 " Constants {{{1
let s:DEFAULTS = { let s:DEFAULTS = {
\ 'api': 'https://validator.w3.org/check', \ 'html': {
\ 'doctype': '' } \ 'ctype': 'text/html',
\ 'doctype': 'HTML5' },
let s:CONTENT_TYPE = { \ 'svg': {
\ 'html': 'text/html', \ 'ctype': 'image/svg+xml',
\ 'svg': 'image/svg+xml', \ 'doctype': 'SVG 1.1' },
\ 'xhtml': 'application/xhtml+xml' } \ 'xhtml': {
\ 'ctype': 'application/xhtml+xml',
\ 'doctype': 'XHTML 1.1' } }
" }}}1 " }}}1
" @vimlint(EVL101, 1, l:api) " @vimlint(EVL101, 1, l:ctype)
" @vimlint(EVL101, 1, l:doctype) " @vimlint(EVL101, 1, l:doctype)
" @vimlint(EVL104, 1, l:doctype)
function! SyntaxCheckers_html_w3_GetLocList() dict " {{{1 function! SyntaxCheckers_html_w3_GetLocList() dict " {{{1
let buf = bufnr('') let buf = bufnr('')
let type = self.getFiletype() let type = self.getFiletype()
let fname = syntastic#util#shescape(fnamemodify(bufname(buf), ':p')) let fname = syntastic#util#shescape(fnamemodify(bufname(buf), ':p'))
let api = syntastic#util#var(type . '_w3_api', 'https://validator.w3.org/check')
for key in keys(s:DEFAULTS) .
let l:{key} = syntastic#util#var(type . '_w3_' . key, get(s:DEFAULTS, key)) for key in keys(s:DEFAULTS[type])
let l:{key} = syntastic#util#var(type . '_w3_' . key, get(s:DEFAULTS[type], key))
endfor endfor
let ctype = get(s:CONTENT_TYPE, type, '')
" SVG is detected as generic XML if doctype is unspecified.
" Default "SVG 1.1" with "Only if missing" (fbd=1) to use DTD if present.
let fbd = ''
if type ==# 'svg' && doctype ==# ''
let doctype = 'SVG 1.1'
let fbd = '1'
endif
" vint: -ProhibitUsingUndeclaredVariable " vint: -ProhibitUsingUndeclaredVariable
let makeprg = self.getExecEscaped() . ' -q -L -s --compressed -F output=json' . let makeprg = self.getExecEscaped() . ' -q -L -s --compressed -F output=json' .
\ (doctype !=# '' ? ' -F doctype=' . syntastic#util#shescape(doctype) : '') . \ (doctype !=# '' ? ' -F doctype=' . syntastic#util#shescape(doctype) : '') .
\ (fbd !=# '' ? ' -F fbd=' . fbd : '') .
\ ' -F uploaded_file=@' . fname . \ ' -F uploaded_file=@' . fname .
\ (ctype !=# '' ? '\;type=' . ctype : '') . \ '\;type=' . ctype .
\ '\;filename=' . fname . \ '\;filename=' . fname .
\ ' ' . api \ ' ' . api
" vint: ProhibitUsingUndeclaredVariable " vint: ProhibitUsingUndeclaredVariable
@ -86,8 +78,7 @@ function! SyntaxCheckers_html_w3_GetLocList() dict " {{{1
return loclist return loclist
endfunction " }}}1 endfunction " }}}1
" @vimlint(EVL104, 0, l:doctype) " @vimlint(EVL104, 0, l:doctype)
" @vimlint(EVL101, 0, l:doctype) " @vimlint(EVL101, 0, l:ctype)
" @vimlint(EVL101, 0, l:api)
call g:SyntasticRegistry.CreateAndRegisterChecker({ call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'html', \ 'filetype': 'html',