From d7e4896a286f4aa7f64d2b014e5078333d95f457 Mon Sep 17 00:00:00 2001 From: mattn Date: Tue, 10 Jan 2012 17:35:25 +0900 Subject: [PATCH] fix imageSize. close issue #53 --- autoload/zencoding.vim | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/autoload/zencoding.vim b/autoload/zencoding.vim index 8e29734..360ea8b 100644 --- a/autoload/zencoding.vim +++ b/autoload/zencoding.vim @@ -1,7 +1,7 @@ "============================================================================= " zencoding.vim " Author: Yasuhiro Matsumoto -" Last Change: 16-Dec-2011. +" Last Change: 10-Jan-2012. let s:save_cpo = &cpo set cpo&vim @@ -298,18 +298,19 @@ endfunction function! s:zen_parseTag(tag) let current = { 'name': '', 'attr': {}, 'child': [], 'snippet': '', 'multiplier': 1, 'parent': {}, 'value': '', 'pos': 0 } - let mx = '<\([a-zA-Z][a-zA-Z0-9]*\)\(\%(\s[a-zA-Z][a-zA-Z0-9]\+=\%([^"'' \t]\+\|["''][^"'']*["'']\)\s*\)*\)\(/\{0,1}\)>' + let mx = '<\([a-zA-Z][a-zA-Z0-9]*\)\(\%(\s[a-zA-Z][a-zA-Z0-9]\+=\%([^"'' \t]\+\|["''][^"'']\{-}["'']\)\s*\)*\)\(/\{0,1}\)>' let match = matchstr(a:tag, mx) let current.name = substitute(match, mx, '\1', 'i') let attrs = substitute(match, mx, '\2', 'i') - let mx = '\([a-zA-Z0-9]\+\)=["'']\{0,1}\([^"'' \t]*\|[^"'']\+\)["'']\{0,1}' + let mx = '\([a-zA-Z0-9]\+\)=\%(\([^"'' \t]\+\)\|["'']\([^"'']\{-}\)["'']\)' while len(attrs) > 0 let match = matchstr(attrs, mx) if len(match) == 0 break endif - let name = substitute(match, mx, '\1', 'i') - let value = substitute(match, mx, '\2', 'i') + let attr_match = matchlist(match, mx) + let name = attr_match[1] + let value = len(attr_match[2]) ? attr_match[2] : attr_match[3] let current.attr[name] = value let attrs = attrs[stridx(attrs, match) + len(match):] endwhile