]> git.saurik.com Git - wxWidgets.git/blob - docs/doxygen/regen.sh
add wxEVT_COMMAND_HEADER_SEPARATOR_DCLICK and semi-automatic header resizing support
[wxWidgets.git] / docs / doxygen / regen.sh
1 #!/bin/bash
2 #
3 # $Id$
4 #
5 # This bash script regenerates the HTML doxygen version of the
6 # wxWidgets manual and adjusts the doxygen log to make it more
7 # readable.
8 #
9 # Usage:
10 # ./regen.sh [html|chm|xml|latex|all]
11 #
12 # Pass "x" to regen only the X output format and "all" to regen them all.
13 # If no arguments are passed all formats are regenerated
14 # (just like passing "all").
15 #
16
17
18 # remember current folder and then cd to the docs/doxygen one
19 me=$(basename $0)
20 path=${0%%/$me} # path from which the script has been launched
21 current=$(pwd)
22 cd $path
23 export WXWIDGETS=`cd ../.. && pwd`
24
25 # prepare folders for the cp commands below
26 mkdir -p out/html # we need to copy files in this folder below
27 mkdir -p out/html/wxmsw out/html/wxgtk out/html/wxmac
28
29 # These are not automatically copied by Doxygen because they're not
30 # used in doxygen documentation, only in our html footer and by our
31 # custom aliases
32 cp images/powered-by-wxwidgets.png out/html
33 cp images/*logo.png out/html
34 cp images/wxmsw/*png out/html/wxmsw
35 cp images/wxmac/*png out/html/wxmac
36 cp images/wxgtk/*png out/html/wxgtk
37 cp wxwidgets.js out/html
38
39 # this CSS is not automatically copied by Doxygen because it's
40 # included by our custom html header...
41 cp wxwidgets.css out/html
42
43 # which configuration should we use?
44 if [[ -z "$1" ]]; then
45 cfgfile="Doxyfile_all"
46 else
47 cfgfile="Doxyfile_$1"
48 fi
49
50 #
51 # NOW RUN DOXYGEN
52 #
53 # NB: we do this _after_ copying the required files to the output folders
54 # otherwise when generating the CHM file with Doxygen, those files are
55 # not included!
56 #
57 doxygen $cfgfile
58
59 if [[ "$1" = "qch" ]]; then
60 # we need to add missing files to the .qhp
61 cd out/html
62 qhelpfile="index.qhp"
63
64 # remove all <file> and <files> tags
65 cat $qhelpfile | grep -v "<file" >temp
66
67 # remove last 4 lines (so we have nothing after the last <keyword> tag)
68 lines=$(wc -l < temp)
69 wanted=`expr $lines - 4`
70 head -n $wanted temp >$qhelpfile
71
72 # generate a list of new <keyword> tags to add to the index file; without
73 # this step in the 'index' tab of Qt assistant the "wxWindow" class is not
74 # present; just "wxWindow::wxWindow" ctor is listed.
75 # NOTE: this operation is not indispensable but produces a QCH easier to use IMO.
76 sed -e 's/<keyword name="wx[a-zA-Z~]*" id="wx\([a-zA-Z]*\)::[a-zA-Z~]*" ref="\([a-z_]*.html\)#.*"/<keyword name="wx\1" id="wx\1" ref="\2"/g' < $qhelpfile | grep "<keyword name=\"wx" | uniq >temp
77 cat temp >>$qhelpfile
78 echo " </keywords>" >>$qhelpfile
79 echo " <files>" >>$qhelpfile
80
81 # remove useless files to make the qch slim
82 rm temp *map *md5
83
84 # add a <file> tag for _any_ file in out/html folder except the .qhp itself
85 for f in * */*png; do
86 if [[ $f != $qhelpfile ]]; then
87 echo " <file>$f</file>" >>$qhelpfile
88 fi
89 done
90
91 # add ending tags to the qhp file
92 echo " </files>
93 </filterSection>
94 </QtHelpProject>" >>$qhelpfile
95
96 # replace keyword names so that they appear fully-qualified in the
97 # "index" tab of the Qt Assistant; e.g. Fit => wxWindow::Fit
98 # NOTE: this operation is not indispendable but produces a QCH easier to use IMO.
99 sed -e 's/<keyword name="[a-zA-Z:~]*" id="\([a-zA-Z]*::[a-zA-Z~]*\)"/<keyword name="\1" id="\1"/g' <$qhelpfile >temp
100 mv temp $qhelpfile
101
102 # last, run qhelpgenerator:
103 cd ../..
104 qhelpgenerator out/html/index.qhp -o out/wx.qch
105 fi
106
107 # Doxygen has the annoying habit to put the full path of the
108 # affected files in the log file; remove it to make the log
109 # more readable
110 currpath=`pwd`/
111 interfacepath=`cd ../../interface && pwd`/
112 cat doxygen.log | sed -e "s|$currpath||g" -e "s|$interfacepath||g" >temp
113
114 # Doxygen warnings are not completely sorted for filename; enforce correct sorting:
115 cat temp | sort >doxygen.log
116 rm temp
117
118 # return to the original folder from which this script was launched
119 cd $current