More eRuby fun with encodings.
Ruby 1.8 doesn't support encodings when opening files.
This commit is contained in:
parent
bd67cec8c7
commit
03429e69b6
@ -1,5 +1,5 @@
|
|||||||
"============================================================================
|
"============================================================================
|
||||||
"File: eruby.vim
|
"File: ruby.vim
|
||||||
"Description: Syntax checking plugin for syntastic.vim
|
"Description: Syntax checking plugin for syntastic.vim
|
||||||
"Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
|
"Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
|
||||||
"License: This program is free software. It comes without any warranty,
|
"License: This program is free software. It comes without any warranty,
|
||||||
@ -31,15 +31,20 @@ function! SyntaxCheckers_eruby_ruby_GetLocList()
|
|||||||
|
|
||||||
let fname = "'" . escape(expand('%'), "\\'") . "'"
|
let fname = "'" . escape(expand('%'), "\\'") . "'"
|
||||||
|
|
||||||
|
" TODO: encodings became useful in ruby 1.9 :)
|
||||||
|
if syntastic#util#versionIsAtLeast(syntastic#util#parseVersion('ruby --version'), [1, 9])
|
||||||
let enc = &fileencoding != '' ? &fileencoding : &encoding
|
let enc = &fileencoding != '' ? &fileencoding : &encoding
|
||||||
let encoding_string = enc ==? 'utf-8' ? 'UTF-8' : 'BINARY'
|
let encoding_spec = ', :encoding => "' . (enc ==? 'utf-8' ? 'UTF-8' : 'BINARY') . '"'
|
||||||
|
else
|
||||||
|
let encoding_spec = ''
|
||||||
|
endif
|
||||||
|
|
||||||
"gsub fixes issue #7, rails has it's own eruby syntax
|
"gsub fixes issue #7, rails has it's own eruby syntax
|
||||||
let makeprg =
|
let makeprg =
|
||||||
\ exe . ' -rerb -e ' .
|
\ exe . ' -rerb -e ' .
|
||||||
\ syntastic#util#shescape('puts ERB.new(File.read(' . fname .
|
\ syntastic#util#shescape('puts ERB.new(File.read(' .
|
||||||
\ ', :encoding => "' . encoding_string .
|
\ fname . encoding_spec .
|
||||||
\ '").gsub(''<\%='',''<\%''), nil, ''-'').src') .
|
\ ').gsub(''<\%='',''<\%''), nil, ''-'').src') .
|
||||||
\ ' \| ' . exe . ' -c'
|
\ ' \| ' . exe . ' -c'
|
||||||
|
|
||||||
let errorformat =
|
let errorformat =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user