diff options
Diffstat (limited to 'vim/bundle/syntastic/syntax_checkers/html')
-rw-r--r-- | vim/bundle/syntastic/syntax_checkers/html/eslint.vim | 23 | ||||
-rw-r--r-- | vim/bundle/syntastic/syntax_checkers/html/gjslint.vim | 23 | ||||
-rw-r--r-- | vim/bundle/syntastic/syntax_checkers/html/jshint.vim | 50 | ||||
-rw-r--r-- | vim/bundle/syntastic/syntax_checkers/html/textlint.vim | 23 | ||||
-rw-r--r-- | vim/bundle/syntastic/syntax_checkers/html/tidy.vim | 212 | ||||
-rw-r--r-- | vim/bundle/syntastic/syntax_checkers/html/validator.vim | 69 | ||||
-rw-r--r-- | vim/bundle/syntastic/syntax_checkers/html/w3.vim | 62 |
7 files changed, 462 insertions, 0 deletions
diff --git a/vim/bundle/syntastic/syntax_checkers/html/eslint.vim b/vim/bundle/syntastic/syntax_checkers/html/eslint.vim new file mode 100644 index 0000000..3e91931 --- /dev/null +++ b/vim/bundle/syntastic/syntax_checkers/html/eslint.vim @@ -0,0 +1,23 @@ +"============================================================================ +"File: eslint.vim +"Description: Syntax checking plugin for syntastic +"Maintainer: LCD 47 <lcd047 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. +" +"============================================================================ + +if exists('g:loaded_syntastic_html_eslint_checker') + finish +endif +let g:loaded_syntastic_html_eslint_checker = 1 + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'html', + \ 'name': 'eslint', + \ 'redirect': 'javascript/eslint'}) + +" vim: set sw=4 sts=4 et fdm=marker: diff --git a/vim/bundle/syntastic/syntax_checkers/html/gjslint.vim b/vim/bundle/syntastic/syntax_checkers/html/gjslint.vim new file mode 100644 index 0000000..a26e2f3 --- /dev/null +++ b/vim/bundle/syntastic/syntax_checkers/html/gjslint.vim @@ -0,0 +1,23 @@ +"============================================================================ +"File: gjslint.vim +"Description: Syntax checking plugin for syntastic +"Maintainer: LCD 47 <lcd047 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. +" +"============================================================================ + +if exists('g:loaded_syntastic_html_gjslint_checker') + finish +endif +let g:loaded_syntastic_html_gjslint_checker = 1 + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'html', + \ 'name': 'gjslint', + \ 'redirect': 'javascript/gjslint'}) + +" vim: set sw=4 sts=4 et fdm=marker: diff --git a/vim/bundle/syntastic/syntax_checkers/html/jshint.vim b/vim/bundle/syntastic/syntax_checkers/html/jshint.vim new file mode 100644 index 0000000..a7af758 --- /dev/null +++ b/vim/bundle/syntastic/syntax_checkers/html/jshint.vim @@ -0,0 +1,50 @@ +"============================================================================ +"File: jshint.vim +"Description: Javascript syntax checker for HTML - using jshint +"Maintainer: LCD 47 <lcd047@gmail.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. +"============================================================================ + +if exists('g:loaded_syntastic_html_jshint_checker') + finish +endif +let g:loaded_syntastic_html_jshint_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim + +function! SyntaxCheckers_html_jshint_IsAvailable() dict + call syntastic#log#deprecationWarn('jshint_exec', 'html_jshint_exec') + if !executable(self.getExec()) + return 0 + endif + return syntastic#util#versionIsAtLeast(self.getVersion(), [2, 4]) +endfunction + +function! SyntaxCheckers_html_jshint_GetLocList() dict + call syntastic#log#deprecationWarn('html_jshint_conf', 'html_jshint_args', + \ "'--config ' . syntastic#util#shexpand(OLD_VAR)") + + let makeprg = self.makeprgBuild({ 'args_after': '--verbose --extract always' }) + + let errorformat = '%A%f: line %l\, col %v\, %m \(%t%*\d\)' + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'defaults': {'bufnr': bufnr('')}, + \ 'returns': [0, 2] }) +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'html', + \ 'name': 'jshint'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set sw=4 sts=4 et fdm=marker: diff --git a/vim/bundle/syntastic/syntax_checkers/html/textlint.vim b/vim/bundle/syntastic/syntax_checkers/html/textlint.vim new file mode 100644 index 0000000..b95d8be --- /dev/null +++ b/vim/bundle/syntastic/syntax_checkers/html/textlint.vim @@ -0,0 +1,23 @@ +"============================================================================ +"File: textlint.vim +"Description: Syntax checking plugin for syntastic +"Maintainer: LCD 47 <lcd047 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. +" +"============================================================================ + +if exists('g:loaded_syntastic_html_textlint_checker') + finish +endif +let g:loaded_syntastic_html_textlint_checker = 1 + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'html', + \ 'name': 'textlint', + \ 'redirect': 'text/textlint'}) + +" vim: set sw=4 sts=4 et fdm=marker: diff --git a/vim/bundle/syntastic/syntax_checkers/html/tidy.vim b/vim/bundle/syntastic/syntax_checkers/html/tidy.vim new file mode 100644 index 0000000..3075a7d --- /dev/null +++ b/vim/bundle/syntastic/syntax_checkers/html/tidy.vim @@ -0,0 +1,212 @@ +"============================================================================ +"File: tidy.vim +"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. +" +"============================================================================ + +if exists('g:loaded_syntastic_html_tidy_checker') + finish +endif +let g:loaded_syntastic_html_tidy_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim + +" Checker options {{{1 + +if !exists('g:syntastic_html_tidy_ignore_errors') + let g:syntastic_html_tidy_ignore_errors = [] +endif + +if !exists('g:syntastic_html_tidy_blocklevel_tags') + let g:syntastic_html_tidy_blocklevel_tags = [] +endif + +if !exists('g:syntastic_html_tidy_inline_tags') + let g:syntastic_html_tidy_inline_tags = [] +endif + +if !exists('g:syntastic_html_tidy_empty_tags') + let g:syntastic_html_tidy_empty_tags = [] +endif + +" }}}1 + +" Constants {{{1 + +let s:IGNORE_ERRORS = [ + \ "<table> lacks \"summary\" attribute", + \ "not approved by W3C", + \ "<input> proprietary attribute \"placeholder\"", + \ "<meta> proprietary attribute \"charset\"", + \ "<meta> lacks \"content\" attribute", + \ "inserting \"type\" attribute", + \ "proprietary attribute \"data-", + \ "missing <!DOCTYPE> declaration", + \ "inserting implicit <body>", + \ "inserting missing 'title' element", + \ "unescaped & or unknown entity", + \ "<input> attribute \"type\" has invalid value", + \ "proprietary attribute \"role\"", + \ "proprietary attribute \"aria-activedescendant\"", + \ "proprietary attribute \"aria-atomic\"", + \ "proprietary attribute \"aria-autocomplete\"", + \ "proprietary attribute \"aria-busy\"", + \ "proprietary attribute \"aria-checked\"", + \ "proprietary attribute \"aria-controls\"", + \ "proprietary attribute \"aria-describedby\"", + \ "proprietary attribute \"aria-disabled\"", + \ "proprietary attribute \"aria-dropeffect\"", + \ "proprietary attribute \"aria-expanded\"", + \ "proprietary attribute \"aria-flowto\"", + \ "proprietary attribute \"aria-grabbed\"", + \ "proprietary attribute \"aria-haspopup\"", + \ "proprietary attribute \"aria-hidden\"", + \ "proprietary attribute \"aria-invalid\"", + \ "proprietary attribute \"aria-label\"", + \ "proprietary attribute \"aria-labelledby\"", + \ "proprietary attribute \"aria-level\"", + \ "proprietary attribute \"aria-live\"", + \ "proprietary attribute \"aria-multiline\"", + \ "proprietary attribute \"aria-multiselectable\"", + \ "proprietary attribute \"aria-orientation\"", + \ "proprietary attribute \"aria-owns\"", + \ "proprietary attribute \"aria-posinset\"", + \ "proprietary attribute \"aria-pressed\"", + \ "proprietary attribute \"aria-readonly\"", + \ "proprietary attribute \"aria-relevant\"", + \ "proprietary attribute \"aria-relevant\"", + \ "proprietary attribute \"aria-required\"", + \ "proprietary attribute \"aria-selected\"", + \ "proprietary attribute \"aria-setsize\"", + \ "proprietary attribute \"aria-sort\"", + \ "proprietary attribute \"aria-valuemax\"", + \ "proprietary attribute \"aria-valuemin\"", + \ "proprietary attribute \"aria-valuenow\"", + \ "proprietary attribute \"aria-valuetext\"" + \ ] +lockvar! s:IGNORE_ERRORS + +let s:BLOCKLEVEL_TAGS = [ + \ 'main', + \ 'section', + \ 'article', + \ 'aside', + \ 'header', + \ 'footer', + \ 'nav', + \ 'figure', + \ 'figcaption' + \ ] +lockvar! s:BLOCKLEVEL_TAGS + +let s:INLINE_TAGS = [ + \ 'video', + \ 'audio', + \ 'source', + \ 'embed', + \ 'mark', + \ 'progress', + \ 'meter', + \ 'time', + \ 'ruby', + \ 'rt', + \ 'rp', + \ 'canvas', + \ 'command', + \ 'details', + \ 'datalist' + \ ] +lockvar! s:INLINE_TAGS + +let s:EMPTY_TAGS = [ + \ 'wbr', + \ 'keygen' + \ ] +lockvar! s:EMPTY_TAGS + +" }}}1 + +function! SyntaxCheckers_html_tidy_GetLocList() dict " {{{1 + let makeprg = self.makeprgBuild({ 'args_after': s:Args() }) + + let errorformat = + \ '%Wline %l column %v - Warning: %m,' . + \ '%Eline %l column %v - Error: %m,' . + \ '%-G%.%#' + + let loclist = SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'defaults': {'bufnr': bufnr('')}, + \ 'returns': [0, 1, 2] }) + + " filter out valid HTML5 from the errors + for e in loclist + if e['valid'] && s:IgnoreError(e['text']) == 1 + let e['valid'] = 0 + endif + endfor + + return loclist +endfunction " }}}1 + +" Utilities {{{1 + +" TODO: join this with xhtml.vim for DRY's sake? +function! s:TidyEncOptByFenc() " {{{2 + let TIDY_OPTS = { + \ 'utf-8': '-utf8', + \ 'ascii': '-ascii', + \ 'latin1': '-latin1', + \ 'iso-2022-jp': '-iso-2022', + \ 'cp1252': '-win1252', + \ 'macroman': '-mac', + \ 'utf-16le': '-utf16le', + \ 'utf-16': '-utf16', + \ 'big5': '-big5', + \ 'cp932': '-shiftjis', + \ 'sjis': '-shiftjis', + \ 'cp850': '-ibm858', + \ } + return get(TIDY_OPTS, &fileencoding, '-utf8') +endfunction " }}}2 + +function! s:IgnoreError(text) " {{{2 + for item in s:IGNORE_ERRORS + g:syntastic_html_tidy_ignore_errors + if stridx(a:text, item) != -1 + return 1 + endif + endfor + return 0 +endfunction " }}}2 + +function! s:NewTags(name) " {{{2 + return syntastic#util#shescape(join( s:{toupper(a:name)} + g:syntastic_html_tidy_{a:name}, ',' )) +endfunction " }}}2 + +function! s:Args() " {{{2 + let args = s:TidyEncOptByFenc() . + \ ' --new-blocklevel-tags ' . s:NewTags('blocklevel_tags') . + \ ' --new-inline-tags ' . s:NewTags('inline_tags') . + \ ' --new-empty-tags ' . s:NewTags('empty_tags') . + \ ' -e' + return args +endfunction " }}}2 + +" }}}1 + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'html', + \ 'name': 'tidy'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set sw=4 sts=4 et fdm=marker: diff --git a/vim/bundle/syntastic/syntax_checkers/html/validator.vim b/vim/bundle/syntastic/syntax_checkers/html/validator.vim new file mode 100644 index 0000000..14a4c64 --- /dev/null +++ b/vim/bundle/syntastic/syntax_checkers/html/validator.vim @@ -0,0 +1,69 @@ +"============================================================================ +"File: validator.vim +"Description: Syntax checking plugin for syntastic.vim +"Maintainer: LCD 47 <lcd047 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. +" +"============================================================================ + +if exists('g:loaded_syntastic_html_validator_checker') + finish +endif +let g:loaded_syntastic_html_validator_checker=1 + +if !exists('g:syntastic_html_validator_api') + let g:syntastic_html_validator_api = 'https://validator.nu/' +endif + +if !exists('g:syntastic_html_validator_parser') + let g:syntastic_html_validator_parser = '' +endif + +if !exists('g:syntastic_html_validator_nsfilter') + let g:syntastic_html_validator_nsfilter = '' +endif + +let s:save_cpo = &cpo +set cpo&vim + +function! SyntaxCheckers_html_validator_GetLocList() dict + let fname = syntastic#util#shexpand('%') + let makeprg = self.getExecEscaped() . ' -q -L -s --compressed -F out=gnu -F asciiquotes=yes' . + \ (g:syntastic_html_validator_parser !=# '' ? ' -F parser=' . g:syntastic_html_validator_parser : '') . + \ (g:syntastic_html_validator_nsfilter !=# '' ? ' -F nsfilter=' . g:syntastic_html_validator_nsfilter : '') . + \ ' -F doc=@' . fname . '\;type=text/html\;filename=' . fname . ' ' . g:syntastic_html_validator_api + + let errorformat = + \ '%E"%f":%l: %trror: %m,' . + \ '%E"%f":%l-%\d%\+: %trror: %m,' . + \ '%E"%f":%l%\%.%c: %trror: %m,' . + \ '%E"%f":%l%\%.%c-%\d%\+%\%.%\d%\+: %trror: %m,' . + \ '%E"%f":%l: %trror fatal: %m,' . + \ '%E"%f":%l-%\d%\+: %trror fatal: %m,' . + \ '%E"%f":%l%\%.%c: %trror fatal: %m,' . + \ '%E"%f":%l%\%.%c-%\d%\+%\%.%\d%\+: %trror fatal: %m,' . + \ '%W"%f":%l: info %tarning: %m,' . + \ '%W"%f":%l-%\d%\+: info %tarning: %m,' . + \ '%W"%f":%l%\%.%c: info %tarning: %m,' . + \ '%W"%f":%l%\%.%c-%\d%\+%\%.%\d%\+: info %tarning: %m' + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'preprocess': 'validator', + \ 'returns': [0] }) +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'html', + \ 'name': 'validator', + \ 'exec': 'curl' }) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set sw=4 sts=4 et fdm=marker: diff --git a/vim/bundle/syntastic/syntax_checkers/html/w3.vim b/vim/bundle/syntastic/syntax_checkers/html/w3.vim new file mode 100644 index 0000000..37ff11a --- /dev/null +++ b/vim/bundle/syntastic/syntax_checkers/html/w3.vim @@ -0,0 +1,62 @@ +"============================================================================ +"File: w3.vim +"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. +" +"============================================================================ + +if exists('g:loaded_syntastic_html_w3_checker') + finish +endif +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 + +let s:save_cpo = &cpo +set cpo&vim + +function! SyntaxCheckers_html_w3_GetLocList() dict + let makeprg = self.getExecEscaped() . ' -q -L -s -F output=json ' . + \ '-F uploaded_file=@' . syntastic#util#shexpand('%:p') . '\;type=text/html ' . + \ g:syntastic_html_w3_api + + let errorformat = + \ '%A %\+{,' . + \ '%C %\+"lastLine": %l\,%\?,' . + \ '%C %\+"lastColumn": %c\,%\?,' . + \ '%C %\+"message": "%m"\,%\?,' . + \ '%C %\+"type": "%trror"\,%\?,' . + \ '%-G %\+"type": "%tnfo"\,%\?,' . + \ '%C %\+"subtype": "%tarning"\,%\?,' . + \ '%Z %\+}\,,' . + \ '%-G%.%#' + + let loclist = SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'defaults': {'bufnr': bufnr('')}, + \ 'returns': [0] }) + + for e in loclist + let e['text'] = substitute(e['text'], '\m\\\([\"]\)', '\1', 'g') + endfor + + return loclist +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'html', + \ 'name': 'w3', + \ 'exec': 'curl' }) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set sw=4 sts=4 et fdm=marker: |