2012-05-01 15:14:42 +01:00
|
|
|
"============================================================================
|
2012-05-01 15:23:22 +01:00
|
|
|
"File: w3.vim
|
2012-05-01 15:14:42 +01:00
|
|
|
"Description: Syntax checking plugin for syntastic.vim
|
|
|
|
"Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
|
|
|
|
"License: This program is free software. It comes without any warranty,
|
|
|
|
" to the extent permitted by applicable law. You can redistribute
|
|
|
|
" it and/or modify it under the terms of the Do What The Fuck You
|
|
|
|
" Want To Public License, Version 2, as published by Sam Hocevar.
|
|
|
|
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
|
|
|
"
|
|
|
|
"============================================================================
|
2013-04-16 11:30:42 +03:00
|
|
|
"
|
|
|
|
" Checker option:
|
|
|
|
"
|
|
|
|
" - g:syntastic_html_w3_api (string; default: 'http://validator.w3.org/check')
|
|
|
|
" URL of the service to use for checking; leave it to the default to run the
|
|
|
|
" checks against http://validator.w3.org/, or set it to
|
|
|
|
" 'http://localhost/w3c-validator/check' if you're running a local service
|
|
|
|
|
2013-02-21 15:50:41 +00:00
|
|
|
if exists("g:loaded_syntastic_html_w3_checker")
|
|
|
|
finish
|
|
|
|
endif
|
2013-04-16 11:30:42 +03:00
|
|
|
let g:loaded_syntastic_html_w3_checker = 1
|
|
|
|
|
|
|
|
if !exists('g:syntastic_html_w3_api')
|
|
|
|
let g:syntastic_html_w3_api = 'http://validator.w3.org/check'
|
|
|
|
endif
|
2013-02-21 15:50:41 +00:00
|
|
|
|
2014-01-03 11:29:08 +02:00
|
|
|
let s:save_cpo = &cpo
|
|
|
|
set cpo&vim
|
|
|
|
|
2013-10-28 13:53:33 +02:00
|
|
|
function! SyntaxCheckers_html_w3_GetLocList() dict
|
2014-02-07 11:19:30 +02:00
|
|
|
let makeprg = self.getExecEscaped() . ' -s -F output=json ' .
|
2013-07-04 21:04:20 +03:00
|
|
|
\ '-F uploaded_file=@' . syntastic#util#shexpand('%:p') . '\;type=text/html ' .
|
2013-04-16 11:30:42 +03:00
|
|
|
\ g:syntastic_html_w3_api
|
2013-07-12 08:08:41 +03:00
|
|
|
|
2013-04-16 11:30:42 +03:00
|
|
|
let errorformat =
|
|
|
|
\ '%A %\+{,' .
|
|
|
|
\ '%C %\+"lastLine": %l\,%\?,' .
|
|
|
|
\ '%C %\+"lastColumn": %c\,%\?,' .
|
|
|
|
\ '%C %\+"message": "%m"\,%\?,' .
|
|
|
|
\ '%C %\+"type": "%trror"\,%\?,' .
|
|
|
|
\ '%-G %\+"type": "%tnfo"\,%\?,' .
|
|
|
|
\ '%C %\+"subtype": "%tarning"\,%\?,' .
|
|
|
|
\ '%Z %\+}\,,' .
|
|
|
|
\ '%-G%.%#'
|
2013-07-12 08:08:41 +03:00
|
|
|
|
|
|
|
let loclist = SyntasticMake({
|
|
|
|
\ 'makeprg': makeprg,
|
|
|
|
\ 'errorformat': errorformat,
|
|
|
|
\ 'defaults': {'bufnr': bufnr("")},
|
|
|
|
\ 'returns': [0] })
|
2012-05-01 15:14:42 +01:00
|
|
|
|
2013-11-08 10:45:15 +02:00
|
|
|
for e in loclist
|
2013-11-04 23:00:51 +02:00
|
|
|
let e['text'] = substitute(e['text'], '\m\\\([\"]\)', '\1', 'g')
|
2013-04-15 11:21:52 +03:00
|
|
|
endfor
|
2012-05-01 15:14:42 +01:00
|
|
|
|
|
|
|
return loclist
|
|
|
|
endfunction
|
2013-01-27 20:08:30 +00:00
|
|
|
|
|
|
|
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
|
|
|
\ 'filetype': 'html',
|
2014-01-03 10:43:01 +02:00
|
|
|
\ 'name': 'w3',
|
|
|
|
\ 'exec': 'curl' })
|
2013-01-27 20:08:30 +00:00
|
|
|
|
2014-01-03 11:29:08 +02:00
|
|
|
let &cpo = s:save_cpo
|
|
|
|
unlet s:save_cpo
|
|
|
|
|
|
|
|
" vim: set et sts=4 sw=4:
|