X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=scripts%2Fbuild_doc.sh;h=2efa9b991e2370dca4f767fb2b4302a42b4f86dc;hb=65604fea85234a5ae3e787f7cafd81ece6b8621d;hp=0db7bf330fc10b016e113dcb1198089fd30bfcec;hpb=27f054b7e2b2a0847a3812a24324fcc48779641f;p=kivitendo-erp.git diff --git a/scripts/build_doc.sh b/scripts/build_doc.sh index 0db7bf330..2efa9b991 100755 --- a/scripts/build_doc.sh +++ b/scripts/build_doc.sh @@ -1,7 +1,7 @@ #!/bin/bash # Usage: -# cd /path/to/lx-office +# cd /path/to/kivitendo # ./scripts/build_doc.sh set -e @@ -11,10 +11,35 @@ if [[ ! -d doc ]]; then exit 1 fi +doc=${PWD}/doc + +html=1 +pdf=1 +images=1 + +if [[ ! -z $1 ]] ; then + html=0 + pdf=0 + images=0 + while [[ ! -z $1 ]] ; do + case $1 in + html) html=1 ;; + pdf) pdf=1 ;; + images) images=1 ;; + *) + echo "Unknown parameter $1" + exit 1 + ;; + esac + + shift + done +fi + dobudish=$(ls -d doc/build/dobudish* 2> /dev/null) if [[ -z $dobudish ]] || [[ ! -d ${dobudish} ]]; then - echo "There's no dobudish directory inside doc/build." + echo "There's no dobudish directory inside doc/build OR more than one file / dir starting with dobudish (hint: zip file downloaded there?)." exit 1 fi @@ -29,12 +54,33 @@ input=${base}/input output=${base}/output custom=${base}/custom-cfg -rm -f ${input}/*.xml -cp ../../dokumentation.xml ${input}/ +rm -rf ${input} ${custom} +mkdir ${input} ${input}/copy_to_output ${custom} -rm -f ${custom}/* -cp -R ../custom-cfg/* ${custom}/ +cp ${doc}/dokumentation.xml ${input}/ +test -d ${doc}/images && cp -R ${doc}/images ${input}/copy_to_output/ +cp -R ${doc}/build/custom-cfg/* ${custom}/ -./generator.sh dokumentation pdf +if [[ $pdf = 1 ]] ; then + ./generator.sh dokumentation pdf + cp ${output}/pdf/dokumentation.pdf ${doc}/kivitendo-Dokumentation.pdf +fi + +if [[ $html = 1 ]]; then + ./generator.sh dokumentation html + rm -rf ${doc}/html + mkdir ${doc}/html + cp -R ${output}/html ${doc}/ +fi -cp ${output}/pdf/dokumentation.pdf ../../ +if [[ $images = 1 ]]; then + # copy system images from Dobudish directory + image_list=$(mktemp) + perl -nle 'print $1 while m{ (?: \.\./ )+ ( system/ [^\"]+ ) }xg' ${doc}/html/*.html | sort | uniq > $image_list + if [[ -s $image_list ]]; then + tar -c -f - -T $image_list | tar -x -f - -C ${doc}/html + perl -pi -e 's{ (\.\./)+ system }{system}xg' ${doc}/html/*.html + fi + + rm $image_list +fi