forked from FRRouting/frr-www
-
Notifications
You must be signed in to change notification settings - Fork 0
/
format-manual
executable file
·95 lines (84 loc) · 2.73 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#! /bin/bash -e
#-------------------------------------------------------------------------------
#
# Copyright 2017 Cumulus Networks, inc all rights reserved
# author: [email protected]
# 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\" and \"make developer-html\"."
echo
exit 1
}
#-------------------------------------------------------------------------------
DEV_SRC_DIR=$1/doc/developer/_build/html
USR_SRC_DIR=$1/doc/user/_build/html
# 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"
if [ ! -d $USR_SRC_DIR ] || [ ! -f $USR_SRC_DIR/index.html ]; then
usage "Does not look like you've built frr user docs in \"$1/doc/\". Try \"make html\" in the doc directory."
fi
if [ ! -d $DEV_SRC_DIR ] || [ ! -f $DEV_SRC_DIR/index.html ]; then
usage "Does not look like you've built frr dev docs in \"$1/doc/\". Try \"make developer-html\" in the doc directory."
fi
# Prep the destination directory
USR_DST_DIR=./www/user-guide
DEV_DST_DIR=./www/dev-guide
rm -rf $(pwd)/$USR_DST_DIR/*
rm -rf $(pwd)/$DEV_DST_DIR/*
#-------------------------------------------------------------------------------
#
# Pull in the manual
#
for I in $DEV_SRC_DIR/*
do
F=$DEV_DST_DIR/$(basename $I)
case $F in
*.html) echo "styling ... $F"
# This section may be used for style transformations if
# needed, but it is preferred to do this using Sphinx's
# builtin theme customization facilities
#touch $F
#cat templates/header.html >> $F
#sed -e '/^<\/style>$/ r css-links' $I >> $F
#cat templates/footer.html >> $F
;&
*) echo "copying ... $F"
cp -r $I $F
;;
esac
done
for I in $USR_SRC_DIR/*
do
F=$USR_DST_DIR/$(basename $I)
case $F in
*.html) echo "styling ... $F"
# This section may be used for style transformations if
# needed, but it is preferred to do this using Sphinx's
# builtin theme customization facilities
#touch $F
#cat templates/header.html >> $F
#sed -e '/^<\/style>$/ r css-links' $I >> $F
#cat templates/footer.html >> $F
;&
*) echo "copying ... $F"
cp -r $I $F
;;
esac
done
exit 0