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);
8 map {push @extra_files, "html/GRAS_tut_$_.html"} qw (intro
9 tour tour_install tour_setup tour_simpleexchange tour_args tour_callbacks tour_globals
10 tour_logs tour_timers tour_exceptions tour_rpc);
13 $debug{'parse'} = 0; # show how we parse the module tree
14 $debug{'input'} = 0; # display the resulting tree
15 $debug{'handle'}= 0; # Be verbose on the post-processing
16 $debug{'rename'}= 0; # do not overwrite the files (allows several debuging runs without rerunning doxygen)
20 ### Get the module definitions
23 open IN, "html/modules.html" || die "Cannot parse html/modules.html. Did you really run doxygen?\n";
27 last if /group__SimGrid__API.html/;
35 $current->{'label'}="ROOT";
36 push @{$top->{'down'}},$current;
39 print "Push $current as child of $top\n" if $debug{'parse'};
43 print "DOWN: $current -> " if $debug{'parse'};
44 $current = $current->{'down'}[scalar @{$current->{'down'}} - 1];
45 print "$current\n" if $debug{'parse'};
49 $current = $current->{'up'};
50 print "UP\n" if $debug{'parse'};
57 m|href="([^"]*)">([^<]*)</a>|; #"
60 $entry->{'file'} = $1;
61 $entry->{'label'} = $2;
62 $entry->{'up'} = $current;
63 push @{$current->{'down'}},$entry;
64 print "Push $1 $2 as child of $current\n" if $debug{'parse'};
65 push @allfiles,"html/$1";
69 # Check each file for extra information (short name, extra childs)
73 if (defined($current->{'file'})) {
74 open IN, "html/$current->{'file'}";
76 if (/DOXYGEN_NAVBAR_LABEL/) {
77 if (/DOXYGEN_NAVBAR_LABEL="([^"]*)"/) {#"
78 $current->{'label'}=$1;
80 die "Malformated DOXYGEN_NAVBAR_LABEL line in $current->{'file'}";
83 if (/DOXYGEN_NAVBAR_CHILD/) {
84 if (/DOXYGEN_NAVBAR_CHILD *"([^"]*)"=([^ ]*)/) {#"
86 $entry->{'label'} = $1;
87 $entry->{'file'} = $2;
88 chomp($entry->{'file'});
89 $entry->{'up'} = $current;
90 push @{$current->{'down'}},$entry;
92 die "Malformated DOXYGEN_NAVBAR_CHILD line in $current->{'file'}";
98 foreach my $entry (@{$current->{'down'}}) {
109 print "$current: ".$current->{'label'}." ($current->{'file'})\n";
110 foreach my $entry (@{$current->{'down'}}) {
111 display($entry,$level+1);
115 display($top,0) if $debug{'input'};
118 ### Generate the navbar
121 # the root deserves some special handling
122 open IN,"html/modules.html" || die;
123 open OUT,">html/modules.new.html" || die;
125 while ($line = <IN>) {
126 last if $line =~ /<h1>SimGrid Modules</;
130 print OUT "<div class=\"tabs\">\n <ul>\n";
131 foreach $current (@{ ${$top->{'down'}}[0]->{'down'} }) {
132 print OUT " <li><a href=\"$current->{'file'}\"><span>$current->{'label'}</span></a></li>\n";
134 print OUT " </ul></div>\n";
142 rename("html/modules.new.html","html/modules.html") unless $debug{'rename'};
144 # Operate the recursion
149 print "Handle $current->{'file'} at level $level\n" if $debug{'handle'};
151 # we generate the tabs bottom up begining from where we are in the tree
152 # and display them top down, as it should in a file
155 if (defined ($current->{'label'}) and $current->{'label'} ne 'ROOT') {
156 # print "handle $current->{'file'}, at level $level\n";
158 my $iterator = $current;
160 while ($lvl_it >= 0) {
161 my $father = $iterator->{'up'};
162 $tabs[$lvl_it] = "<div class=\"tabs\">\n <ul>\n";
163 foreach my $bro (@{$father->{'down'}}) {
164 $tabs[$lvl_it] .= " <li".($bro==$iterator?" id=\"current\"":"")."> <a href=\"$bro->{'file'}\"><span>$bro->{'label'}</span></a></li>\n";
166 $tabs[$lvl_it] .= " </ul></div>\n";
170 if (defined $current->{'down'}) { # there's some kid. Display them too
171 $tabs[$level+1] = "<div class=\"tabs\">\n <ul>\n";
172 foreach my $kid (@{$current->{'down'}}) {
173 $tabs[$level+1] .= " <li> <a href=\"$kid->{'file'}\"><span>$kid->{'label'}</span></a></li>\n";
175 $tabs[$level+1] .= " </ul></div>\n";
179 open FROM,"html/$current->{'file'}" || die;
180 my $newname="html/$current->{'file'}";
181 $newname =~ s/.html/.new.html/;
182 open TO,">$newname" || die;
184 # add "current" to the module API granfather page
185 s|<li><a href="modules.html"><span>[^<]*</span></a></li>|<li id="current"><a href="modules.html"><span>Modules API</span></a></li>|;
187 last if m|</ul></div>|;
197 rename("$newname","html/$current->{'file'}") unless $debug{'rename'};
198 # print "mv $newname html/$current->{'file'}\n";
202 foreach my $entry (@{$current->{'down'}}) {
203 handle_page($entry,$level+1);
208 ### Launch the modules navbar reworking
210 handle_page($top,-2);# skip roots (we have 2 roots) in level counting
214 ### Post-processsing common to all pages
216 map {push @allfiles,$_} @extra_files;
218 foreach my $file (@allfiles) {
219 open FROM,"$file" || die;
220 my $outfile = "$file";
221 $outfile =~ s/.(html|php)$/.new.$1/;
222 open TO,">$outfile" || die;
223 # print "POSTPROCESSING $file (tmp=$outfile)\n";
225 # Add the simgrid css, just in case
226 print TO '<link href="simgrid.css" rel="stylesheet" type="text/css">'."\n"
230 if (m,<li><a href="(doc/)?index.html"><span>Main\ Page</span></a></li>,) {
231 print TO '<li><a href="'.$1.'index.html"><span>Overview</span></a></li>'."\n";
232 print TO '<li><a href="'.$1.'faq.html"><span>FAQ</span></a></li>'."\n";
235 if (m,<li><a href="(doc/)?annotated.html"><span>Data\ Structures</span></a></li>,) {
236 print TO '<li><a href="'.$1.'publis.html"><span>Publications</span></a></li>'."\n";
239 s|<span>Modules</span>|<span>Modules API</span>|g;
240 # s|<li><a href="(doc/)?dirs.html"><span>Directories</span></a></li>||g;
246 rename("$outfile", "$file") unless $debug{'rename'};