The html/validator checker chokes on empty lines in curl output.

This commit is contained in:
LCD 47 2013-10-10 19:26:44 +03:00
parent 2fbd870a20
commit c035ac2426

View File

@ -52,24 +52,26 @@ function! SyntaxCheckers_html_validator_IsAvailable()
endfunction
function! SyntaxCheckers_html_validator_Preprocess(errors)
let out = copy(a:errors)
for n in range(len(out))
let parts = matchlist(out[n], '\v^"([^"]+)"(.+)')
" URL decode, except leave alone any "+"
let parts[1] = substitute(parts[1], '\m%\(\x\x\)', '\=nr2char("0x".submatch(1))', 'g')
let parts[1] = substitute(parts[1], '\\"', '"', 'g')
let parts[1] = substitute(parts[1], '\\\\', '\\', 'g')
let out[n] = '"' . parts[1] . '"' . parts[2]
let out = []
for e in a:errors
let parts = matchlist(e, '\v^"([^"]+)"(.+)')
if len(parts) >= 3
" URL decode, except leave alone any "+"
let parts[1] = substitute(parts[1], '\m%\(\x\x\)', '\=nr2char("0x".submatch(1))', 'g')
let parts[1] = substitute(parts[1], '\\"', '"', 'g')
let parts[1] = substitute(parts[1], '\\\\', '\\', 'g')
call add(out, '"' . parts[1] . '"' . parts[2])
endif
endfor
return out
endfunction
function! SyntaxCheckers_html_validator_GetLocList()
let fname = syntastic#util#shexpand('%')
let makeprg = 'curl -s --compressed -F out=gnu -F asciiquotes=yes' .
\ (!empty(g:syntastic_html_validator_parser) ? ' -F parser=' . g:syntastic_html_validator_parser : '') .
\ (!empty(g:syntastic_html_validator_nsfilter) ? ' -F nsfilter=' . g:syntastic_html_validator_nsfilter : '') .
\ ' -F doc=@' . syntastic#util#shexpand('%') . '\;type=text/html\;filename=' . syntastic#util#shexpand('%') . ' ' .
\ g:syntastic_html_validator_api
\ ' -F doc=@' . fname . '\;type=text/html\;filename=' . fname . ' ' . g:syntastic_html_validator_api
let errorformat =
\ '%E"%f":%l: %trror: %m,' .