diff --git a/rem2html/rem2html.in b/rem2html/rem2html.in
index 369df570..300f1b1c 100644
--- a/rem2html/rem2html.in
+++ b/rem2html/rem2html.in
@@ -96,6 +96,14 @@ without any EhtmlE or EbodyE tags.
Use I as the content between EtitleE and E/titleE
tags.
+=item --yaag
+
+Instead of making 7-column tables for each month, show each month
+as a I table row of 38 columns. This is the so-called
+"year-at-a-glance" format. You must use the "-ppp" option to
+C or the --yaag option will be ignored. And this format
+works best if you create a calendar for an entire year (so, starting
+in January and using "-ppp12" to get 12 months' worth of reminders.)
=item --prologue I
@@ -188,6 +196,7 @@ Options:
--title string What to put in ... tags
--prologue html_text Text to insert at the top of the body
--epilogue html_text Text to insert at the end of the body
+--yaag Output one month per row for year-at-a-glance format
EOM
exit($exit_status);
}
@@ -218,6 +227,7 @@ sub parse_options
"man",
"utf8",
"pngs",
+ "yaag",
"version",
"stylesheet=s",
"nostyle",
@@ -316,6 +326,10 @@ sub parse_input
if ($_ eq '[') {
return parse_input_ppp();
}
+ if ($Options{yaag}) {
+ $Options{yaag} = 0;
+ print STDERR "Ignoring option --yaag: You must use remind -ppp for this option\n";
+ }
if (/# translations/) {
slurp_translations();
next;
@@ -472,6 +486,10 @@ sub parse_input_ppp
}
if (exists($array->[0]{caltype}) &&
$array->[0]{caltype} eq 'weekly') {
+ if ($Options{yaag}) {
+ $Options{yaag} = 0;
+ print STDERR "Ignoring option --yaag for a weekly calendar\n";
+ }
emit_ppp_calendars($array, 'weekly');
} else {
emit_ppp_calendars($array, 'monthly');
@@ -488,11 +506,45 @@ sub parse_input_ppp
}
}
+sub print_yaag_weekday_row
+{
+ my ($cal) = @_;
+ print "";
+ print "";
+ for (my $i=0; $i<37; $i++) {
+ my $day;
+ if ($cal->{mondayfirst}) {
+ $day = $cal->{daynames}->[($i+1) % 7];
+ } else {
+ $day = $cal->{daynames}->[$i % 7];
+ }
+ print "";
+ }
+ print "
\n";
+}
+
sub emit_ppp_calendars
{
my ($array, $type) = @_;
+ my $prev_year = 0;
+ my $done_one = 0;
foreach my $cal (@$array) {
+ if ($Options{yaag}) {
+ if ($cal->{year} != $prev_year) {
+ $prev_year = $cal->{year};
+ if ($done_one) {
+ print "\n";
+ }
+ print "$prev_year\n";
+ print "\n";
+ print_yaag_weekday_row($cal);
+ }
+ }
emit_one_ppp_calendar($cal, $type);
+ $done_one = 1;
+ }
+ if ($done_one) {
+ print "
\n";
}
}
@@ -766,44 +818,71 @@ sub output_calendar
# Start the table
my $class;
- if ($Options{nostyle}) {
- print '';
- if ($type eq 'monthly') {
- print "$Month $Year ";
- }
- print "\n";
- $class = ' width="14%"';
- } else {
- if ($type eq 'monthly') {
- print '' .
- $Month . ' ' . $Year . '' . "\n";
+ if (!$Options{yaag}) {
+ if ($Options{nostyle}) {
+ print '';
+ if ($type eq 'monthly') {
+ print "$Month $Year ";
+ }
+ print "\n";
+ $class = ' width="14%"';
} else {
- print '' . "\n";
+ if ($type eq 'monthly') {
+ print '' .
+ $Month . ' ' . $Year . '' . "\n";
+ } else {
+ print '' . "\n";
+ }
+ print '';
+ $class = ' class="rem-cal-hdr"';
}
- print '
';
- $class = ' class="rem-cal-hdr"';
- }
- if ($type eq 'monthly') {
- if (!$Mondayfirst) {
- print "| " . $Daynames[0] . ' | ';
+ if ($type eq 'monthly') {
+ if (!$Mondayfirst) {
+ print "" . $Daynames[0] . ' | ';
+ }
+ for (my $i=1; $i<7; $i++) {
+ print "" . $Daynames[$i] . ' | ';
+ }
+ if ($Mondayfirst) {
+ print "" . $Daynames[0] . ' | ';
+ }
+ } else {
+ for (my $i=0; $i<7; $i++) {
+ my $inf = $date_info->[$i];
+ print "" . $inf->{dayname} . " " .
+ $inf->{day} . ' ' .
+ $inf->{month} . ' ' .
+ $inf->{year} . ' | ';
+ }
}
- for (my $i=1; $i<7; $i++) {
- print "" . $Daynames[$i] . ' | ';
- }
- if ($Mondayfirst) {
- print "" . $Daynames[0] . ' | ';
- }
- } else {
- for (my $i=0; $i<7; $i++) {
- my $inf = $date_info->[$i];
- print "" . $inf->{dayname} . " " .
- $inf->{day} . ' ' .
- $inf->{month} . ' ' .
- $inf->{year} . ' | ';
- }
- }
- print "
\n";
+ print "\n";
+ } else {
+ # For year-at-a-glance calendar, it's just a row
+ print '';
+ print '| ' . $Month . " | \n";
+
+ my $cells_drawn = 0;
+ # Print the blank ones
+ for (my $i=0; $i<$first_col; $i++) {
+ print " | ";
+ $cells_drawn++;
+ }
+
+ # All the entries
+ for (my $day=1; $day <= $Numdays; $day++) {
+ draw_day_cell($day, 1, $type);
+ $cells_drawn++;
+ }
+
+ # And fill in the remaining ones
+ while ($cells_drawn < 37) {
+ print " | ";
+ $cells_drawn++;
+ }
+ print "
\n";
+ return;
+ }
# Start the calendar rows
my $col = 0;
if ($Options{nostyle}) {
@@ -911,7 +990,11 @@ sub draw_day_cell
if ($Options{nostyle}) {
$class = $classes->[$day] || '';
} else {
- $class = $classes->[$day] || "rem-cell rem-cell-$number_of_rows-rows";
+ if ($Options{yaag}) {
+ $class = $classes->[$day] || "rem-yaag-cell";
+ } else {
+ $class = $classes->[$day] || "rem-cell rem-cell-$number_of_rows-rows";
+ }
}
if ($shade) {
$shade = " style=\"background: $shade;\"";
@@ -984,7 +1067,11 @@ sub draw_day_cell
print "$day$week
\n";
print "
\n";
} else {
- print "$day$week
\n";
+ if ($Options{yaag}) {
+ print "$day$week
\n";
+ } else {
+ print "$day$week
\n";
+ }
}
} else {
if ($Options{nostyle}) {
@@ -1050,6 +1137,19 @@ table.rem-cal {
font-size: 12pt;
}
+table.rem-yaag {
+ font-family: helvetica, arial, sans-serif;
+ font-size: 8pt;
+ table-layout: fixed;
+ cellspacing: 0;
+ border-collapse: collapse;
+}
+
+span.year_heading {
+ font-family: helvetica, arial, sans-serif;
+ font-size: 28pt;
+}
+
table.rem-sc-table {
font-family: helvetica, arial, sans-serif;
font-size: 10pt;
@@ -1075,8 +1175,33 @@ td.rem-empty, td.rem-cell, td.rem-small-calendar {
border-width: 1px;
vertical-align: top;
}
+
+td.rem-yaag-cell {
+ height: 7em;
+ border-style: solid;
+ border-width: 1px;
+ vertical-align: top;
+}
+
+td.rem-cal-yaag-blank {
+ height: 7em;
+ border-style: solid;
+ border-width: 1px;
+ vertical-align: top;
+}
+
+th.rem-cal-yaag-hdr {
+ border-style: solid;
+ border-width: 1px;
+ vertical-align: top;
+}
+th.rem-yaag-weekday-header {
+ border-style: solid;
+ border-width: 1px;
+ vertical-align: top;
+}
+
td.rem-today {
- width: 14%;
height: 7em;
border-style: solid;
border-width: 2px;
@@ -1096,6 +1221,13 @@ div.rem-daynumber {
font-size: 14pt;
}
+div.rem-daynumber-yaag {
+ float: right;
+ text-align: right;
+ vertical-align: top;
+ font-size: 10pt;
+}
+
p.rem-entry {
clear: both;
}
diff --git a/tests/manpage-personal-dict b/tests/manpage-personal-dict
index edddce2b..a06f1504 100644
--- a/tests/manpage-personal-dict
+++ b/tests/manpage-personal-dict
@@ -780,6 +780,7 @@ popen
pp12
pp3
ppp
+ppp12
pre
preprocessor
prev
@@ -977,6 +978,7 @@ xsiz
xsiz1
y1
y2
+yaag
year1
year2
yeardiff