mirror of
https://github.com/mattn/emmet-vim.git
synced 2025-12-08 11:34:46 +08:00
fixed html tag parser.
This commit is contained in:
@@ -1194,13 +1194,16 @@ endfunction
|
|||||||
|
|
||||||
function! s:zen_parseTag(tag)
|
function! s:zen_parseTag(tag)
|
||||||
let current = { 'name': '', 'attr': {}, 'child': [], 'snippet': '', 'multiplier': 1, 'parent': {}, 'value': '', 'pos': 0 }
|
let current = { 'name': '', 'attr': {}, 'child': [], 'snippet': '', 'multiplier': 1, 'parent': {}, 'value': '', 'pos': 0 }
|
||||||
let mx = '<\([a-z][a-z0-9]*\)\(\%(\s[a-z0-9]\+=\%([^"'' \t]\+\|["''][^"'']\+["'']\)\)*\)\(/\{0,1}\)>'
|
let mx = '<\([a-z][a-z0-9]*\)\(\%(\s[a-z][a-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-z0-9]\+\)=["'']\{0,1}\([^"'' \t]\+\|[^"'']\+\)["'']\{0,1}'
|
let mx = '\([a-z0-9]\+\)=["'']\{0,1}\([^"'' \t]\+\|[^"'']\+\)["'']\{0,1}'
|
||||||
while len(attrs) > 0
|
while len(attrs) > 0
|
||||||
let match = matchstr(attrs, mx)
|
let match = matchstr(attrs, mx)
|
||||||
|
if len(match) == 0
|
||||||
|
break
|
||||||
|
endif
|
||||||
let name = substitute(match, mx, '\1', 'i')
|
let name = substitute(match, mx, '\1', 'i')
|
||||||
let value = substitute(match, mx, '\2', 'i')
|
let value = substitute(match, mx, '\2', 'i')
|
||||||
let current.attr[name] = value
|
let current.attr[name] = value
|
||||||
|
|||||||
Reference in New Issue
Block a user