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);
9 $debug{'parse'} = 0; # show how we parse the module tree
10 $debug{'input'} = 0; # display the resulting tree
11 $debug{'handle'}= 0; # Be verbose on the post-processing
12 $debug{'rename'}= 0; # do not overwrite the files (allows several debuging runs without rerunning doxygen)
16 ### Get the module definitions
19 open IN, "html/modules.html" || die "Cannot parse html/modules.html. Did you really run doxygen?\n";
23 last if /group__SimGrid__API.html/;
31 $current->{'label'}="ROOT";
32 push @{$top->{'down'}},$current;
35 print "Push $current as child of $top\n" if $debug{'parse'};
39 print "DOWN: $current -> " if $debug{'parse'};
40 $current = $current->{'down'}[scalar @{$current->{'down'}} - 1];
41 print "$current\n" if $debug{'parse'};
45 $current = $current->{'up'};
46 print "UP\n" if $debug{'parse'};
53 m|href="([^"]*)">([^<]*)</a>|; #"
56 $entry->{'file'} = $1;
57 $entry->{'label'} = $2;
58 $entry->{'up'} = $current;
59 push @{$current->{'down'}},$entry;
60 print "Push $1 $2 as child of $current\n" if $debug{'parse'};
61 push @allfiles,"html/$1";
65 # Check each file for extra information (short name, extra childs)
69 if (defined($current->{'file'})) {
70 open IN, "html/$current->{'file'}";
72 if (/DOXYGEN_NAVBAR_LABEL/) {
73 if (/DOXYGEN_NAVBAR_LABEL="([^"]*)"/) {#"
74 $current->{'label'}=$1;
76 die "Malformated DOXYGEN_NAVBAR_LABEL line in $current->{'file'}";
79 if (/DOXYGEN_NAVBAR_CHILD/) {
80 if (/DOXYGEN_NAVBAR_CHILD *"([^"]*)"=([^ ]*)/) {#"
82 $entry->{'label'} = $1;
83 $entry->{'file'} = $2;
84 chomp($entry->{'file'});
85 $entry->{'up'} = $current;
86 push @{$current->{'down'}},$entry;
88 die "Malformated DOXYGEN_NAVBAR_CHILD line in $current->{'file'}";
94 foreach my $entry (@{$current->{'down'}}) {
105 print "$current: ".$current->{'label'}." ($current->{'file'})\n";
106 foreach my $entry (@{$current->{'down'}}) {
107 display($entry,$level+1);
111 display($top,0) if $debug{'input'};
114 ### Generate the navbar
117 # the root deserves some special handling
118 open IN,"html/modules.html" || die;
119 open OUT,">html/modules.new.html" || die;
121 while ($line = <IN>) {
122 last if $line =~ /<h1>SimGrid Modules</;
126 print OUT "<div class=\"tabs\">\n <ul>\n";
127 foreach $current (@{ ${$top->{'down'}}[0]->{'down'} }) {
128 print OUT " <li><a href=\"$current->{'file'}\"><span>$current->{'label'}</span></a></li>\n";
130 print OUT " </ul></div>\n";
138 rename("html/modules.new.html","html/modules.html") unless $debug{'rename'};
140 # Operate the recursion
145 print "Handle $current->{'file'} at level $level\n" if $debug{'handle'};
147 # we generate the tabs bottom up begining from where we are in the tree
148 # and display them top down, as it should in a file
151 if (defined ($current->{'label'}) and $current->{'label'} ne 'ROOT') {
152 # print "handle $current->{'file'}, at level $level\n";
154 my $iterator = $current;
156 while ($lvl_it >= 0) {
157 my $father = $iterator->{'up'};
158 $tabs[$lvl_it] = "<div class=\"tabs\">\n <ul>\n";
159 foreach my $bro (@{$father->{'down'}}) {
160 $tabs[$lvl_it] .= " <li".($bro==$iterator?" id=\"current\"":"")."> <a href=\"$bro->{'file'}\"><span>$bro->{'label'}</span></a></li>\n";
162 $tabs[$lvl_it] .= " </ul></div>\n";
166 if (defined $current->{'down'}) { # there's some kid. Display them too
167 $tabs[$level+1] = "<div class=\"tabs\">\n <ul>\n";
168 foreach my $kid (@{$current->{'down'}}) {
169 $tabs[$level+1] .= " <li> <a href=\"$kid->{'file'}\"><span>$kid->{'label'}</span></a></li>\n";
171 $tabs[$level+1] .= " </ul></div>\n";
175 open FROM,"html/$current->{'file'}" || die;
176 my $newname="html/$current->{'file'}";
177 $newname =~ s/.html/.new.html/;
178 open TO,">$newname" || die;
180 # add "current" to the module API granfather page
181 s|<li><a href="modules.html"><span>[^<]*</span></a></li>|<li id="current"><a href="modules.html"><span>Modules API</span></a></li>|;
183 last if m|</ul></div>|;
193 rename("$newname","html/$current->{'file'}") unless $debug{'rename'};
194 # print "mv $newname html/$current->{'file'}\n";
198 foreach my $entry (@{$current->{'down'}}) {
199 handle_page($entry,$level+1);
204 ### Launch the modules navbar reworking
206 handle_page($top,-2);# skip roots (we have 2 roots) in level counting
210 ### Post-processsing common to all pages
212 map {push @allfiles,$_} @extra_files;
214 foreach my $file (@allfiles) {
215 open FROM,"$file" || die;
216 my $outfile = "$file";
217 $outfile =~ s/.(html|php)$/.new.$1/;
218 open TO,">$outfile" || die;
219 # print "POSTPROCESSING $file (tmp=$outfile)\n";
221 # Add the simgrid css, just in case
222 print TO '<link href="simgrid.css" rel="stylesheet" type="text/css">'."\n"
226 if (m,<li><a href="(doc/)?index.html"><span>Main\ Page</span></a></li>,) {
227 print TO '<li><a href="'.$1.'index.html"><span>Overview</span></a></li>'."\n";
228 print TO '<li><a href="'.$1.'faq.html"><span>FAQ</span></a></li>'."\n";
231 if (m,<li><a href="(doc/)?annotated.html"><span>Data\ Structures</span></a></li>,) {
232 print TO '<li><a href="'.$1.'publis.html"><span>Publications</span></a></li>'."\n";
235 s|<span>Modules</span>|<span>Modules API</span>|g;
236 s|<li><a href="(doc/)?dirs.html"><span>Directories</span></a></li>||g;
242 rename("$outfile", "$file") unless $debug{'rename'};