--- /dev/null
+#!/bin/sh
+
+. "$_EXEC/cgilite/cgilite.sh"
+. "$_EXEC/acl.sh"
+. "$_EXEC/tools.sh"
+
+[ $# = 0 ] && set -- "*"
+
+printf '<div class="macro gallery">'
+for glob in "$@"; do
+ page="${glob%/*}"
+ [ "$page" = "$glob" ] && page=./
+ [ ! "$page" ] && page=/
+
+ acl_read "$(page_abs "${page}")" \
+ && attachment_glob "$glob"
+done \
+| grep -xiE '.*\.jpe?g|.*\.png|.*\.gif' \
+| sort -u \
+| while read attachment; do
+ case $attachment in
+ */*)
+ printf '<a href="%s"><img src="%s"></a>' \
+ "${attachment%/*}/[attachment]/${attachment##*/}" "${attachment}"
+ ;;
+ *)
+ printf '<a href="%s"><img src="%s"></a>' \
+ "[attachment]/${attachment}" "${attachment}"
+ ;;
+ esac
+done
+printf '</div>'
.macro.toc li.h5 { margin-left: 5em; }
.macro.toc li.h6 { margin-left: 6.25em; }
+.macro.gallery {
+ text-align: center;
+ margin: 2em 0;
+ padding: .5em .125em;
+ background-color: #444;
+}
+.macro.gallery img {
+ max-height: 9em;
+ margin: 0 .25em;
+}