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;
43 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 $current->{'label'}=$1;
84 die "Malformated DOXYGEN_NAVBAR_LABEL line in $current->{'file'}";
87 if (/DOXYGEN_NAVBAR_CHILD/) {
88 if (/DOXYGEN_NAVBAR_CHILD *"([^"]*)"=([^ ]*)/) {#"
90 $entry->{'label'} = $1;
91 $entry->{'file'} = $2;
92 chomp($entry->{'file'});
93 $entry->{'up'} = $current;
94 push @{$current->{'down'}},$entry;
96 die "Malformated DOXYGEN_NAVBAR_CHILD line in $current->{'file'}";
102 foreach my $entry (@{$current->{'down'}}) {
113 print "$current: ".$current->{'label'}." ($current->{'file'})\n";
114 foreach my $entry (@{$current->{'down'}}) {
115 display($entry,$level+1);
119 display($top,0) if $debug{'input'};
122 ### Generate the navbar
125 # the root deserves some special handling
126 open IN,"html/modules.html" || die;
127 open OUT,">html/modules.new.html" || die;
129 while ($line = <IN>) {
130 last if $line =~ /<h1>SimGrid Modules</;
134 print OUT "<div class=\"tabs\">\n <ul>\n";
135 foreach $current (@{ ${$top->{'down'}}[0]->{'down'} }) {
136 print OUT " <li><a href=\"$current->{'file'}\"><span>$current->{'label'}</span></a></li>\n";
138 print OUT " </ul></div>\n";
146 rename("html/modules.new.html","html/modules.html") unless $debug{'rename'};
148 # Operate the recursion
153 print "Handle $current->{'file'} at level $level\n" if $debug{'handle'};
155 # we generate the tabs bottom up begining from where we are in the tree
156 # and display them top down, as it should in a file
159 if (defined ($current->{'label'}) and $current->{'label'} ne 'ROOT') {
160 # print "handle $current->{'file'}, at level $level\n";
162 my $iterator = $current;
164 while ($lvl_it >= 0) {
165 my $father = $iterator->{'up'};
166 $tabs[$lvl_it] = "<div class=\"tabs\">\n <ul>\n";
167 foreach my $bro (@{$father->{'down'}}) {
168 $tabs[$lvl_it] .= " <li".($bro==$iterator?" id=\"current\"":"")."> <a href=\"$bro->{'file'}\"><span>$bro->{'label'}</span></a></li>\n";
170 $tabs[$lvl_it] .= " </ul></div>\n";
174 if (defined $current->{'down'}) { # there's some kid. Display them too
175 $tabs[$level+1] = "<div class=\"tabs\">\n <ul>\n";
176 foreach my $kid (@{$current->{'down'}}) {
177 $tabs[$level+1] .= " <li> <a href=\"$kid->{'file'}\"><span>$kid->{'label'}</span></a></li>\n";
179 $tabs[$level+1] .= " </ul></div>\n";
183 open FROM,"html/$current->{'file'}" || die;
184 my $newname="html/$current->{'file'}";
185 $newname =~ s/.html/.new.html/;
186 open TO,">$newname" || die;
188 # add "current" to the module API granfather page
189 s|<li><a href="modules.html"><span>[^<]*</span></a></li>|<li id="current"><a href="modules.html"><span>Modules API</span></a></li>|;
191 last if m|</ul></div>|;
201 rename("$newname","html/$current->{'file'}") unless $debug{'rename'};
202 # print "mv $newname html/$current->{'file'}\n";
206 foreach my $entry (@{$current->{'down'}}) {
207 handle_page($entry,$level+1);
212 ### Launch the modules navbar reworking
214 handle_page($top,-2);# skip roots (we have 2 roots) in level counting
218 ### Post-processsing common to all pages
220 map {push @allfiles,$_} @extra_files;
222 foreach my $file (@allfiles) {
223 open FROM,"$file" || die;
224 my $outfile = "$file";
225 $outfile =~ s/.(html|php)$/.new.$1/;
226 open TO,">$outfile" || die;
227 # print "POSTPROCESSING $file (tmp=$outfile)\n";
229 # Add the simgrid css, just in case
230 print TO '<link href="simgrid.css" rel="stylesheet" type="text/css">'."\n"
234 if (m,<li><a href="(doc/)?index.html"><span>Main\ Page</span></a></li>,) {
235 print TO '<li><a href="'.$1.'index.html"><span>Overview</span></a></li>'."\n";
236 print TO '<li><a href="'.$1.'faq.html"><span>FAQ</span></a></li>'."\n";
239 if (m,<li><a href="(doc/)?annotated.html"><span>Data\ Structures</span></a></li>,) {
240 print TO '<li><a href="'.$1.'publis.html"><span>Publications</span></a></li>'."\n";
243 s|<span>Modules</span>|<span>Modules API</span>|g;
244 # s|<li><a href="(doc/)?dirs.html"><span>Directories</span></a></li>||g;
250 rename("$outfile", "$file") unless $debug{'rename'};