status2html 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/usr/bin/perl
  2. #
  3. # Convert the Status text file to HTML
  4. #
  5. # Usage: status2html.pl < 00STATUS > 00STATUS.html
  6. #
  7. my $bgcolor = "ffffff";
  8. print ("<table cellspacing=0 cellpadding=0 border=0>\n");
  9. LOOP:while(<>) {
  10. @array = ($text0, $text1, $text2, $text3, $text4) = /^(\w+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+/;
  11. $array[0] =~ s|^\s+(.*?)|{$array[0]=$1}|es; # Remove whitespaces at the beginning
  12. next LOOP if $array[0] eq "";
  13. next LOOP if $array[0] =~ /^=/;
  14. $array[0] =~ s|(.*?)\s+$|{$array[0]=$1}|es; # Remove whitespaces at the end
  15. printf ("<tr bgcolor=#%s>\n", $bgcolor);
  16. foreach (@array) {
  17. print ("<td>");
  18. ($dummy, $_) = ($_ =~ /^(\w+):(\S+)/) if ($_ =~ /^(\w+):(\S+)/); # Remove 1th part to ":"
  19. if ($_ eq "no") {
  20. print ("<font color=\"#cc3333\">");
  21. } elsif ($_ eq "yes") {
  22. print ("<font color=\"#33cc33\">");
  23. }
  24. print ("$_");
  25. print ("</td>");
  26. }
  27. if ($bgcolor eq "f0f0f0") { $bgcolor = "ffffff"; }
  28. else { $bgcolor = "f0f0f0"; }
  29. }
  30. print ("</table>\n");