mirror of
https://github.com/mattn/emmet-vim.git
synced 2025-12-07 03:04:27 +08:00
no need to add cursor when has children.
This commit is contained in:
@@ -317,21 +317,25 @@ function! zencoding#lang#html#toString(settings, current, type, inline, filters,
|
||||
else
|
||||
let str .= ">"
|
||||
let str .= current.value[1:-2]
|
||||
let str .= '${cursor}'
|
||||
for n in range(len(current.child))
|
||||
let child = current.child[n]
|
||||
if len(current.child) > 0 && stridx(','.settings.html.inline_elements.',', ','.current_name.',') == -1
|
||||
if len(current.child) > 1 || stridx(','.settings.html.inline_elements.',', ','.child.name.',') == -1
|
||||
let str .= "\n" . indent
|
||||
let nc = len(current.child)
|
||||
if nc > 0
|
||||
for n in range(nc)
|
||||
let child = current.child[n]
|
||||
if stridx(','.settings.html.inline_elements.',', ','.current_name.',') == -1
|
||||
if nc > 1 || stridx(','.settings.html.inline_elements.',', ','.child.name.',') == -1
|
||||
let str .= "\n" . indent
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
let inner = zencoding#toString(child, type, 0, filters)
|
||||
let inner = substitute(inner, "\n", "\n" . indent, 'g')
|
||||
let inner = substitute(inner, "\n" . indent . '$', '', 'g')
|
||||
let str .= inner
|
||||
endfor
|
||||
if len(current.child) > 0 && stridx(','.settings.html.inline_elements.',', ','.current_name.',') == -1
|
||||
if len(current.child) > 1 || (len(current.child) == 1 && stridx(','.settings.html.inline_elements.',', ','.current.child[0].name.',') == -1)
|
||||
let inner = zencoding#toString(child, type, 0, filters)
|
||||
let inner = substitute(inner, "\n", "\n" . indent, 'g')
|
||||
let inner = substitute(inner, "\n" . indent . '$', '', 'g')
|
||||
let str .= inner
|
||||
endfor
|
||||
else
|
||||
let str .= '${cursor}'
|
||||
endif
|
||||
if nc > 0 && stridx(','.settings.html.inline_elements.',', ','.current_name.',') == -1
|
||||
if nc > 1 || (nc == 1 && stridx(','.settings.html.inline_elements.',', ','.current.child[0].name.',') == -1)
|
||||
let str .= "\n"
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -425,7 +425,7 @@ finish
|
||||
},
|
||||
{
|
||||
'query': "f div.boxes>article.box2>header>(hgroup>h2{aaa}+h3{bbb})+p{ccc}$$$$",
|
||||
'result': "f <div class=\"boxes\">\n\t<article class=\"box2\">\n\t\t<header>\n\t\t\t<hgroup>\n\t\t\t\t<h2>aaa</h2>\n\t\t\t\t<h3>bbb</h3>\n\t\t\t</hgroup>\n\t\t\t<p>ccc</p>\n\t\t</header>\n\t</article>\n</div>\n",
|
||||
'result': "f <div class=\"boxes\">\n\t<article class=\"box2\">\n\t\t<header>\n\t\t\t<hgroup>\n\t\t\t\t<h2>aaa</h2>\n\t\t\t\t<h3>bbb</h3>\n\t\t\t</hgroup>\n\t\t\t<p>ccc</p>\n\t\t</header>\n\t</article>\n</div>",
|
||||
},
|
||||
{
|
||||
'query': "div.boxes>(div.box2>section>h2{a}+p{b})+(div.box1>section>h2{c}+p{d}+p{e}+(bq>h2{f}+h3{g})+p{h})",
|
||||
|
||||
Reference in New Issue
Block a user