mirror of
https://github.com/mattn/emmet-vim.git
synced 2025-12-08 19:44:47 +08:00
fix re-set parent of brother node. all tests are passed again!
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
"=============================================================================
|
"=============================================================================
|
||||||
" zencoding.vim
|
" zencoding.vim
|
||||||
" Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
|
" Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
|
||||||
" Last Change: 01-Jun-2012.
|
" Last Change: 02-Jun-2012.
|
||||||
|
|
||||||
let s:save_cpo = &cpo
|
let s:save_cpo = &cpo
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
|
|||||||
@@ -218,6 +218,7 @@ function! zencoding#lang#html#parseIntoTree(abbr, type)
|
|||||||
break
|
break
|
||||||
endif
|
endif
|
||||||
let parent = tmp
|
let parent = tmp
|
||||||
|
let current.parent = tmp
|
||||||
endfor
|
endfor
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -301,8 +302,10 @@ function! zencoding#lang#html#toString(settings, current, type, inline, filters,
|
|||||||
let current_name = substitute(current.name, '\$$', itemno+1, '')
|
let current_name = substitute(current.name, '\$$', itemno+1, '')
|
||||||
|
|
||||||
if len(current.parent.name) > 0 && current.multiplier > 0 && stridx(','.settings.html.inline_elements.',', ','.current_name.',') == -1
|
if len(current.parent.name) > 0 && current.multiplier > 0 && stridx(','.settings.html.inline_elements.',', ','.current_name.',') == -1
|
||||||
|
if current.parent.multiplier > 0
|
||||||
let str .= "\n"
|
let str .= "\n"
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
let tmp = '<' . current_name
|
let tmp = '<' . current_name
|
||||||
for attr in keys(current.attr)
|
for attr in keys(current.attr)
|
||||||
@@ -365,7 +368,7 @@ function! zencoding#lang#html#toString(settings, current, type, inline, filters,
|
|||||||
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 .= " />"
|
||||||
else
|
else
|
||||||
let str .= ">" . inner . '${cursor}</' . current_name . ">"
|
let str .= ">" . inner . '${cursor}</' . current_name . ">"
|
||||||
endif
|
endif
|
||||||
|
|||||||
12
unittest.vim
12
unittest.vim
@@ -321,15 +321,13 @@ finish
|
|||||||
'name': "a>b>i<<b",
|
'name': "a>b>i<<b",
|
||||||
'query': "a>b>i<<b",
|
'query': "a>b>i<<b",
|
||||||
'type': "html",
|
'type': "html",
|
||||||
'result': "<a href=\"\"><b><i></i></b></a>\n<b></b>",
|
'result': "<a href=\"\"><b><i></i></b></a>\n<b></b>\n",
|
||||||
'skip': 0,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': "blockquote>b>i<<b",
|
'name': "blockquote>b>i<<b",
|
||||||
'query': "blockquote>b>i<<b",
|
'query': "blockquote>b>i<<b",
|
||||||
'type': "html",
|
'type': "html",
|
||||||
'result': "<blockquote><b><i></i></b></blockquote>\n<b></b>",
|
'result': "<blockquote><b><i></i></b></blockquote>\n<b></b>\n",
|
||||||
'skip': 0,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': "a[href=foo][class=bar]",
|
'name': "a[href=foo][class=bar]",
|
||||||
@@ -414,7 +412,6 @@ finish
|
|||||||
'query': "#header>li<#content",
|
'query': "#header>li<#content",
|
||||||
'type': "html",
|
'type': "html",
|
||||||
'result': "<div id=\"header\">\n\t<li></li>\n</div>\n<div id=\"content\"></div>\n",
|
'result': "<div id=\"header\">\n\t<li></li>\n</div>\n<div id=\"content\"></div>\n",
|
||||||
'skip': 1,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': "(#header>li)<#content",
|
'name': "(#header>li)<#content",
|
||||||
@@ -427,7 +424,6 @@ finish
|
|||||||
'query': "a>b>i<<div",
|
'query': "a>b>i<<div",
|
||||||
'type': "html",
|
'type': "html",
|
||||||
'result': "<a href=\"\"><b><i></i></b></a>\n<div></div>\n",
|
'result': "<a href=\"\"><b><i></i></b></a>\n<div></div>\n",
|
||||||
'skip': 1,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': "(#header>h1)+#content+#footer",
|
'name': "(#header>h1)+#content+#footer",
|
||||||
@@ -439,8 +435,7 @@ finish
|
|||||||
'name': "(#header>h1)+(#content>(#main>h2+div#entry$.section*5>(h3>a)+div>p*3+ul+)+(#utilities))+(#footer>address)",
|
'name': "(#header>h1)+(#content>(#main>h2+div#entry$.section*5>(h3>a)+div>p*3+ul+)+(#utilities))+(#footer>address)",
|
||||||
'query': "(#header>h1)+(#content>(#main>h2+div#entry$.section*5>(h3>a)+div>p*3+ul+)+(#utilities))+(#footer>address)",
|
'query': "(#header>h1)+(#content>(#main>h2+div#entry$.section*5>(h3>a)+div>p*3+ul+)+(#utilities))+(#footer>address)",
|
||||||
'type': "html",
|
'type': "html",
|
||||||
'result': "<div id=\"header\">\n\t<h1></h1>\n</div>\n<div id=\"content\">\n\t<div id=\"main\">\n\t\t<h2></h2>\n\t\t<div id=\"entry1\" class=\"section\">\n\t\t\t<h3>\n\t\t\t\t<a href=\"\"></a>\n\t\t\t</h3>\n\t\t\t<div>\n\t\t\t\t<p></p>\n\t\t\t\t<p></p>\n\t\t\t\t<p></p>\n\t\t\t\t<ul>\n\t\t\t\t\t<li></li>\n\t\t\t\t</ul>\n\t\t\t</div>\n\t\t</div>\n\t\t<div id=\"entry2\" class=\"section\">\n\t\t\t<h3>\n\t\t\t\t<a href=\"\"></a>\n\t\t\t</h3>\n\t\t\t<div>\n\t\t\t\t<p></p>\n\t\t\t\t<p></p>\n\t\t\t\t<p></p>\n\t\t\t\t<ul>\n\t\t\t\t\t<li></li>\n\t\t\t\t</ul>\n\t\t\t</div>\n\t\t</div>\n\t\t<div id=\"entry3\" class=\"section\">\n\t\t\t<h3>\n\t\t\t\t<a href=\"\"></a>\n\t\t\t</h3>\n\t\t\t<div>\n\t\t\t\t<p></p>\n\t\t\t\t<p></p>\n\t\t\t\t<p></p>\n\t\t\t\t<ul>\n\t\t\t\t\t<li></li>\n\t\t\t\t</ul>\n\t\t\t</div>\n\t\t</div>\n\t\t<div id=\"entry4\" class=\"section\">\n\t\t\t<h3>\n\t\t\t\t<a href=\"\"></a>\n\t\t\t</h3>\n\t\t\t<div>\n\t\t\t\t<p></p>\n\t\t\t\t<p></p>\n\t\t\t\t<p></p>\n\t\t\t\t<ul>\n\t\t\t\t\t<li></li>\n\t\t\t\t</ul>\n\t\t\t</div>\n\t\t</div>\n\t\t<div id=\"entry5\" class=\"section\">\n\t\t\t<h3>\n\t\t\t\t<a href=\"\"></a>\n\t\t\t</h3>\n\t\t\t<div>\n\t\t\t\t<p></p>\n\t\t\t\t<p></p>\n\t\t\t\t<p></p>\n\t\t\t\t<ul>\n\t\t\t\t\t<li></li>\n\t\t\t\t</ul>\n\t\t\t</div>\n\t\t</div>\n\t</div>\n\t<div id=\"utilities\"></div>\n</div>\n<div id=\"footer\">\n\t<address></address>\n</div>\n",
|
'result': "<div id=\"header\">\n\t<h1></h1>\n</div>\n<div id=\"content\">\n\t<div id=\"main\">\n\t\t<h2></h2>\n\t\t<div id=\"entry1\" class=\"section\">\n\t\t\t<h3><a href=\"\"></a></h3>\n\t\t\t<div>\n\t\t\t\t<p></p>\n\t\t\t\t<p></p>\n\t\t\t\t<p></p>\n\t\t\t\t<ul>\n\t\t\t\t\t<li></li>\n\t\t\t\t</ul>\n\t\t\t</div>\n\t\t</div>\n\t\t<div id=\"entry2\" class=\"section\">\n\t\t\t<h3><a href=\"\"></a></h3>\n\t\t\t<div>\n\t\t\t\t<p></p>\n\t\t\t\t<p></p>\n\t\t\t\t<p></p>\n\t\t\t\t<ul>\n\t\t\t\t\t<li></li>\n\t\t\t\t</ul>\n\t\t\t</div>\n\t\t</div>\n\t\t<div id=\"entry3\" class=\"section\">\n\t\t\t<h3><a href=\"\"></a></h3>\n\t\t\t<div>\n\t\t\t\t<p></p>\n\t\t\t\t<p></p>\n\t\t\t\t<p></p>\n\t\t\t\t<ul>\n\t\t\t\t\t<li></li>\n\t\t\t\t</ul>\n\t\t\t</div>\n\t\t</div>\n\t\t<div id=\"entry4\" class=\"section\">\n\t\t\t<h3><a href=\"\"></a></h3>\n\t\t\t<div>\n\t\t\t\t<p></p>\n\t\t\t\t<p></p>\n\t\t\t\t<p></p>\n\t\t\t\t<ul>\n\t\t\t\t\t<li></li>\n\t\t\t\t</ul>\n\t\t\t</div>\n\t\t</div>\n\t\t<div id=\"entry5\" class=\"section\">\n\t\t\t<h3><a href=\"\"></a></h3>\n\t\t\t<div>\n\t\t\t\t<p></p>\n\t\t\t\t<p></p>\n\t\t\t\t<p></p>\n\t\t\t\t<ul>\n\t\t\t\t\t<li></li>\n\t\t\t\t</ul>\n\t\t\t</div>\n\t\t</div>\n\t</div>\n\t<div id=\"utilities\"></div>\n</div>\n<div id=\"footer\">\n\t<address></address>\n</div>\n",
|
||||||
'skip': 1,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': "(div>(ul*2)*2)+(#utilities)",
|
'name': "(div>(ul*2)*2)+(#utilities)",
|
||||||
@@ -489,7 +484,6 @@ finish
|
|||||||
'query': "link:css",
|
'query': "link:css",
|
||||||
'type': "html",
|
'type': "html",
|
||||||
'result': "<link media=\"all\" rel=\"stylesheet\" href=\"style.css\" type=\"text/css\" />\n",
|
'result': "<link media=\"all\" rel=\"stylesheet\" href=\"style.css\" type=\"text/css\" />\n",
|
||||||
'skip': 1,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': "a[title=\"Hello', world\" rel]",
|
'name': "a[title=\"Hello', world\" rel]",
|
||||||
|
|||||||
Reference in New Issue
Block a user