rst2pseudoxml.vim 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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_GetLocList() dict
  22. let makeprg = self.makeprgBuild({
  23. \ 'args_after': '--report=2 --exit-status=1',
  24. \ 'tail': syntastic#util#DevNull() })
  25. let errorformat =
  26. \ '%f:%l: (%tNFO/1) %m,'.
  27. \ '%f:%l: (%tARNING/2) %m,'.
  28. \ '%f:%l: (%tRROR/3) %m,'.
  29. \ '%f:%l: (%tEVERE/4) %m,'.
  30. \ '%-G%.%#'
  31. let loclist = SyntasticMake({
  32. \ 'makeprg': makeprg,
  33. \ 'errorformat': errorformat })
  34. for e in loclist
  35. if e['type'] ==? 'S'
  36. let e['type'] = 'E'
  37. elseif e['type'] ==? 'I'
  38. let e['type'] = 'W'
  39. let e['subtype'] = 'Style'
  40. endif
  41. endfor
  42. return loclist
  43. endfunction
  44. call g:SyntasticRegistry.CreateAndRegisterChecker({
  45. \ 'filetype': 'rst',
  46. \ 'name': 'rst2pseudoxml',
  47. \ 'exec': s:rst2pseudoxml })
  48. let &cpo = s:save_cpo
  49. unlet s:save_cpo
  50. " vim: set sw=4 sts=4 et fdm=marker: