#!/usr/bin/perl use CGI qw(:standard ); use XML::DT ; use strict; my %titulos=(); my @lts =(); my $tit; my $ignoro = <>; my $filename = <>; chomp $filename; while(<>){ chomp: s/#.*//; if(/^0\s+(.*)/){ $tit = $1;} elsif (/^(\d+)\s+(.*)/){ $titulos{$1}=$2; push(@lts,$1) ;} else { warn ("$_ ???\n") } } my %tab=(); my $n=0; my %handler=( -html => 1, 'font' => sub{ $c }, 'title' => sub{ $tit ||= $c; }, 'head' => sub{ "" }, 'table' => sub{ $n++; $tab{$n} = toxml() ; ":::::" . a({href=>"#$n"}, $titulos{$n} || "Tabela $n" )." ::::"}, ); dt($filename,%handler); #for (@lts){ # print li( a({href => "$_"}, "Tabela $_")) ; #} print h1($tit); print ol( li( [ map { a({href => "#$_"}, $titulos{$_}) } @lts ] )) ; for (@lts){ print h1( a({name => "$_"}, $titulos{$_})) , $tab{$_}; } __END__ =head1 NAME tabreorder - script language!!! for table reordering =head1 SYNOPSIS #!/usr/bin/perl tabreorder Filename table*... =head1 DESCRIPTION =head2 EXPORT =head2 Example #!/usr/bin/perl tabreorder /tmp/portuguese-english.html 0 Titulo geral 5 DicionĂ¡rio 9 Autores 3 Data 6 Contactos e mails =head1 AUTHOR Turma de Scripting 2006 J.Joao Almeida, jj@di.uminho.pt =head1 SEE ALSO perl(1). =cut