]> git.plutz.net Git - shellwiki/commitdiff
handler for exporting plain html pages
authorPaul Hänsch <paul@plutz.net>
Tue, 4 Nov 2025 12:07:51 +0000 (13:07 +0100)
committerPaul Hänsch <paul@plutz.net>
Tue, 4 Nov 2025 12:07:51 +0000 (13:07 +0100)
handlers/29_html_export.sh [new file with mode: 0755]

diff --git a/handlers/29_html_export.sh b/handlers/29_html_export.sh
new file mode 100755 (executable)
index 0000000..c1ebc87
--- /dev/null
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+[ "$HTML_EXPORT" ] || return 1
+
+. "$_EXEC/cgilite/file.sh"
+
+case "${PATH_INFO}" in
+  /"[.]"/*)
+    :;;
+  *${BR}*)
+    :;;
+  */\#*)
+    :;;
+  */\[*\]/*|*/\[*\])
+    :;;
+  */)
+    if mdfile "$PATH_INFO" >&- \
+    && acl_read "$PATH_INFO"; then
+      mkdir -p "${HTML_EXPORT}${PATH_INFO}"
+      ( unset USER_NAME
+        acl_read "$PATH_INFO" \
+        && theme_page "${PATH_INFO}" \
+         | tee "${HTML_EXPORT}${PATH_INFO}/index.html"
+      ) && return 0
+    fi
+    ;;
+esac
+
+return 1