]> git.plutz.net Git - serve0/commitdiff
stubs for bookmark drawer
authorPaul Hänsch <paul@plutz.net>
Wed, 18 Jul 2018 00:25:14 +0000 (02:25 +0200)
committerPaul Hänsch <paul@plutz.net>
Wed, 18 Jul 2018 00:25:14 +0000 (02:25 +0200)
cgilite
widgets.sh

diff --git a/cgilite b/cgilite
index d490f720aed2ad75f580ac526f83c581d659633b..a301c53cc6f28dde4fa2f80d5785f7988542e327 160000 (submodule)
--- a/cgilite
+++ b/cgilite
@@ -1 +1 @@
-Subproject commit d490f720aed2ad75f580ac526f83c581d659633b
+Subproject commit a301c53cc6f28dde4fa2f80d5785f7988542e327
index f9c0380b740c6c0c856db3e7a20c2c6c5750e8ee..658d2bb2291d87bdf979f6912a6f5ecd62e3139c 100644 (file)
@@ -15,6 +15,29 @@ w_tagcategories="$(printf %s "$w_tags" |cut -sd: -f1 |sort -u)"
 
 CHECK(){ [ "$1" = "$2" ] && printf checked; }
 
 
 CHECK(){ [ "$1" = "$2" ] && printf 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=?
 w_search(){
   printf '
   [form #search method=GET action=?