mirror of
https://github.com/mattn/emmet-vim.git
synced 2025-12-08 11:34:46 +08:00
Fix default attributes
This commit is contained in:
@@ -191,14 +191,16 @@ function! emmet#lang#html#parseIntoTree(abbr, type)
|
|||||||
endif
|
endif
|
||||||
if item[0] == '['
|
if item[0] == '['
|
||||||
let atts = item[1:-2]
|
let atts = item[1:-2]
|
||||||
if matchstr(atts, '^\s*\zs[0-9a-zA-Z-:]\+\(="[^"]*"\|=''[^'']*''\|=\w\)') == ''
|
if matchstr(atts, '^\s*\zs[0-9a-zA-Z-:]\+\(="[^"]*"\|=''[^'']*''\|=[^ ''"]\+\)') == ''
|
||||||
let keys = keys(current.attr)
|
if has_key(default_attributes, current.name)
|
||||||
if len(keys) > 0
|
let keys = keys(default_attributes[current.name])
|
||||||
let current.attr[keys[0]] = atts
|
if len(keys) > 0
|
||||||
|
let current.attr[keys[0]] = atts
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
while len(atts)
|
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
|
if len(amat) == 0
|
||||||
break
|
break
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -309,11 +309,11 @@ finish
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'query': "a[a=b][b=c=d][e]{foo}*2",
|
'query': "a[a=b][b=c=d][e]{foo}*2",
|
||||||
'result': "<a href=\"\" a=\"b\" b=\"c=d\" e=\"\">foo</a>\n<a href=\"\" a=\"b\" b=\"c=d\" e=\"\">foo</a>\n",
|
'result': "<a href=\"e\" a=\"b\" b=\"c=d\">foo</a>\n<a href=\"e\" a=\"b\" b=\"c=d\">foo</a>\n",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'query': "a[a=b][b=c=d][e]*2{foo}",
|
'query': "a[a=b][b=c=d][e]*2{foo}",
|
||||||
'result': "<a href=\"\" a=\"b\" b=\"c=d\" e=\"\"></a>\n<a href=\"\" a=\"b\" b=\"c=d\" e=\"\"></a>\nfoo",
|
'result': "<a href=\"e\" a=\"b\" b=\"c=d\"></a>\n<a href=\"e\" a=\"b\" b=\"c=d\"></a>\nfoo",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'query': "a*2{foo}a",
|
'query': "a*2{foo}a",
|
||||||
|
|||||||
Reference in New Issue
Block a user