]> git.sur5r.net Git - bacula/docs/blob - docs/tools/htmls.sh
Tweak Postgres doc
[bacula/docs] / docs / tools / htmls.sh
1 #!/bin/bash
2 #
3 # Philippe Chauvat - BaculaSystems
4 # Last modification 26-feb-2014
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/pdf-and-html"
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 # For each manual
63 for M in ${LIST}
64 do
65     #
66     # Extract the directory name: console, developers, main, etc.
67     thedirname=`echo $M | sed -e 's/.*www-\(.*\)/\1/g'`
68     #
69     # Message to indicate what we are building
70     echo ""
71     echo ""
72     echo "$thedirname Manual"
73     #
74     # Where to find HTML files
75     readdir=$M/$thedirname
76     #
77     # Where to store the result
78     DESTINATION_DIR=$SOURCEDIRHEAD/$thedirname
79     #
80     # Create the desitnation directory if needed
81     mkdir -p $DESTINATION_DIR
82     #
83     # Create otherdirs if needed
84     for D in ${DIRSTOCREATE}
85     do
86         mkdir -p $SOURCEDIRHEAD/$D
87     done
88     for L in `ls ${readdir}|egrep html$`
89     do
90         echo -n "Translating $L..."
91         ./translatedoc.pl ${DEBUG} -i ${readdir}/${L} -o ${DESTINATION_DIR}/${L} -j ${JSDIR} -c ${CSSDIR} -p ${IMAGEDIR} -n ${thedirname}
92         echo "Done."
93     done
94     echo "Moving CSS file..." 
95     cp ${readdir}/${thedirname}.css ${SOURCEDIRHEAD}/css/
96 done
97 #
98 # Anchor management
99 readdir=""
100 for M in ${LIST}
101 do
102     #
103     # Extract the directory name: console, developers, main, etc.
104     thedirname=`echo $M | sed -e 's/.*www-\(.*\)/\1/g'`
105     #
106     # Where to find HTML files
107     readdir="${readdir} $SOURCEDIRHEAD/$thedirname"
108     #
109     # Copy images
110     cp -v ${SOURCEIMAGEDIR}/$(M)/$(thedirname)/*.png ${DESTIMAGEDIR}/
111 done
112 echo "./handle-xr-references.pl -m \"${readdir}\" -i list-of-anchors -l en"
113 ./handle-xr-references.pl -m "${readdir}" -d -i list-of-anchors -l en
114 #
115 rm -f list-of-anchors