]> granicus.if.org Git - icinga2/blob - doc/mkdoc.sh
Fix null ptr exception in Zone::GetLocalZone()
[icinga2] / doc / mkdoc.sh
1 #!/bin/sh
2 cd $(dirname -- $0)
3
4 if [ -z "$1" ]; then
5   echo "Syntax: $0 <build-dir>"
6   exit 1
7 fi
8
9 BUILDDIR="$1"
10
11 mkdir -p $BUILDDIR/htdocs
12
13 if ! which pandoc; then
14   echo "Please install pandoc to build the documentation files." > $BUILDDIR/htdocs/index.html
15   exit 0
16 fi
17
18 if ! which sphinx-build; then
19   echo "Please install sphinx-build to build the documentation files." > $BUILDDIR/htdocs/index.html
20   exit 0
21 fi
22
23 BUILDDIR="$1"
24
25 echo "Build dir: $BUILDDIR"
26
27 rm -f index.rst
28 cat > index.rst <<RST
29 Icinga 2
30 ========
31
32 .. toctree::
33 RST
34
35 for chapter in $(seq 1 100); do
36   files=$chapter*.md
37   count=0
38   for file in $files; do
39     if [ -f $file ]; then
40       count=$(expr $count + 1)
41     fi
42   done
43   if [ $count = 0 ]; then
44     break
45   fi
46   echo "    chapter-$chapter" >> index.rst
47   for file in $files; do
48     cat $file
49     echo
50   done | sed 's/<a id=".*"><\/a>//' | pandoc -f markdown_phpextra -t rst > chapter-$chapter.rst
51 done
52
53 sphinx-build -b html -d $BUILDDIR/doctrees . $BUILDDIR/htdocs