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", 'type': "html",
'result': "<link media=\"all\" rel=\"stylesheet\" href=\"style.css\" type=\"text/css\" />\n", '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 " File: zencoding.vim
" Author: Yasuhiro Matsumoto <mattn.jp@gmail.com> " Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
" Last Change: 06-Sep-2010. " Last Change: 08-Oct-2010.
" Version: 0.44 " Version: 0.45
" WebPage: http://github.com/mattn/zencoding-vim " WebPage: http://github.com/mattn/zencoding-vim
" Description: vim plugins for HTML and CSS hi-speed coding. " Description: vim plugins for HTML and CSS hi-speed coding.
" SeeAlso: http://code.google.com/p/zen-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') let current.attr.class = substitute(item[1:], '\.', ' ', 'g')
endif endif
if item[0] == '[' if item[0] == '['
let kks = split(item[1:-2], ' ') let atts = item[1:-2]
for kki in kks while len(atts)
let kk = split(kki, '=') let amat = matchstr(atts, '\(\w\+\%(="[^"]*"\|=''[^'']*''\|[^ ''"\]]*\)\{0,1}\)')
let current.attr[kk[0]] = len(kk) > 1 ? join(kk[1:], '=') : '' if len(amat) == 0
endfor 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 endif
let attr = substitute(strpart(attr, len(item)), '^\s*', '', '') let attr = substitute(strpart(attr, len(item)), '^\s*', '', '')
endwhile endwhile

View File

@@ -2,7 +2,7 @@ script_name: ZenCoding.vim
script_id: '2981' script_id: '2981'
script_type: utility script_type: utility
script_package: zencoding.vim script_package: zencoding.vim
script_version: '0.44' script_version: '0.45'
required_vim_version: '7.0' required_vim_version: '7.0'
summary: vim plugins for HTML and CSS hi-speed coding. summary: vim plugins for HTML and CSS hi-speed coding.
@@ -95,6 +95,9 @@ install_details: |
copy zencoding.vim to your plugin directory. copy zencoding.vim to your plugin directory.
versions: versions:
- '0.45': |
This is an upgrade for ZenCoding.vim:
fixed attribute parsing like: a[href="hello', world" rel].
- '0.44': | - '0.44': |
This is an upgrade for ZenCoding.vim: This is an upgrade for ZenCoding.vim:
fixed checking whether have mapping using maparg() / hasmapto(). fixed checking whether have mapping using maparg() / hasmapto().