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'*
Type: string
Default: ""
Default: "HTML5"
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:
@ -6697,7 +6697,7 @@ See also: |syntastic-html-validator|, |syntastic-xhtml-validator|.
2. W3 *syntastic-svg-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
details:
@ -6727,10 +6727,9 @@ run the checks against "https://validator.w3.org/", or set it to
*'g:syntastic_svg_w3_doctype'*
Type: string
Default: "SVG 1.1" (if not detected from DTD)
Name of the document type definition to use for checking. If unspecified, the
type is detected from a Document Type Declaration, if present, or "SVG 1.1" is
used. Currently supported values for SVG:
Default: "SVG 1.1"
Name of the document type definition to use for checking. Currently supported
values for SVG:
- SVG 1.0
- SVG 1.1
@ -7768,7 +7767,7 @@ See also: |syntastic-html-validator|, |syntastic-svg-validator|.
5. W3 *syntastic-xhtml-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
details:
@ -7798,7 +7797,7 @@ run the checks against "https://validator.w3.org/", or set it to
*'g:syntastic_xhtml_w3_doctype'*
Type: string
Default: ""
Default: "XHTML 1.1"
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:

View File

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

View File

@ -21,43 +21,35 @@ set cpo&vim
" Constants {{{1
let s:DEFAULTS = {
\ 'api': 'https://validator.w3.org/check',
\ 'doctype': '' }
let s:CONTENT_TYPE = {
\ 'html': 'text/html',
\ 'svg': 'image/svg+xml',
\ 'xhtml': 'application/xhtml+xml' }
\ 'html': {
\ 'ctype': 'text/html',
\ 'doctype': 'HTML5' },
\ 'svg': {
\ 'ctype': 'image/svg+xml',
\ 'doctype': 'SVG 1.1' },
\ 'xhtml': {
\ 'ctype': 'application/xhtml+xml',
\ 'doctype': 'XHTML 1.1' } }
" }}}1
" @vimlint(EVL101, 1, l:api)
" @vimlint(EVL101, 1, l:ctype)
" @vimlint(EVL101, 1, l:doctype)
" @vimlint(EVL104, 1, l:doctype)
function! SyntaxCheckers_html_w3_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 . '_w3_' . key, get(s:DEFAULTS, key))
let api = syntastic#util#var(type . '_w3_api', 'https://validator.w3.org/check')
.
for key in keys(s:DEFAULTS[type])
let l:{key} = syntastic#util#var(type . '_w3_' . key, get(s:DEFAULTS[type], key))
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
let makeprg = self.getExecEscaped() . ' -q -L -s --compressed -F output=json' .
\ (doctype !=# '' ? ' -F doctype=' . syntastic#util#shescape(doctype) : '') .
\ (fbd !=# '' ? ' -F fbd=' . fbd : '') .
\ ' -F uploaded_file=@' . fname .
\ (ctype !=# '' ? '\;type=' . ctype : '') .
\ '\;type=' . ctype .
\ '\;filename=' . fname .
\ ' ' . api
" vint: ProhibitUsingUndeclaredVariable
@ -86,8 +78,7 @@ function! SyntaxCheckers_html_w3_GetLocList() dict " {{{1
return loclist
endfunction " }}}1
" @vimlint(EVL104, 0, l:doctype)
" @vimlint(EVL101, 0, l:doctype)
" @vimlint(EVL101, 0, l:api)
" @vimlint(EVL101, 0, l:ctype)
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'html',