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 -->
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 -->
38 <!--
39 <ENTRY NAME="class name" VALUE="displayed text" PATH="path to helpfiles" FILE="path to htmlfile" />
40 Leave blank to display message "There is no helpfile specified for this class."
41 -->
42 <ENTRIES>
43 EOF
45 echo -en "Generating doc/guide.xml..."
46 # core guide.xml
47 pushd . &> /dev/null
48 cd doc/core
49 cat < guide.xml >> ../guide.xml
50 popd &> /dev/null
52 # plugins guide.xml
53 pushd . &> /dev/null
54 if [ -d doc/plugins ]; then
55 cd doc/plugins
56 for plugin in *; do
57 [ -r $plugin/guide.xml ] && cat < $plugin/guide.xml >> ../guide.xml
58 done
59 fi
60 popd &> /dev/null
62 echo -en "</ENTRIES>\n" >> doc/guide.xml
63 sed -i s/"[ \t][ \t]*"/" "/g doc/guide.xml
64 echo -en " done.\n"
66 # Core help
67 echo -en "Processing core\n"
68 pushd . &> /dev/null
69 cd doc/core
70 for lang in *; do
71 [ ! -d "$lang" ] && continue
73 pushd . &> /dev/null
74 echo -en "\tProcessing language $lang...\n"
75 cd $lang/lyx-source
77 for source in $(find . -name \*.lyx -exec basename {} \;); do
78 echo -en "\t\tProcessing $source..."
79 echo -en " tex"
80 $LYX -e latex $source &> /dev/null
81 d=../html/${source%%\.*}/
82 [ -d $d ] || mkdir -p $d && rm -r $d/* &> /dev/null
83 echo -en " html"
84 $CNV -no_navigation -dir $d ${source%%\.*}.tex &> /dev/null
85 echo -en " cleanup"
86 rm images/*.eps &> /dev/null
87 rm ${source%%\.lyx}.tex &> /dev/null
88 echo -en " done.\n"
89 continue
90 done
91 popd &> /dev/null
92 done
94 popd &> /dev/null
96 # Plugin help
97 pushd . &> /dev/null
98 if [ -d doc/plugins ]; then
99 cd doc/plugins
101 for plugin in *; do
102 pushd . &> /dev/null
103 echo -en "Processing $plugin\n"
104 cd $plugin
105 for lang in *; do
106 [ ! -d "$lang" ] && continue
108 pushd . &> /dev/null
109 echo -en "\tProcessing language $lang...\n"
110 cd $lang/lyx-source
112 for source in $(find . -name \*.lyx -exec basename {} \;); do
113 echo -en "\t\tProcessing $source..."
114 echo -en " tex"
115 $LYX -e latex $source &> /dev/null
116 d=../html/${source%%\.*}/
117 [ -d $d ] || mkdir -p $d && rm -r $d/* &> /dev/null
118 echo -en " html"
119 $CNV -no_navigation -dir $d ${source%%\.*}.tex &> /dev/null
120 echo -en " cleanup"
121 rm images/*.eps &> /dev/null
122 rm ${source%%\.lyx}.tex &> /dev/null
123 echo -en " done.\n"
124 continue
125 done
126 popd &> /dev/null
127 done
128 popd &> /dev/null
129 done
131 fi
132 popd &> /dev/null
133 echo
134 exit 0