]> git.sur5r.net Git - bacula/docs/blob - docs/tools/htmls.sh
This modification is designed to separate HTML and PDF documentation. make html-manua...
[bacula/docs] / docs / tools / htmls.sh
1 #!/bin/bash
2 #
3 # Philippe Chauvat - BaculaSystems
4 # Last modification 04-dec-2012
5 #
6 # This script fetch all HTML 'manual' directories
7 # to apply a conversion script (translatedoc.pl)
8 # and then produce the final HTML version of the manuals
9 #
10 # args: none
11
12 # vars
13 # SOURCEDIRHEAD:        Where are located the original directories relatively to the
14 #                       current script
15 #                       Default: ../manuals/en
16 #
17 # TRANSLATOR:           The script to apply to each HTML original file
18 #                       Default: ./translatedoc.pl
19 #
20 # DEBUG:                You want some ? Specify -d there
21 #                       Default: ""
22 #
23 # FROMFILEMENUEXTRACT:  We want to extract ako menu. This var give the name of the file
24 #                       from which to extract it
25 #                       Default: index.html
26 #
27 # DIRSTOCREATE:         Specify here which directory(ies) must be created before running the conversion
28 #                       Default: "css js images"
29 #
30 # LIST                  The list of dirs containing the manuals to translate
31 #                       Default: `find ${SOURCEDIRHEAD} -mindepth 1 -maxdepth 1 -name "www-*" -type d`
32 #
33 # ROOTDIR               All HTML files rely on CSS, JS and IMAGES. ROOTDIR specify the relative path to those.
34 #                       Default: "../.."
35 #
36 # CSSDIR                The CSS directory used by HTMLs
37 #                       Default: ${ROOTDIR}/css
38 #
39 # JSDIR                 The JS (javascript) directory used by HTMLs
40 #                       Default: ${ROOTDIR}/js
41 #
42 # IMAGEDIR              The images directory used by HTMLs
43 #                       Default: ${ROOTDIR}/images
44 #
45 # DOSUBFILES            Do we want to generate all subfiles (not only the index.html). Debug and tests purpose
46 #                       Default: yes
47 #
48 SOURCEDIRHEAD="../manuals/en"
49 TRANSLATOR='./translatedoc.pl'
50 DEBUG="" # change to -d if you want some debug there
51 FROMFILEMENUEXTRACT="index.html"
52 DIRSTOCREATE="css js images"
53 LIST=`find ${SOURCEDIRHEAD} -mindepth 1 -maxdepth 1 -name "www-*" -type d`
54 #LIST=${SOURCEDIRHEAD}/www-main
55 ROOTDIR="../.."
56 CSSDIR=${ROOTDIR}/css
57 JSDIR=${ROOTDIR}/js
58 IMAGEDIR=${ROOTDIR}/images
59 SOURCEIMAGEDIR=../images
60 DESTIMAGEDIR=${SOURCEDIRHEAD}/images
61 #
62 # Do we want to generate HTML files for all
63 # files
64 DOSUBFILES=yes
65 #
66 # For each manual
67 for M in ${LIST}
68 do
69     #
70     # Extract the directory name: console, developers, main, etc.
71     thedirname=`echo $M | sed -e 's/.*www-\(.*\)/\1/g'`
72     #
73     # Message to indicate what we are building
74     echo "$thedirname Manual"
75     #
76     # Where to find HTML files
77     readdir=$M/$thedirname
78     #
79     # Where to store the result
80     DESTINATION_DIR=$SOURCEDIRHEAD/$thedirname/$thedirname
81     #
82     # Create the desitnation directory if needed
83     mkdir -p $DESTINATION_DIR
84     #
85     # Create otherdirs if needed
86     for D in ${DIRSTOCREATE}
87     do
88         mkdir -p $SOURCEDIRHEAD/$D
89     done
90     #
91     # Building the menu must be done without any existing file
92     rm -f wholemenu_${thedirname}.html
93     echo -n "Building navigation menu from ${readdir}/${FROMFILEMENUEXTRACT} to ${DESTINATION_DIR}/${FROMFILEMENUEXTRACT}..."
94     ./translatedoc.pl ${DEBUG} -i ${readdir}/${FROMFILEMENUEXTRACT} -e -o ${DESTINATION_DIR}/${FROMFILEMENUEXTRACT} -j ${JSDIR} -c ${CSSDIR} -p ${IMAGEDIR} -n ${thedirname} -r ${SOURCEDIRHEAD}
95     echo "Done."
96     if [ ${DOSUBFILES} == "yes" ]
97     then
98         for L in `ls ${readdir}|egrep html$`
99         do
100             echo -n "Translating $L..."
101             ./translatedoc.pl ${DEBUG} -i ${readdir}/${L} -o ${DESTINATION_DIR}/${L} -j ${JSDIR} -c ${CSSDIR} -p ${IMAGEDIR} -n ${thedirname}
102             echo "Done."
103         done
104     fi
105 done
106 #
107 # Copy images
108 cp -v ${SOURCEIMAGEDIR}/png/*.png ${DESTIMAGEDIR}/