From 490802965d0ed28a8b0183f746af8b426b4c492f Mon Sep 17 00:00:00 2001 From: mattn Date: Mon, 2 Jul 2012 10:03:43 +0900 Subject: [PATCH] fix escape filter. close #85 --- autoload/zencoding.vim | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/autoload/zencoding.vim b/autoload/zencoding.vim index 97672d3..10441b4 100644 --- a/autoload/zencoding.vim +++ b/autoload/zencoding.vim @@ -1,7 +1,7 @@ "============================================================================= " zencoding.vim " Author: Yasuhiro Matsumoto -" Last Change: 29-Jun-2012. +" Last Change: 02-Jul-2012. let s:save_cpo = &cpo set cpo&vim @@ -183,11 +183,6 @@ function! zencoding#toString(...) endif let itemno = itemno + 1 endwhile - if zencoding#useFilter(filters, 'e') - let str = substitute(str, '&', '\&', 'g') - let str = substitute(str, '<', '\<', 'g') - let str = substitute(str, '>', '\>', 'g') - endif return str endfunction @@ -285,6 +280,11 @@ function! zencoding#expandAbbr(mode, abbr) range for item in items let expand .= zencoding#toString(item, type, 0, filters) endfor + if zencoding#useFilter(filters, 'e') + let expand = substitute(expand, '&', '\&', 'g') + let expand = substitute(expand, '<', '\<', 'g') + let expand = substitute(expand, '>', '\>', 'g') + endif let line = getline(a:firstline) let part = substitute(line, '^\s*', '', '') for n in range(a:firstline, a:lastline) @@ -328,6 +328,11 @@ function! zencoding#expandAbbr(mode, abbr) range for item in items let expand .= zencoding#toString(item, type, 0, filters) endfor + if zencoding#useFilter(filters, 'e') + let expand = substitute(expand, '&', '\&', 'g') + let expand = substitute(expand, '<', '\<', 'g') + let expand = substitute(expand, '>', '\>', 'g') + endif endif elseif a:mode == 4 let line = getline('.') @@ -363,6 +368,11 @@ function! zencoding#expandAbbr(mode, abbr) range for item in items let expand .= zencoding#toString(item, type, 0, filters) endfor + if zencoding#useFilter(filters, 'e') + let expand = substitute(expand, '&', '\&', 'g') + let expand = substitute(expand, '<', '\<', 'g') + let expand = substitute(expand, '>', '\>', 'g') + endif let expand = substitute(expand, '\$line\([0-9]\+\)\$', '\=submatch(1)', 'g') endif if len(expand)