#!/usr/bin/perl -w # # This is purely used to generate a page on the website; it's not intended # to be distributed or installed. my $tmpl = q{__TYPE____DESCRIPTION____NAME____SCORE__}; while (<>) { s/#.*$//g; s/^\s+//; s/\s+$//; if (/^(header|body|rawbody|uri|full|describe)\s+(\S+)\s+(.+)$/) { if (!defined $test{$2}) { push (@testnames, $2); $type{$2} = $1; } $test{$2} = $3; } if (/^score\s+(\S+)\s+(.+)$/) { $score{$1} = $2; } } my $n = 0; foreach my $t (@testnames) { $n++; $_ = $tmpl; $test = $test{$t}; $test =~ s,&,&,gs; # protect HTML $test =~ s,<,<,gs; $test =~ s,>,>,gs; $test =~ s,\|,| ,gs; # allow line breaks on pipes my $bgcolor = ''; if ($n % 2 == 0) { $bgcolor = ' bgcolor=#ccffcc'; } s/__BGCOLOR__/$bgcolor/gs; s/__NAME__/$t/gs; s/__DESCRIPTION__/$test/gs; s/__TYPE__/$type{$t}/gs; s/__SCORE__/$score{$t} or 1/ges; print; }