4 #   cd /path/to/kivitendo
 
   5 #   ./scripts/build_doc.sh
 
   9 if [[ ! -d doc ]]; then
 
  10   echo "Please run this from the installation directory."
 
  20 if [[ ! -z $1 ]] ; then
 
  24   while [[ ! -z $1 ]] ; do
 
  30         echo "Unknown parameter $1"
 
  39 dobudish=$(ls -d doc/build/dobudish* 2> /dev/null)
 
  41 if [[ -z $dobudish ]] || [[ ! -d ${dobudish} ]]; then
 
  42   echo "There's no dobudish directory inside doc/build."
 
  48 base=documents/dokumentation
 
  49 if [[ ! -d $base ]]; then
 
  50   ./generator.sh dokumentation create book
 
  55 custom=${base}/custom-cfg
 
  57 rm -rf ${input} ${custom}
 
  58 mkdir ${input} ${input}/copy_to_output ${custom}
 
  60 cp ${doc}/dokumentation.xml ${input}/
 
  61 test -d ${doc}/images && cp -R ${doc}/images ${input}/copy_to_output/
 
  62 cp -R ${doc}/build/custom-cfg/* ${custom}/
 
  64 if [[ $pdf = 1 ]] ; then
 
  65   ./generator.sh dokumentation pdf
 
  66   cp ${output}/pdf/dokumentation.pdf ${doc}/kivitendo-Dokumentation.pdf
 
  69 if [[ $html = 1 ]]; then
 
  70   ./generator.sh dokumentation html
 
  73   cp -R ${output}/html ${doc}/
 
  76 if [[ $images = 1 ]]; then
 
  77   # copy system images from Dobudish directory
 
  79   perl -nle 'print $1 while m{ (?: \.\./ )+ ( system/ [^\"]+ ) }xg' ${doc}/html/*.html | sort | uniq > $image_list
 
  80   if [[ -s $image_list ]]; then
 
  81     tar -c -f - -T $image_list | tar -x -f - -C ${doc}/html
 
  82     perl -pi -e 's{ (\.\./)+ system }{system}xg' ${doc}/html/*.html