From 381c85b5ef410ccae46d09ce4b2a45ca54fceb21 Mon Sep 17 00:00:00 2001 From: Andrew Croce Date: Thu, 2 Aug 2018 16:14:40 -0400 Subject: [PATCH 1/2] jinja filter for getting an icon's SVG file contents --- atst/app.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/atst/app.py b/atst/app.py index 46b017bb..1553679f 100644 --- a/atst/app.py +++ b/atst/app.py @@ -57,6 +57,11 @@ def make_flask_callbacks(app): "atat_permissions": [], } + @app.template_filter('iconSvg') + def iconSvg(name): + with open('static/icons/'+name+'.svg') as contents: + return contents.read() + def map_config(config): return { From d9d105433b6b24613d99ac925edf487b8858b7b7 Mon Sep 17 00:00:00 2001 From: Andrew Croce Date: Thu, 2 Aug 2018 16:14:58 -0400 Subject: [PATCH 2/2] use iconSvg filter for Icon component --- templates/components.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/components.html b/templates/components.html index ea214631..a9b566cd 100644 --- a/templates/components.html +++ b/templates/components.html @@ -1,6 +1,6 @@ {% macro Icon(name, classes="") -%} {% autoescape false %} - + {% endautoescape %} {%- endmacro %}