This is a Question with pug(jade).
As you can see below, i'm looking for ways to output js variables that summarized the contents of attributes. What I am trying to do specifically is trying to make mixin of versatile SNS share buttons.
mixin
mixin shareButton()
-
const shareScript = ()=> {
const hatebu = `
href="" class="btn btn-b" target="_blank" rel="noopener noreferrer"
`
;
return hatebu;
};
a&attributes(`!{shareScript()}`) //- error!
a&attributes(shareScript()) //- output. but all string sliced…
index.pug
p.btn-share
+shareButton()
output(HTML)
<p class="btn-share">
<a 0="h" 1="r" 2="e" 3="f" 4="=" 5="" "="" 6="h" 7="t" 8="t" 9="p" 10=":" 11="/" 12="/" 13="e" 14="x" 15="a" 16="m" 17="p" 18="l" 19="e" 20="." 21="c" 22="o" 23="m" 24="/" 25="t" 26="e" 27="s" 28="t" 29="" 30=" " 31="c" 32="l" 33="a" 34="s" 35="s" 36="=" 37="" 38="b" 39="t" 40="n" 41=" " 42="b" 43="t" 44="n" 45="-" 46="b" 47="" 48=" " 49="t" 50="a" 51="r" 52="g" 53="e" 54="t" 55="=" 56="" 57="_" 58="b" 59="l" 60="a" 61="n" 62="k" 63="" 64=" " 65="r" 66="e" 67="l" 68="=" 69="" 70="n" 71="o" 72="o" 73="p" 74="e" 75="n" 76="e" 77="r" 78=" " 79="n" 80="o" 81="r" 82="e" 83="f" 84="e" 85="r" 86="r" 87="e" 88="r" 89=""></a>
</p>
I hope this output(HTML)
<p>
<a href="http://example.com/test" class="btn btn-b" target="_blank" rel="noopener noreferrer"></a>
</p>
I don't know how to output a template literal as it is as an attribute of a tag.
How can I do it?