fet
fet copied to clipboard
Unscape HTML variables
Is a way to pass HTML content in a variable and disable the escaping process?
P.e.:
<html><body>
{%$myvar = "<b>Hello</b> world"%}
{%$myvar}
</body></html>
Expected output:
<html><body>
<b>Hello</b> world
</body></html>
@imayatech since FET will translate the code into html/template template code, the func.go provides a method named safe to allowed HTML output. https://github.com/fefit/fet/blob/9e2ebbd55cc8678c84d2742234dc69c3bbc876b3/lib/funcs/funcs.go#L226
so you can use the method in the code like below:
<html><body>
{%$myvar = "<b>Hello</b> world"|safe%}
{%$myvar}
</body></html>
I hope that can solves your problem. thx for your issue~