mirror of
https://github.com/mattn/emmet-vim.git
synced 2025-12-07 03:04:27 +08:00
Merge pull request #484 from grohiro/boolean_attr
Fix updateTag() boolean attribute
This commit is contained in:
@@ -720,11 +720,11 @@ endfunction
|
|||||||
|
|
||||||
function! emmet#lang#html#parseTag(tag) abort
|
function! emmet#lang#html#parseTag(tag) abort
|
||||||
let current = emmet#newNode()
|
let current = emmet#newNode()
|
||||||
let mx = '<\([a-zA-Z][a-zA-Z0-9]*\)\(\%(\s[a-zA-Z][a-zA-Z0-9]\+=\%([^"'' \t]\+\|"[^"]\{-}"\|''[^'']\{-}''\)\s*\)*\)\(/\{0,1}\)>'
|
let mx = '<\([a-zA-Z][a-zA-Z0-9]*\)\(\%(\s[a-zA-Z][a-zA-Z0-9]\+=\?\%([^"'' \t]\+\|"[^"]\{-}"\|''[^'']\{-}''\)\s*\)*\)\(/\{0,1}\)>'
|
||||||
let match = matchstr(a:tag, mx)
|
let match = matchstr(a:tag, mx)
|
||||||
let current.name = substitute(match, mx, '\1', 'i')
|
let current.name = substitute(match, mx, '\1', 'i')
|
||||||
let attrs = substitute(match, mx, '\2', 'i')
|
let attrs = substitute(match, mx, '\2', 'i')
|
||||||
let mx = '\([a-zA-Z0-9]\+\)=\%(\([^"'' \t]\+\)\|"\([^"]\{-}\)"\|''\([^'']\{-}\)''\)'
|
let mx = '\([a-zA-Z0-9]\+\)\(\(=[^"'' \t]\+\)\|="\([^"]\{-}\)"\|=''\([^'']\{-}\)''\)\?'
|
||||||
while len(attrs) > 0
|
while len(attrs) > 0
|
||||||
let match = matchstr(attrs, mx)
|
let match = matchstr(attrs, mx)
|
||||||
if len(match) == 0
|
if len(match) == 0
|
||||||
@@ -732,8 +732,12 @@ function! emmet#lang#html#parseTag(tag) abort
|
|||||||
endif
|
endif
|
||||||
let attr_match = matchlist(match, mx)
|
let attr_match = matchlist(match, mx)
|
||||||
let name = attr_match[1]
|
let name = attr_match[1]
|
||||||
let value = len(attr_match[2]) ? attr_match[2] : attr_match[3]
|
if len(attr_match[2])
|
||||||
let current.attr[name] = value
|
let Val = len(attr_match[3]) ? attr_match[3] : attr_match[4]
|
||||||
|
else
|
||||||
|
let Val = function('emmet#types#true')
|
||||||
|
endif
|
||||||
|
let current.attr[name] = Val
|
||||||
let current.attrs_order += [name]
|
let current.attrs_order += [name]
|
||||||
let attrs = attrs[stridx(attrs, match) + len(match):]
|
let attrs = attrs[stridx(attrs, match) + len(match):]
|
||||||
endwhile
|
endwhile
|
||||||
|
|||||||
@@ -681,6 +681,10 @@ finish
|
|||||||
'query': "<h$$$$\\<c-y>u.global\\<cr>$$$$3></h3>",
|
'query': "<h$$$$\\<c-y>u.global\\<cr>$$$$3></h3>",
|
||||||
'result': "<h3 class=\"global\"></h3>",
|
'result': "<h3 class=\"global\"></h3>",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'query': "<button$$$$\\<c-y>u.btn\\<cr>$$$$ disabled></button>",
|
||||||
|
'result': "<button class=\"btn\" disabled></button>",
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user