Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot//simgrid/simgrid
[simgrid.git] / tools / doxygen / bibtex2html_wrapper.pl
1 #!/usr/bin/perl -w
2 use utf8;
3 use strict;
4
5 my $file = shift @ARGV || die "USAGE: bibtex2html_wrapper <file>\n";
6
7 my $output;
8 my $write;
9 my $line;
10 my $title;
11
12 open IN,"bibtex2html -single-output -nv -force -sort year -copy-icons ${file}.bib -output -|iconv -f latin1 -t utf8 -|";
13
14 $write=0;
15 while($line = <IN>) {
16     chomp $line;
17     next if $line =~ /WARNING: unknown field type/;
18     
19     if($line =~ /table width/) {
20         $line = <IN>;
21         chomp $line;
22         if($line =~ /height="50"/) {
23             ## Skip preembule
24             $write=1;
25             do {
26                 $line = <IN>;
27                 chomp $line;
28             } while (!($line =~ /table/));
29             next;
30         }
31         if($line =~ /height="35"/) {
32                 my $output;
33             ## Change this uggly table into a h2
34             do {
35                 $line = <IN>;
36                 chomp $line;
37             } while (($line =~ /</));
38             $title=$line;
39             do {
40                 $line = <IN>;
41                 chomp $line;
42             } while (!($line =~ /table/));
43             $output .= "<h1>$title</h1>\n";
44             next;
45         }
46     }
47     $line =~ s/<ol>/<ul>/g;
48     $line =~ s/<\/ol>/<\/ul>/g;
49
50     if($line =~ /Disclaimer:/ || $line =~ /body>/) {
51         $write=0;
52         next;
53     }
54     if($line =~ /This document was translated f/) {
55         $write=1;
56     }
57
58     if($write) {
59         $output .= $line."\n";
60     }
61     
62 }
63 open(OUT,">${file}_bib.html");
64 print OUT $output;
65 close(OUT);
66 close(IN);