Code

Fixed strings
[gosa.git] / gosa-core / update-online-help
1 #!/bin/bash
3 # Defaults for Debian
4 CNV=`pwd`/contrib/latex2html
5 LYX=lyx
7 # Sanity checks
8 if [ ! -d doc/core ]; then
9         echo "Can't find usable core documentation structure - aborting"
10         exit 1
11 fi
13 # Commands present?
14 for cmd in $CNV $LYX; do
15         if [[ ! `which $cmd` ]]; then
16                 echo "Can't find executable for '$cmd' - aborting"
17                 exit 2
18         fi
19 done
21 # Create guide.xml
22 cat << EOF > doc/guide.xml
23 <?xml version="1.0"?>
24         <!-- 
25                 WARNING:
26                 This file is automatically generated by update-online-help.
27                 If you want to add entries, use doc/core/guide.xml or doc/plugins/"Appropriate Plugin Directory"/guide.xml.
28                 Then execute update-online-help to merge them into this file.
29         -->
30         
31         <!--
32                 This xml file specifies which class is documented in which help file.
34                 If isset ( $_SESSION['current_class_for_help'] ) then open the helpfile which is  
35                 specified for this class below.
36         -->
37         
38         <!-- name="class name" value="displayed text" path="path to helpfiles" 
39                  Leave blank to display message "There is no helpfile specified for this class."        
40         -->
41 <ENTRIES>
42 EOF
44 echo -en "Generating doc/guide.xml..."
45 # core guide.xml
46 pushd . &> /dev/null
47 cd doc/core
48 cat < guide.xml >> ../guide.xml
49 popd &> /dev/null
51 # plugins guide.xml
52 pushd . &> /dev/null
53 if [ -d doc/plugins ]; then
54         cd doc/plugins
55         for plugin in *; do
56                 [ -r $plugin/guide.xml ] && cat < $plugin/guide.xml >> ../guide.xml
57         done
58 fi
59 popd &> /dev/null
61 echo -en "</ENTRIES>\n" >> doc/guide.xml
62 sed -i "s~\t~ ~;s~\t~~g;" doc/guide.xml
63 echo -en " done.\n"
65 # Core help
66 echo -en "Processing core\n"
67 pushd . &> /dev/null
68 cd doc/core
69 for lang in *; do
70         [ ! -d "$lang" ] && continue
72         pushd . &> /dev/null
73         echo -en "\tProcessing language $lang...\n"
74         cd $lang/lyx-source
76         for source in $(find . -name \*.lyx -exec basename {} \;); do
77                 echo -en "\t\tProcessing $source..."
78                 echo -en " tex"
79                 $LYX -e latex $source &> /dev/null
80                 d=../html/${source%%\.*}/
81                 [ -d $d ] || mkdir -p $d && rm -r $d/* &> /dev/null
82                 echo -en " html"
83                 $CNV -no_navigation -dir $d ${source%%\.*}.tex &> /dev/null
84                 echo -en " cleanup"
85                 rm images/*.eps &> /dev/null
86                 rm ${source%%\.lyx}.tex &> /dev/null
87                 echo -en " done.\n"
88                 continue
89         done
90         popd &> /dev/null
91 done
93 popd &> /dev/null
95 # Plugin help
96 pushd . &> /dev/null
97 if [ -d doc/plugins ]; then
98         cd doc/plugins
100         for plugin in *; do
101                 pushd . &> /dev/null
102                 echo -en "Processing $plugin\n"
103                 cd $plugin
104                 for lang in *; do
105                         [ ! -d "$lang" ] && continue
107                         pushd . &> /dev/null
108                         echo -en "\tProcessing language $lang...\n"
109                         cd $lang/lyx-source
111                         for source in $(find . -name \*.lyx -exec basename {} \;); do
112                                 echo -en "\t\tProcessing $source..."
113                                 echo -en " tex"
114                                 $LYX -e latex $source &> /dev/null
115                                 d=../html/${source%%\.*}/
116                                 [ -d $d ] || mkdir -p $d && rm -r $d/* &> /dev/null
117                                 echo -en " html"
118                                 $CNV -no_navigation -dir $d ${source%%\.*}.tex &> /dev/null
119                                 echo -en " cleanup"
120                                 rm images/*.eps &> /dev/null
121                                 rm ${source%%\.lyx}.tex &> /dev/null
122                                 echo -en " done.\n"
123                                 continue
124                         done
125                         popd &> /dev/null
126                 done
127                 popd &> /dev/null
128         done
130 fi
131 popd &> /dev/null
132 echo
133 exit 0