]> git.plutz.net Git - serve0/commitdiff
avoid one level of indirection
authorPaul Hänsch <paul@plutz.net>
Tue, 22 Feb 2022 14:15:10 +0000 (15:15 +0100)
committerPaul Hänsch <paul@plutz.net>
Tue, 22 Feb 2022 14:15:10 +0000 (15:15 +0100)
list.sh

diff --git a/list.sh b/list.sh
index 86b60fd55f3a0260fcf5c246db312d091f6f2fec..ccb91393dec2821f375cf797f485b86a772dafa0 100755 (executable)
--- a/list.sh
+++ b/list.sh
@@ -7,11 +7,6 @@
 list_item() {
   local meta file link name
   eval "$LOCAL_META"
-  meta="${1}";
-
-  read_meta <<-EOF
-       $meta
-       EOF
 
   if [ "${META_NAME%/}" != "${META_NAME}" ]; then
     printf '[a .list .dir href="%s?%s" . %s]' \
@@ -164,9 +159,14 @@ list_paginate() {
   end=$((page + LISTSIZE))
 
   printf '[div .itemlist '
-  while read -r i; do
+  while :; do
     c=$((c + 1))
-    [ $c -gt $page -a $c -le $end  ] && list_item "$i"
+    if [ $c -gt $page -a $c -le $end  ]; then 
+      read_meta || break
+      list_item
+    else
+      read -r discard || break
+    fi
   done
   printf ']'