- lbid="$(HTML "cat_${n}_${category}")"
- printf '[input .cat type=radio %s name="cat_%i" id="%s"][label for="%s" %s]
- [select name=tag_%s size=10 multiple="multiple"' \
- "$([ ! "${f%%*|${category}:*}" -o ! "${category%\*}" ] && printf 'checked="checked"')" \
- $n "$lbid" "$lbid" "$(HTML "$category")" $n
-
- printf %s "$w_tags" \
- | { [ "$category" = '*' ] && grep -vF ':' || grep -wF "${category}"; } \
+ lbid="cat_${n}_${category}"
+
+ t=''
+ [ "$category" = '*' -a "${f%%|${category}:*}" ] && t=checked
+ [ "$category" != '*' -a ! "${f%%|${category}:*}" ] && t=checked
+
+ printf '[radio "cat_%i" "%s" .cat %s id="%s"][label for="%s" %s]
+ [select name=tag_%s size=10 multiple' \
+ $n "$category" "$t" "$lbid" "$lbid" "$category" $n
+
+ printf '%s\n' "$w_tags" \
+ | { [ "$category" = '*' ] && grep -vF ':' |grep -vxF '' || grep -wF "${category}"; } \