From d13a512829cd9cf5d2a364a9a6cee3ce7f614f02 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Tue, 22 Feb 2022 19:48:13 +0100 Subject: [PATCH] avoid orphaned close tag when tag list is empty --- widgets.sh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/widgets.sh b/widgets.sh index 23afd9d..df141e7 100755 --- a/widgets.sh +++ b/widgets.sh @@ -230,7 +230,7 @@ w_delete(){ } w_tagging(){ - local tctag oldcat category tag + local tctag oldcat="" category tag cat <<-EOF [a href="#multitag" Add Tags / Remove Tags] @@ -238,8 +238,6 @@ w_tagging(){ [a href="#" X] EOF - oldcat="Tags" - printf '[fieldset [legend %s:][div .tagselect\n' "Tags" printf '%s\n' "$w_tags" \ | while read tctag; do [ "$tctag" ] || continue @@ -250,14 +248,14 @@ w_tagging(){ && category="Tags" if [ "$category" != "$oldcat" ]; then - printf ']]' + [ "$oldcat" ] && printf ']]' printf '[fieldset [legend %s:][div .tagselect\n' "$category" fi printf '[label [checkbox "tag" "%s"] %s]\n' "$tctag" "$tag" oldcat="$category" done - printf ']]' + [ "$w_tags" ] && printf ']]' cat <<-EOF [fieldset [legend New:][textarea name=newtag\n] -- 2.39.2