Subject: | PATCH: Fix HTML tags |
This patch significantly cleans up the HTML Table code generated only
create one table (with the same visual result) and removes dangling
tags, and unneeded tags.
It also adds two classes so that the look can be customized from
external CSS.
Subject: | Simple.patch |
--- Simple.pm.orig 2006-06-27 00:44:36.000000000 -0700
+++ Simple.pm 2006-06-27 01:12:26.000000000 -0700
@@ -200,19 +200,22 @@
my $ref = shift or return $self->_spacer;
return $ref if $ref eq $self->_spacer;
my $q = $self->_cgi;
- my $day = exists $ref->{day_link}
+ my $day = "<SPAN class='date'>";
+ $day .= exists $ref->{day_link}
? $q->a({ -href => $ref->{day_link} }, $ref->{date}->day)
- : $ref->{date}->day;
- my $elem = $q->start_table . $q->Tr($q->td($day));
+ : $ref->{'date'}->day;
+ $day .= "</SPAN>";
+ my $elem = $day;
my %info = %{ $ref };
foreach my $key (keys %info) {
next if ($key eq 'date' or $key eq 'day_link');
my $method = "_$key";
+ $elem .= "<BR><SPAN class='event'>";
$elem .= $self->can($method)
- ? $q->Tr($q->td($self->$method($info{$key})))
- : $q->Tr($q->td($info{$key}));
+ ? $self->$method($info{$key})
+ : $info{$key};
+ $elem .= "</SPAN>";
}
- $elem .= $q->end_table;
return $elem;
}
@@ -280,14 +283,14 @@
my $q = $self->_cgi;
my $mnth = $q->h3($months{$self->month} . " " . $self->year);
my $cal = $q->start_table({-border => 1})
- . $q->th([sort { $days{$a} <=> $days{$b} } keys %days]);
+ . $q->Tr($q->th([sort { $days{$a} <=> $days{$b} } keys %days]));
while (@seq) {
my @week_row = $self->_table_row(splice @seq, 0, 7);
$cal .= $q->Tr($q->td([@week_row]));
}
+ $cal = $mnth
+ . $cal;
$cal .= $q->end_table;
- $cal = $q->start_table . $q->Tr($q->td({ align => 'center' }, $mnth))
- . $q->Tr($q->td($cal)) . $q->end_table;
$cal = $self->_add_pic($cal) if $self->picture;
return $cal;
}