]> git.plutz.net Git - serve0/commitdiff
Merge branch 'cgilite' of git.plutz.net:serve0 into cgilite
authorPaul Hänsch <paul@plutz.net>
Wed, 18 Jul 2018 00:25:19 +0000 (02:25 +0200)
committerPaul Hänsch <paul@plutz.net>
Wed, 18 Jul 2018 00:25:19 +0000 (02:25 +0200)
widgets.sh

index ead4c7c88c2c40fc6807ab4f7997579399e17856..ba47062a9f775b9020b1cacebdd8a412edf1e0a8 100644 (file)
@@ -18,6 +18,29 @@ w_tagcategories="$(printf %s "$w_tags" | cut -sd: -f1 | uniq)"
 [ "$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=?