This repository was archived by the owner on Aug 20, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgen-nav.bash
More file actions
executable file
·52 lines (45 loc) · 1.48 KB
/
gen-nav.bash
File metadata and controls
executable file
·52 lines (45 loc) · 1.48 KB
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
#!/bin/bash
GIT_REPO="https://github.com/caltechlibrary/rss2"
function write_nav() {
DNAME="$1"
finddir -depth 2 ${DNAME} | while read D; do
if [[ "$D" != "." ]]; then
echo "Writing ${DNAME}${D}/nav.md"
RELPATH=$(reldocpath ${DNAME}"${D}" .)
mkpage nav.tmpl relroot="text:${RELPATH}" \
readme="text:${RELPATH}index.html" \
license="text:${RELPATH}license.html" \
docs="text:${RELPATH}docs/" \
install="text:${RELPATH}install.html" \
gitrepo="text:${GIT_REPO}" \
>"${DNAME}${D}/nav.md"
fi
done
}
# root nav
echo "Writing root nav.md"
mkpage nav.tmpl relroot="text:" \
readme="text:index.html" \
license="text:license.html" \
docs="text:docs/" \
install="text:install.html" \
gitrepo="text:${GIT_REPO}" \
>"nav.md"
# generate docs nav
mkpage nav.tmpl relroot="text:" \
readme="text:../index.html" \
license="text:../license.html" \
docs="text:./" \
install="text:../install.html" \
gitrepo="text:${GIT_REPO}" \
>"docs/nav.md"
# generate how-to nav
mkpage nav.tmpl relroot="text:" \
readme="text:../index.html" \
license="text:../license.html" \
docs="text:../docs/" \
install="text:../install.html" \
gitrepo="text:${GIT_REPO}" \
>"how-to/nav.md"
# walk docs/ and generate needed nav.md
write_nav "docs/"