mirror of
https://github.com/mattn/emmet-vim.git
synced 2025-12-06 18:54:27 +08:00
fixed conversion of tag name like h${sometext}*3.
This commit is contained in:
@@ -69,7 +69,7 @@ function! s:zen_parseIntoTree(abbr, type)
|
|||||||
let rabbr = substitute(abbr, '\([a-zA-Z][a-zA-Z0-9+]*\)+\([()]\|$\)', '\="(".s:zen_getExpandos(type, submatch(1)).")".submatch(2)', 'i')
|
let rabbr = substitute(abbr, '\([a-zA-Z][a-zA-Z0-9+]*\)+\([()]\|$\)', '\="(".s:zen_getExpandos(type, submatch(1)).")".submatch(2)', 'i')
|
||||||
endif
|
endif
|
||||||
let abbr = rabbr
|
let abbr = rabbr
|
||||||
let mx = '\([+>]\|<\+\)\{-}\s*\((*\)\{-}\s*\([@#.]\{-}[a-zA-Z\!][a-zA-Z0-9:\!\-]*\|{[^}]\+}\)\(\%(\%(#{[{}a-zA-Z0-9_\-\$]\+\|#[a-zA-Z0-9_\-\$]\+\)\|\%(\[[^\]]\+\]\)\|\%(\.{[{}a-zA-Z0-9_\-\$]\+\|\.[a-zA-Z0-9_\-\$]\+\)\)*\)\%(\({[^}]\+}\)\)\{0,1}\%(\s*\*\s*\([0-9]\+\)\s*\)\{0,1}\(\%(\s*)\%(\s*\*\s*[0-9]\+\s*\)\{0,1}\)*\)'
|
let mx = '\([+>]\|<\+\)\{-}\s*\((*\)\{-}\s*\([@#.]\{-}[a-zA-Z\!][a-zA-Z0-9:\!\-$]*\|{[^}]\+}\)\(\%(\%(#{[{}a-zA-Z0-9_\-\$]\+\|#[a-zA-Z0-9_\-\$]\+\)\|\%(\[[^\]]\+\]\)\|\%(\.{[{}a-zA-Z0-9_\-\$]\+\|\.[a-zA-Z0-9_\-\$]\+\)\)*\)\%(\({[^}]\+}\)\)\{0,1}\%(\s*\*\s*\([0-9]\+\)\s*\)\{0,1}\(\%(\s*)\%(\s*\*\s*[0-9]\+\s*\)\{0,1}\)*\)'
|
||||||
else
|
else
|
||||||
let mx = '\([+>]\|<\+\)\{-}\s*\((*\)\{-}\s*\([@#.]\{-}[a-zA-Z\!][a-zA-Z0-9:\!\+\-]*\|{[^}]\+}\)\(\%(\%(#{[{}a-zA-Z0-9_\-\$]\+\|#[a-zA-Z0-9_\-\$]\+\)\|\%(\[[^\]]\+\]\)\|\%(\.{[{}a-zA-Z0-9_\-\$]\+\|\.[a-zA-Z0-9_\-\$]\+\)\)*\)\%(\({[^}]\+}\)\)\{0,1}\%(\s*\*\s*\([0-9]\+\)\s*\)\{0,1}\(\%(\s*)\%(\s*\*\s*[0-9]\+\s*\)\{0,1}\)*\)'
|
let mx = '\([+>]\|<\+\)\{-}\s*\((*\)\{-}\s*\([@#.]\{-}[a-zA-Z\!][a-zA-Z0-9:\!\+\-]*\|{[^}]\+}\)\(\%(\%(#{[{}a-zA-Z0-9_\-\$]\+\|#[a-zA-Z0-9_\-\$]\+\)\|\%(\[[^\]]\+\]\)\|\%(\.{[{}a-zA-Z0-9_\-\$]\+\|\.[a-zA-Z0-9_\-\$]\+\)\)*\)\%(\({[^}]\+}\)\)\{0,1}\%(\s*\*\s*\([0-9]\+\)\s*\)\{0,1}\(\%(\s*)\%(\s*\*\s*[0-9]\+\s*\)\{0,1}\)*\)'
|
||||||
endif
|
endif
|
||||||
@@ -257,17 +257,17 @@ function! s:zen_parseIntoTree(abbr, type)
|
|||||||
let abbr = abbr[stridx(abbr, match) + len(match):]
|
let abbr = abbr[stridx(abbr, match) + len(match):]
|
||||||
|
|
||||||
if g:zencoding_debug > 1
|
if g:zencoding_debug > 1
|
||||||
echo "str=".str
|
echomsg "str=".str
|
||||||
echo "block_start=".block_start
|
echomsg "block_start=".block_start
|
||||||
echo "tag_name=".tag_name
|
echomsg "tag_name=".tag_name
|
||||||
echo "operator=".operator
|
echomsg "operator=".operator
|
||||||
echo "attributes=".attributes
|
echomsg "attributes=".attributes
|
||||||
echo "value=".value
|
echomsg "value=".value
|
||||||
echo "multiplier=".multiplier
|
echomsg "multiplier=".multiplier
|
||||||
echo "block_end=".block_end
|
echomsg "block_end=".block_end
|
||||||
echo "abbr=".abbr
|
echomsg "abbr=".abbr
|
||||||
echo "pos=".string(pos)
|
echomsg "pos=".string(pos)
|
||||||
echo "\n"
|
echomsg "---"
|
||||||
endif
|
endif
|
||||||
endwhile
|
endwhile
|
||||||
return root
|
return root
|
||||||
@@ -339,8 +339,10 @@ function! s:zen_toString_haml(settings, current, type, inline, filters, itemno,
|
|||||||
|
|
||||||
let comment_indent = ''
|
let comment_indent = ''
|
||||||
let comment = ''
|
let comment = ''
|
||||||
|
let current_name = current.name
|
||||||
|
let current_name = substitute(current.name, '\$$', itemno+1, '')
|
||||||
if len(current.name) > 0
|
if len(current.name) > 0
|
||||||
let str .= '%' . current.name
|
let str .= '%' . current_name
|
||||||
let tmp = ''
|
let tmp = ''
|
||||||
for attr in keys(current.attr)
|
for attr in keys(current.attr)
|
||||||
let val = current.attr[attr]
|
let val = current.attr[attr]
|
||||||
@@ -361,7 +363,7 @@ function! s:zen_toString_haml(settings, current, type, inline, filters, itemno,
|
|||||||
if len(tmp)
|
if len(tmp)
|
||||||
let str .= '{' . tmp . ' }'
|
let str .= '{' . tmp . ' }'
|
||||||
endif
|
endif
|
||||||
if stridx(','.settings.html.empty_elements.',', ','.current.name.',') != -1 && len(current.value) == 0
|
if stridx(','.settings.html.empty_elements.',', ','.current_name.',') != -1 && len(current.value) == 0
|
||||||
let str .= "/"
|
let str .= "/"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -407,9 +409,11 @@ function! s:zen_toString_html(settings, current, type, inline, filters, itemno,
|
|||||||
if s:zen_useFilter(filters, 'c')
|
if s:zen_useFilter(filters, 'c')
|
||||||
let comment_indent = substitute(str, '^.*\(\s*\)$', '\1', '')
|
let comment_indent = substitute(str, '^.*\(\s*\)$', '\1', '')
|
||||||
endif
|
endif
|
||||||
let tmp = '<' . current.name
|
let current_name = current.name
|
||||||
|
let current_name = substitute(current.name, '\$$', itemno+1, '')
|
||||||
|
let tmp = '<' . current_name
|
||||||
for attr in keys(current.attr)
|
for attr in keys(current.attr)
|
||||||
if current.name =~ '^\(xsl:with-param\|xsl:variable\)$' && s:zen_useFilter(filters, 'xsl') && len(current.child) && attr == 'select'
|
if current_name =~ '^\(xsl:with-param\|xsl:variable\)$' && s:zen_useFilter(filters, 'xsl') && len(current.child) && attr == 'select'
|
||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
let val = current.attr[attr]
|
let val = current.attr[attr]
|
||||||
@@ -429,7 +433,7 @@ function! s:zen_toString_html(settings, current, type, inline, filters, itemno,
|
|||||||
endif
|
endif
|
||||||
let str .= tmp
|
let str .= tmp
|
||||||
let inner = current.value[1:-2]
|
let inner = current.value[1:-2]
|
||||||
if stridx(','.settings.html.inline_elements.',', ','.current.name.',') != -1
|
if stridx(','.settings.html.inline_elements.',', ','.current_name.',') != -1
|
||||||
let child_inline = 1
|
let child_inline = 1
|
||||||
else
|
else
|
||||||
let child_inline = 0
|
let child_inline = 0
|
||||||
@@ -442,43 +446,43 @@ function! s:zen_toString_html(settings, current, type, inline, filters, itemno,
|
|||||||
let inner .= html
|
let inner .= html
|
||||||
endfor
|
endfor
|
||||||
if len(current.child) == 1 && current.child[0].name == ''
|
if len(current.child) == 1 && current.child[0].name == ''
|
||||||
if stridx(','.settings.html.inline_elements.',', ','.current.name.',') == -1
|
if stridx(','.settings.html.inline_elements.',', ','.current_name.',') == -1
|
||||||
let str .= ">" . inner . "</" . current.name . ">\n"
|
let str .= ">" . inner . "</" . current_name . ">\n"
|
||||||
else
|
else
|
||||||
let str .= ">" . inner . "</" . current.name . ">"
|
let str .= ">" . inner . "</" . current_name . ">"
|
||||||
endif
|
endif
|
||||||
elseif len(current.child)
|
elseif len(current.child)
|
||||||
if inline == 0
|
if inline == 0
|
||||||
if stridx(','.settings.html.inline_elements.',', ','.current.name.',') == -1
|
if stridx(','.settings.html.inline_elements.',', ','.current_name.',') == -1
|
||||||
if inner =~ "\n$"
|
if inner =~ "\n$"
|
||||||
let inner = substitute(inner, "\n", "\n" . indent, 'g')
|
let inner = substitute(inner, "\n", "\n" . indent, 'g')
|
||||||
let inner = substitute(inner, indent . "$", "", 'g')
|
let inner = substitute(inner, indent . "$", "", 'g')
|
||||||
let str .= ">\n" . indent . inner . "</" . current.name . ">\n"
|
let str .= ">\n" . indent . inner . "</" . current_name . ">\n"
|
||||||
else
|
else
|
||||||
let str .= ">\n" . indent . inner . indent . "\n</" . current.name . ">\n"
|
let str .= ">\n" . indent . inner . indent . "\n</" . current_name . ">\n"
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
let str .= ">" . inner . "</" . current.name . ">\n"
|
let str .= ">" . inner . "</" . current_name . ">\n"
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
let str .= ">" . inner . "</" . current.name . ">"
|
let str .= ">" . inner . "</" . current_name . ">"
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
if inline == 0
|
if inline == 0
|
||||||
if stridx(','.settings.html.empty_elements.',', ','.current.name.',') != -1
|
if stridx(','.settings.html.empty_elements.',', ','.current_name.',') != -1
|
||||||
let str .= " />\n"
|
let str .= " />\n"
|
||||||
else
|
else
|
||||||
if stridx(','.settings.html.inline_elements.',', ','.current.name.',') == -1 && len(current.child)
|
if stridx(','.settings.html.inline_elements.',', ','.current_name.',') == -1 && len(current.child)
|
||||||
let str .= ">\n" . inner . '${cursor}</' . current.name . ">\n"
|
let str .= ">\n" . inner . '${cursor}</' . current_name . ">\n"
|
||||||
else
|
else
|
||||||
let str .= ">" . inner . '${cursor}</' . current.name . ">\n"
|
let str .= ">" . inner . '${cursor}</' . current_name . ">\n"
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
if stridx(','.settings.html.empty_elements.',', ','.current.name.',') != -1
|
if stridx(','.settings.html.empty_elements.',', ','.current_name.',') != -1
|
||||||
let str .= " />"
|
let str .= " />"
|
||||||
else
|
else
|
||||||
let str .= ">" . inner . '${cursor}</' . current.name . ">"
|
let str .= ">" . inner . '${cursor}</' . current_name . ">"
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|||||||
Reference in New Issue
Block a user