#!/usr/bin/perl

print
    "<table style=\"border-collapse: collapse; width: 800px\">",
    "<tr style=\"background-color: #aaaaff\">",
    "<th style=\"width: 100px;\">Date</th>",
    "<th style=\"width: 150px;\">Topic</th>",
    "<th style=\"width: 225px;\">Readings</th>",
    "<th style=\"width: 175px;\">Assignment details</th>",
    "</tr>\n";

while (<>) {
    s/\\\#/[ANCHOR]/;
    s/#.*//;
    s/\[ANCHOR\]/\#/;
    next unless $_;
    my ($date,$topic,$assignment,$readings) = split(/\|/);

    my $bgcolor = '#ffffff';
    $bgcolor = '#eeeedd' if $date =~ /week/i;
    
    print
	"<tr style=\"background-color: $bgcolor\">",
	"<th valign=\"top\">$date</th>",
	"<td valign=\"top\"><em>$topic</em></td>",
	"<td valign=\"top\">$readings</td>",
	"<td valign=\"top\">$assignment</td>",
	"</tr>\n";
}

print "</table>";
