diff --git a/autoload/emmet/lang/html.vim b/autoload/emmet/lang/html.vim
index 693032d..328145f 100644
--- a/autoload/emmet/lang/html.vim
+++ b/autoload/emmet/lang/html.vim
@@ -191,27 +191,34 @@ function! emmet#lang#html#parseIntoTree(abbr, type)
endif
if item[0] == '['
let atts = item[1:-2]
- while len(atts)
- let amat = matchstr(atts, '\([0-9a-zA-Z-:]\+\%(="[^"]*"\|=''[^'']*''\|[^ ''"\]]*\)\{0,1}\)')
- if len(amat) == 0
- break
+ if matchstr(atts, '^\s*\([0-9a-zA-Z-:]\+\%(="[^"]*"\|=''[^'']*''\|[^ ''"\]]*\)\{0,1}\)') == ''
+ let keys = keys(current.attr)
+ if len(keys) > 0
+ let current.attr[keys[0]] = atts
endif
- let key = split(amat, '=')[0]
- let Val = amat[len(key)+1:]
- if key =~ '\.$' && Val == ''
- let key = key[:-2]
+ else
+ while len(atts)
+ let amat = matchstr(atts, '^\s*\zs\([0-9a-zA-Z-:]\+\%(="[^"]*"\|=''[^'']*''\|[^ ''"\]]*\)\{0,1}\)')
+ if len(amat) == 0
+ break
+ endif
+ let key = split(amat, '=')[0]
+ let Val = amat[len(key)+1:]
+ if key =~ '\.$' && Val == ''
+ let key = key[:-2]
+ unlet Val
+ let Val = function('emmet#types#true')
+ elseif Val =~ '^["'']'
+ let Val = Val[1:-2]
+ endif
+ let current.attr[key] = Val
+ if index(current.attrs_order, key) == -1
+ let current.attrs_order += [key]
+ endif
+ let atts = atts[stridx(atts, amat) + len(amat):]
unlet Val
- let Val = function('emmet#types#true')
- elseif Val =~ '^["'']'
- let Val = Val[1:-2]
- endif
- let current.attr[key] = Val
- if index(current.attrs_order, key) == -1
- let current.attrs_order += [key]
- endif
- let atts = atts[stridx(atts, amat) + len(amat):]
- unlet Val
- endwhile
+ endwhile
+ endif
endif
let attr = substitute(strpart(attr, len(item)), '^\s*', '', '')
endwhile
diff --git a/unittest.vim b/unittest.vim
index f5f6b94..6cf757f 100644
--- a/unittest.vim
+++ b/unittest.vim
@@ -1,3 +1,4 @@
+" {{{
let s:sfile = expand('')
function! s:reload(d)
@@ -192,10 +193,11 @@ command! -nargs=* -complete=customlist,g:emmet_unittest_complete EmmetUnitTest c
if s:sfile == expand('%:p')
EmmetUnitTest
endif
+" }}}
finish
[
-{
+{ 'test-html': "{{{",
'type': "html",
'categories': [
{
@@ -580,6 +582,15 @@ finish
},
],
},
+ {
+ 'name': 'default attributes',
+ 'tests': [
+ {
+ 'query': "p.title>a[/hoge/]",
+ 'result': "
\n",
+ },
+ ],
+ },
{
'name': 'multiple group',
'tests': [
@@ -603,8 +614,8 @@ finish
],
},
],
-},
-{
+ 'dummy': "}}}"},
+{ 'test-css': '{{{',
'type': 'css',
'categories': [
{
@@ -689,8 +700,8 @@ finish
],
},
],
-},
-{
+ 'dummy': "}}}"},
+{ 'test-haml': '{{{',
'type': 'haml',
'categories': [
{
@@ -745,8 +756,8 @@ finish
],
},
],
-},
-{
+ 'dummy': "}}}"},
+{ 'test-slim': "{{{",
'type': 'slim',
'categories': [
{
@@ -801,8 +812,8 @@ finish
],
},
],
-},
-{
+ 'dummy': "}}}"},
+{ 'test-xsl': "{{{",
'type': 'xsl',
'categories': [
{
@@ -819,8 +830,8 @@ finish
],
},
],
-},
-{
+ 'dummy': "}}}"},
+{ 'test-xsd': "{{{",
'type': 'xsd',
'categories': [
{
@@ -833,8 +844,8 @@ finish
],
},
],
-},
-{
+ 'dummy': "}}}"},
+{ 'test-mustache': "{{{",
'type': 'mustache',
'categories': [
{
@@ -851,8 +862,8 @@ finish
],
},
],
-},
-{
+ 'dummy': "}}}"},
+{ 'test-sass': "{{{",
'type': 'sass',
'categories': [
{
@@ -937,6 +948,6 @@ finish
],
},
],
-},
+ 'dummy': "}}}"},
]
-" vim:set et:
+" vim:set et fdm=marker: