]> git.plutz.net Git - shellwiki/blobdiff - macros/revisions
Merge commit 'f5a7a98f217d9a047cba2c9c92c21baa46d9e0db'
[shellwiki] / macros / revisions
index c6fb8fa2cb59b7d239b81f372515a5ed96ed3a55..4271149cffbd8074d89f16d88418b26f5f842441 100755 (executable)
@@ -9,18 +9,19 @@ page_abs="$(page_abs "$page")"
 
 if ! acl_read "$page_abs"; then
   return 0
-elif [ ! "$(which git)" ]; then
+elif [ "$REV_PAGES" != true ]; then
   printf '<div class="macro revisions error">GIT is not available to handle revisioning.</div>'
 fi
 
-printf '<ul class="macro revisions">'
+printf '<ul class="macro revisions">\n'
   IFS="        "
-  git -C "$_DATA" log --date=format:"%a, %x %H:%M" \
-                      --pretty=format:"%h      %cd     %s%n" \
-                      -- "pages${page_abs}#page.md" \
-  | while read hash date message; do
+  { git -C "$_DATA" log --date=format:"%a, %x %H:%M" \
+                      --pretty=format:"%h      %cd     %s" \
+                      -- "pages${page_abs}#page.md"
+    printf '\n'
+  } | while read -r hash date message; do
     user="${message% @*}"; user="${user##*@ }"
-    printf '<a href="%s"><span class="hash">%s</span><span="date">%s</span><span class="user">%s</span></a>' \
-      "$(HTML "${page%/}/[revisions]/$hash")" "$(HTML "$hash")" "$(HTML "$date")" "$(HTML "$user")"
+    printf '<li><span class="hash"><a href="%s">%s</a></span><span class="date">%s</span><span class="user">%s</span></li>\n' \
+      "$(HTML "${page%/}/[revision]/$hash")" "$(HTML "$hash")" "$(HTML "$date")" "$(HTML "$user")"
   done
-printf '</ul>'
+printf '</ul>\n'