--- /dev/null
+#!/usr/bin/perl
+
+my $state = 'skipping';
+
+if ($0 =~ /html/) {
+ print "<html><head><title>test output</title>";
+ print "<link rel='stylesheet' type='text/css' href='test_output.css'>";
+ print "</head><body><pre>\n";
+}
+
+while (my $line = <>) {
+ if ($line =~ /_\.-~=/) {
+ $state = 'outputting';
+ }
+ if ($state eq 'outputting') {
+ if ($0 =~ /html/) {
+ my $class = '';
+ if ($line =~ /^ok/
+ || $line =~ /\. ok/
+ || $line =~ /^PASS/
+ ) {
+ $class .= 'ok ';
+ }
+ $class .= 'error ' if ($line =~ /^err/i);
+ if ($line =~ /^not ok/
+ || $line =~ /\. not ok/
+ ) {
+ $class .= 'notok ';
+ }
+ $class .= 'result ' if ($line =~ /^Result:/);
+ $class .= 'pass ' if ($line =~ /^Result: PASS/);
+ $class .= 'fail ' if ($line =~ /^Result: FAIL/);
+ if ($line =~ /^#/
+ || $line =~ /Checks:/
+ || $line =~ /_\.-~=/
+ || $line =~ /=~-\._/
+ || $line =~ / tests /
+ || $line =~ /Failed /
+ || $line =~ /Passed /
+ || $line =~ /Files:/
+ ) {
+ $class .= 'comment ';
+ }
+ chomp $line;
+ print "<span class='$class'>$line</span>\n";
+ } else {
+ print $line;
+ }
+ }
+ if ($line =~ /=~-\._/) {
+ $state = 'skipping';
+ }
+}
+
+if ($0 =~ /html/) {
+ print "</pre></body></html>\n";
+}