summaryrefslogtreecommitdiff
path: root/article/entry
blob: 9bccfbda95b1fe3693a8d3a1af86649c1d0cf2f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/bash
after () { test -z "${2##*$1*}" && echo -n "${2#*$1}"; }
if test -z "$1"
then
    # TODO: deep dark magic of constructing a list of articles
    cd list
    export articles="$(vsvs-archive)"
    cd ..
    vsvs-extract 'test "$key" == "list" && echo "$value"' "template" | shelter
elif test -e "list/${1%%/*}"
then
    if test -n "$(after / $1)"
    then cat $base/data/404.html
    else
        export title="$(vsvs-extract 'test "$key" == "title" && echo "$value"' "list/${1%%/*}")"
        export content="$(vsvs-extract 'test "$key" == "content" && echo "$value"' "list/${1%%/*}")"
        vsvs-extract 'test "$key" == "page" && echo "$value"' "template" | shelter
    fi
else cat $base/data/404.html
fi