From 8555352c18956047bdccbf2215c34a758d61eaf1 Mon Sep 17 00:00:00 2001 From: Dianne Skoll Date: Mon, 3 Feb 2025 11:36:19 -0500 Subject: [PATCH] Add popup for location and description in HTML calendar. --- rem2html/rem2html.in | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/rem2html/rem2html.in b/rem2html/rem2html.in index 18031dce..44b97e5b 100644 --- a/rem2html/rem2html.in +++ b/rem2html/rem2html.in @@ -359,10 +359,11 @@ sub parse_input chomp; last if /^\# rem2ps2? end$/; next if /^\#/; - my ($y, $m, $d, $special, $tag, $duration, $time, $body); + my ($y, $m, $d, $special, $tag, $duration, $time, $body, $title); if (m/^(\d*).(\d*).(\d*)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s*(.*)$/) { ($y, $m, $d, $special, $tag, $duration, $time, $body) = ($1, $2, $3, $4, $5, $6, $7, $8); + $title = ''; } elsif (/\{/) { my $obj; if ($Options{utf8}) { @@ -379,6 +380,7 @@ sub parse_input $duration = $obj->{duration} || '*'; $time = $obj->{time} || '*'; $body = $obj->{body}; + $title = info_to_title($obj->{info}); } else { next; } @@ -415,10 +417,10 @@ sub parse_input my($r, $g, $b, $text) = ($1, $2, $3, $4); my $color = sprintf("style=\"color: #%02X%02X%02X;\"", $r % 256, $g % 256, $b % 256); - push(@{$days->[$d]}, "" . fix_whitespace(escape_html($text)) . '

'); + push(@{$days->[$d]}, "" . fix_whitespace(escape_html($text)) . '

'); } } elsif ($special eq '*') { - push(@{$days->[$d]}, "" . fix_whitespace(escape_html($body)) . '

'); + push(@{$days->[$d]}, "" . fix_whitespace(escape_html($body)) . '

'); } } return $found_data; @@ -477,6 +479,29 @@ sub emit_ppp_calendars } } +sub info_to_title +{ + my ($info) = @_; + if (!$info) { + return ''; + } + my $done_one = 0; + my $title = ''; + foreach my $key ('location', 'description') { + next unless $info->{$key}; + if ($done_one) { + $title .= " "; + } + $done_one = 1; + my $val = escape_html($info->{$key}); + $val =~ s/\n/ /g; + $val =~ s/"/"/g; + $val =~ s/{duration} || '*'; my $time = $obj->{time} || '*'; my $body = $obj->{body}; + my $title = info_to_title($obj->{info}); $special = uc($special); if ($special eq 'HTML') { push(@{$days->[$col]}, $body); @@ -568,10 +594,10 @@ sub emit_one_ppp_calendar my($r, $g, $b, $text) = ($1, $2, $3, $4); my $color = sprintf("style=\"color: #%02X%02X%02X;\"", $r % 256, $g % 256, $b % 256); - push(@{$days->[$col]}, "" . fix_whitespace(escape_html($text)) . '

'); + push(@{$days->[$col]}, "" . fix_whitespace(escape_html($text)) . '

'); } } elsif ($special eq '*') { - push(@{$days->[$col]}, "" . fix_whitespace(escape_html($body)) . '

'); + push(@{$days->[$col]}, "" . fix_whitespace(escape_html($body)) . '

'); } } output_calendar($type, $cols_to_date_info);