From c035ac24269b999a4caebb5bb7b318ee96614129 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 10 Oct 2013 19:26:44 +0300 Subject: [PATCH] The html/validator checker chokes on empty lines in curl output. --- syntax_checkers/html/validator.vim | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/syntax_checkers/html/validator.vim b/syntax_checkers/html/validator.vim index 04666354..745fa74b 100644 --- a/syntax_checkers/html/validator.vim +++ b/syntax_checkers/html/validator.vim @@ -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,' .