forked from FRRouting/frr-www
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathformat-manual
executable file
·67 lines (59 loc) · 1.8 KB
/
format-manual
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
#! /bin/bash -e
#-------------------------------------------------------------------------------
#
# Copyright 2017 Cumulus Networks, inc all rights reserved
# author: jrrivers@cumulusnetworks.com
# license: GPL-2
#
# Pulls the FRR user guide from a source/build tree into the web site tree and
# applies the web site styles
#
#-------------------------------------------------------------------------------
usage() {
[ "$*" == "" ] || echo; echo "$*"
echo
echo "$0 pulls the FRR user guide from a source/build tree into the web site tree and"
echo "applies the web site styles."
echo
echo "usage: $0 <path-to-frr-build-tree>"
echo " <path-to-frr-build-tree> points to a project source tree in which the docs have"
echo " been build using \"make html\"."
echo
exit 1
}
#-------------------------------------------------------------------------------
# Sanity check the source directory
#
[ $# == 1 ] ||
usage "Expecting a pointer to a build tree"
[ -d $1/zebra ] ||
usage "\"$1\" does not look like an frr source/build directory"
SRC_DIR=$1/doc/frr.html
[ -d $SRC_DIR ] ||
usage "Does not look like you've built frr docs in \"$1\". Try \"make html\""
SRC_DIR=$1/doc/frr.html
[ -f $SRC_DIR/index.html ] ||
usage "Does not look like you've built frr docs in \"$1\". Try \"make html\""
# Prep the destination directory
DST_DIR=www/user-guide
rm -rf $DST_DIR/*
#-------------------------------------------------------------------------------
#
# Pull in the manual
#
for I in $SRC_DIR/*
do
F=$DST_DIR/$(basename $I)
case $F in
*.html) echo "styling ... $F"
touch $F
cat templates/header.html >> $F
sed -e '/^<\/style>$/ r css-links' $I >> $F
cat templates/footer.html >> $F
;;
*) echo "copying ... $F"
cp $I $F
;;
esac
done
exit 0