From 1b221ce8bed546196999ef3b66ac7af6550d9116 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Sun, 25 Oct 2020 20:24:06 -0700 Subject: [PATCH] Add innertext_safe if you want to avoid escaping. --- frontends/etiquette_flask/templates/tag_object.html | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/frontends/etiquette_flask/templates/tag_object.html b/frontends/etiquette_flask/templates/tag_object.html index bef4f75..e4198cb 100644 --- a/frontends/etiquette_flask/templates/tag_object.html +++ b/frontends/etiquette_flask/templates/tag_object.html @@ -19,6 +19,7 @@ tag, extra_classes="", innertext=None, + innertext_safe=None, link='search', onclick=None, with_alt_description=False @@ -35,9 +36,9 @@ -%} {%- set class = ("tag_object" + " " + extra_classes).strip() -%} {%- set title = (with_alt_description and tag.description) or None -%} -{%- set innertext = innertext or tag.name -%} +{%- set innertext = innertext_safe or (innertext or tag.name)|e -%} {%- set element = "a" if (link or onclick) else "span" -%} -<{{element}} {{make_attributes(class=class, title=title, href=href, onclick=onclick, **kwargs)|safe}}>{{innertext}} +<{{element}} {{make_attributes(class=class, title=title, href=href, onclick=onclick, **kwargs)|safe}}>{{innertext|safe}} {{-''-}} {%- endmacro -%}