mirror of
https://salsa.debian.org/dskoll/remind.git
synced 2026-04-20 16:22:59 +02:00
Handle the WEEK special.
This commit is contained in:
@@ -753,6 +753,13 @@ proc FillCalWindow {} {
|
|||||||
set month [string trimleft $month 0]
|
set month [string trimleft $month 0]
|
||||||
set extratags ""
|
set extratags ""
|
||||||
switch -exact -- $type {
|
switch -exact -- $type {
|
||||||
|
"WEEK" {
|
||||||
|
set stuff [string trimleft $stuff]
|
||||||
|
set stuff [string trimright $stuff]
|
||||||
|
set label [expr $firstWkday + $day - 1]
|
||||||
|
.cal.l$label configure -text "$day (W$stuff)"
|
||||||
|
continue
|
||||||
|
}
|
||||||
"SHADE" {
|
"SHADE" {
|
||||||
DoShadeSpecial $n $stuff
|
DoShadeSpecial $n $stuff
|
||||||
continue
|
continue
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
#define SPECIAL_MOON 3
|
#define SPECIAL_MOON 3
|
||||||
#define SPECIAL_SHADE 4
|
#define SPECIAL_SHADE 4
|
||||||
#define SPECIAL_COLOR 5
|
#define SPECIAL_COLOR 5
|
||||||
|
#define SPECIAL_WEEK 6
|
||||||
|
|
||||||
typedef struct calentry {
|
typedef struct calentry {
|
||||||
struct calentry *next;
|
struct calentry *next;
|
||||||
@@ -306,6 +307,7 @@ void DoPsCal(void)
|
|||||||
if (!strcmp(passthru, "PostScript") ||
|
if (!strcmp(passthru, "PostScript") ||
|
||||||
!strcmp(passthru, "PSFile") ||
|
!strcmp(passthru, "PSFile") ||
|
||||||
!strcmp(passthru, "MOON") ||
|
!strcmp(passthru, "MOON") ||
|
||||||
|
!strcmp(passthru, "WEEK") ||
|
||||||
!strcmp(passthru, "SHADE")) {
|
!strcmp(passthru, "SHADE")) {
|
||||||
is_ps = 1;
|
is_ps = 1;
|
||||||
}
|
}
|
||||||
@@ -324,6 +326,8 @@ void DoPsCal(void)
|
|||||||
c->special = SPECIAL_SHADE;
|
c->special = SPECIAL_SHADE;
|
||||||
} else if (!strcmp(passthru, "MOON")) {
|
} else if (!strcmp(passthru, "MOON")) {
|
||||||
c->special = SPECIAL_MOON;
|
c->special = SPECIAL_MOON;
|
||||||
|
} else if (!strcmp(passthru, "WEEK")) {
|
||||||
|
c->special = SPECIAL_WEEK;
|
||||||
} else {
|
} else {
|
||||||
c->special = SPECIAL_PSFILE;
|
c->special = SPECIAL_PSFILE;
|
||||||
}
|
}
|
||||||
@@ -954,6 +958,13 @@ int DoQueuedPs(void)
|
|||||||
r/255.0, g/255.0, b/255.0);
|
r/255.0, g/255.0, b/255.0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case SPECIAL_WEEK: /* Week number */
|
||||||
|
num = sscanf(e->entry+fnoff, "%d", &phase);
|
||||||
|
if (num == 1) {
|
||||||
|
printf("gsave Border Border moveto /EntryFont findfont EntrySize 1.2 div scalefont setfont ( (W %d)) show grestore\n",
|
||||||
|
phase);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case SPECIAL_MOON: /* Moon phase */
|
case SPECIAL_MOON: /* Moon phase */
|
||||||
num = sscanf(e->entry+fnoff, "%d %d %d", &phase, &moonsize,
|
num = sscanf(e->entry+fnoff, "%d %d %d", &phase, &moonsize,
|
||||||
&fontsize);
|
&fontsize);
|
||||||
|
|||||||
+14
-3
@@ -9,7 +9,7 @@ my %Options;
|
|||||||
|
|
||||||
my $rem2html_version = '2.0';
|
my $rem2html_version = '2.0';
|
||||||
|
|
||||||
my($days, $shades, $moons, $classes, $Month, $Year, $Numdays, $Firstwkday, $Mondayfirst,
|
my($days, $shades, $moons, $classes, $Month, $Year, $Numdays, $Firstwkday, $Mondayfirst, $weeks,
|
||||||
@Daynames, $Nextmon, $Nextlen, $Prevmon, $Prevlen);
|
@Daynames, $Nextmon, $Nextlen, $Prevmon, $Prevlen);
|
||||||
|
|
||||||
my $TIDY_PROGNAME = $0;
|
my $TIDY_PROGNAME = $0;
|
||||||
@@ -186,6 +186,7 @@ sub parse_input
|
|||||||
undef $shades;
|
undef $shades;
|
||||||
undef $moons;
|
undef $moons;
|
||||||
undef $classes;
|
undef $classes;
|
||||||
|
undef $weeks;
|
||||||
|
|
||||||
my $found_data = 0;
|
my $found_data = 0;
|
||||||
while(<STDIN>) {
|
while(<STDIN>) {
|
||||||
@@ -232,10 +233,16 @@ sub parse_input
|
|||||||
next unless m/^(\d*).(\d*).(\d*)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s*(.*)$/;
|
next unless m/^(\d*).(\d*).(\d*)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s*(.*)$/;
|
||||||
my ($y, $m, $d, $special, $tag, $duration, $time, $body) =
|
my ($y, $m, $d, $special, $tag, $duration, $time, $body) =
|
||||||
($1, $2, $3, $4, $5, $6, $7, $8);
|
($1, $2, $3, $4, $5, $6, $7, $8);
|
||||||
|
my $d1 = $d;
|
||||||
|
$d1 =~ s/^0+//;
|
||||||
if ($special eq 'HTML') {
|
if ($special eq 'HTML') {
|
||||||
push(@{$days->[$d]}, $body);
|
push(@{$days->[$d]}, $body);
|
||||||
} elsif ($special eq 'HTMLCLASS') {
|
} elsif ($special eq 'HTMLCLASS') {
|
||||||
$classes->[$d] = $body;
|
$classes->[$d] = $body;
|
||||||
|
} elsif ($special eq 'WEEK') {
|
||||||
|
$body =~ s/^\s+//;
|
||||||
|
$body =~ s/\s+$//;
|
||||||
|
$weeks->{$d1} = $body;
|
||||||
} elsif ($special eq 'MOON') {
|
} elsif ($special eq 'MOON') {
|
||||||
if ($body =~ /(\S+)\s+(\S+)\s+(\S+)\s+(.*)$/) {
|
if ($body =~ /(\S+)\s+(\S+)\s+(\S+)\s+(.*)$/) {
|
||||||
my ($phase, $moonsize, $fontsize, $msg) = ($1, $2, $3, $4);
|
my ($phase, $moonsize, $fontsize, $msg) = ($1, $2, $3, $4);
|
||||||
@@ -474,6 +481,10 @@ sub draw_day_cell
|
|||||||
{
|
{
|
||||||
my($day) = @_;
|
my($day) = @_;
|
||||||
my $shade = $shades->[$day];
|
my $shade = $shades->[$day];
|
||||||
|
my $week = '';
|
||||||
|
if (exists($weeks->{$day})) {
|
||||||
|
$week = ' (W' . $weeks->{$day} . ')';
|
||||||
|
}
|
||||||
my $class;
|
my $class;
|
||||||
if ($Options{'nostyle'}) {
|
if ($Options{'nostyle'}) {
|
||||||
$class = $classes->[$day] || '';
|
$class = $classes->[$day] || '';
|
||||||
@@ -528,10 +539,10 @@ sub draw_day_cell
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($Options{'nostyle'}) {
|
if ($Options{'nostyle'}) {
|
||||||
print "<div style=\"float: right\">$day</div>\n";
|
print "<div style=\"float: right\">$day$week</div>\n";
|
||||||
print "<p> </p>\n";
|
print "<p> </p>\n";
|
||||||
} else {
|
} else {
|
||||||
print "<div class=\"rem-daynumber\">$day</div>\n";
|
print "<div class=\"rem-daynumber\">$day$week</div>\n";
|
||||||
}
|
}
|
||||||
if ($days->[$day]) {
|
if ($days->[$day]) {
|
||||||
print(join("\n", @{$days->[$day]}));
|
print(join("\n", @{$days->[$day]}));
|
||||||
|
|||||||
Reference in New Issue
Block a user