diff --git a/autoload/emmet/lang/html.vim b/autoload/emmet/lang/html.vim index 51b1662..47f9271 100644 --- a/autoload/emmet/lang/html.vim +++ b/autoload/emmet/lang/html.vim @@ -191,14 +191,16 @@ function! emmet#lang#html#parseIntoTree(abbr, type) endif if item[0] == '[' let atts = item[1:-2] - if matchstr(atts, '^\s*\zs[0-9a-zA-Z-:]\+\(="[^"]*"\|=''[^'']*''\|=\w\)') == '' - let keys = keys(current.attr) - if len(keys) > 0 - let current.attr[keys[0]] = atts + if matchstr(atts, '^\s*\zs[0-9a-zA-Z-:]\+\(="[^"]*"\|=''[^'']*''\|=[^ ''"]\+\)') == '' + if has_key(default_attributes, current.name) + let keys = keys(default_attributes[current.name]) + if len(keys) > 0 + let current.attr[keys[0]] = atts + endif endif else while len(atts) - let amat = matchstr(atts, '^\s*\zs\([0-9a-zA-Z-:]\+\%(="[^"]*"\|=''[^'']*''\|[^ ''"\]]*\)\{0,1}\)') + let amat = matchstr(atts, '^\s*\zs\([0-9a-zA-Z-:]\+\%(="[^"]*"\|=''[^'']*''\|=[^ ''"]\+\|[^ ''"\]]*\)\{0,1}\)') if len(amat) == 0 break endif diff --git a/unittest.vim b/unittest.vim index 6cf757f..75ec1b2 100644 --- a/unittest.vim +++ b/unittest.vim @@ -309,11 +309,11 @@ finish }, { 'query': "a[a=b][b=c=d][e]{foo}*2", - 'result': "foo\nfoo\n", + 'result': "foo\nfoo\n", }, { 'query': "a[a=b][b=c=d][e]*2{foo}", - 'result': "\n\nfoo", + 'result': "\n\nfoo", }, { 'query': "a*2{foo}a",