]> 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 07:00:39 +0000 (09:00 +0200)
committerPaul Hänsch <paul@plutz.net>
Wed, 18 Jul 2018 07:00:39 +0000 (09:00 +0200)
indexmeta.sh
list.sh
widgets.sh

index 2ac459fd484689e1a29979b512bf7b24eb792d20..45a3bac008b2ee469719d6ac2b91b3a0976b9178 100644 (file)
@@ -85,7 +85,7 @@ meta_dir(){
     touch "$meta"  # preliminary touch to prevent concurrent generators
     find "$dir" -type f -mindepth 1 -maxdepth 1 \
     | grep -aE "$file_pattern" \
-    | while v="$(line)"; do
+    | while read -r v; do
       meta_line "$v"
     done >"$meta"
 
@@ -94,7 +94,7 @@ meta_dir(){
     touch "$meta"
     find "$dir" -type f -mindepth 1 -maxdepth 1 \
     | grep -aE "$file_pattern" \
-    | while v="$(line)"; do
+    | while read -r v; do
       if [ "$v" -nt "$meta" ]; then
         grep -qF "     $(meta_name "$v")" "$meta" \
         || meta_line "$v"
diff --git a/list.sh b/list.sh
index a2dcd5549e56599a416c670d93fd1c9bb94a61a3..9e2f2f8a110029dbd1ae8e766da9875e7c139703 100644 (file)
--- a/list.sh
+++ b/list.sh
@@ -93,7 +93,7 @@ list_index(){
   local meta
   (cd "$_DATA/$ITEM";
     find ./ -path '*/.index/meta'
-  ) | while meta="$(line)"; do
+  ) | while read -r meta; do
     list_filemeta "${meta%/.index/meta}"
   done
 }
index ce1813cde7d329e3ec677ddbe67712b91b8aeec2..4a64deb08df1957c4ff03eac7e2c1c1ad8f4d261 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=?