summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--admin/entry2
-rw-r--r--article/entry17
-rw-r--r--entry4
3 files changed, 19 insertions, 4 deletions
diff --git a/admin/entry b/admin/entry
index c72a79a..16b8506 100644
--- a/admin/entry
+++ b/admin/entry
@@ -1,2 +1,2 @@
#!/bin/bash
-cat $base/data/404.html
+echo "<html><head><title>Admin</title></head><body><p>Admin</p></body></html>"
diff --git a/article/entry b/article/entry
index c72a79a..3a933a7 100644
--- a/article/entry
+++ b/article/entry
@@ -1,2 +1,17 @@
#!/bin/bash
-cat $base/data/404.html
+after () { test -z "${2##*$1*}" && echo -n "${2#*$1}"; }
+if test -z "$1"
+then
+ # TODO: deep dark magic of constructing a list of articles
+ cat $base/data/404.html
+elif test -e "list/${1%%/*}"
+then
+ if test -n "$(after / $1)"
+ then cat $base/data/404.html
+ else
+ export title="$(vsvs-extract 'echo "$value"' "list/${1%%/*}/title")"
+ export content="$(vsvs-extract 'echo "$value"' "list/${1%%/*}/content")"
+ vsvs-extract 'echo "$value"' "template/page" | shelter
+ fi
+else cat $base/data/404.html
+fi
diff --git a/entry b/entry
index b42d378..d5c02a8 100644
--- a/entry
+++ b/entry
@@ -9,10 +9,10 @@
after () { test -z "${2##*$1*}" && echo -n "${2#*$1}"; }
startswith() { case $2 in "$1"*) true;; *) false;; esac; }
if test -z "$1"
-then cat index.html
+then cat data/index.html
elif startswith "article/" "$1"
then cd article; ./entry "$(after / $1)"
elif startswith "admin/" "$1"
then cd admin; ./entry "$(after / $1)"
-else cat 404.html
+else cat data/404.html
fi