emmet.snippets
emmet.snippets copied to clipboard
Default attribute mangling like b'attr'=""
Default attributes somehow upon expansion become prefixed with b
and single-quoted, e.g. img becomes <img b'src'="" b'alt'=""></img>
.
We can see same thing in the test output:
#
html: pass
(jumps) html: pass
html>body: pass
(jumps) html>body: pass
html>body>p: pass
(jumps) html>body>p: pass
html+body: pass
(jumps) html+body: pass
html>body>p^head: pass
(jumps) html>body>p^head: pass
html>body>p^head^html2: pass
(jumps) html>body>p^head^html2: pass
html>body>p^^head: pass
(jumps) html>body>p^^head: pass
html>body>p>p^^^head: pass
(jumps) html>body>p>p^^^head: pass
html#html: pass
(jumps) html#html: pass
html#top>body#bottom: pass
(jumps) html#top>body#bottom: pass
html.html: pass
(jumps) html.html: pass
html.top>body.bottom: pass
(jumps) html.top>body.bottom: pass
html.top>body.bottom.right: pass
(jumps) html.top>body.bottom.right: pass
html.top#html>body.bottom#body: pass
(jumps) html.top#html>body.bottom#body: pass
html.top.left#html>body.bottom#body: pass
(jumps) html.top.left#html>body.bottom#body: pass
html*3: pass
(jumps) html*3: pass
html*2>body: pass
(jumps) html*2>body: pass
html*2>body*2: pass
(jumps) html*2>body*2: pass
html*2>body>h1: pass
(jumps) html*2>body>h1: pass
html*2>body#body: pass
(jumps) html*2>body#body: pass
html*2>body>h1#h1: pass
(jumps) html*2>body>h1#h1: pass
html*2>body#body>h1#h1: pass
(jumps) html*2>body#body>h1#h1: pass
html*2>body#body.exer: pass
(jumps) html*2>body#body.exer: pass
html*2>body#body.exer.cise: pass
(jumps) html*2>body#body.exer.cise: pass
html*2>body^html2: pass
(jumps) html*2>body^html2: pass
html*2>body>h1^html2: pass
(jumps) html*2>body>h1^html2: pass
html*2>body>h1^^html2: pass
(jumps) html*2>body>h1^^html2: pass
ul>li.item$*1: pass
(jumps) ul>li.item$*1: pass
ul>li.item$$*1: pass
(jumps) ul>li.item$$*1: pass
ul>li.item$*2: pass
(jumps) ul>li.item$*2: pass
ul>li.item$$*2: pass
(jumps) ul>li.item$$*2: pass
ul>li.it$em$*2: pass
(jumps) ul>li.it$em$*2: pass
ul*2>li.item$*2: pass
(jumps) ul*2>li.item$*2: pass
html{text}: pass
(jumps) html{text}: pass
html{text$}: pass
(jumps) html{text$}: pass
html{text$}>body: pass
(jumps) html{text$}>body: pass
html{text$}>body>p{text$}^head: pass
(jumps) html{text$}>body>p{text$}^head: pass
ul*2>li.item$*2{item nr. $}: pass
(jumps) ul*2>li.item$*2{item nr. $}: pass
td.test[title colspan=3]: pass
(jumps) td.test[title colspan=3]: pass
td.test[title="nr $" colspan=3]: pass
(jumps) td.test[title="nr $" colspan=3]: pass
a[href="nr$"]: failure
---------------- got:
<a b'href'="" href="nr1"></a>
---------------- expected:
<a href="nr1"></a>
----------------
(jumps) a[href="nr$"]: failure
---------------- got:
<a b'href'="$2" href="${3:nr1}">$4</a>
---------------- expected:
<a href="${2:nr1}">$3</a>
----------------
td.test[title="Hello world!" colspan=3]: pass
(jumps) td.test[title="Hello world!" colspan=3]: pass
td.test[title="Hello world!" colspan=$]*3: pass
(jumps) td.test[title="Hello world!" colspan=$]*3: pass
tr*2>td{my text$}*3: pass
(jumps) tr*2>td{my text$}*3: pass
tr*2>td.test[title="Hello world!" colspan=$]*3: pass
(jumps) tr*2>td.test[title="Hello world!" colspan=$]*3: pass
a: failure
---------------- got:
<a b'href'=""></a>
---------------- expected:
<a href=""></a>
----------------
(jumps) a: failure
---------------- got:
<a b'href'="$2">$3</a>
---------------- expected:
<a href="$2">$3</a>
----------------
link: failure
Traceback (most recent call last):
File "/home/mher/.vim/plugged/emmet.snippets/pythonx/test_emmet.py", line 223, in test_write
r = str(e)
File "/home/mher/.vim/plugged/emmet.snippets/pythonx/emmet.py", line 372, in __str__
return self.tostr(Jumpcount())
File "/home/mher/.vim/plugged/emmet.snippets/pythonx/emmet.py", line 378, in tostr
return '\n'.join([t.tostr(jm) for t in self.children])
File "/home/mher/.vim/plugged/emmet.snippets/pythonx/emmet.py", line 378, in <listcomp>
return '\n'.join([t.tostr(jm) for t in self.children])
File "/home/mher/.vim/plugged/emmet.snippets/pythonx/emmet.py", line 284, in tostr
attrs = (' ' if self.attributes else '') + ' '.join(map(lambda a: a.tostr(jm, mul=_mul), self.attributes))
File "/home/mher/.vim/plugged/emmet.snippets/pythonx/emmet.py", line 284, in <lambda>
attrs = (' ' if self.attributes else '') + ' '.join(map(lambda a: a.tostr(jm, mul=_mul), self.attributes))
File "/home/mher/.vim/plugged/emmet.snippets/pythonx/emmet.py", line 151, in tostr
nv += c
TypeError: can only concatenate str (not "int") to str
span>a+a: failure
---------------- got:
<span>
<a b'href'=""></a>
<a b'href'=""></a>
</span>
---------------- expected:
<span><a href=""></a><a href=""></a></span>
----------------
(jumps) span>a+a: failure
---------------- got:
<span>
<a b'href'="$2">$3</a>
<a b'href'="$4">$5</a>
</span>
---------------- expected:
<span><a href="$2">$3</a><a href="$4">$5</a></span>
----------------
span>a+a+span: failure
---------------- got:
<span>
<a b'href'=""></a>
<a b'href'=""></a>
<span></span>
</span>
---------------- expected:
<span><a href=""></a><a href=""></a><span></span></span>
----------------
(jumps) span>a+a+span: failure
---------------- got:
<span>
<a b'href'="$2">$3</a>
<a b'href'="$4">$5</a>
<span>$6</span>
</span>
---------------- expected:
<span><a href="$2">$3</a><a href="$4">$5</a><span>$6</span></span>
----------------
input: failure
---------------- got:
<input b'id'="" b'name'="" b'type'=""></input>
---------------- expected:
<input id="" name="" type="" />
----------------
(jumps) input: failure
---------------- got:
<input b'id'="$2" b'name'="$3" b'type'="$4">$5</input>
---------------- expected:
<input id="$2" name="$3" type="$4" />
----------------
input.myclass: failure
---------------- got:
<input b'id'="" b'name'="" b'type'="" class="myclass"></input>
---------------- expected:
<input id="" name="" type="" class="myclass" />
----------------
(jumps) input.myclass: failure
---------------- got:
<input b'id'="$2" b'name'="$3" b'type'="$4" class="${5:myclass}">$6</input>
---------------- expected:
<input id="$2" name="$3" type="$4" class="${5:myclass}" />
----------------
input>test: failure
---------------- got:
<input b'id'="" b'name'="" b'type'="">
<test></test>
</input>
---------------- expected:
<input id="" name="" type=""><test></test></input>
----------------
(jumps) input>test: failure
---------------- got:
<input b'id'="$2" b'name'="$3" b'type'="$4">
<test>$5</test>
</input>
---------------- expected:
<input id="$2" name="$3" type="$4"><test>$5</test></input>
----------------
input{test}: failure
---------------- got:
<input b'id'="" b'name'="" b'type'="">test</input>
---------------- expected:
<input id="" name="" type="">test</input>
----------------
(jumps) input{test}: failure
---------------- got:
<input b'id'="$2" b'name'="$3" b'type'="$4">${5:test}</input>
---------------- expected:
<input id="$2" name="$3" type="$4">${5:test}</input>
----------------
bq: failure
---------------- got:
<b'blockquote'></b'blockquote'>
---------------- expected:
<blockquote></blockquote>
----------------
(jumps) bq: failure
---------------- got:
<b'blockquote'>$2</b'blockquote'>
---------------- expected:
<blockquote>$2</blockquote>
----------------
bq>a>fig: failure
---------------- got:
<b'blockquote'><a b'href'="">
<b'figure'></b'figure'>
</a></b'blockquote'>
---------------- expected:
<blockquote><a href=""><figure></figure></a></blockquote>
----------------
(jumps) bq>a>fig: failure
---------------- got:
<b'blockquote'><a b'href'="$2">
<b'figure'>$3</b'figure'>
</a></b'blockquote'>
---------------- expected:
<blockquote><a href="$2"><figure>$3</figure></a></blockquote>
----------------
html : pass
(jumps) html : pass
html > body: pass
(jumps) html > body: pass
BTW snippets get expanded as I type, without
When I try to modify default attributes by putting following in vimrc
let g:emmet_html_default_attributes_extension = {
\ 'a': {'href': '', 'id': 'ID'},
\ }
I get runtime error when expanding a
# a
Traceback (most recent call last):
File "/home/mher/.vim/plugged/emmet.snippets/pythonx/emmet.py", line 474, in write
for line in str(e).split('\n'):
File "/home/mher/.vim/plugged/emmet.snippets/pythonx/emmet.py", line 372, in __str__
return self.tostr(Jumpcount())
File "/home/mher/.vim/plugged/emmet.snippets/pythonx/emmet.py", line 378, in tostr
return '\n'.join([t.tostr(jm) for t in self.children])
File "/home/mher/.vim/plugged/emmet.snippets/pythonx/emmet.py", line 378, in <listcomp>
return '\n'.join([t.tostr(jm) for t in self.children])
File "/home/mher/.vim/plugged/emmet.snippets/pythonx/emmet.py", line 284, in tostr
attrs = (' ' if self.attributes else '') + ' '.join(map(lambda a: a.tostr(jm, mul=_mul), self.attributes))
File "/home/mher/.vim/plugged/emmet.snippets/pythonx/emmet.py", line 284, in <lambda>
attrs = (' ' if self.attributes else '') + ' '.join(map(lambda a: a.tostr(jm, mul=_mul), self.attributes))
File "/home/mher/.vim/plugged/emmet.snippets/pythonx/emmet.py", line 151, in tostr
nv += c
TypeError: can only concatenate str (not "int") to str
Some of my active plugins are coc with coc-html, vim-sandwich. I am linking here my vimrc https://github.com/iFork/dotfiles/blob/2ae6ae3b4a27b048b99e05c4d55dd313928de277/vim/.vim/vimrc
What else can I do to facilitate debugging?
Thank you!
This sounds like a python3 issue. Sorry, I'm not using the plugin anymore and won't look into the issue.