blob: 425a147cd74a8e64cdbfe2b940c23e17c8989bda (
plain)
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
|
#!/bin/sh -e
rm -rf public
mkdir -p public
for i in $(find . -type f -name "*.html" | sed 's|^\./||'); do
dir=${i%/*}
file=${i##*/}
title=${dir##*/}
[ "$dir" = "$file" ] && {
title=home; dir=
}
mkdir -p public/$dir
echo "copy html for $i..."
{
sed "s/@TITLE@/$title/g" files/header
cat $i
cat files/footer
} > public/$dir/$file
done
# docs
cat docs/readme.md > docs/index.md
for f in docs/*.md; do
case $f in */readme.md|*/index.md) continue;; esac
title=$(head -n1 $f)
file=${f##*/}
echo "- [$title](./${file%.md}.html)" >> docs/index.md
done
for i in $(find . -type f -name "*.md" | sed 's|^\./||'); do
dir=${i%/*}
file=${i##*/}
title=${dir##*/}
[ "$dir" = "$file" ] && {
title=home; dir=
}
mkdir -p public/$dir
echo "generating html for $i..."
{
sed "s/@TITLE@/$title/g" files/header
cmark $i
cat files/footer
} > public/${i%.md}.html
done
# mv readme.html to index.html
for i in $(find public -type f -name "readme.html" | sed 's|^\./||'); do
mv -n $i ${i%/*}/index.html
done
rm -f docs/index.md
if [ -d files ]; then
cp -ra files public/assets
fi
echo alicelinux.emmett1.my > public/.domains
echo alicelinux.org >> public/.domains
exit 0
|