From 78a3aa36a8548f1b365f0f37f107fe83cb427305 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Sun, 27 Sep 2020 12:14:20 -0700 Subject: [PATCH] Let make_attributes replace underscores with hyphens in attr names. --- frontends/etiquette_flask/backend/jinja_filters.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frontends/etiquette_flask/backend/jinja_filters.py b/frontends/etiquette_flask/backend/jinja_filters.py index 7142a03..2f3830c 100644 --- a/frontends/etiquette_flask/backend/jinja_filters.py +++ b/frontends/etiquette_flask/backend/jinja_filters.py @@ -68,7 +68,11 @@ def users_to_usernames(users): @global_function def make_attributes(*booleans, **keyvalues): - keyvalues = {key: value for (key, value) in keyvalues.items() if value is not None} + keyvalues = { + key.replace('_', '-'): value + for (key, value) in keyvalues.items() + if value is not None + } attributes = [f'{key}="{jinja2.filters.escape(value)}"' for (key, value) in keyvalues.items()] attributes.extend(booleans) attributes = ' '.join(attributes)