diff --git a/unittest.vim b/unittest.vim index b864032..3f9f4e7 100644 --- a/unittest.vim +++ b/unittest.vim @@ -341,6 +341,12 @@ finish 'type': "html", 'result': "\n", }, + { + 'name': "a[title=\"Hello', world\" rel]", + 'query': "a[title=\"Hello', world\" rel]", + 'type': "html", + 'result': "\n", + }, ], }, { diff --git a/zencoding.vim b/zencoding.vim index 69d7197..5efc7b3 100644 --- a/zencoding.vim +++ b/zencoding.vim @@ -1,8 +1,8 @@ "============================================================================= " File: zencoding.vim " Author: Yasuhiro Matsumoto -" Last Change: 06-Sep-2010. -" Version: 0.44 +" Last Change: 08-Oct-2010. +" Version: 0.45 " WebPage: http://github.com/mattn/zencoding-vim " Description: vim plugins for HTML and CSS hi-speed coding. " SeeAlso: http://code.google.com/p/zen-coding/ @@ -994,11 +994,20 @@ function! s:zen_parseIntoTree(abbr, type) let current.attr.class = substitute(item[1:], '\.', ' ', 'g') endif if item[0] == '[' - let kks = split(item[1:-2], ' ') - for kki in kks - let kk = split(kki, '=') - let current.attr[kk[0]] = len(kk) > 1 ? join(kk[1:], '=') : '' - endfor + let atts = item[1:-2] + while len(atts) + let amat = matchstr(atts, '\(\w\+\%(="[^"]*"\|=''[^'']*''\|[^ ''"\]]*\)\{0,1}\)') + if len(amat) == 0 + break + endif + let key = split(amat, '=')[0] + let val = amat[len(key)+1:] + if val =~ '^["'']' + let val = val[1:-2] + endif + let current.attr[key] = val + let atts = atts[stridx(atts, amat) + len(amat):] + endwhile endif let attr = substitute(strpart(attr, len(item)), '^\s*', '', '') endwhile diff --git a/zencoding.vim.vimup b/zencoding.vim.vimup index f34164f..77e6720 100644 --- a/zencoding.vim.vimup +++ b/zencoding.vim.vimup @@ -2,7 +2,7 @@ script_name: ZenCoding.vim script_id: '2981' script_type: utility script_package: zencoding.vim -script_version: '0.44' +script_version: '0.45' required_vim_version: '7.0' summary: vim plugins for HTML and CSS hi-speed coding. @@ -95,6 +95,9 @@ install_details: | copy zencoding.vim to your plugin directory. versions: +- '0.45': | + This is an upgrade for ZenCoding.vim: + fixed attribute parsing like: a[href="hello', world" rel]. - '0.44': | This is an upgrade for ZenCoding.vim: fixed checking whether have mapping using maparg() / hasmapto().