]> git.plutz.net Git - shellwiki/commitdiff
some simplification due to better path-presentation in attachment_glob(), include...
authorPaul Hänsch <paul@plutz.net>
Fri, 7 Nov 2025 00:47:01 +0000 (01:47 +0100)
committerPaul Hänsch <paul@plutz.net>
Fri, 7 Nov 2025 00:47:01 +0000 (01:47 +0100)
macros/gallery

index edc6a39d1f2240198fb924f728c2940eb9138c82..17fbab7f823b3f6acf90b570fe691e9fe40ef010 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-# Copyright 2023 Paul Hänsch
+# Copyright 2023, 2025 Paul Hänsch
 # 
 # Permission to use, copy, modify, and/or distribute this software for any
 # purpose with or without fee is hereby granted, provided that the above
@@ -29,19 +29,10 @@ for glob in "$@"; do
   acl_read "$(page_abs "${page}")" \
   && attachment_glob "$glob"
 done \
-| grep -xiE '.*\.jpe?g|.*\.png|.*\.gif' \
+| grep -xiE '.*\.(jpe?g|png|gif|webp|avif)' \
 | while read attachment; do
-  case $attachment in
-    */*)
-      printf '<a href="%s"><img alt="" src="%s"></a>' \
-             "$(URL "${attachment%/*}/[attachment]/${attachment##*/}")" \
-             "$(URL "${attachment}")"
-      ;;
-    *)
-      printf '<a href="%s"><img alt="" src="%s"></a>' \
-             "$(URL "[attachment]/${attachment}")" \
-             "$(URL "${attachment}")"
-      ;;
-  esac
+  printf '<a href="%s"><img alt="" src="%s"></a>' \
+         "$(HTML "${attachment%/*}/[attachment]/${attachment##*/}")" \
+         "$(HTML "${attachment}")"
 done
 printf '</div>'