forked from FRRouting/frr-www
-
Notifications
You must be signed in to change notification settings - Fork 0
/
format-community
executable file
·52 lines (45 loc) · 1.6 KB
/
format-community
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
#! /bin/bash
#-----------------------------------------------------------------------------------------
#
# Copyright 2017 Cumulus Networks, inc all rights reserved
# author: [email protected]
# license: GPL-2
#
# generate community html files from markdown files
#
#-----------------------------------------------------------------------------------------
usage() {
[ "$*" == "" ] || echo; echo "ERROR: $*"
echo
echo "$0 generates community html files from markdown files"
echo
echo "usage: $0"
echo
exit 1
}
#-----------------------------------------------------------------------------------------
# sanity check
#
[ $(which markdown) ] ||
usage "Need access to markdown, you should run this on the web server"
#-----------------------------------------------------------------------------------------
for I in community/*.md; do
F="www/community/$(basename ${I} .md).html"
echo "converting ... $I"
cat templates/header.html > $F
markdown $I >> $F
cat templates/footer.html >> $F
# Add some border spaceing to tables
sed -i 's/<table>/<table style="border-collapse: separate; border-spacing: 10px;">/g' $F
done
# Now format subdirectories
for I in community/*/*.md; do
F="www/community/$(basename $(dirname ${I}))/$(basename ${I} .md).html"
echo "converting ... $I"
install -D templates/header.html $F
markdown $I >> $F
cat templates/footer.html >> $F
# Add some border spaceing to tables
sed -i 's/<table>/<table style="border-collapse: separate; border-spacing: 10px;">/g' $F
done
exit 0