fixed issue #11

This commit is contained in:
mattn
2010-10-08 10:40:34 +09:00
parent feb6b8ca14
commit 5ed0a7e599
3 changed files with 26 additions and 8 deletions

View File

@@ -341,6 +341,12 @@ finish
'type': "html",
'result': "<link media=\"all\" rel=\"stylesheet\" href=\"style.css\" type=\"text/css\" />\n",
},
{
'name': "a[title=\"Hello', world\" rel]",
'query': "a[title=\"Hello', world\" rel]",
'type': "html",
'result': "<a rel=\"\" href=\"\" title=\"Hello', world\"></a>\n",
},
],
},
{

View File

@@ -1,8 +1,8 @@
"=============================================================================
" File: zencoding.vim
" Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
" 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

View File

@@ -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().