This repository has been archived by the owner on Jun 27, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmk-website.bash
executable file
·81 lines (69 loc) · 1.91 KB
/
mk-website.bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/bin/bash
START=$(pwd)
cd "$(dirname "$0")"
function checkApp() {
APP_NAME="$(which "$1")"
if [ "$APP_NAME" = "" ] && [ ! -f "./bin/$1" ]; then
echo "Missing $APP_NAME"
exit 1
fi
}
function softwareCheck() {
for APP_NAME in "$@"; do
checkApp "$APP_NAME"
done
}
function MakePage() {
nav="$1"
content="$2"
html="$3"
# Always use the latest compiled mkpage
if [ -f ./bin/mkpage ]; then
export PATH=bin:$PATH
fi
echo "Rendering $html"
mkpage \
"title=text:mkpage: An experimental template and markdown processor" \
"nav=$nav" \
"content=$content" \
"sitebuilt=text:Updated $(date)" \
"copyright=copyright.md" \
page.tmpl >"$html"
}
echo "Checking necessary software is installed"
softwareCheck mkpage
echo "Generating website index.html"
MakePage nav.md README.md index.html
echo "Generating install.html"
MakePage nav.md INSTALL.md install.html
echo "Generating license.html"
MakePage nav.md "markdown:$(cat LICENSE)" license.html
echo "Generating CLI docs"
mkpage \
"title=text:mkpage: An experimental template and markdown processor" \
"nav=docs/nav.md" \
"content=docs/index.md" \
"sitebuilt=text:Updated $(date)" \
"copyright=copyright.md" \
page.tmpl >docs/index.html
for SCRIPT_NAME in $(findfile -s .bash docs); do
echo "Running docs/$SCRIPT_NAME"
"docs/$SCRIPT_NAME"
done
echo "Generating How-To documentation"
mkpage \
"title=text:mkpage: An experimental template and markdown processor" \
"nav=how-to/nav.md" \
"content=how-to/index.md" \
"sitebuilt=text:Updated $(date)" \
"copyright=copyright.md" \
page.tmpl >how-to/index.html
echo "Generating the-basics.html"
MakePage how-to/nav.md how-to/the-basics.md how-to/the-basics.html
echo "Generating go-template-recipes.html"
MakePage how-to/nav.md how-to/go-template-recipes.md how-to/go-template-recipes.html
for SCRIPT_NAME in $(findfile -s .bash how-to); do
echo "Running how-to/$SCRIPT_NAME"
"how-to/$SCRIPT_NAME"
done
cd "$START"