2014-04-07 21:55:01 +02:00
|
|
|
#!/bin/sh
|
|
|
|
cd $(dirname -- $0)
|
|
|
|
|
2014-04-08 10:30:43 +02:00
|
|
|
if [ -z "$1" ]; then
|
|
|
|
echo "Syntax: $0 <build-dir>"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2014-04-08 10:45:22 +02:00
|
|
|
BUILDDIR="$1"
|
|
|
|
|
|
|
|
mkdir -p $BUILDDIR/htdocs
|
|
|
|
|
2014-04-08 10:30:43 +02:00
|
|
|
if ! which pandoc; then
|
2014-04-08 10:45:22 +02:00
|
|
|
echo "Please install pandoc to build the documentation files." > $BUILDDIR/htdocs/index.html
|
2014-04-08 10:30:43 +02:00
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2014-04-08 10:45:22 +02:00
|
|
|
if ! which sphinx-build; then
|
|
|
|
echo "Please install sphinx-build to build the documentation files." > $BUILDDIR/htdocs/index.html
|
2014-04-08 10:30:43 +02:00
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
BUILDDIR="$1"
|
|
|
|
|
|
|
|
echo "Build dir: $BUILDDIR"
|
|
|
|
|
2014-04-07 21:55:01 +02:00
|
|
|
rm -f index.rst
|
|
|
|
cat > index.rst <<RST
|
|
|
|
Icinga 2
|
|
|
|
========
|
|
|
|
|
|
|
|
.. toctree::
|
|
|
|
RST
|
|
|
|
|
|
|
|
for chapter in $(seq 1 100); do
|
|
|
|
files=$chapter*.md
|
|
|
|
count=0
|
|
|
|
for file in $files; do
|
|
|
|
if [ -f $file ]; then
|
|
|
|
count=$(expr $count + 1)
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
if [ $count = 0 ]; then
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
echo " chapter-$chapter" >> index.rst
|
|
|
|
for file in $files; do
|
|
|
|
cat $file
|
|
|
|
echo
|
|
|
|
done | sed 's/<a id=".*"><\/a>//' | pandoc -f markdown_phpextra -t rst > chapter-$chapter.rst
|
|
|
|
done
|
2014-04-08 10:30:43 +02:00
|
|
|
|
|
|
|
sphinx-build -b html -d $BUILDDIR/doctrees . $BUILDDIR/htdocs
|