From 58cb1ec15db10b03e2ed17d19192a1f9c016b882 Mon Sep 17 00:00:00 2001 From: Jonah Aragon Date: Wed, 13 May 2020 10:59:56 -0500 Subject: [PATCH] Move badge code to separate file --- _includes/badge.html | 20 ++++++++++++++++++++ _includes/cardv2.html | 29 ++++++++--------------------- 2 files changed, 28 insertions(+), 21 deletions(-) create mode 100644 _includes/badge.html diff --git a/_includes/badge.html b/_includes/badge.html new file mode 100644 index 00000000..ac2a8a7e --- /dev/null +++ b/_includes/badge.html @@ -0,0 +1,20 @@ +{% if include.link %} + {{ include.text }} +{% else %}> {{ include.text }}{% endif %} + +{% else %} + {{include.text}} + {% else %} + > {% if include.icon %}{% endif %} {{include.text}} + {% endif %} + +{% endif %} diff --git a/_includes/cardv2.html b/_includes/cardv2.html index 3b88f05a..87066b83 100644 --- a/_includes/cardv2.html +++ b/_includes/cardv2.html @@ -45,7 +45,7 @@ {% assign label_data = label | split:"::" %} {% for label_attr in label_data %} {% assign attr = label_attr | split:"==" %} - {% if attr[0] == "color" } + {% if attr[0] == "color" %} {% assign color = attr[1] %} {% elsif attr[0] == "link" %} {% assign link = attr[1] %} @@ -57,26 +57,13 @@ {% assign tooltip = attr[1] %} {% endif %} {% endfor %} - {% if link %} - {{ text }} - {% else %}> {{ text }}{% endif %} - - {% else %} - {{text}} - {% else %} - > {% if icon %}{% endif %} {{text}} - {% endif %} - - {% endif %} + {% include badge.html + link=link + color=color + text=text + icon=icon + tooltip=tooltip + %} {% endfor %} {% endif %}