-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzero.sh
executable file
·50 lines (37 loc) · 878 Bytes
/
zero.sh
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
#!/bin/bash
. configuration
#cleanup existing files
./cleanup.sh
#compile to <article>
for inputfile in $POSTFILES_FOLDER/*
do
./generateblock.sh $inputfile
done
#list
>bloglist
for article in $ARTICLES/*
do
timestamp=$(grep -m 1 "<!-- TIME" $article |\
sed 's/.*TIME \([0-9]*\).*/\1/')
articletitle=$(grep -m 1 "<h1>" $article |\
sed 's/<h1>\(.*\)<\/1>/\1/')
echo $timestamp $article $articletitle >> bloglist
done
#sort
sort -rn bloglist >sortedlist
#generate index
./generateindex.sh sortedlist >$BLOG_FOLDER/index.html
#generate pages
./generatepages.sh
#generate individual articles
for article in $ARTICLES/*
do
art_name=$(basename $article | sed 's/\.block//')
./generatepermlink.sh $article >$ARTICLES_PAGES/$art_name.html
done
#Cleanup
rm sortedlist bloglist
if [[ -n "$ARTICLES" ]]
then
rm $ARTICLES/*
fi