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{'rename'}= 0; # do not overwrite the files (allows several debuging runs without rerunning doxygen)
15 ### Get the module definitions
18 open IN, "html/modules.html" || die "Cannot parse html/modules.html. Did you really run doxygen?\n";
22 last if /group__SimGrid__API.html/;
30 $current->{'label'}="ROOT";
31 push @{$top->{'down'}},$current;
34 print "Push $current as child of $top\n" if $debug{'parse'};
38 print "DOWN: $current -> " if $debug{'parse'};
39 $current = $current->{'down'}[scalar @{$current->{'down'}} - 1];
40 print "$current\n" if $debug{'parse'};
44 $current = $current->{'up'};
45 print "UP\n" if $debug{'parse'};
52 m|href="([^"]*)">([^<]*)</a>|; #"
55 $entry->{'file'} = $1;
56 $entry->{'label'} = $2;
57 $entry->{'up'} = $current;
58 push @{$current->{'down'}},$entry;
59 print "Push $1 $2 as child of $current\n" if $debug{'parse'};
60 push @allfiles,"html/$1";
64 # Check each file for extra information (short name, extra childs)
68 if (defined($current->{'file'})) {
69 open IN, "html/$current->{'file'}";
71 if (/DOXYGEN_NAVBAR_LABEL/) {
72 if (/DOXYGEN_NAVBAR_LABEL="([^"]*)"/) {#"
73 $current->{'label'}=$1;
75 die "Malformated DOXYGEN_NAVBAR_LABEL line in $current->{'file'}";
78 if (/DOXYGEN_NAVBAR_CHILD/) {
79 if (/DOXYGEN_NAVBAR_CHILD *"([^"]*)"=([^ ]*)/) {#"
81 $entry->{'label'} = $1;
82 $entry->{'file'} = $2;
83 chomp($entry->{'file'});
84 $entry->{'up'} = $current;
85 push @{$current->{'down'}},$entry;
87 die "Malformated DOXYGEN_NAVBAR_CHILD line in $current->{'file'}";
93 foreach my $entry (@{$current->{'down'}}) {
104 print "$current: ".$current->{'label'}." ($current->{'file'})\n";
105 foreach my $entry (@{$current->{'down'}}) {
106 display($entry,$level+1);
110 display($top,0) if $debug{'input'};
113 ### Generate the navbar
116 # the root deserves some special handling
117 open IN,"html/modules.html" || die;
118 open OUT,">html/modules.new.html" || die;
120 while ($line = <IN>) {
121 last if $line =~ /<h1>SimGrid Modules</;
125 print OUT "<div class=\"tabs\">\n <ul>\n";
126 foreach $current (@{ ${$top->{'down'}}[0]->{'down'} }) {
127 print OUT " <li><a href=\"$current->{'file'}\"><span>$current->{'label'}</span></a></li>\n";
129 print OUT " </ul></div>\n";
137 rename("html/modules.new.html","html/modules.html") unless $debug{'rename'};
139 # Operate the recursion
144 # we generate the tabs bottom up begining from where we are in the tree
145 # and display them top down, as it should in a file
148 if (defined ($current->{'label'}) and $current->{'label'} ne 'ROOT') {
149 # print "handle $current->{'file'}, at level $level\n";
151 my $iterator = $current;
153 while ($lvl_it >= 0) {
154 my $father = $iterator->{'up'};
155 $tabs[$lvl_it] = "<div class=\"tabs\">\n <ul>\n";
156 foreach my $bro (@{$father->{'down'}}) {
157 $tabs[$lvl_it] .= " <li".($bro==$iterator?" id=\"current\"":"")."> <a href=\"$bro->{'file'}\"><span>$bro->{'label'}</span></a></li>\n";
159 $tabs[$lvl_it] .= " </ul></div>\n";
163 if (defined $current->{'down'}) { # there's some kid. Display them too
164 $tabs[$level+1] = "<div class=\"tabs\">\n <ul>\n";
165 foreach my $kid (@{$current->{'down'}}) {
166 $tabs[$level+1] .= " <li> <a href=\"$kid->{'file'}\"><span>$kid->{'label'}</span></a></li>\n";
168 $tabs[$level+1] .= " </ul></div>\n";
172 open FROM,"html/$current->{'file'}" || die;
173 my $newname="html/$current->{'file'}";
174 $newname =~ s/.html/.new.html/;
175 open TO,">$newname" || die;
177 # add "current" to the module API granfather page
178 s|<li><a href="modules.html"><span>Modules API</span></a></li>|<li id="current"><a href="modules.html"><span>Modules API</span></a></li>|;
181 last if m|</ul></div>|;
191 rename("$newname","html/$current->{'file'}") unless $debug{'rename'};
192 # print "mv $newname html/$current->{'file'}\n";
196 foreach my $entry (@{$current->{'down'}}) {
197 handle_page($entry,$level+1);
202 ### Launch the modules navbar reworking
204 handle_page($top,-2);# skip roots (we have 2 roots) in level counting
208 ### Post-processsing common to all pages
210 map {push @allfiles,$_} @extra_files;
212 foreach my $file (@allfiles) {
213 open FROM,"$file" || die;
214 my $outfile = "$file";
215 $outfile =~ s/.(html|php)$/.new.$1/;
216 open TO,">$outfile" || die;
217 # print "POSTPROCESSING $file (tmp=$outfile)\n";
219 # Add the simgrid css, just in case
220 print TO '<link href="simgrid.css" rel="stylesheet" type="text/css">'."\n"
224 if (m,<li><a href="(doc/)?index.html"><span>Main\ Page</span></a></li>,) {
225 print TO '<li><a href="'.$1.'index.html"><span>Overview</span></a></li>'."\n";
226 print TO '<li><a href="'.$1.'faq.html"><span>FAQ</span></a></li>'."\n";
229 if (m,<li><a href="(doc/)?annotated.html"><span>Data\ Structures</span></a></li>,) {
230 print TO '<li><a href="'.$1.'publis.html"><span>Publications</span></a></li>'."\n";
233 s|<span>Modules</span>|<span>Modules API</span>|g;
234 s|<li><a href="(doc/)?dirs.html"><span>Directories</span></a></li>||g;
240 rename("$outfile", "$file") unless $debug{'rename'};