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/publis.html html/pages.html html/modules.html html/contrib.html index.php html/GRAS_tut.html);
9 map {push @extra_files, "html/GRAS_tut_$_.html"} qw (intro
10 tour tour_install tour_setup tour_simpleexchange tour_args tour_callbacks tour_globals
11 tour_logs tour_timers tour_exceptions tour_rpc);
14 map {push @extra_files, "html/GRAS_ex_$_.html"} qw (ping mmrpc token timer);
17 $debug{'parse'} = 0; # show how we parse the module tree
18 $debug{'input'} = 0; # display the resulting tree
19 $debug{'handle'}= 0; # Be verbose on the post-processing
20 $debug{'rename'}= 0; # do not overwrite the files (allows several debuging runs without rerunning doxygen)
24 ### Get the module definitions
27 open IN, "html/modules.html" || die "Cannot parse html/modules.html. Did you really run doxygen?\n";
31 last if /group__SimGrid__API.html/;
39 $current->{'label'}="ROOT";
40 push @{$top->{'down'}},$current;
41 print "Push $current as child of $top\n" if $debug{'parse'};
47 print "DOWN: $current -> " if $debug{'parse'};
48 $current = $current->{'down'}[scalar @{$current->{'down'}} - 1];
49 print "$current\n" if $debug{'parse'};
53 $current = $current->{'up'};
54 print "UP\n" if $debug{'parse'};
61 m|href="([^"]*)">([^<]*)</a>|; #"
64 $entry->{'file'} = $1;
65 $entry->{'label'} = $2;
66 $entry->{'up'} = $current;
67 push @{$current->{'down'}},$entry;
68 print "Push $1 $2 as child of $current\n" if $debug{'parse'};
69 push @allfiles,"html/$1";
73 # Check each file for extra information (short name, extra childs)
77 if (defined($current->{'file'})) {
78 open IN, "html/$current->{'file'}";
80 if (/DOXYGEN_NAVBAR_LABEL/) {
81 if (/DOXYGEN_NAVBAR_LABEL="([^"]*)"/) {#"
82 print "Extra info from $current->{'file'}: label=$1, not $current->{'label'}\n" if $debug{'parse'};
83 $current->{'label'}=$1;
85 die "Malformated DOXYGEN_NAVBAR_LABEL line in $current->{'file'}";
88 if (/DOXYGEN_NAVBAR_CHILD/) {
89 if (/DOXYGEN_NAVBAR_CHILD *"([^"]*)"=([^ ]*)/) {#"
91 $entry->{'label'} = $1;
92 $entry->{'file'} = $2;
93 chomp($entry->{'file'});
94 $entry->{'up'} = $current;
95 push @{$current->{'down'}},$entry;
96 print "Extra info from $current->{'file'}: New child $entry->{'label'}=$entry->{'file'}\n" if $debug{'parse'};
98 die "Malformated DOXYGEN_NAVBAR_CHILD line in $current->{'file'}";
104 foreach my $entry (@{$current->{'down'}}) {
115 print "$current: ".$current->{'label'}." ($current->{'file'})\n";
116 foreach my $entry (@{$current->{'down'}}) {
117 display($entry,$level+1);
121 display($top,0) if $debug{'input'};
124 ### Generate the navbar
127 # the root deserves some special handling
128 open IN,"html/modules.html" || die;
129 open OUT,">html/modules.new.html" || die;
131 while ($line = <IN>) {
132 last if $line =~ /<h1>SimGrid Modules</;
136 print OUT "<div class=\"tabs\">\n <ul>\n";
137 foreach $current (@{ ${$top->{'down'}}[0]->{'down'} }) {
138 print OUT " <li><a href=\"$current->{'file'}\"><span>$current->{'label'}</span></a></li>\n";
140 print OUT " </ul></div>\n";
148 rename("html/modules.new.html","html/modules.html") unless $debug{'rename'};
150 # Operate the recursion
155 print "Handle $current->{'file'} at level $level\n" if $debug{'handle'};
157 # we generate the tabs bottom up begining from where we are in the tree
158 # and display them top down, as it should in a file
161 if (defined ($current->{'label'}) and $current->{'label'} ne 'ROOT') {
162 # print "handle $current->{'file'}, at level $level\n";
164 my $iterator = $current;
166 while ($lvl_it >= 0) {
167 my $father = $iterator->{'up'};
168 $tabs[$lvl_it] = "<div class=\"tabs\">\n <ul>\n";
169 foreach my $bro (@{$father->{'down'}}) {
170 $tabs[$lvl_it] .= " <li".($bro==$iterator?" class=\"current\"":"")."> <a href=\"$bro->{'file'}\"><span>$bro->{'label'}</span></a></li>\n";
172 $tabs[$lvl_it] .= " </ul></div>\n";
176 if (defined $current->{'down'}) { # there's some kid. Display them too
177 $tabs[$level+1] = "<div class=\"tabs\">\n <ul>\n";
178 foreach my $kid (@{$current->{'down'}}) {
179 $tabs[$level+1] .= " <li> <a href=\"$kid->{'file'}\"><span>$kid->{'label'}</span></a></li>\n";
181 $tabs[$level+1] .= " </ul></div>\n";
185 open FROM,"html/$current->{'file'}" || die;
186 my $newname="html/$current->{'file'}";
187 $newname =~ s/.html/.handlepage.html/;
188 open TO,">$newname" || die;
189 # print "XXX Deal with html/$current->{'file'} -> $newname\n";
192 # add "current" to the module API granfather page
193 s|<li><a href="modules.html"><span>[^<]*</span></a></li>|<li class="current"><a href="modules.html"><span>Modules API</span></a></li>|;
194 # print "++Write $_";
207 rename("$newname","html/$current->{'file'}") unless $debug{'rename'};
211 foreach my $entry (@{$current->{'down'}}) {
212 handle_page($entry,$level+1);
217 ### Launch the modules navbar reworking
219 handle_page($top,-2);# skip roots (we have 2 roots) in level counting
223 ### Post-processsing common to all pages
225 map {push @allfiles,$_} @extra_files;
227 foreach my $file (@allfiles) {
228 $file =~ s/.html/.handlepage.html/ if $debug{'rename'}; # Take right name if debugging
230 open FROM,"$file" || die;
231 my $outfile = "$file";
232 $outfile =~ s/.(html|php)$/.new.$1/;
233 open TO,">$outfile" || die;
234 # print "POSTPROCESSING $file (tmp=$outfile)\n";
236 # Add the simgrid css, just in case
237 print TO '<link href="simgrid.css" rel="stylesheet" type="text/css">'."\n"
241 if (m,<li><a href="(doc/)?index.html"><span>Main\ Page</span></a></li>,) {
242 print TO ' <li'.($file =~ m,(doc/)?index.html, ? " class='current'" :"").'><a href="'.$1.'index.html"><span>Overview</span></a></li>'."\n";
243 print TO ' <li'.($file =~ m,(doc/)?faq.html, ? " class='current'" :"").'><a href="'.$1.'faq.html"><span>FAQ</span></a></li>'."\n";
246 if (m,<li><a href="(doc/)?annotated.html"><span>Data\ Structures</span></a></li>,) {
247 print TO ' <li'.($file =~ m,(doc/)?publis.html, ? " class='current'" :"").'><a href="'.$1.'publis.html"><span>Publications</span></a></li>'."\n";
250 s|<span>Modules</span>|<span>Modules API</span>|g;
251 # s|<li><a href="(doc/)?dirs.html"><span>Directories</span></a></li>||g;
257 rename("$outfile", "$file") unless $debug{'rename'};