rst2pseudoxml.vim 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. "============================================================================
  2. "File: rst.vim
  3. "Description: Syntax checking plugin for docutils' reStructuredText files
  4. "Maintainer: James Rowe <jnrowe at gmail dot com>
  5. "License: This program is free software. It comes without any warranty,
  6. " to the extent permitted by applicable law. You can redistribute
  7. " it and/or modify it under the terms of the Do What The Fuck You
  8. " Want To Public License, Version 2, as published by Sam Hocevar.
  9. " See http://sam.zoy.org/wtfpl/COPYING for more details.
  10. "
  11. "============================================================================
  12. " We use rst2pseudoxml.py, as it is ever so marginally faster than the other
  13. " rst2${x} tools in docutils.
  14. if exists('g:loaded_syntastic_rst_rst2pseudoxml_checker')
  15. finish
  16. endif
  17. let g:loaded_syntastic_rst_rst2pseudoxml_checker = 1
  18. let s:rst2pseudoxml = (executable('rst2pseudoxml.py') && !syntastic#util#isRunningWindows()) ? 'rst2pseudoxml.py' : 'rst2pseudoxml'
  19. let s:save_cpo = &cpo
  20. set cpo&vim
  21. function! SyntaxCheckers_rst_rst2pseudoxml_IsAvailable() dict
  22. call self.log('exec =', self.getExec())
  23. return executable(self.getExec())
  24. endfunction
  25. function! SyntaxCheckers_rst_rst2pseudoxml_GetLocList() dict
  26. let makeprg = self.makeprgBuild({
  27. \ 'args_after': '--report=2 --exit-status=1',
  28. \ 'tail': syntastic#util#DevNull() })
  29. let errorformat =
  30. \ '%f:%l: (%t%\w%\+/%\d%\+) %m,'.
  31. \ '%f:: (%t%\w%\+/%\d%\+) %m,'.
  32. \ '%-G%.%#'
  33. let loclist = SyntasticMake({
  34. \ 'makeprg': makeprg,
  35. \ 'errorformat': errorformat })
  36. for e in loclist
  37. if e['type'] ==? 'I'
  38. let e['type'] = 'W'
  39. let e['subtype'] = 'Style'
  40. else
  41. let e['type'] = 'E'
  42. endif
  43. endfor
  44. return loclist
  45. endfunction
  46. call g:SyntasticRegistry.CreateAndRegisterChecker({
  47. \ 'filetype': 'rst',
  48. \ 'name': 'rst2pseudoxml',
  49. \ 'exec': s:rst2pseudoxml })
  50. let &cpo = s:save_cpo
  51. unlet s:save_cpo
  52. " vim: set sw=4 sts=4 et fdm=marker: