about summary refs log tree commit diff
path: root/gen
diff options
context:
space:
mode:
author1970-01-01 00:00:00 +0000
committer2025-01-01 19:17:14 +0000
commit0fa0fdebf092fb1eeb08644014d0dc57ff486e49 (patch)
tree5dcca3c64f59b8b42b9899dafaf7360909d2b51b /gen
parentmin (diff)
downloadw-0fa0fdebf092fb1eeb08644014d0dc57ff486e49.tar
w-0fa0fdebf092fb1eeb08644014d0dc57ff486e49.tar.gz
w-0fa0fdebf092fb1eeb08644014d0dc57ff486e49.tar.bz2
w-0fa0fdebf092fb1eeb08644014d0dc57ff486e49.tar.xz
w-0fa0fdebf092fb1eeb08644014d0dc57ff486e49.zip
site generation
Diffstat (limited to 'gen')
-rwxr-xr-xgen18
1 files changed, 18 insertions, 0 deletions
diff --git a/gen b/gen
new file mode 100755
index 0000000..16a79fa
--- /dev/null
+++ b/gen
@@ -0,0 +1,18 @@
+#!/usr/bin/env sh
+# generate site
+find -name "m.htm" -exec sh -c '
+	title=$(head -n1 ${1%/*}/m.htm | cut -d, -f1)
+	subdir=$(head -n1 ${1%/*}/m.htm | cut -d, -f2)
+	redirect=$(head -n1 ${1%/*}/m.htm | cut -d, -f3)
+	(cat h.htm; tail -n+2 ${1%/*}/m.htm; cat f.htm) >${1%/*}/index.html
+	sed -i "s,<title>,<title>$title," ${1%/*}/index.html
+	sed -i "s,href=\"//,href=\"http://,g" ${1%/*}/index.html
+	sed -i "s,href=\"/,href=\"$subdir,g" ${1%/*}/index.html
+	sed -i "s,src=\"/,src=\"$subdir,g" ${1%/*}/index.html
+	sed -zi "s,\n,,g" ${1%/*}/index.html
+	if [ "$(head -n1 ${1%/*}/m.htm | tr -cd ",")" = ",," ];
+	then
+		sed -i "s,8\",8\"\ \/\>\<meta\ http-equiv=\"refresh\"\ content=\"0\;url=$redirect\"," ${1%/*}/index.html
+	fi
+' sh {} \;
+sed "s/\.\.\///g" e/index.html >404.html