Escaping fails with Unescaped String Interpolation
figurnov opened this issue · 3 comments
figurnov commented
Pug Version: 3.0.2
Node Version: 18.16.0
Input Pug
\!{unescaped string}
Expected HTML
!{unescaped string}
Actual HTML
#{unescaped string}
Additional Comments
Pug:
p Escaping works with \#{Escaped String Interpolation}.
p It works with \#[Tag Interpolation] too!
p But it fails with \!{Unescaped String Interpolation}.
HTML:
<p>Escaping works with #{Escaped String Interpolation}.</p>
<p>It works with #[Tag Interpolation] too!</p>
<p>But it fails with #{Unescaped String Interpolation}. </p>
MrJithil commented
Working on it.
MrJithil commented
Issue not exist.
- var msg = "not my inside voice";
p This is \!{msg.toUpperCase()}
compiled to
<p>This is !{msg.toUpperCase()}</p>
figurnov commented
Indeed, in Pug 3.0.2, the problem is not observed. Thank you very much.
It turned out that Pug 2.0.4 was called in incorrectly compiled examples
Along the way, it turned out that almost all available online converters from Pug to HTML use the old version of Pug, in which the described problem is observed. For example:
- https://pughtml.com/
- https://codebeautify.org/pug-to-html-converter
- https://www.ubercompute.com/pug-to-html
- https://pug2html.com/
- https://www.cssportal.com/pug-to-html/
- https://cfjedimaster.github.io/webdemos/pugclient/
- https://www.xhcode.com/pug-to-html-converter.html
- https://html2jade.org/
- https://masteringjs.io/tutorials/node/pug-to-html
- https://codepen.io/getflourish/pen/KWRNKr
And here are the online converters with the correct compilation result: