From c443d0a9da2f26dd2bd49b09e779dc44e1cf1b93 Mon Sep 17 00:00:00 2001 From: Dianne Skoll Date: Tue, 12 Oct 2021 21:44:25 -0400 Subject: [PATCH] Make imgbase and stylesheet options behave rationally. --- rem2html/rem2html | 113 +++++++++++++++++++++++++++++++++++++++------- 1 file changed, 97 insertions(+), 16 deletions(-) diff --git a/rem2html/rem2html b/rem2html/rem2html index e8dcd94a..079250bc 100644 --- a/rem2html/rem2html +++ b/rem2html/rem2html @@ -61,7 +61,8 @@ I as the base URL. =item --stylesheet I Use I as the stylesheet. If this option is used, -I is I interpreted relative to B. +I is interpreted relative to B I it start +with a "/". =item --nostyle @@ -145,19 +146,17 @@ sub parse_options } $Options{'title'} ||= 'HTML Calendar'; - # Fix up imgbase - my $imgbase = '%IMAGEBASE%'; - if ($imgbase ne '%' . 'IMAGEBASE' . '%') { - $Options{'imgbase'} ||= $imgbase; - } else { - $Options{'imgbase'} ||= ''; + my $stylesheet = $Options{'stylesheet'}; + if ($stylesheet) { + if ($stylesheet !~ m{^/}) { + my $imgbase = $Options{'imgbase'}; + if ($imgbase) { + $imgbase .= '/' unless $imgbase =~ m{/$}; + $stylesheet = $imgbase . $stylesheet; + } + } + $Options{'stylesheet'} = $stylesheet; } - - $Options{'imgbase'} =~ s|/+$||; - my $stylesheet = $Options{'imgbase'}; - $stylesheet .= '/' if ($stylesheet ne ''); - $stylesheet .= 'rem-default.css'; - $Options{'stylesheet'} ||= $stylesheet; } sub start_output @@ -167,9 +166,13 @@ sub start_output print("\n\n" . $Options{'title'} . "\n"); if (!$Options{'nostyle'}) { if ($Options{'stylesheet'}) { - print('' . "\n"); - } + print('' . "\n"); + } else { + print("\n"); + } } print("\n\n"); if ($Options{'prologue'}) { @@ -614,3 +617,81 @@ if ($found_something) { exit(1); } +sub default_stylesheet +{ + return <<'EOF'; +table.rem-cal { + font-family: helvetica, arial, sans-serif; + font-size: 12pt; +} + +table.rem-sc-table { + font-family: helvetica, arial, sans-serif; + font-size: 10pt; + width: 95%; + float: left; +} + +caption.rem-cal-caption { + font-size: 14pt; + font-weight: bold; +} + +th.rem-cal-hdr { + width: 14%; + border-style: solid; + border-width: 1px; + vertical-align: top; +} +td.rem-empty, td.rem-cell, td.rem-small-calendar { + width: 14%; + height: 7em; + border-style: solid; + border-width: 1px; + vertical-align: top; +} +td.rem-today { + width: 14%; + height: 7em; + border-style: solid; + border-width: 2px; + border-color: #EE3333; + vertical-align: top; +} + +table.rem-cal { + width: 100%; + border-collapse: collapse; +} + +div.rem-daynumber { + float: right; + text-align: right; + vertical-align: top; + font-size: 14pt; +} + +p.rem-entry { + clear: both; +} + +div.rem-moon { + float: left; + text-align: left; + vertical-align: top; +} + +th.rem-sc-hdr { + text-align: right; +} + +td.rem-sc-empty-cell, td.rem-sc-cell { + text-align: right; + width: 14%; +} + +caption.rem-sc-caption { + font-size: 12pt; +} +EOF +}