From: Paul Hänsch Date: Wed, 18 Jul 2018 00:25:19 +0000 (+0200) Subject: Merge branch 'cgilite' of git.plutz.net:serve0 into cgilite X-Git-Url: http://git.plutz.net/?p=serve0;a=commitdiff_plain;h=0cebf2d806b0ef9d791987a4969143dc79403db7 Merge branch 'cgilite' of git.plutz.net:serve0 into cgilite --- 0cebf2d806b0ef9d791987a4969143dc79403db7 diff --cc widgets.sh index 658d2bb,ead4c7c..ba47062 --- a/widgets.sh +++ b/widgets.sh @@@ -8,36 -8,16 +8,39 @@@ include_widgets="$0 w_refuri="$(HTML "$REQUEST_URI")" w_tags="$(find "$_DATA/" -path '*/.index/meta' -print0 \ - | xargs -r0 cut -f4 \ - | cut -d= -f2- |tr , '\n' | sort -u)" - w_tags="$(UNSTRING "$w_tags")" - w_tagcategories="$(printf %s "$w_tags" |cut -sd: -f1 |sort -u)" + | xargs -r0 sed -r ' + s;^.*\t.*\t.*\ttags=(.*)\tcomment=.*\t.*\r$;\1;; + s;,;\n;g;'"$UNSTRING" \ + | sort -u |HTML |sed 's;:\;;:;g; s; \;;\n;g;')" + w_tagcategories="$(printf %s "$w_tags" | cut -sd: -f1 | uniq)" - CHECK(){ [ "$1" = "$2" ] && printf checked; } + [ "$ORDER" = Name ] && w_coname=checked + [ "$ORDER" = Date ] && w_codate=checked + [ "$ORDER" = Length ] && w_colength=checked +w_bookmarks(){ + local name link bm + bm="$_DATA/.index/bookmarks" + + printf '[form #bookmarks action=?a=bookmarks method=POST + [a href="#" X] + [hidden "ref" "%s"] + ' "$w_refuri" + + name="$(grep -m1 -F " $(STRING "${REQUEST_URI}")" "$bm")" + printf '[hidden "link" "%s"][input name="name" value="%s"]' \ + "$(HTML "$link")" "$(HTML "$name")" + + sort "$bm" |while read -r name link; do + name="$(UNSTRING "$name")" + link="$(UNSTRING "$link")" + if [ "$link" != "$REQUEST_URI" ]; then + printf '[a href="%s"\n%s]' "$(HTML "$link")" "$(HTML "$name")" + fi + done + printf ']' +} + w_search(){ printf ' [form #search method=GET action=?