Merge pull request #81 from millermedeiros/master
improve support for HTML5 attributes
This commit is contained in:
commit
a97b9eaba8
@ -37,19 +37,50 @@ function! s:TidyEncOptByFenc()
|
|||||||
return get(tidy_opts, &fileencoding, '-utf8')
|
return get(tidy_opts, &fileencoding, '-utf8')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
let s:ignore_html_errors = [
|
||||||
|
\ "<table> lacks \"summary\" attribute",
|
||||||
|
\ "not approved by W3C",
|
||||||
|
\ "attribute \"placeholder\"",
|
||||||
|
\ "<meta> proprietary attribute \"charset\"",
|
||||||
|
\ "<meta> lacks \"content\" attribute",
|
||||||
|
\ "inserting \"type\" attribute",
|
||||||
|
\ "proprietary attribute \"data-"
|
||||||
|
\]
|
||||||
|
|
||||||
|
function! s:ValidateError(text)
|
||||||
|
let valid = 0
|
||||||
|
for i in s:ignore_html_errors
|
||||||
|
if stridx(a:text, i) != -1
|
||||||
|
let valid = 1
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
return valid
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
function! SyntaxCheckers_html_GetLocList()
|
function! SyntaxCheckers_html_GetLocList()
|
||||||
|
|
||||||
"grep out the '<table> lacks "summary" attribute' since it is almost
|
|
||||||
"always present and almost always useless
|
|
||||||
let encopt = s:TidyEncOptByFenc()
|
let encopt = s:TidyEncOptByFenc()
|
||||||
let makeprg="tidy ".encopt." --new-blocklevel-tags 'section, article, aside, hgroup, header, footer, nav, figure, figcaption' --new-inline-tags 'video, audio, embed, mark, progress, meter, time, ruby, rt, rp, canvas, command, details, datalist' --new-empty-tags 'wbr, keygen' -e ".shellescape(expand('%'))." 2>&1 \\| grep -v '\<table\> lacks \"summary\" attribute' \\| grep -v 'not approved by W3C' \\| grep -v 'attribute \"placeholder\"'"
|
let makeprg="tidy ".encopt." --new-blocklevel-tags 'section, article, aside, hgroup, header, footer, nav, figure, figcaption' --new-inline-tags 'video, audio, embed, mark, progress, meter, time, ruby, rt, rp, canvas, command, details, datalist' --new-empty-tags 'wbr, keygen' -e ".shellescape(expand('%'))." 2>&1"
|
||||||
let errorformat='%Wline %l column %c - Warning: %m,%Eline %l column %c - Error: %m,%-G%.%#,%-G%.%#'
|
let errorformat='%Wline %l column %c - Warning: %m,%Eline %l column %c - Error: %m,%-G%.%#,%-G%.%#'
|
||||||
let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||||
|
|
||||||
"the file name isnt in the output so stick in the buf num manually
|
" process loclist since we need to add some info and filter out valid HTML5
|
||||||
for i in loclist
|
" from the errors
|
||||||
let i['bufnr'] = bufnr("")
|
let n = len(loclist) - 1
|
||||||
endfor
|
let bufnum = bufnr("")
|
||||||
|
while n >= 0
|
||||||
|
let i = loclist[n]
|
||||||
|
" filter out valid HTML5
|
||||||
|
if s:ValidateError(i['text']) == 1
|
||||||
|
unlet loclist[n]
|
||||||
|
else
|
||||||
|
"the file name isnt in the output so stick in the buf num manually
|
||||||
|
let i['bufnr'] = bufnum
|
||||||
|
endif
|
||||||
|
let n -= 1
|
||||||
|
endwhile
|
||||||
|
|
||||||
return loclist
|
return loclist
|
||||||
endfunction
|
endfunction
|
||||||
|
Loading…
Reference in New Issue
Block a user