5 # Add here the pages of the documentation generated by a @page doxygen macro
6 my @extra_files = qw(html/index.html html/faq.html html/history.html html/contrib.html html/people.html
7 html/publis.html html/publis_core.html html/publis_extern.html html/publis_intra.html
8 html/pages.html html/modules.html index.php
12 map {push @extra_files, "html/GRAS_tut_$_.html"} qw (intro
13 tour tour_install tour_setup tour_simpleexchange tour_args tour_callbacks tour_globals
14 tour_logs tour_timers tour_exceptions tour_rpc);
17 map {push @extra_files, "html/GRAS_ex_$_.html"} qw (ping mmrpc token timer);
20 $debug{'parse'} = 0; # show how we parse the module tree
21 $debug{'input'} = 0; # display the resulting tree
22 $debug{'handle'}= 0; # Be verbose on the post-processing
23 $debug{'rename'}= 0; # do not overwrite the files (allows several debuging runs without rerunning doxygen)
27 ### Get the module definitions
30 open IN, "html/modules.html" || die "Cannot parse html/modules.html. Did you really run doxygen?\n";
34 last if /group__SimGrid__API.html/;
42 $current->{'label'}="ROOT";
43 push @{$top->{'down'}},$current;
44 print "Push $current as child of $top\n" if $debug{'parse'};
50 print "DOWN: $current -> " if $debug{'parse'};
51 $current = $current->{'down'}[scalar @{$current->{'down'}} - 1];
52 print "$current\n" if $debug{'parse'};
56 $current = $current->{'up'};
57 print "UP\n" if $debug{'parse'};
64 m|href="([^"]*)">([^<]*)</a>|; #"
67 $entry->{'file'} = $1;
68 $entry->{'label'} = $2;
69 $entry->{'up'} = $current;
70 push @{$current->{'down'}},$entry;
71 print "Push $1 $2 as child of $current\n" if $debug{'parse'};
72 push @allfiles,"html/$1";
76 # Check each file for extra information (short name, extra childs)
80 if (defined($current->{'file'})) {
81 open IN, "html/$current->{'file'}";
83 if (/DOXYGEN_NAVBAR_LABEL/) {
84 if (/DOXYGEN_NAVBAR_LABEL="([^"]*)"/) {#"
85 print "Extra info from $current->{'file'}: label=$1, not $current->{'label'}\n" if $debug{'parse'};
86 $current->{'label'}=$1;
88 die "Malformated DOXYGEN_NAVBAR_LABEL line in $current->{'file'}";
91 if (/DOXYGEN_NAVBAR_CHILD/) {
92 if (/DOXYGEN_NAVBAR_CHILD *"([^"]*)"=([^ ]*)/) {#"
94 $entry->{'label'} = $1;
95 $entry->{'file'} = $2;
96 chomp($entry->{'file'});
97 $entry->{'up'} = $current;
98 push @{$current->{'down'}},$entry;
99 print "Extra info from $current->{'file'}: New child $entry->{'label'}=$entry->{'file'}\n" if $debug{'parse'};
101 die "Malformated DOXYGEN_NAVBAR_CHILD line in $current->{'file'}";
107 foreach my $entry (@{$current->{'down'}}) {
118 print "$current: ".$current->{'label'}." ($current->{'file'})\n";
119 foreach my $entry (@{$current->{'down'}}) {
120 display($entry,$level+1);
124 display($top,0) if $debug{'input'};
127 ### Generate the navbar
130 # the root deserves some special handling
131 open IN,"html/modules.html" || die;
132 open OUT,">html/modules.new.html" || die;
134 while ($line = <IN>) {
135 last if $line =~ /<h1>SimGrid Modules</;
139 print OUT "<div class=\"tabs\">\n <ul>\n";
140 foreach $current (@{ ${$top->{'down'}}[0]->{'down'} }) {
141 print OUT " <li><a href=\"$current->{'file'}\"><span>$current->{'label'}</span></a></li>\n";
143 print OUT " </ul></div>\n";
151 rename("html/modules.new.html","html/modules.html") unless $debug{'rename'};
153 # the publication pages deserves some special handling too
154 my %pub_tabs = ("publis.html" =>"Reference publications",
155 "publis_core.html" =>"Other publication about SimGrid",
156 "publis_extern.html"=>"External papers using SimGrid",
157 "publis_intra.html"=>"Internal papers using SimGrid");
159 my @pub_titles = ("publis.html", "publis_core.html", "publis_extern.html", "publis_intra.html");
162 my $newname = $oldname;
163 $newname =~ s/\.html$/.new.html/;
165 # print "Handle_pub($oldname -> $newname)\n";
167 open IN,"html/$oldname" || die "Cannot open $oldname";
168 open OUT,">html/$newname" || die "Cannot open $newname";
170 while ($line = <IN>) {
171 last if $line =~ /<h1>/;
175 print OUT "<div class=\"tabs\">\n <ul>\n";
176 foreach my $page (@pub_titles) {
177 print OUT " <li".($page eq $oldname? " class=\"current\"":"" )."> <a href=\"$page\"><span>".($pub_tabs{$page})."</span></a></li>\n";
180 print OUT " </ul></div>\n";
182 while ($line = <IN>) {
187 rename("html/$newname","html/$oldname") unless $debug{'rename'};
189 map {handle_pub($_)} @pub_titles;
192 # Operate the recursion
197 print "Handle $current->{'file'} at level $level\n" if $debug{'handle'};
199 # we generate the tabs bottom up begining from where we are in the tree
200 # and display them top down, as it should in a file
203 if (defined ($current->{'label'}) and $current->{'label'} ne 'ROOT') {
204 # print "handle $current->{'file'}, at level $level\n";
206 my $iterator = $current;
208 while ($lvl_it >= 0) {
209 my $father = $iterator->{'up'};
210 $tabs[$lvl_it] = "<div class=\"tabs\">\n <ul>\n";
211 foreach my $bro (@{$father->{'down'}}) {
212 $tabs[$lvl_it] .= " <li".($bro==$iterator?" class=\"current\"":"")."> <a href=\"$bro->{'file'}\"><span>$bro->{'label'}</span></a></li>\n";
214 $tabs[$lvl_it] .= " </ul></div>\n";
218 if (defined $current->{'down'}) { # there's some kid. Display them too
219 $tabs[$level+1] = "<div class=\"tabs\">\n <ul>\n";
220 foreach my $kid (@{$current->{'down'}}) {
221 $tabs[$level+1] .= " <li> <a href=\"$kid->{'file'}\"><span>$kid->{'label'}</span></a></li>\n";
223 $tabs[$level+1] .= " </ul></div>\n";
227 open FROM,"html/$current->{'file'}" || die;
228 my $newname="html/$current->{'file'}";
229 $newname =~ s/.html/.handlepage.html/;
230 open TO,">$newname" || die;
231 # print "XXX Deal with html/$current->{'file'} -> $newname\n";
234 # add "current" to the module API granfather page
235 s|<li><a href="modules.html"><span>[^<]*</span></a></li>|<li class="current"><a href="modules.html"><span>Modules API</span></a></li>|;
236 # print "++Write $_";
244 if ($current->{'file'} =~ m/^class/) {
251 if (m/The documentation for/) {
260 rename("$newname","html/$current->{'file'}") unless $debug{'rename'};
264 foreach my $entry (@{$current->{'down'}}) {
265 handle_page($entry,$level+1);
270 ### Launch the modules navbar reworking
272 handle_page($top,-2);# skip roots (we have 2 roots) in level counting
276 ### Post-processsing common to all pages
278 map {push @allfiles,$_} @extra_files;
279 print "All files: ".(join(", ",@allfiles))."\n" if $debug{'parse'};
281 foreach my $file (@allfiles) {
282 $file =~ s/.html/.handlepage.html/ if $debug{'rename'}; # Take right name if debugging
284 open FROM,"$file" || die;
285 my $outfile = "$file";
286 $outfile =~ s/.(html|php)$/.new.$1/;
287 open TO,">$outfile" || die;
288 # print "POSTPROCESSING $file (tmp=$outfile)\n";
290 # Add the simgrid css, just in case
291 print TO '<link href="simgrid.css" rel="stylesheet" type="text/css">'."\n"
295 if (m,<li><a href="(doc/)?index.html"><span>Main\ Page</span></a></li>,) {
296 print TO ' <li'.($file =~ m,(doc/)?index.html, ? " class='current'" :"").'><a href="'.$1.'index.html"><span>Overview</span></a></li>'."\n";
297 print TO ' <li'.($file =~ m,(doc/)?faq.html, ? " class='current'" :"").'><a href="'.$1.'faq.html"><span>FAQ</span></a></li>'."\n";
300 if (m,<li><a href="(doc/)?annotated.html"><span>Data\ Structures</span></a></li>,) {
301 print TO ' <li'.($file =~ m,(doc/)?publis(_[^.]*)?.html, ? " class='current'" :"").'><a href="'.$1.'publis.html"><span>Publications</span></a></li>'."\n";
302 print TO ' <li'.($file =~ m,(doc/)?people.html, ? " class='current'" :"").'><a href="'.$1.'people.html"><span>People</span></a></li>'."\n";
303 print TO ' <li'.($file =~ m,(doc/)?history.html, ? " class='current'" :"").'><a href="'.$1.'history.html"><span>History</span></a></li>'."\n";
304 print TO ' <li'.($file =~ m,(doc/)?contrib.html, ? " class='current'" :"").'><a href="'.$1.'contrib.html"><span>Contrib</span></a></li>'."\n";
307 s|<span>Modules</span>|<span>Modules API</span>|g;
308 s|<span>Related Pages</span>|<span>Site Plan</span>|g;
314 rename("$outfile", "$file") unless $debug{'rename'};