( if [ $(POST_COUNT select) -gt 0 ]; then
taglist >"$c_tags.$$"
- tclist "$(cat "$c_tags.$$")" >"$c_tagcategories.$$"
mv -- "$c_tags.$$" "$c_tags"
- mv -- "$c_tagcategories.$$" "$c_tagcategories"
fi &
) &
| UNSTRING | HTML \
| sed -E 's;
\;;\n;g; s;\n+;\n;g;'
}
-
-tclist(){
- printf %s "$*" \
- | sed -rn '/:/s;^-?([^:]+):.*$;\1;p' \
- |sort -u
+tagorder(){
+ printf '*\n%s\n$\n' "$w_tagcategories" \
+ | while read -r category; do
+ printf '%s\n' "$w_tags" \
+ | { [ "$category" = '*' ] && grep -avF ':' || grep -awF "${category}"; } \
+ | { sed -u 10q; sort; }
+ done
}
c_tags="$_DATA/.index/tags.cache";
mv "$c_tags.$$" "$c_tags"
fi
w_tags="$(cat "$c_tags")"
-
-c_tagcategories="$_DATA/.index/tagcategories.cache"
-if [ ! -s "$c_tagcategories" ]; then
- tclist "$w_tags" >"$c_tagcategories.$$"
- mv "$c_tagcategories.$$" "$c_tagcategories"
-fi
-w_tagcategories="$(cat "$c_tagcategories")"
+w_tagcategories="$(
+ printf %s "$w_tags" \
+ | sed -rn '/:/s;^-?([^:]+):.*$;\1;p' \
+ |sort -u
+)"
+w_tags="$(tagorder)"
[ "$ORDER" = Name ] && w_coname=checked
[ "$ORDER" = Date ] && w_codate=checked
printf '%s\n' "$w_tags" \
| { [ "$category" = '*' ] && grep -avF ':' || grep -awF "${category}"; } \
- | { sed -u 10q; sort; } \
| while read -r tag; do
[ "$tag" ] || continue
t=''; [ ! "${f%%*|${tag}|*}" ] && t=checked
printf '[fieldset [legend %s:][div .tagselect\n' "$category"
printf %s "$w_tags" \
| { [ "$category" = 'Tags' ] && grep -avF ':' || grep -awF "${category}"; } \
- | { sed -u 10q; sort; } \
| while read -r tag; do
[ "$tag" ] || continue
d="${tag#-}"; d="${d#*:}"