blob: 87ba81bd89ee561e8435ae9ea58cd891d120fb40 (
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
#!/bin/sh
rm -r html
mkdir html
cp -r media html
cp css/*.css html
cp *.php html
cp *.js html
# cp favicon.ico html
# Generate Pages
echo "generating pages..."
cd content
pages=".pages"
echo "<div class="box">\n" >> $pages
echo "### Last 10 Modified Pages:\n" >> $pages
for page in $(ls *.* -t | head -10); do # todo: use git for this (if its better)
name=${page%.md}
echo "* **[$name]($name.html)** - <small>$(date -r $page "+%d/%m/%y")</small>" >> $pages
done
echo "</div>" >> $pages
# echo "<div class="box">\n" >> $pages
# echo "### Last 10 Recently Created Pages:\n" >> $pages
# for page in $(ls *.* -t --time=birth | head -10); do
# name=${page%.md}
# echo "* **[$name]($name.html)**" >> $pages
# done
# echo "</div>" >> $pages
echo "\n### All Pages:\n" >> $pages
first=true
for page in *.*; do
name=${page%.md}
if [ "$first" = true ]; then
first=false
else
echo " // " >> $pages
fi
echo "**[$name]($name.html)**" >> $pages
done
# Excluded pages.md from last modified, as it will always be the last modified D:
mv $pages pages.md
for page in *.md; do
name="${page%.md}"
title="$(echo $name | sed "s/_/ /g")"
pagename="../html/$name.html"
if [ "$name" = "index" ]; then
sed -e "s|{{ page }}||g" -e "s|{{ title }}|neetlo.li|g" ../template.html >> $pagename
else
sed -e "s|{{ page }}|\>\<\> $title|g" -e "s|{{ title }}|$title|g" ../template.html >> $pagename
fi
cmark-gfm --unsafe -e table -e autolink $page >> $pagename
echo "<hr>Last Modified: $(date -r "$page" "+%B %d, %Y")" >> $pagename
echo "</main></body></html>" >> $pagename
done
rm pages.md
cd ..
echo "generated pages"
|