fix escape filter. close #85

This commit is contained in:
mattn
2012-07-02 10:03:43 +09:00
parent 689ff1efab
commit 490802965d

View File

@@ -1,7 +1,7 @@
"============================================================================= "=============================================================================
" zencoding.vim " zencoding.vim
" Author: Yasuhiro Matsumoto <mattn.jp@gmail.com> " Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
" Last Change: 29-Jun-2012. " Last Change: 02-Jul-2012.
let s:save_cpo = &cpo let s:save_cpo = &cpo
set cpo&vim set cpo&vim
@@ -183,11 +183,6 @@ function! zencoding#toString(...)
endif endif
let itemno = itemno + 1 let itemno = itemno + 1
endwhile endwhile
if zencoding#useFilter(filters, 'e')
let str = substitute(str, '&', '\&amp;', 'g')
let str = substitute(str, '<', '\&lt;', 'g')
let str = substitute(str, '>', '\&gt;', 'g')
endif
return str return str
endfunction endfunction
@@ -285,6 +280,11 @@ function! zencoding#expandAbbr(mode, abbr) range
for item in items for item in items
let expand .= zencoding#toString(item, type, 0, filters) let expand .= zencoding#toString(item, type, 0, filters)
endfor endfor
if zencoding#useFilter(filters, 'e')
let expand = substitute(expand, '&', '\&amp;', 'g')
let expand = substitute(expand, '<', '\&lt;', 'g')
let expand = substitute(expand, '>', '\&gt;', 'g')
endif
let line = getline(a:firstline) let line = getline(a:firstline)
let part = substitute(line, '^\s*', '', '') let part = substitute(line, '^\s*', '', '')
for n in range(a:firstline, a:lastline) for n in range(a:firstline, a:lastline)
@@ -328,6 +328,11 @@ function! zencoding#expandAbbr(mode, abbr) range
for item in items for item in items
let expand .= zencoding#toString(item, type, 0, filters) let expand .= zencoding#toString(item, type, 0, filters)
endfor endfor
if zencoding#useFilter(filters, 'e')
let expand = substitute(expand, '&', '\&amp;', 'g')
let expand = substitute(expand, '<', '\&lt;', 'g')
let expand = substitute(expand, '>', '\&gt;', 'g')
endif
endif endif
elseif a:mode == 4 elseif a:mode == 4
let line = getline('.') let line = getline('.')
@@ -363,6 +368,11 @@ function! zencoding#expandAbbr(mode, abbr) range
for item in items for item in items
let expand .= zencoding#toString(item, type, 0, filters) let expand .= zencoding#toString(item, type, 0, filters)
endfor endfor
if zencoding#useFilter(filters, 'e')
let expand = substitute(expand, '&', '\&amp;', 'g')
let expand = substitute(expand, '<', '\&lt;', 'g')
let expand = substitute(expand, '>', '\&gt;', 'g')
endif
let expand = substitute(expand, '\$line\([0-9]\+\)\$', '\=submatch(1)', 'g') let expand = substitute(expand, '\$line\([0-9]\+\)\$', '\=submatch(1)', 'g')
endif endif
if len(expand) if len(expand)