Compare commits

...

26 Commits

Author SHA1 Message Date
David F. Skoll
f678dc96b8 Write man page for rem2html 2007-10-07 22:24:35 -04:00
David F. Skoll
c2e371904e Update distclean target. 2007-10-07 22:10:25 -04:00
David F. Skoll
2a1cbff22e Add www/Makfile to gitignore. 2007-10-07 22:09:47 -04:00
David F. Skoll
a2d9f277c4 Minor tweaks to Makefile.in 2007-10-07 22:09:37 -04:00
David F. Skoll
d939059417 Improve www/Makefile stuff. 2007-10-07 22:05:35 -04:00
David F. Skoll
740cd4cfed Update README. 2007-10-06 11:41:40 -04:00
David F. Skoll
91a5306a67 Fix typo. 2007-10-06 11:38:23 -04:00
David F. Skoll
b78ffcbffd Tidy up option processing. 2007-10-06 11:35:57 -04:00
David F. Skoll
4f72f557b7 Minor fix to --nostyle output. 2007-10-05 11:52:16 -04:00
David F. Skoll
e3b21d6d0d More tweaks. 2007-10-04 22:02:27 -04:00
David F. Skoll
af28c49d8d Fixed up the www stuff. 2007-10-04 22:01:09 -04:00
David F. Skoll
67f4635573 Fix DST rules. 2007-10-04 13:41:42 -04:00
David F. Skoll
5f8d10908d Minor cleanups. 2007-10-03 12:32:41 -04:00
David F. Skoll
7307421812 Add --nostyle option to rem2html so it can produce basic HTML that does
not rely on an external stylesheet.
2007-10-02 18:47:38 -04:00
David F. Skoll
5cd3b628c5 Minor tweaks. 2007-10-02 14:03:19 -04:00
David F. Skoll
29e483ab64 Updated Makefile and rem2html to use IMGBASE for stylesheet also. 2007-10-02 11:31:06 -04:00
David F. Skoll
66ddba45af Add support for HTMLCLASS special. Add CSS code for rem-today class to
highlight "today".
2007-10-02 11:21:40 -04:00
David F. Skoll
9325b3f035 Minor tweaks to CSS. 2007-10-01 18:03:21 -04:00
David F. Skoll
522c4c94e1 Add --imgbase option. 2007-10-01 17:59:33 -04:00
David F. Skoll
730505cff3 Less verbose. 2007-10-01 17:27:58 -04:00
David F. Skoll
019783e1fa Redo rem2html. Uses CSS instead of hard-coded stuff. 2007-10-01 17:21:59 -04:00
David F. Skoll
8612bb6480 Do not evaluate SATISFY expression if reminder has expired. 2007-09-26 08:41:34 -04:00
David F. Skoll
7f1e6d21d9 Update version number and copyright year. 2007-09-24 10:32:06 -04:00
David F. Skoll
e6c0371be1 Make calendar times show duration. 2007-09-16 17:44:33 -04:00
David F. Skoll
58feaa7e0c Update version in test.cmp 2007-09-12 10:08:04 -04:00
David F. Skoll
a828378466 Update version. 2007-09-12 09:55:40 -04:00
29 changed files with 4084 additions and 3011 deletions

1
.gitignore vendored
View File

@@ -3,6 +3,7 @@ autom4te.cache
config.log
config.status
src/Makefile
www/Makefile
*.o
src/config.h
src/remind

View File

@@ -3,7 +3,7 @@ THE REMIND COPYRIGHT
1. REMIND refers to the entire set of files and documentation in the
REMIND package.
2. REMIND is Copyright 1999-2005 Roaring Penguin Software Inc.,
2. REMIND is Copyright 1999-2007 Roaring Penguin Software Inc.,
except where noted in individual files.
3. DISTRIBUTION AND USE

View File

@@ -28,7 +28,7 @@ test:
cd src && $(MAKE) test
distclean: clean
rm -f config.cache config.log config.status src/Makefile src/config.h tests/test.out
rm -f config.cache config.log config.status src/Makefile src/config.h tests/test.out www/Makefile
src/Makefile: src/Makefile.in
./configure

5296
configure vendored

File diff suppressed because it is too large Load Diff

View File

@@ -45,4 +45,4 @@ if test "$GCC" = yes; then
fi
AC_CHECK_FUNCS(setenv unsetenv)
AC_OUTPUT(src/Makefile)
AC_OUTPUT(src/Makefile www/Makefile)

View File

@@ -27,8 +27,8 @@ RUN OFF
################################################
# Ensure required version of remind is used... #
################################################
IF version() < "03.00.19"
ERRMSG This file requires at least version 03.00.19 of Remind.%
IF version() < "03.01.02"
ERRMSG This file requires at least version 03.01.02 of Remind.%
ERRMSG This version is version [version()].
EXIT
ENDIF
@@ -93,7 +93,7 @@ SET Week_1 1
SET Week_2 8
SET Week_3 15
SET Week_4 22
FSET _last(mo) "1 " + MON((mo%12)+1)+" --7"
FSET _last(mo) "1 " + MON((mo%12)+1) + " --7"
# Shorthand for commonly used expression...
FSET _trig() TRIGGER(TRIGDATE())
@@ -101,46 +101,6 @@ FSET _trig() TRIGGER(TRIGDATE())
# Handy function to provide SCANFROM dates...
FSET _back(days) TRIGGER(TODAY()-days)
###########################################################
# On MS-DOS systems, the standard C library functions are #
# not reliable for computing offsets from local time to #
# UTC. The following provides a work-around for the #
# sunrise() and sunset() functions. Note, however, that #
# if Daylight Savings Time is in effect for today(), the #
# sun functions return times in DST even for dates on #
# which DST is not in effect; the converse can also occur.#
# #
# Change the timezone to your timezone - the default is #
# for EST which is 5 hours (300 minutes) behind UTC. #
# The code is correct for places in which Daylight Savings#
# Time begins on the last Sunday in April and ends on the #
# last Sunday in October. #
###########################################################
IF OSTYPE() == "MSDOS"
# Eastern Standard Time
SET TimeZone -300
# Use --8 rather than --7 because we want the last day BEFORE
# the time switch occurs.
REM Sun 1 May --8 SATISFY 1
SET BegDst TRIGDATE()
REM Sun 1 Nov --8 SATISFY 1
SET EndDst TRIGDATE()
SET $CalcUTC 0
# Check out the following IF statement and figure out why it works!
IF EndDst < BegDst
# Daylight Savings Time
SET $MinsFromUTC TimeZone+60
ELSE
# Standard Time
SET $MinsFromUTC TimeZone
ENDIF
ENDIF
###########################################################
# Function which returns a string in "am/pm" format based #
# on the time. For example, set a am_pm(NOW())... #
@@ -347,7 +307,12 @@ REM Feb 14 MSG %"Valentine's%" Day
REM Mon Feb [Week_3] SCANFROM [_back(7)] SATISFY 1
OMIT [_trig()] MSG %"President's Day%"
REM Mar 17 MSG %"St. Patrick's%" Day
REM Sun Apr 1 ++2 MSG Daylight Savings Time - %"DST starts%" %b
# The DST rules are accurate for most locations in
# North America
REM Sun Apr 1 ++2 UNTIL 1 Jan 2007 MSG Daylight Savings Time - %"DST starts%" %b
REM Sun Mar 8 ++2 FROM 1 Jan 2007 MSG Daylight Savings Time - %"DST starts%" %b
REM Apr 1 MSG %"April Fool's%" Day
REM Mon Tue Wed Thu Fri Sat 15 Apr MSG %"Income tax%" due
REM May 5 MSG %"Cinco de Mayo%"
@@ -362,7 +327,12 @@ REM Mon Sep [Week_1] SCANFROM [_back(7)] SATISFY 1
OMIT [_trig()] MSG %"Labor Day%"
REM Mon Oct [Week_2] MSG %"Columbus Day%"
REM Nov 11 MSG %"Veterans Day%"
REM Sun [_last(Oct)] MSG Daylight Savings Time - %"DST over%"
# The DST rules are accurate for most locations in
# North America
REM Sun [_last(Oct)] UNTIL 1 Jan 2007 MSG Daylight Savings Time - %"DST over%"
REM Sun 1 Nov FROM 1 Jan 2007 MSG Daylight Savings Time - %"DST over%"
REM Oct 30 MSG %"Mischief Night%"
REM Oct 31 MSG %"Halloween%"
REM Tue Nov 2 SCANFROM [_back(7)] \

View File

@@ -1,7 +1,7 @@
# Makefile.in for REMIND
#
VERSION=03.01.02
VERSION=03.01.03
SHELL= /bin/sh
BETA = 1
srcdir=@srcdir@

View File

@@ -682,7 +682,7 @@ static int DoCalRem(ParsePtr p, int col)
return E_NO_MEM;
}
} else {
if (DBufPuts(&obuf, SimpleTime(tim.ttime)) != OK) {
if (DBufPuts(&obuf, CalendarTime(tim.ttime, tim.duration)) != OK) {
DBufFree(&obuf);
DBufFree(&pre_buf);
return E_NO_MEM;
@@ -878,6 +878,89 @@ static void WriteCalDays(void)
PutChar('\n');
}
/***************************************************************/
/* */
/* CalendarTime */
/* */
/* Format the time according to simple time format. */
/* Answer is returned in a static buffer. */
/* A trailing space is always added. */
/* This takes into account duration */
/* */
/***************************************************************/
char *
CalendarTime(int tim, int duration)
{
static char buf[128];
int h, min, hh;
int h2, min2, hh2, newtim, days;
char *ampm1;
char *ampm2;
char daybuf[64];
buf[0] = 0;
if (duration == NO_TIME) {
/* No duration... just call into SimpleTime */
return SimpleTime(tim);
}
if (tim == NO_TIME) {
/* No time... nothing to return */
return buf;
}
h = tim/60;
min = tim % 60;
if (h == 0) hh=12;
else if (h > 12) hh=h-12;
else hh = h;
newtim = tim + duration;
/* How many days in duration? */
days = newtim / MINUTES_PER_DAY;
newtim = newtim % MINUTES_PER_DAY;
h2 = newtim/60;
min2 = newtim % 60;
if (h2 == 0) hh2=12;
else if (h2 > 12) hh2=h2-12;
else hh2 = h2;
if (days) {
sprintf(daybuf, "+%d", days);
} else {
daybuf[0] = 0;
}
if (h >= 12) {
ampm1 = L_PM;
} else {
ampm1 = L_AM;
}
if (h2 >= 12) {
ampm2 = L_PM;
} else {
ampm2 = L_AM;
}
if (!days) {
if (!strcmp(ampm1, ampm2)) {
ampm1 = "";
}
}
switch(ScFormat) {
case SC_AMPM:
sprintf(buf, "%d%c%02d%s-%d%c%02d%s%s ",
hh, TimeSep, min, ampm1, hh2, TimeSep, min2, ampm2, daybuf);
break;
case SC_MIL:
sprintf(buf, "%02d%c%02d-%02d%c%02d%s ",
h, TimeSep, min, h2, TimeSep, min2, daybuf);
break;
}
return buf;
}
/***************************************************************/
/* */
/* SimpleTime */
@@ -903,7 +986,7 @@ char *SimpleTime(int tim)
if (h == 0) hh=12;
else if (h > 12) hh=h-12;
else hh=h;
sprintf(buf, "%2d%c%02d%s ", hh, TimeSep, min, (h>=12) ? L_PM : L_AM);
sprintf(buf, "%d%c%02d%s ", hh, TimeSep, min, (h>=12) ? L_PM : L_AM);
}
break;

View File

@@ -62,6 +62,7 @@ int DoRem(ParsePtr p)
if (trig.typ == SAT_TYPE) {
r=DoSatRemind(&trig, &tim, p);
if (r) return r;
if (!LastTrigValid) return OK;
r=ParseToken(p, &buf);
if (r) return r;
FindToken(DBufValue(&buf), &tok);
@@ -821,6 +822,9 @@ int DoSatRemind(Trigger *trig, TimeTrig *tim, ParsePtr p)
if (r) {
if (r == E_CANT_TRIG) return OK; else return r;
}
if (jul == -1) {
return OK;
}
s = p->pos;
r = EvaluateExpr(p, &v);
t = p->pos;

View File

@@ -22,6 +22,7 @@ int CallUserFunc (char *name, int nargs);
int DoFset (ParsePtr p);
void ProduceCalendar (void);
char *SimpleTime (int tim);
char *CalendarTime (int tim, int duration);
int DoRem (ParsePtr p);
int DoFlush (ParsePtr p);
void DoExit (ParsePtr p);

View File

@@ -232,9 +232,9 @@ void HandleQueuedReminders(void)
strcpy(trig.passthru, q->passthru);
RunDisabled = q->RunDisabled;
if (Daemon < 0) {
printf("NOTE reminder %s ",
printf("NOTE reminder %s",
SimpleTime(q->tt.ttime));
printf("%s ", SimpleTime(SystemTime(0)/60));
printf("%s", SimpleTime(SystemTime(0)/60));
if (!*q->tag) {
printf("*");
} else {

View File

@@ -10,4 +10,4 @@
/* */
/***************************************************************/
#define VERSION "03.01.02"
#define VERSION "03.01.03"

View File

@@ -27,6 +27,15 @@ echo "" >> ../tests/test.out
echo "Test 4" >> ../tests/test.out
echo "" >> ../tests/test.out
../src/remind -sa ../tests/test2.rem 1 aug 2007 >> ../tests/test.out
echo "Test 5" >> ../tests/test.out
echo "" >> ../tests/test.out
../src/remind -p -b0 ../tests/test3.rem 1 aug 2007 >> ../tests/test.out
echo "Test 6" >> ../tests/test.out
echo "" >> ../tests/test.out
../src/remind -p -b1 ../tests/test3.rem 1 aug 2007 >> ../tests/test.out
echo "Test 7" >> ../tests/test.out
echo "" >> ../tests/test.out
../src/remind -p -b2 ../tests/test3.rem 1 aug 2007 >> ../tests/test.out
cmp -s ../tests/test.out ../tests/test.cmp
if [ "$?" = "0" ]; then

View File

@@ -7,8 +7,13 @@ Test 1
#
# ./test-rem # From WITHIN Remind source directory!
# Don't evaluate SATISFY expressions if reminder has expired
REM Wed UNTIL 15 Feb 1991 SATISFY [trigdate() > '1990-01-01'] MSG wookie
../tests/test.rem(10): Expired
REM MSG Today is [hebday(today())] [hebmon(today())] [hebyear(today())]
../tests/test.rem(8): Trig = Saturday, 16 February, 1991
../tests/test.rem(12): Trig = Saturday, 16 February, 1991
Reminders for Saturday, 16th February, 1991:
today() => 1991-02-16
@@ -28,7 +33,7 @@ y => "Tishrey"
hebdate(1, "Tishrey") => 1991-09-09
trigger(1991-09-09) => "9 September 1991"
Leaving UserFN _h() => "9 September 1991"
../tests/test.rem(11): Trig = Monday, 9 September, 1991
../tests/test.rem(15): Trig = Monday, 9 September, 1991
[_h(2, "Tishrey")] MSG Rosh Hashana 2
Entering UserFN _h(2, "Tishrey")
x => 2
@@ -36,7 +41,7 @@ y => "Tishrey"
hebdate(2, "Tishrey") => 1991-09-10
trigger(1991-09-10) => "10 September 1991"
Leaving UserFN _h() => "10 September 1991"
../tests/test.rem(12): Trig = Tuesday, 10 September, 1991
../tests/test.rem(16): Trig = Tuesday, 10 September, 1991
[_h(3, "Tishrey")] MSG Tzom Gedalia
Entering UserFN _h(3, "Tishrey")
x => 3
@@ -44,7 +49,7 @@ y => "Tishrey"
hebdate(3, "Tishrey") => 1991-09-11
trigger(1991-09-11) => "11 September 1991"
Leaving UserFN _h() => "11 September 1991"
../tests/test.rem(13): Trig = Wednesday, 11 September, 1991
../tests/test.rem(17): Trig = Wednesday, 11 September, 1991
[_h(10, "Tishrey")] MSG Yom Kippur
Entering UserFN _h(10, "Tishrey")
x => 10
@@ -52,7 +57,7 @@ y => "Tishrey"
hebdate(10, "Tishrey") => 1991-09-18
trigger(1991-09-18) => "18 September 1991"
Leaving UserFN _h() => "18 September 1991"
../tests/test.rem(14): Trig = Wednesday, 18 September, 1991
../tests/test.rem(18): Trig = Wednesday, 18 September, 1991
[_h(15, "Tishrey")] MSG Sukkot 1
Entering UserFN _h(15, "Tishrey")
x => 15
@@ -60,7 +65,7 @@ y => "Tishrey"
hebdate(15, "Tishrey") => 1991-09-23
trigger(1991-09-23) => "23 September 1991"
Leaving UserFN _h() => "23 September 1991"
../tests/test.rem(15): Trig = Monday, 23 September, 1991
../tests/test.rem(19): Trig = Monday, 23 September, 1991
[_h(25, "Kislev")] MSG Channuka
Entering UserFN _h(25, "Kislev")
x => 25
@@ -68,7 +73,7 @@ y => "Kislev"
hebdate(25, "Kislev") => 1991-12-02
trigger(1991-12-02) => "2 December 1991"
Leaving UserFN _h() => "2 December 1991"
../tests/test.rem(16): Trig = Monday, 2 December, 1991
../tests/test.rem(20): Trig = Monday, 2 December, 1991
[_h(10, "Tevet")] MSG Asara B'Tevet
Entering UserFN _h(10, "Tevet")
x => 10
@@ -76,7 +81,7 @@ y => "Tevet"
hebdate(10, "Tevet") => 1991-12-17
trigger(1991-12-17) => "17 December 1991"
Leaving UserFN _h() => "17 December 1991"
../tests/test.rem(17): Trig = Tuesday, 17 December, 1991
../tests/test.rem(21): Trig = Tuesday, 17 December, 1991
[_h(15, "Shvat")] MSG Tu B'Shvat
Entering UserFN _h(15, "Shvat")
x => 15
@@ -84,7 +89,7 @@ y => "Shvat"
hebdate(15, "Shvat") => 1992-01-20
trigger(1992-01-20) => "20 January 1992"
Leaving UserFN _h() => "20 January 1992"
../tests/test.rem(18): Trig = Monday, 20 January, 1992
../tests/test.rem(22): Trig = Monday, 20 January, 1992
[_h(15, "Adar A")] MSG Purim Katan
Entering UserFN _h(15, "Adar A")
x => 15
@@ -92,7 +97,7 @@ y => "Adar A"
hebdate(15, "Adar A") => 1992-02-19
trigger(1992-02-19) => "19 February 1992"
Leaving UserFN _h() => "19 February 1992"
../tests/test.rem(19): Trig = Wednesday, 19 February, 1992
../tests/test.rem(23): Trig = Wednesday, 19 February, 1992
[_h(14, "Adar")] MSG Purim
Entering UserFN _h(14, "Adar")
x => 14
@@ -100,7 +105,7 @@ y => "Adar"
hebdate(14, "Adar") => 1991-02-28
trigger(1991-02-28) => "28 February 1991"
Leaving UserFN _h() => "28 February 1991"
../tests/test.rem(20): Trig = Thursday, 28 February, 1991
../tests/test.rem(24): Trig = Thursday, 28 February, 1991
[_h(15, "Nisan")] MSG Pesach
Entering UserFN _h(15, "Nisan")
x => 15
@@ -108,7 +113,7 @@ y => "Nisan"
hebdate(15, "Nisan") => 1991-03-30
trigger(1991-03-30) => "30 March 1991"
Leaving UserFN _h() => "30 March 1991"
../tests/test.rem(21): Trig = Saturday, 30 March, 1991
../tests/test.rem(25): Trig = Saturday, 30 March, 1991
[_h(27, "Nisan")] MSG Yom HaShoah
Entering UserFN _h(27, "Nisan")
x => 27
@@ -116,7 +121,7 @@ y => "Nisan"
hebdate(27, "Nisan") => 1991-04-11
trigger(1991-04-11) => "11 April 1991"
Leaving UserFN _h() => "11 April 1991"
../tests/test.rem(22): Trig = Thursday, 11 April, 1991
../tests/test.rem(26): Trig = Thursday, 11 April, 1991
[_h(4, "Iyar")] MSG Yom HaZikaron
Entering UserFN _h(4, "Iyar")
x => 4
@@ -124,7 +129,7 @@ y => "Iyar"
hebdate(4, "Iyar") => 1991-04-18
trigger(1991-04-18) => "18 April 1991"
Leaving UserFN _h() => "18 April 1991"
../tests/test.rem(23): Trig = Thursday, 18 April, 1991
../tests/test.rem(27): Trig = Thursday, 18 April, 1991
[_h(5, "Iyar")] MSG Yom Ha'atzmaut
Entering UserFN _h(5, "Iyar")
x => 5
@@ -132,7 +137,7 @@ y => "Iyar"
hebdate(5, "Iyar") => 1991-04-19
trigger(1991-04-19) => "19 April 1991"
Leaving UserFN _h() => "19 April 1991"
../tests/test.rem(24): Trig = Friday, 19 April, 1991
../tests/test.rem(28): Trig = Friday, 19 April, 1991
[_h(28, "Iyar")] MSG Yom Yerushalayim
Entering UserFN _h(28, "Iyar")
x => 28
@@ -140,7 +145,7 @@ y => "Iyar"
hebdate(28, "Iyar") => 1991-05-12
trigger(1991-05-12) => "12 May 1991"
Leaving UserFN _h() => "12 May 1991"
../tests/test.rem(25): Trig = Sunday, 12 May, 1991
../tests/test.rem(29): Trig = Sunday, 12 May, 1991
[_h(6, "Sivan")] MSG Shavuot
Entering UserFN _h(6, "Sivan")
x => 6
@@ -148,7 +153,7 @@ y => "Sivan"
hebdate(6, "Sivan") => 1991-05-19
trigger(1991-05-19) => "19 May 1991"
Leaving UserFN _h() => "19 May 1991"
../tests/test.rem(26): Trig = Sunday, 19 May, 1991
../tests/test.rem(30): Trig = Sunday, 19 May, 1991
[_h(9, "Av")] MSG Tish'a B'Av
Entering UserFN _h(9, "Av")
x => 9
@@ -156,7 +161,7 @@ y => "Av"
hebdate(9, "Av") => 1991-07-20
trigger(1991-07-20) => "20 July 1991"
Leaving UserFN _h() => "20 July 1991"
../tests/test.rem(27): Trig = Saturday, 20 July, 1991
../tests/test.rem(31): Trig = Saturday, 20 July, 1991
# Test some jahrzeit cases
fset _i(x,y,z,a) trigger(hebdate(x,y,z,a))
@@ -170,7 +175,7 @@ a => 5759
hebdate(30, "Heshvan", 1991-02-16, 5759) => 1991-11-07
trigger(1991-11-07) => "7 November 1991"
Leaving UserFN _i() => "7 November 1991"
../tests/test.rem(31): Trig = Thursday, 7 November, 1991
../tests/test.rem(35): Trig = Thursday, 7 November, 1991
[_i(30, "Heshvan", today(), 5760)] MSG Complete-Defective
today() => 1991-02-16
Entering UserFN _i(30, "Heshvan", 1991-02-16, 5760)
@@ -181,7 +186,7 @@ a => 5760
hebdate(30, "Heshvan", 1991-02-16, 5760) => 1991-11-07
trigger(1991-11-07) => "7 November 1991"
Leaving UserFN _i() => "7 November 1991"
../tests/test.rem(32): Trig = Thursday, 7 November, 1991
../tests/test.rem(36): Trig = Thursday, 7 November, 1991
[_i(30, "Heshvan", today(), 5761)] MSG Illegal
today() => 1991-02-16
Entering UserFN _i(30, "Heshvan", 1991-02-16, 5761)
@@ -189,7 +194,7 @@ x => 30
y => "Heshvan"
z => 1991-02-16
a => 5761
hebdate(30, "Heshvan", 1991-02-16, 5761) => ../tests/test.rem(33): 30 Heshvan 5761: Invalid Hebrew date
hebdate(30, "Heshvan", 1991-02-16, 5761) => ../tests/test.rem(37): 30 Heshvan 5761: Invalid Hebrew date
Invalid Hebrew date
Leaving UserFN _i() => Invalid Hebrew date
@@ -203,7 +208,7 @@ a => 5759
hebdate(30, "Kislev", 1991-02-16, 5759) => 1991-12-07
trigger(1991-12-07) => "7 December 1991"
Leaving UserFN _i() => "7 December 1991"
../tests/test.rem(35): Trig = Saturday, 7 December, 1991
../tests/test.rem(39): Trig = Saturday, 7 December, 1991
[_i(30, "Kislev", today(), 5760)] MSG Complete-Defective
today() => 1991-02-16
Entering UserFN _i(30, "Kislev", 1991-02-16, 5760)
@@ -214,7 +219,7 @@ a => 5760
hebdate(30, "Kislev", 1991-02-16, 5760) => 1991-12-07
trigger(1991-12-07) => "7 December 1991"
Leaving UserFN _i() => "7 December 1991"
../tests/test.rem(36): Trig = Saturday, 7 December, 1991
../tests/test.rem(40): Trig = Saturday, 7 December, 1991
[_i(30, "Kislev", today(), 5761)] MSG Illegal
today() => 1991-02-16
Entering UserFN _i(30, "Kislev", 1991-02-16, 5761)
@@ -222,7 +227,7 @@ x => 30
y => "Kislev"
z => 1991-02-16
a => 5761
hebdate(30, "Kislev", 1991-02-16, 5761) => ../tests/test.rem(37): 30 Kislev 5761: Invalid Hebrew date
hebdate(30, "Kislev", 1991-02-16, 5761) => ../tests/test.rem(41): 30 Kislev 5761: Invalid Hebrew date
Invalid Hebrew date
Leaving UserFN _i() => Invalid Hebrew date
@@ -236,7 +241,7 @@ a => 5755
hebdate(30, "Adar A", 1991-02-16, 5755) => 1992-03-05
trigger(1992-03-05) => "5 March 1992"
Leaving UserFN _i() => "5 March 1992"
../tests/test.rem(39): Trig = Thursday, 5 March, 1992
../tests/test.rem(43): Trig = Thursday, 5 March, 1992
[_i(30, "Adar A", today(), 5756)] MSG Illegal
today() => 1991-02-16
Entering UserFN _i(30, "Adar A", 1991-02-16, 5756)
@@ -244,7 +249,7 @@ x => 30
y => "Adar A"
z => 1991-02-16
a => 5756
hebdate(30, "Adar A", 1991-02-16, 5756) => ../tests/test.rem(40): No Adar A in 5756
hebdate(30, "Adar A", 1991-02-16, 5756) => ../tests/test.rem(44): No Adar A in 5756
Invalid Hebrew date
Leaving UserFN _i() => Invalid Hebrew date
[_i(29, "Adar A", today(), 5755)] MSG Leap
@@ -257,7 +262,7 @@ a => 5755
hebdate(29, "Adar A", 1991-02-16, 5755) => 1991-03-15
trigger(1991-03-15) => "15 March 1991"
Leaving UserFN _i() => "15 March 1991"
../tests/test.rem(41): Trig = Friday, 15 March, 1991
../tests/test.rem(45): Trig = Friday, 15 March, 1991
[_i(29, "Adar A", today(), 5756)] MSG Illegal
today() => 1991-02-16
Entering UserFN _i(29, "Adar A", 1991-02-16, 5756)
@@ -265,221 +270,221 @@ x => 29
y => "Adar A"
z => 1991-02-16
a => 5756
hebdate(29, "Adar A", 1991-02-16, 5756) => ../tests/test.rem(42): No Adar A in 5756
hebdate(29, "Adar A", 1991-02-16, 5756) => ../tests/test.rem(46): No Adar A in 5756
Invalid Hebrew date
Leaving UserFN _i() => Invalid Hebrew date
# Test each possible case of the basic reminders.
REM MSG Every Day
../tests/test.rem(46): Trig = Saturday, 16 February, 1991
../tests/test.rem(50): Trig = Saturday, 16 February, 1991
Every Day
REM 18 MSG Every 18th
../tests/test.rem(48): Trig = Monday, 18 February, 1991
../tests/test.rem(52): Trig = Monday, 18 February, 1991
REM 15 MSG Every 15th
../tests/test.rem(49): Trig = Friday, 15 March, 1991
../tests/test.rem(53): Trig = Friday, 15 March, 1991
REM Feb MSG February
../tests/test.rem(51): Trig = Saturday, 16 February, 1991
../tests/test.rem(55): Trig = Saturday, 16 February, 1991
February
REM Jan MSG January
../tests/test.rem(52): Trig = Wednesday, 1 January, 1992
../tests/test.rem(56): Trig = Wednesday, 1 January, 1992
REM March MSG March
../tests/test.rem(53): Trig = Friday, 1 March, 1991
../tests/test.rem(57): Trig = Friday, 1 March, 1991
REM 13 Jan MSG 13 Jan
../tests/test.rem(55): Trig = Monday, 13 January, 1992
../tests/test.rem(59): Trig = Monday, 13 January, 1992
REM 15 Feb MSG 15 Feb
../tests/test.rem(56): Trig = Saturday, 15 February, 1992
../tests/test.rem(60): Trig = Saturday, 15 February, 1992
REM 28 Feb MSG 28 Feb
../tests/test.rem(57): Trig = Thursday, 28 February, 1991
../tests/test.rem(61): Trig = Thursday, 28 February, 1991
REM 29 Feb MSG 29 Feb
../tests/test.rem(58): Trig = Saturday, 29 February, 1992
../tests/test.rem(62): Trig = Saturday, 29 February, 1992
REM 5 Mar MSG 5 Mar
../tests/test.rem(59): Trig = Tuesday, 5 March, 1991
../tests/test.rem(63): Trig = Tuesday, 5 March, 1991
REM 1990 MSG 1990
../tests/test.rem(61): Expired
../tests/test.rem(65): Expired
REM 1991 MSG 1991
../tests/test.rem(62): Trig = Saturday, 16 February, 1991
../tests/test.rem(66): Trig = Saturday, 16 February, 1991
1991
REM 1992 MSG 1991
../tests/test.rem(63): Trig = Wednesday, 1 January, 1992
../tests/test.rem(67): Trig = Wednesday, 1 January, 1992
REM 1 1990 MSG 1 1990
../tests/test.rem(65): Expired
../tests/test.rem(69): Expired
REM 29 1991 MSG 29 1991
../tests/test.rem(66): Trig = Friday, 29 March, 1991
../tests/test.rem(70): Trig = Friday, 29 March, 1991
REM 29 1992 MSG 29 1992
../tests/test.rem(67): Trig = Wednesday, 29 January, 1992
../tests/test.rem(71): Trig = Wednesday, 29 January, 1992
REM 16 1991 MSG 16 1991
../tests/test.rem(68): Trig = Saturday, 16 February, 1991
../tests/test.rem(72): Trig = Saturday, 16 February, 1991
16 1991
REM Jan 1990 MSG Jan 1990
../tests/test.rem(70): Expired
../tests/test.rem(74): Expired
REM Feb 1991 MSG Feb 1991
../tests/test.rem(71): Trig = Saturday, 16 February, 1991
../tests/test.rem(75): Trig = Saturday, 16 February, 1991
Feb 1991
REM Dec 1991 MSG Dec 1991
../tests/test.rem(72): Trig = Sunday, 1 December, 1991
../tests/test.rem(76): Trig = Sunday, 1 December, 1991
REM May 1992 MSG May 1992
../tests/test.rem(73): Trig = Friday, 1 May, 1992
../tests/test.rem(77): Trig = Friday, 1 May, 1992
REM 1 Jan 1991 MSG 1 Jan 1991
../tests/test.rem(75): Expired
../tests/test.rem(79): Expired
REM 16 Feb 1991 MSG 16 Feb 1991
../tests/test.rem(76): Trig = Saturday, 16 February, 1991
../tests/test.rem(80): Trig = Saturday, 16 February, 1991
16 Feb 1991
REM 29 Dec 1992 MSG 29 Dec 1992
../tests/test.rem(77): Trig = Tuesday, 29 December, 1992
../tests/test.rem(81): Trig = Tuesday, 29 December, 1992
REM Sun MSG Sun
../tests/test.rem(79): Trig = Sunday, 17 February, 1991
../tests/test.rem(83): Trig = Sunday, 17 February, 1991
REM Fri Sat Tue MSG Fri Sat Tue
../tests/test.rem(80): Trig = Saturday, 16 February, 1991
../tests/test.rem(84): Trig = Saturday, 16 February, 1991
Fri Sat Tue
REM Sun 16 MSG Sun 16
../tests/test.rem(82): Trig = Sunday, 17 February, 1991
../tests/test.rem(86): Trig = Sunday, 17 February, 1991
REM Mon Tue Wed Thu Fri 1 MSG Mon Tue Wed Thu Fri 1
../tests/test.rem(83): Trig = Friday, 1 March, 1991
../tests/test.rem(87): Trig = Friday, 1 March, 1991
REM Sun Feb MSG Sun Feb
../tests/test.rem(85): Trig = Sunday, 17 February, 1991
../tests/test.rem(89): Trig = Sunday, 17 February, 1991
REM Mon Tue March MSG Mon Tue March
../tests/test.rem(86): Trig = Monday, 4 March, 1991
../tests/test.rem(90): Trig = Monday, 4 March, 1991
REM Sun 16 Feb MSG Sun 16 Feb
../tests/test.rem(88): Trig = Sunday, 17 February, 1991
../tests/test.rem(92): Trig = Sunday, 17 February, 1991
REM Mon Tue 10 March MSG Mon Tue 10 March
../tests/test.rem(89): Trig = Monday, 11 March, 1991
../tests/test.rem(93): Trig = Monday, 11 March, 1991
REM Sat Sun 1991 MSG Sat Sun 1991
../tests/test.rem(91): Trig = Saturday, 16 February, 1991
../tests/test.rem(95): Trig = Saturday, 16 February, 1991
Sat Sun 1991
REM Mon Tue 1992 MSG Mon Tue 1992
../tests/test.rem(92): Trig = Monday, 6 January, 1992
../tests/test.rem(96): Trig = Monday, 6 January, 1992
REM Sun 16 1991 MSG Sun 16 1991
../tests/test.rem(94): Trig = Sunday, 17 February, 1991
../tests/test.rem(98): Trig = Sunday, 17 February, 1991
REM Mon Tue Wed Thu Fri 1 1992 MSG Mon Tue Wed Thu Fri 1 1992
../tests/test.rem(95): Trig = Wednesday, 1 January, 1992
../tests/test.rem(99): Trig = Wednesday, 1 January, 1992
REM Mon Feb 1991 MSG Mon Feb 1991
../tests/test.rem(97): Trig = Monday, 18 February, 1991
../tests/test.rem(101): Trig = Monday, 18 February, 1991
REM Tue Jan 1992 MSG Tue Jan 1992
../tests/test.rem(98): Trig = Tuesday, 7 January, 1992
../tests/test.rem(102): Trig = Tuesday, 7 January, 1992
REM Sun Mon 16 Feb 1991 MSG Sun Mon 16 Feb 1991
../tests/test.rem(100): Trig = Sunday, 17 February, 1991
../tests/test.rem(104): Trig = Sunday, 17 February, 1991
REM Tue 28 Jan 1992 MSG Tue 28 Jan 1992
../tests/test.rem(101): Trig = Tuesday, 28 January, 1992
../tests/test.rem(105): Trig = Tuesday, 28 January, 1992
# Try some Backs
CLEAR-OMIT-CONTEXT
REM 1 -1 OMIT sat sun MSG 1 -1 OMIT Sat Sun
../tests/test.rem(105): Trig = Thursday, 28 February, 1991
../tests/test.rem(109): Trig = Thursday, 28 February, 1991
REM 1 --1 OMIT sat sun MSG 1 --1 OMIT Sat Sun
../tests/test.rem(106): Trig = Thursday, 28 February, 1991
../tests/test.rem(110): Trig = Thursday, 28 February, 1991
OMIT 28 Feb
REM 1 -1 OMIT sat sun MSG 1 -1 OMIT Sat Sun (28 Feb omitted)
../tests/test.rem(109): Trig = Wednesday, 27 February, 1991
../tests/test.rem(113): Trig = Wednesday, 27 February, 1991
REM 1 --1 OMIT sat sun MSG 1 --1 OMIT Sat Sun (28 Feb omitted)
../tests/test.rem(110): Trig = Thursday, 28 February, 1991
../tests/test.rem(114): Trig = Thursday, 28 February, 1991
CLEAR-OMIT-CONTEXT
# Try out UNTIL
REM Wed UNTIL 21 Feb 1991 MSG Wed UNTIL 21 Feb 1991
../tests/test.rem(115): Trig = Wednesday, 20 February, 1991
../tests/test.rem(119): Trig = Wednesday, 20 February, 1991
# Try playing with the OMIT context
OMIT 28 Feb 1991
REM 1 Mar -1 MSG 1 mar -1 (28feb91 omitted)
../tests/test.rem(120): Trig = Wednesday, 27 February, 1991
../tests/test.rem(124): Trig = Wednesday, 27 February, 1991
REM 1 Mar --1 MSG 1 mar --1 (28Feb91 omitted)
../tests/test.rem(121): Trig = Thursday, 28 February, 1991
../tests/test.rem(125): Trig = Thursday, 28 February, 1991
REM 28 Feb BEFORE MSG 28 Feb BEFORE (28Feb91 omitted)
../tests/test.rem(122): Trig = Wednesday, 27 February, 1991
../tests/test.rem(126): Trig = Wednesday, 27 February, 1991
REM 28 Feb SKIP MSG 28 Feb SKIP (28Feb91 omitted)
../tests/test.rem(123): Trig = Friday, 28 February, 1992
../tests/test.rem(127): Trig = Friday, 28 February, 1992
REM 28 Feb AFTER MSG 28 Feb AFTER (28Feb91 omitted)
../tests/test.rem(124): Trig = Friday, 1 March, 1991
../tests/test.rem(128): Trig = Friday, 1 March, 1991
PUSH-OMIT-CONTEXT
CLEAR-OMIT-CONTEXT
REM 1 Mar -1 MSG 1 mar -1
../tests/test.rem(128): Trig = Thursday, 28 February, 1991
REM 1 Mar --1 MSG 1 mar --1
../tests/test.rem(129): Trig = Thursday, 28 February, 1991
REM 28 Feb BEFORE MSG 28 Feb BEFORE
../tests/test.rem(130): Trig = Thursday, 28 February, 1991
REM 28 Feb SKIP MSG 28 Feb SKIP
../tests/test.rem(131): Trig = Thursday, 28 February, 1991
REM 28 Feb AFTER MSG 28 Feb AFTER
../tests/test.rem(132): Trig = Thursday, 28 February, 1991
REM 1 Mar --1 MSG 1 mar --1
../tests/test.rem(133): Trig = Thursday, 28 February, 1991
REM 28 Feb BEFORE MSG 28 Feb BEFORE
../tests/test.rem(134): Trig = Thursday, 28 February, 1991
REM 28 Feb SKIP MSG 28 Feb SKIP
../tests/test.rem(135): Trig = Thursday, 28 February, 1991
REM 28 Feb AFTER MSG 28 Feb AFTER
../tests/test.rem(136): Trig = Thursday, 28 February, 1991
POP-OMIT-CONTEXT
REM 1 Mar -1 MSG 1 mar -1 (28feb91 omitted)
../tests/test.rem(135): Trig = Wednesday, 27 February, 1991
../tests/test.rem(139): Trig = Wednesday, 27 February, 1991
REM 1 Mar --1 MSG 1 mar --1 (28Feb91 omitted)
../tests/test.rem(136): Trig = Thursday, 28 February, 1991
../tests/test.rem(140): Trig = Thursday, 28 February, 1991
REM 28 Feb BEFORE MSG 28 Feb BEFORE (28Feb91 omitted)
../tests/test.rem(137): Trig = Wednesday, 27 February, 1991
../tests/test.rem(141): Trig = Wednesday, 27 February, 1991
REM 28 Feb SKIP MSG 28 Feb SKIP (28Feb91 omitted)
../tests/test.rem(138): Trig = Friday, 28 February, 1992
../tests/test.rem(142): Trig = Friday, 28 February, 1992
REM 28 Feb AFTER MSG 28 Feb AFTER (28Feb91 omitted)
../tests/test.rem(139): Trig = Friday, 1 March, 1991
../tests/test.rem(143): Trig = Friday, 1 March, 1991
REM 13 March 1991 *1 UNTIL 19 March 1991 MSG 13-19 Mar 91
../tests/test.rem(142): Trig = Wednesday, 13 March, 1991
../tests/test.rem(146): Trig = Wednesday, 13 March, 1991
# Test BACK
CLEAR-OMIT-CONTEXT
REM 18 Feb 1991 +1 MSG 18 Feb 1991 +1
../tests/test.rem(146): Trig = Monday, 18 February, 1991
../tests/test.rem(150): Trig = Monday, 18 February, 1991
OMIT 17 Feb 1991
REM 18 Feb 1991 +1 MSG 18 Feb 1991 +1 (17Feb91 omitted)
../tests/test.rem(149): Trig = Monday, 18 February, 1991
../tests/test.rem(153): Trig = Monday, 18 February, 1991
18 Feb 1991 +1 (17Feb91 omitted)
REM 18 Feb 1991 ++1 MSG 18 Feb 1991 ++1 (17Feb91 omitted)
../tests/test.rem(150): Trig = Monday, 18 February, 1991
../tests/test.rem(154): Trig = Monday, 18 February, 1991
CLEAR-OMIT-CONTEXT
# Test the scanfrom clause
REM Fri SATISFY 1
../tests/test.rem(154): Trig = Friday, 22 February, 1991
../tests/test.rem(158): Trig = Friday, 22 February, 1991
OMIT [trigger(trigdate())]
trigdate() => 1991-02-22
trigger(1991-02-22) => "22 February 1991"
REM Fri after MSG 23 Feb 1991
../tests/test.rem(156): Trig = Saturday, 23 February, 1991
../tests/test.rem(160): Trig = Saturday, 23 February, 1991
CLEAR-OMIT-CONTEXT
REM Fri SCANFROM [trigger(today()-7)] SATISFY 1
today() => 1991-02-16
1991-02-16 - 7 => 1991-02-09
trigger(1991-02-09) => "9 February 1991"
../tests/test.rem(158): Trig = Friday, 15 February, 1991
../tests/test.rem(162): Trig = Friday, 15 February, 1991
OMIT [trigger(trigdate())]
trigdate() => 1991-02-15
trigger(1991-02-15) => "15 February 1991"
REM Fri after MSG 16 Feb 1991
../tests/test.rem(160): Trig = Saturday, 16 February, 1991
../tests/test.rem(164): Trig = Saturday, 16 February, 1991
16 Feb 1991
CLEAR-OMIT-CONTEXT
@@ -505,7 +510,7 @@ set a008 coerce("string", 11:44)
coerce("string", 11:44) => "11:44"
set a009 coerce("int", "badnews")
coerce("int", "badnews") => Can't coerce
../tests/test.rem(171): Can't coerce
../tests/test.rem(175): Can't coerce
set a010 coerce("int", "12")
coerce("int", "12") => 12
set a011 coerce("int", 11:44)
@@ -517,7 +522,7 @@ set a013 date(1992, 2, 2)
date(1992, 2, 2) => 1992-02-02
set a014 date(1993, 2, 29)
date(1993, 2, 29) => Bad date specification
../tests/test.rem(176): Bad date specification
../tests/test.rem(180): Bad date specification
set a015 day(today())
today() => 1991-02-16
day(1991-02-16) => 16
@@ -612,15 +617,15 @@ strlen("sadjflkhsldkfhsdlfjhk") => 21
set a050 substr(a049, 2)
a049 => 21
substr(21, 2) => Type mismatch
../tests/test.rem(214): Type mismatch
../tests/test.rem(218): Type mismatch
set a051 substr(a050, 2, 6)
a050 => ../tests/test.rem(215): Undefined variable: a050
a050 => ../tests/test.rem(219): Undefined variable: a050
set a052 time(1+2, 3+4)
1 + 2 => 3
3 + 4 => 7
time(3, 7) => 03:07
rem 10 jan 1992 AT 11:22 CAL
../tests/test.rem(217): Trig = Friday, 10 January, 1992
../tests/test.rem(221): Trig = Friday, 10 January, 1992
set a053 trigdate()
trigdate() => 1992-01-10
set a054 trigtime()
@@ -633,7 +638,7 @@ set a057 value("a05"+"6")
"a05" + "6" => "a056"
value("a056") => "SDFJHSDF KSJDFH KJSDFH KSJDFH"
set a058 version()
version() => "03.01.02"
version() => "03.01.03"
set a059 wkday(today())
today() => 1991-02-16
wkday(1991-02-16) => "Saturday"
@@ -712,31 +717,31 @@ y => 11:33
x => "foo"
y => 11:33
"foo" * 11:33 => Type mismatch
../tests/test.rem(240): `*': Type mismatch
../tests/test.rem(244): `*': Type mismatch
Leaving UserFN h() => Type mismatch
set a074 dosubst("%a %b %c %d %e %f %g %h", '1992/5/5')
dosubst("%a %b %c %d %e %f %g %h", 1992-05-05) => "on Tuesday, 5 May, 1992 in 444 days' tim"...
msg [a074]%
../tests/test.rem(242): Trig = Saturday, 16 February, 1991
../tests/test.rem(246): Trig = Saturday, 16 February, 1991
a074 => "on Tuesday, 5 May, 1992 in 444 days' tim"...
on Tuesday, 5 May, 1992 in 444 days' time on Tuesday 5 on 05-05-1992 on 05-05-1992 on Tuesday, 5 May on 05-05
set a075 dosubst("%i %j %k %l %m %n %o %p", '1992/5/5')
dosubst("%i %j %k %l %m %n %o %p", 1992-05-05) => "on 05-05 on Tuesday, May 5th, 1992 on Tu"...
msg [a075]%
../tests/test.rem(244): Trig = Saturday, 16 February, 1991
../tests/test.rem(248): Trig = Saturday, 16 February, 1991
a075 => "on 05-05 on Tuesday, May 5th, 1992 on Tu"...
on 05-05 on Tuesday, May 5th, 1992 on Tuesday, May 5th on 1992-05-05 May 5 s
set a076 dosubst("%q %r %s %t %u %v %w %x", '1992/5/5')
dosubst("%q %r %s %t %u %v %w %x", 1992-05-05) => "s' 05 th 05 on Tuesday, 5th May, 1992 on"...
msg [a076]%
../tests/test.rem(246): Trig = Saturday, 16 February, 1991
../tests/test.rem(250): Trig = Saturday, 16 February, 1991
a076 => "s' 05 th 05 on Tuesday, 5th May, 1992 on"...
s' 05 th 05 on Tuesday, 5th May, 1992 on Tuesday, 5th May Tuesday 444
set a077 dosubst("%y %z", '1992/5/5')
dosubst("%y %z", 1992-05-05) => "1992 92
"
msg [a077]%
../tests/test.rem(248): Trig = Saturday, 16 February, 1991
../tests/test.rem(252): Trig = Saturday, 16 February, 1991
a077 => "1992 92
"
1992 92
@@ -774,7 +779,7 @@ dump
a048 "foo"
a067 "INT"
a039 "February"
a058 "03.01.02"
a058 "03.01.03"
a077 "1992 92
"
a049 21
@@ -886,7 +891,7 @@ September 30
2007/08/18 * * * * 12 NonOmit-2
2007/08/19 * * * * 17 NonOmit-1
2007/08/19 * * * * 12 NonOmit-2
2007/08/20 COLOR * * 825 6 7 8 1:45pm Mooo!
2007/08/20 COLOR * * 825 6 7 8 1:45pm Mooo!
2007/08/20 * * * * 18 NonOmit-1
2007/08/20 * * * * 12 NonOmit-2
2007/08/21 PostScript * * 115 (wookie) show
@@ -969,7 +974,7 @@ Test 3
2007/08/18 * * * * 12 NonOmit-2
2007/08/19 * * * * 17 NonOmit-1
2007/08/19 * * * * 12 NonOmit-2
2007/08/20 COLOR * * 825 6 7 8 1:45pm Mooo!
2007/08/20 COLOR * * 825 6 7 8 1:45pm Mooo!
2007/08/20 * * * * 18 NonOmit-1
2007/08/20 * * * * 12 NonOmit-2
2007/08/21 * * * * 19 NonOmit-1
@@ -1050,7 +1055,7 @@ Test 4
2007/08/18 * * * * 12 NonOmit-2
2007/08/19 * * * * 17 NonOmit-1
2007/08/19 * * * * 12 NonOmit-2
2007/08/20 COLOR * * 825 6 7 8 1:45pm Mooo!
2007/08/20 COLOR * * 825 6 7 8 1:45pm Mooo!
2007/08/20 COLOR * * * 0 0 255 Blue Wednesday is in 2 days' time
2007/08/20 * * * * 18 NonOmit-1
2007/08/20 * * * * 12 NonOmit-2
@@ -1083,3 +1088,90 @@ Test 4
2007/08/30 * * * * 20 NonOmit-2
2007/08/31 * * * * 29 NonOmit-1
2007/08/31 * * * * 21 NonOmit-2
Test 5
# rem2ps begin
August 2007 31 3 0
Sunday Monday Tuesday Wednesday Thursday Friday Saturday
July 31
September 30
2007/08/01 * * * 660 11:00am Wookie
2007/08/01 * * 45 660 11:00-11:45am Lettuce
2007/08/01 * * 105 660 11:00am-12:45pm Apple
2007/08/01 * * 885 660 11:00am-1:45am+1 Green
2007/08/01 * * 1485 660 11:00am-11:45am+1 Yellow
2007/08/01 * * 2205 660 11:00am-11:45pm+1 Purple
2007/08/01 * * 2925 660 11:00am-11:45am+2 Sad
2007/08/01 * * * 720 12:00pm Cookie
2007/08/01 * * 45 720 12:00-12:45pm Cabbage
2007/08/01 * * 165 720 12:00-2:45pm Pear
2007/08/01 * * 885 720 12:00pm-2:45am+1 Blue
2007/08/01 * * 1485 720 12:00pm-12:45pm+1 Orange
2007/08/01 * * 2205 720 12:00pm-12:45am+2 Black
2007/08/01 * * 2925 720 12:00pm-12:45pm+2 Happy
2007/08/01 * * * 780 1:00pm Snookie
2007/08/01 * * 45 780 1:00-1:45pm Tomato
2007/08/01 * * 225 780 1:00-4:45pm Grape
2007/08/01 * * 885 780 1:00pm-3:45am+1 Red
2007/08/01 * * 1485 780 1:00pm-1:45pm+1 Magenta
2007/08/01 * * 2205 780 1:00pm-1:45am+2 Brown
2007/08/01 * * 2925 780 1:00pm-1:45pm+2 Strange
# rem2ps end
Test 6
# rem2ps begin
August 2007 31 3 0
Sunday Monday Tuesday Wednesday Thursday Friday Saturday
July 31
September 30
2007/08/01 * * * 660 11:00 Wookie
2007/08/01 * * 45 660 11:00-11:45 Lettuce
2007/08/01 * * 105 660 11:00-12:45 Apple
2007/08/01 * * 885 660 11:00-01:45+1 Green
2007/08/01 * * 1485 660 11:00-11:45+1 Yellow
2007/08/01 * * 2205 660 11:00-23:45+1 Purple
2007/08/01 * * 2925 660 11:00-11:45+2 Sad
2007/08/01 * * * 720 12:00 Cookie
2007/08/01 * * 45 720 12:00-12:45 Cabbage
2007/08/01 * * 165 720 12:00-14:45 Pear
2007/08/01 * * 885 720 12:00-02:45+1 Blue
2007/08/01 * * 1485 720 12:00-12:45+1 Orange
2007/08/01 * * 2205 720 12:00-00:45+2 Black
2007/08/01 * * 2925 720 12:00-12:45+2 Happy
2007/08/01 * * * 780 13:00 Snookie
2007/08/01 * * 45 780 13:00-13:45 Tomato
2007/08/01 * * 225 780 13:00-16:45 Grape
2007/08/01 * * 885 780 13:00-03:45+1 Red
2007/08/01 * * 1485 780 13:00-13:45+1 Magenta
2007/08/01 * * 2205 780 13:00-01:45+2 Brown
2007/08/01 * * 2925 780 13:00-13:45+2 Strange
# rem2ps end
Test 7
# rem2ps begin
August 2007 31 3 0
Sunday Monday Tuesday Wednesday Thursday Friday Saturday
July 31
September 30
2007/08/01 * * * 660 Wookie
2007/08/01 * * 45 660 Lettuce
2007/08/01 * * 105 660 Apple
2007/08/01 * * 885 660 Green
2007/08/01 * * 1485 660 Yellow
2007/08/01 * * 2205 660 Purple
2007/08/01 * * 2925 660 Sad
2007/08/01 * * * 720 Cookie
2007/08/01 * * 45 720 Cabbage
2007/08/01 * * 165 720 Pear
2007/08/01 * * 885 720 Blue
2007/08/01 * * 1485 720 Orange
2007/08/01 * * 2205 720 Black
2007/08/01 * * 2925 720 Happy
2007/08/01 * * * 780 Snookie
2007/08/01 * * 45 780 Tomato
2007/08/01 * * 225 780 Grape
2007/08/01 * * 885 780 Red
2007/08/01 * * 1485 780 Magenta
2007/08/01 * * 2205 780 Brown
2007/08/01 * * 2925 780 Strange
# rem2ps end

View File

@@ -5,6 +5,10 @@
#
# ./test-rem # From WITHIN Remind source directory!
# Don't evaluate SATISFY expressions if reminder has expired
REM Wed UNTIL 15 Feb 1991 SATISFY [trigdate() > '1990-01-01'] MSG wookie
REM MSG Today is [hebday(today())] [hebmon(today())] [hebyear(today())]
fset _h(x, y) trigger(hebdate(x,y))

29
tests/test3.rem Normal file
View File

@@ -0,0 +1,29 @@
REM 1 AT 11:00 MSG Wookie
REM 1 AT 12:00 MSG Cookie
REM 1 AT 13:00 MSG Snookie
REM 1 AT 11:00 DURATION 0:45 MSG Lettuce
REM 1 AT 12:00 DURATION 0:45 MSG Cabbage
REM 1 AT 13:00 DURATION 0:45 MSG Tomato
REM 1 AT 11:00 DURATION 1:45 MSG Apple
REM 1 AT 12:00 DURATION 2:45 MSG Pear
REM 1 AT 13:00 DURATION 3:45 MSG Grape
REM 1 AT 11:00 DURATION 14:45 MSG Green
REM 1 AT 12:00 DURATION 14:45 MSG Blue
REM 1 AT 13:00 DURATION 14:45 MSG Red
REM 1 AT 11:00 DURATION 24:45 MSG Yellow
REM 1 AT 12:00 DURATION 24:45 MSG Orange
REM 1 AT 13:00 DURATION 24:45 MSG Magenta
REM 1 AT 11:00 DURATION 36:45 MSG Purple
REM 1 AT 12:00 DURATION 36:45 MSG Black
REM 1 AT 13:00 DURATION 36:45 MSG Brown
REM 1 AT 11:00 DURATION 48:45 MSG Sad
REM 1 AT 12:00 DURATION 48:45 MSG Happy
REM 1 AT 13:00 DURATION 48:45 MSG Strange

View File

@@ -1,95 +0,0 @@
# Makefile for installing WWW server calendar scripts
# This file is part of REMIND.
# Copyright (C) 1992-1997 by David F. Skoll
# Copyright (C) 1999 by Roaring Penguin Software Inc.
# The complete name of your www host. Example: www.mycompany.com
WWWHOST = magnesium.roaringpenguin.com
# WWWHOST = www.mycompany.com
# The complete path to where the scripts actually live, as seen by
# the UNIX operating system.
SCRIPTDIR = /var/www/cgi-bin
# SCRIPTDIR = /home/dfs/Remind/www/TEST
# Where the scripts live as seen by the web browser. If
# they live in WWWHOST/cgi-bin, supply /cgi-bin
CGIDIR = /cgi-bin
# The complete path to the directory containing the HTML file "calendar.html".
# This is a sample file containing links to all the scripts. This path
# should be the path as seen by the UNIX operating system
HTMLDIR = /var/www/html/remind
# Where you stick images, as seen by UNIX
IMAGEDIR = /var/www/html/remind
# Where images are, as seen by web browers
IMAGEBASE = /remind
# Location. Typically, the name of your city or town. Example: Ottawa
LOCATION = Ottawa
# LOCATION = New York
# Where do Remind and Rem2PS executables live?
REMIND = /usr/local/bin/remind
REM2PS = /usr/local/bin/rem2ps
# If your Web server requires CGI programs to have a .cgi suffix, use
# the next line. Otherwise, comment it out
CGISUFFIX=.cgi
# Don't change stuff below here.
# --------------------------------------------------------------------
# Construct a rotten mean nasty sed script to do the dirty work
SEDSCRIPT = -e 's/Ottawa/$(LOCATION)/g' \
-e 's@http://your.machine/your.dir@http://$(WWWHOST)$(CGIDIR)@g' \
-e 's@%SCRIPTDIR%@$(SCRIPTDIR)@g' \
-e 's@%REMIND%@$(REMIND)@g' \
-e 's@%IMAGEBASE%@$(IMAGEBASE)@g' \
-e 's@%REM2PS%@$(REM2PS)@g' \
-e 's@cal_dispatch@cal_dispatch$(CGISUFFIX)@g' \
-e 's@rem2html@rem2html$(CGISUFFIX)@g'
SEDSCRIPT2 = -e 's/Ottawa/$(LOCATION)/g' \
-e 's@http://your.machine/your.dir@http://$(WWWHOST)$(CGIDIR)@g' \
-e 's@%SCRIPTDIR%@$(SCRIPTDIR)@g' \
-e 's@%REMIND%@$(REMIND)@g' \
-e 's@%IMAGEBASE%@$(IMAGEBASE)@g' \
-e 's@%REM2PS%@$(REM2PS)@g'
all:
@echo "Edit the Makefile; then type 'make install' to install"
@echo "the www server scripts."
# OK, it's abominable. But it works...
install:
-mkdir $(SCRIPTDIR)
cp calps hebdate hebps hebhtml moon sunrise sunset $(SCRIPTDIR)
sed $(SEDSCRIPT) < cal_dispatch-DIST > $(SCRIPTDIR)/cal_dispatch$(CGISUFFIX)
sed $(SEDSCRIPT) < hebdate.rem-DIST > $(SCRIPTDIR)/hebdate.rem
sed $(SEDSCRIPT) < moon.rem-DIST > $(SCRIPTDIR)/moon.rem
sed $(SEDSCRIPT) < sunrise.rem-DIST > $(SCRIPTDIR)/sunrise.rem
sed $(SEDSCRIPT) < sunset.rem-DIST > $(SCRIPTDIR)/sunset.rem
sed $(SEDSCRIPT) < calendar.html-DIST > $(HTMLDIR)/calendar.html
sed $(SEDSCRIPT) < hebhtml > $(SCRIPTDIR)/hebhtml
sed $(SEDSCRIPT2) < rem2html > $(SCRIPTDIR)/rem2html$(CGISUFFIX)
chmod 644 $(SCRIPTDIR)/sunrise.rem
chmod 644 $(SCRIPTDIR)/moon.rem
chmod 644 $(SCRIPTDIR)/hebdate.rem
chmod 644 $(SCRIPTDIR)/sunset.rem
chmod 644 $(HTMLDIR)/calendar.html
chmod 755 $(SCRIPTDIR)/cal_dispatch$(CGISUFFIX)
chmod 755 $(SCRIPTDIR)/rem2html$(CGISUFFIX)
chmod 755 $(SCRIPTDIR)/calps $(SCRIPTDIR)/hebdate \
$(SCRIPTDIR)/hebps $(SCRIPTDIR)/moon $(SCRIPTDIR)/sunrise \
$(SCRIPTDIR)/sunset $(SCRIPTDIR)/hebhtml $(SCRIPTDIR)/rem2html$(CGISUFFIX)
-mkdir $(IMAGEDIR)
cp firstquarter.png fullmoon.png lastquarter.png newmoon.png $(IMAGEDIR)
chmod 644 $(IMAGEDIR)/firstquarter.png $(IMAGEDIR)/fullmoon.png $(IMAGEDIR)/lastquarter.png $(IMAGEDIR)/newmoon.png

100
www/Makefile.in Normal file
View File

@@ -0,0 +1,100 @@
# Makefile.in for installing WWW server calendar scripts
# This file is part of REMIND.
# Copyright (C) 1992-1997 by David F. Skoll
# Copyright (C) 1999-2007 by Roaring Penguin Software Inc.
# The complete path to where the scripts actually live, as seen by
# the UNIX operating system.
SCRIPTDIR = /var/www/cgi-bin
# Where the scripts live as seen by the web browser.
CGIDIR = /cgi-bin
# The complete path to the directory containing the HTML file "calendar.html".
# This is a sample file containing links to all the scripts. This path
# should be the path as seen by the UNIX operating system
HTMLDIR = /var/www/remind
# Where you stick images and CSS files, as seen by UNIX
IMAGEDIR = /var/www/remind/resources
# Where images are, as seen by web browers
IMAGEBASE = /remind/resources
# Set by configure - don't touch.
srcdir=@srcdir@
prefix=@prefix@
exec_prefix=@exec_prefix@
mandir=@mandir@
bindir=@bindir@
datadir=@datadir@
datarootdir=@datarootdir@
# Where do Remind and Rem2PS executables live?
REMIND = $(bindir)/remind
REM2PS = $(bindir)/rem2ps
# If your Web server requires CGI programs to have a .cgi suffix, use
# the next line. Otherwise, comment it out
CGISUFFIX=.cgi
# Don't change stuff below here.
# --------------------------------------------------------------------
# Construct a rotten mean nasty sed script to do the dirty work
SEDSCRIPT = -e 's@%CGIDIR%@$(CGIDIR)@g' \
-e 's@%SCRIPTDIR%@$(SCRIPTDIR)@g' \
-e 's@%REMIND%@$(REMIND)@g' \
-e 's@%IMAGEBASE%@$(IMAGEBASE)@g' \
-e 's@%REM2PS%@$(REM2PS)@g' \
-e 's@cal_dispatch@cal_dispatch$(CGISUFFIX)@g' \
-e 's@rem2html@rem2html$(CGISUFFIX)@g'
SEDSCRIPT2 = -e 's@%CGIDIR%@$(CGIDIR)@g' \
-e 's@%SCRIPTDIR%@$(SCRIPTDIR)@g' \
-e 's@%REMIND%@$(REMIND)@g' \
-e 's@%IMAGEBASE%@$(IMAGEBASE)@g' \
-e 's@%REM2PS%@$(REM2PS)@g'
all:
@echo "Edit the Makefile; then type 'make install' to install"
@echo "the www server scripts."
# OK, it's abominable. But it works...
install:
-mkdir -p $(DESTDIR)$(SCRIPTDIR)
-mkdir -p $(DESTDIR)$(HTMLDIR)
cp calps hebdate hebps hebhtml moon sunrise sunset $(DESTDIR)$(SCRIPTDIR)
sed $(SEDSCRIPT) < cal_dispatch-DIST > $(DESTDIR)$(SCRIPTDIR)/cal_dispatch$(CGISUFFIX)
sed $(SEDSCRIPT) < hebdate.rem-DIST > $(DESTDIR)$(SCRIPTDIR)/hebdate.rem
sed $(SEDSCRIPT) < moon.rem-DIST > $(DESTDIR)$(SCRIPTDIR)/moon.rem
sed $(SEDSCRIPT) < sunrise.rem-DIST > $(DESTDIR)$(SCRIPTDIR)/sunrise.rem
sed $(SEDSCRIPT) < sunset.rem-DIST > $(DESTDIR)$(SCRIPTDIR)/sunset.rem
sed $(SEDSCRIPT) < calendar.html-DIST > $(DESTDIR)$(HTMLDIR)/calendar.html
sed $(SEDSCRIPT) < hebhtml > $(DESTDIR)$(SCRIPTDIR)/hebhtml
sed $(SEDSCRIPT2) < rem2html > $(DESTDIR)$(SCRIPTDIR)/rem2html$(CGISUFFIX)
chmod 644 $(DESTDIR)$(SCRIPTDIR)/sunrise.rem
chmod 644 $(DESTDIR)$(SCRIPTDIR)/moon.rem
chmod 644 $(DESTDIR)$(SCRIPTDIR)/hebdate.rem
chmod 644 $(DESTDIR)$(SCRIPTDIR)/sunset.rem
chmod 644 $(DESTDIR)$(HTMLDIR)/calendar.html
chmod 755 $(DESTDIR)$(SCRIPTDIR)/cal_dispatch$(CGISUFFIX)
chmod 755 $(DESTDIR)$(SCRIPTDIR)/rem2html$(CGISUFFIX)
chmod 755 $(DESTDIR)$(SCRIPTDIR)/calps $(DESTDIR)$(SCRIPTDIR)/hebdate \
$(DESTDIR)$(SCRIPTDIR)/hebps $(DESTDIR)$(SCRIPTDIR)/moon \
$(DESTDIR)$(SCRIPTDIR)/sunrise $(DESTDIR)$(SCRIPTDIR)/sunset \
$(DESTDIR)$(SCRIPTDIR)/hebhtml \
$(DESTDIR)$(SCRIPTDIR)/rem2html$(CGISUFFIX)
-mkdir -p $(DESTDIR)$(IMAGEDIR)
cp firstquarter.png fullmoon.png lastquarter.png newmoon.png rem-default.css $(DESTDIR)$(IMAGEDIR)
chmod 644 $(DESTDIR)$(IMAGEDIR)/firstquarter.png \
$(DESTDIR)$(IMAGEDIR)/fullmoon.png \
$(DESTDIR)$(IMAGEDIR)/lastquarter.png \
$(DESTDIR)$(IMAGEDIR)/newmoon.png \
$(DESTDIR)$(IMAGEDIR)/rem-default.css

View File

@@ -1,24 +1,13 @@
REM2HTML
--------
Rem2HTML is a Perl script which transforms the output of
`remind -p ...' to an HTML table. Type `perl rem2html --help' for
usage information.
Rem2HTML is a Perl script that transforms the output of `remind -p
...' to HTML. Type `perl rem2html --help' for usage information.
Typical usage: remind -p ~/.reminders | rem2html > file.html
You may have to edit the "#!/bin/perl" line to reflect the location
of your Perl interpreter.
If you make Remind output data for more than one month (for example,
remind -p3 ~/.reminders | rem2html > file.html), then rem2html
creates a _SINGLE_ file of concatenated HTML documents. It's up
to you to split them. In this case, you're probably better off
using the --tableonly option to rem2html and adding the appropriate
head and tail with another program.
Rem2HTML was contributed by Don Schwarz <darkowl@mcs.net>. It
produces HTML compatible with most modern browsers, but *not* with
browsers which don't support tables (like Lynx, as of this writing.)
You may have to edit the "#!/usr/bin/perl" line to reflect the
location of your Perl interpreter.
--
David F. Skoll

View File

@@ -6,10 +6,6 @@
# CAL_DISPATCH -- Shell script for CGI directory to dispatch calendar
# commands.
#
# WARNING WARNING WARNING -- If your /bin/sh is really GNU's "bash",
# make sure you don't have a buggy version which treats char 0xFF as
# a command separator -- it is a security risk!
#########################
#

View File

@@ -1,28 +1,28 @@
<HTML>
<!-- Sample HTML file with links to the calendar stuff -->
<HEAD>
<TITLE>David Skoll's Calendar Server</TITLE>
<TITLE>Remind Calendar Server</TITLE>
</HEAD>
<BODY>
<H1>Roaring Penguin's Calendar Server</H1>
<H1>Remind Calendar Server</H1>
<a HREF="http://your.machine/your.dir/cal_dispatch?sunrise">
<a HREF="%CGIDIR%/cal_dispatch?sunrise">
Sunrise Information</a><P>
<a HREF="http://your.machine/your.dir/cal_dispatch?sunset">
<a HREF="%CGIDIR%/cal_dispatch?sunset">
Sunset Information</a><P>
<a HREF="http://your.machine/your.dir/cal_dispatch?moon">
<a HREF="%CGIDIR%/cal_dispatch?moon">
Moon Phase Information</a><P>
<a HREF="http://your.machine/your.dir/cal_dispatch?calps">
<a HREF="%CGIDIR%/cal_dispatch?calps">
Blank PostScript Calendar</a> (Approximately 20kB)<P>
<a HREF="http://your.machine/your.dir/cal_dispatch?hebdate">
<a HREF="%CGIDIR%/cal_dispatch?hebdate">
Today's Hebrew Date</a><P>
<a HREF="http://your.machine/your.dir/cal_dispatch?hebps">
<a HREF="%CGIDIR%/cal_dispatch?hebps">
PostScript Calendar with Jewish Holidays</a> (Approximately 35 kB)<P>
<a HREF="http://your.machine/your.dir/cal_dispatch?hebhtml">
HTML Calendar with Jewish Holidays</a> (Your browser must support tables.)<P>
<a HREF="%CGIDIR%/cal_dispatch?hebhtml">
HTML Calendar with Jewish Holidays</a>
<HR>
<a HREF="http://www.roaringpenguin.com/remind.html">
<a HREF="http://www.roaringpenguin.com/remind">
Get the Remind software</a> that provides this service.<P>
</BODY>

View File

@@ -8,5 +8,5 @@
echo "Content-type: application/postscript"
echo
$REMIND -p /dev/null | $REM2PS -e -c3
$REMIND -p /dev/null | $REM2PS -e -c3 -l
exit 0

View File

@@ -65,7 +65,7 @@ IF !InIsrael
[_h(16, "Tishrey")] MSG %"Sukkot 2%"
ENDIF
[_h(21, "Tishrey")] ++12 MSG %"Hashana Rabba%" is %b.
[_h(21, "Tishrey")] ++12 MSG %"Hoshana Rabba%" is %b.
[_h(22, "Tishrey")] ++12 MSG %"Shemini Atzeret%" is %b.
IF InIsrael
@@ -158,8 +158,8 @@ IF ostart <= TODAY() && (TODAY() - ostart < 49)
ENDIF
IF !$PSCAL
REM 20 ++40 msg Also available: <a HREF="http://your.machine/your.dir/cal_dispatch?hebps">a PostScript calendar</a> (about 35KB) for %m %y, complete with Hebrew dates, Jewish holidays, and moon phases for Ottawa. (This takes a few seconds to generate.)
REM 20 ++40 msg And: <a HREF="http://your.machine/your.dir/cal_dispatch?hebhtml">an HTML version</a> of the above. (Your browser must handle tables.)
REM 20 ++40 msg Also available: <a HREF="%CGIDIR%/cal_dispatch?hebps">a PostScript calendar</a> (about 35KB) for %m %y, complete with Hebrew dates, Jewish holidays, and moon phases for [$Location].
REM 20 ++40 msg And: <a HREF="%CGIDIR%/cal_dispatch?hebhtml">an HTML version</a> of the above.
ELSE
[trigger(moondate(0))] SPECIAL MOON 0
[trigger(moondate(1))] SPECIAL MOON 1

View File

@@ -12,7 +12,7 @@ echo ""
$REMIND - <<EOR
BANNER %
REM 20 ++40 RUN $REMIND -iHTML=0 -p $DIR/hebdate.rem %m %y | $REM2PS -e -c3
REM 20 ++40 RUN $REMIND -iHTML=0 -p $DIR/hebdate.rem %m %y | $REM2PS -e -c3 -l
EOR
exit 0

View File

@@ -9,11 +9,11 @@ set now now()
banner %
MSG <HEAD>%
MSG <TITLE>Moon over Ottawa</TITLE>%
MSG <TITLE>Moon over [$Location]</TITLE>%
MSG </HEAD>%
MSG <BODY>
MSG <H1>Moon over Ottawa</H1>
MSG <H1>Moon over [$Location]</H1>
set ndate moondate(0)
set ntime moontime(0)
@@ -22,12 +22,12 @@ set ftime moontime(2)
fset t(x) wkday(x)+", "+day(x)+" "+mon(x)+", "+year(x)
msg Today is %w, %d %m, %y.<P>
msg The local time in Ottawa is [now].<P>
msg The local time in [$Location] is [now].<P>
if ndate < fdate
msg The next new moon is on [t(ndate)] at [ntime], Ottawa time.<P>
msg The next full moon is on [t(fdate)] at [ftime], Ottawa time.<P>
msg The next new moon is on [t(ndate)] at [ntime], [$Location] time.<P>
msg The next full moon is on [t(fdate)] at [ftime], [$Location] time.<P>
else
msg The next full moon is on [t(fdate)] at [ftime], Ottawa time.<P>
msg The next new moon is on [t(ndate)] at [ntime], Ottawa time.<P>
msg The next full moon is on [t(fdate)] at [ftime], [$Location] time.<P>
msg The next new moon is on [t(ndate)] at [ntime], [$Location] time.<P>
endif

69
www/rem-default.css Normal file
View File

@@ -0,0 +1,69 @@
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;
}
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;
}

View File

@@ -1,102 +1,533 @@
#!/usr/bin/perl
# rem2html
#
# A script to convert from the output of "remind -p" to Hyper-Text Markup
# Language (HTML), the text format used in WWW documents. By default, it
# outputs a stand-alone file which can be fed directly into a web browser.
# The output uses nested <TABLE> blocks, so it will only work in a browser
# which supports tables (Netscape, MSIE, etc, NOT Lynx).
#
# This script works well on my computer (Linux 2.0.27) under Perl 5.003 and
# 5.004. It should work fine on other unices but I have no idea whether
# it will run under VMS, OS/2, Windows, etc.
#
# [Note from David: The REMIND license prohibits you from using REMIND
# under Windows.]
#
# Rem2html puts "normal" CAL or MSG-type reminders in a <P></P> pair,
# and escapes any special HTML characters.
#
# If you want to put actual HTML code in the calendar (hyper-links, for
# example), use the "SPECIAL HTML" type. For example:
#
# REM Wed SPECIAL HTML <P> Meeting at \
# <A HREF="http://www.linuxhq.com">Linux HQ</A> </P>
#
# This file is Copyright (C) 1997-8 by Don Schwarz <darkowl@mcs.net>
# and David F. Skoll
use strict;
use warnings;
use Getopt::Long;
@months = (January,February,March,April,May,June,July,August,September,October,November,December);
my %Options;
$DefaultImageDir = "%IMAGEBASE%";
if ($DefaultImageDir =~ m@/$@) {
chop $DefaultImageDir;
}
my $rem2html_version = '2.0';
$rem2html_version = "1.0";
my($days, $shades, $moons, $classes, $Month, $Year, $Numdays, $Firstwkday, $Mondayfirst,
@Daynames, $Nextmon, $Nextlen, $Prevmon, $Prevlen);
&parse_options();
my $TIDY_PROGNAME = $0;
$TIDY_PROGNAME =~ s|^.*/||;
# Backgound color -- unfortunately, most Web browsers (as of 14 October 1999)
# do not correctly handle transparency in PNG images, so I had to make the
# moon image background white.
$Options{'bgcolor'} ||= "BGCOLOR=\"#FFFFFF\"";
# rem2html -- convert the output of "remind -p" to HTML
if (-t STDIN) {
print STDERR "(Rem2HTML: Input should not come from a terminal.)\n";
$Options{'help'} = 1;
}
=head1 NAME
if ($Options{'help'}) {
&show_usage();
} elsif ($Options{'version'}) {
print "Rem2HTML Version $rem2html_version.\n";
} else {
$successes = 0;
while(1) {
last if (!parse_input());
$successes++;
&output_header();
&output_data();
&output_footer();
}
print STDERR "Rem2HTML: Couldn't find any calendar data.\n" if (!$successes);
}
rem2html - Convert the output of "remind -p" to HTML
exit(0);
=head1 SYNOPSIS
sub show_usage {
print STDERR <<EndOfUsage;
Rem2HTML: Produce a HTML calendar from the output of Remind.
remind -p ... | rem2html [options]
Usage: rem2html [options]
=head1 OPTIONS
=over 4
=item --help, -h
Print usage information
=item --version
Print version
=item --backurl I<url>
When producing the small calendar for the previous month, make the
month name a link to I<url>.
=item --forwurl I<url>
When producing the small calendar for the next month, make the
month name a link to I<url>.
=item --imgbase I<url>
When creating URLs for images and the stylesheet, use
I<url> as the base URL.
=item --stylesheet I<url.css>
Use I<url.css> as the stylesheet. If this option is used,
I<url.css> is I<not> interpreted relative to B<imgbase>.
=item --nostyle
Produce basic HTML that does not use a CSS stylesheet.
=item --tableonly
Output results as a E<lt>tableE<gt> ... E<lt>/tableE<gt> sequence only
without any E<lt>htmlE<gt> or E<lt>bodyE<gt> tags.
=item --title I<title>
Use I<title> as the content between E<lt>titleE<gt> and E<lt>/titleE<gt>
tags.
=item --prologue I<html_text>
Insert I<html_text> right after the E<lt>bodyE<gt> tag.
=item --epilogue I<html_text>
Insert I<html_text> right before the E<lt>/bodyE<gt> tag.
=back
=head1 AUTHOR
rem2html was written by David F. Skoll with much inspiration from an
earlier version by Don Schwarz.
=cut
sub usage
{
my ($exit_status) = @_;
if (!defined($exit_status)) {
$exit_status = 1;
}
print STDERR <<"EOM";
$TIDY_PROGNAME: Produce an HTML calendar from the output of "remind -p"
Usage: remind -p ... | rem2html [options]
Options:
--help, -h Print this information
--version Version information
-p file Prepend the specified HTML file to the beginning of the
output
-a file Append the specified HTML file to the end of the output
-f[shted] font Set font for small cal, hdr, title, cal entries,day numbers
-s[hted] size Set size for header, title, calendar entries and/or day
numbers
--backurl url Make the title on the previous month's small calendar entry
a hyperlink to <url>
--forwurl url Same as --backurl, but with the next month's small calendar
--tableonly Output the results as a <TABLE> block only, no <HTML>, etc.
--border,-b size Set the border thickness of the table
--cellspace,-t size Set the line thickness of the table
--bgcolor,-g color Set the background color for the day entries
EndOfUsage
--help, -h Print usage information
--man Show man page (requires "perldoc")
--version Print version
--backurl url Make the title on the previous month's small calendar
entry a link to <url>
--forwurl url Same as --backurl, but for the next month's small calendar
--imgbase url Base URL of images and default stylesheet file
--stylesheet url.css URL of CSS stylesheet. If specified, imgbase is NOT
prepended to url.css
--nostyle Produce basic HTML that does not use a CSS stylesheet
--tableonly Output results as a <table> only, no <html>, <body>, etc.
--title string What to put in <title>...</title> 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
EOM
exit($exit_status);
}
sub escape_html {
sub parse_options
{
local $SIG{__WARN__} = sub { print STDERR "$TIDY_PROGNAME: $_[0]\n"; };
if (!GetOptions(\%Options, "help|h",
"man",
"version",
"stylesheet=s",
"nostyle",
"backurl=s",
"forwurl=s",
"title=s",
"prologue=s",
"epilogue=s",
"imgbase=s",
"tableonly")) {
usage(1);
}
$Options{'title'} ||= 'HTML Calendar';
# Fix up imgbase
my $imgbase = '%IMAGEBASE%';
if ($imgbase ne '%' . 'IMAGEBASE' . '%') {
$Options{'imgbase'} ||= $imgbase;
} else {
$Options{'imgbase'} ||= '';
}
$Options{'imgbase'} =~ s|/+$||;
my $stylesheet = $Options{'imgbase'};
$stylesheet .= '/' if ($stylesheet ne '');
$stylesheet .= 'rem-default.css';
$Options{'stylesheet'} ||= $stylesheet;
}
sub start_output
{
return if ($Options{'tableonly'});
print("<html>\n<head>\n<title>" . $Options{'title'} . "</title>\n");
if (!$Options{'nostyle'}) {
if ($Options{'stylesheet'}) {
print('<link rel="stylesheet" type="text/css" href="' .
$Options{'stylesheet'} . '">' . "\n");
}
}
print("</head>\n<body>\n");
if ($Options{'prologue'}) {
print $Options{'prologue'} . "\n";
}
}
sub end_output
{
return if ($Options{'tableonly'});
if ($Options{'epilogue'}) {
print $Options{'epilogue'} . "\n";
}
print("</body>\n</html>\n");
}
sub parse_input
{
undef $days;
undef $shades;
undef $moons;
undef $classes;
my $found_data = 0;
while(<STDIN>) {
chomp;
last if /^\# rem2ps begin$/;
}
my $line;
# Month Year numdays firstday monday_first_flag
$line = <STDIN>;
return 0 unless $line;
chomp($line);
($Month, $Year, $Numdays, $Firstwkday, $Mondayfirst) = split(' ', $line);
# Day names
$line = <STDIN>;
return 0 unless $line;
chomp($line);
@Daynames = split(' ', $line);
# Prevmon prevlen
$line = <STDIN>;
return 0 unless $line;
chomp($line);
($Prevmon, $Prevlen) = split(' ', $line);
# Nextmon nextlen
$line = <STDIN>;
return 0 unless $line;
chomp($line);
($Nextmon, $Nextlen) = split(' ', $line);
$found_data = 1;
my $class;
if ($Options{'nostyle'}) {
$class = '';
} else {
$class = ' class="rem-entry"';
}
while(<STDIN>) {
chomp;
last if /^\# rem2ps end$/;
next if /^\#/;
next unless m/^(\d*).(\d*).(\d*)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s*(.*)$/;
my ($y, $m, $d, $special, $tag, $duration, $time, $body) =
($1, $2, $3, $4, $5, $6, $7, $8);
if ($special eq 'HTML') {
push(@{$days->[$d]}, $body);
} elsif ($special eq 'HTMLCLASS') {
$classes->[$d] = $body;
} elsif ($special eq 'MOON') {
if ($body =~ /(\S+)\s+(\S+)\s+(\S+)\s+(.*)$/) {
my ($phase, $moonsize, $fontsize, $msg) = ($1, $2, $3, $4);
$moons->[$d]->{'phase'} = $phase;
$moons->[$d]->{'msg'} = $msg;
} elsif ($body =~ /(\S+)/) {
$moons->[$d]->{'phase'} = $1;
$moons->[$d]->{'msg'} = '';
}
} elsif ($special eq 'SHADE') {
if ($body =~ /(\d+)\s+(\d+)\s+(\d+)/) {
$shades->[$d] = sprintf("#%02X%02X%02X",
($1 % 256), ($2 % 256), ($3 % 256));
}
} elsif ($special eq 'COLOR') {
if ($body =~ /(\d+)\s+(\d+)\s+(\d+)\s+(.*)$/) {
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]}, "<p$class $color>" . escape_html($text) . '</p>');
}
} elsif ($special eq '*') {
push(@{$days->[$d]}, "<p$class>" . escape_html($body) . '</p>');
}
}
return $found_data;
}
sub small_calendar
{
my($month, $monlen, $url, $first_col) = @_;
if ($Mondayfirst) {
$first_col--;
if ($first_col < 0) {
$first_col = 6;
}
}
if ($Options{'nostyle'}) {
print "<td width=\"14%\">\n";
print "<table border=\"0\">\n";
print "<caption>";
} else {
print "<td class=\"rem-small-calendar\">\n";
print "<table class=\"rem-sc-table\">\n";
print "<caption class=\"rem-sc-caption\">";
}
print "<a href=\"$url\">" if ($url);
print $month;
print "</a>" if ($url);
print "</caption>\n";
my $class;
if ($Options{'nostyle'}) {
print '<tr>';
$class = ' align="right"';
} else {
print '<tr class="rem-sc-hdr-row">';
$class = ' class="rem-sc-hdr"';
}
if (!$Mondayfirst) {
print "<th$class>" . substr($Daynames[0], 0, 1) . '</th>';
}
for (my $i=1; $i<7; $i++) {
print "<th$class>" . substr($Daynames[$i], 0, 1) . '</th>';
}
if ($Mondayfirst) {
print "<th$class>" . substr($Daynames[0], 0, 1) . '</th>';
}
print("</tr>\n");
my $col = 0;
for (; $col<$first_col; $col++) {
if ($col == 0) {
print("<tr>\n");
}
if ($Options{'nostyle'}) {
print("<td align=\"right\" width=\"14%\">&nbsp;</td>");
} else {
print("<td class=\"rem-sc-empty-cell\">&nbsp;</td>");
}
}
for (my $day=1; $day <= $monlen; $day++) {
if ($col == 0) {
print("<tr>\n");
}
$col++;
if ($Options{'nostyle'}) {
print("<td align=\"right\" width=\"14%\">$day</td>");
} else {
print("<td class=\"rem-sc-cell\">$day</td>");
}
if ($col == 7) {
print("</tr>\n");
$col = 0;
}
}
if ($col) {
while ($col < 7) {
if ($Options{'nostyle'}) {
print("<td align=\"right\" width=\"14%\">&nbsp;</td>");
} else {
print("<td class=\"rem-sc-empty-cell\">&nbsp;</td>");
}
$col++;
}
print("</tr>\n");
}
print("</table>\n");
print "</td>\n";
}
sub output_calendar
{
# Which column is 1st of month in?
my $first_col = $Firstwkday;
if ($Mondayfirst) {
$first_col--;
if ($first_col < 0) {
$first_col = 6;
}
}
# Last column
my $last_col = ($first_col + $Numdays - 1) % 7;
# Start the table
my $class;
if ($Options{'nostyle'}) {
print '<table width="100%" border="1" cellspacing=\"0\"><caption>' .
$Month . ' ' . $Year . '</caption>' . "\n";
print '<tr>';
$class = ' width="14%"';
} else {
print '<table class="rem-cal"><caption class="rem-cal-caption">' .
$Month . ' ' . $Year . '</caption>' . "\n";
print '<tr class="rem-cal-hdr-row">';
$class = ' class="rem-cal-hdr"';
}
if (!$Mondayfirst) {
print "<th$class>" . $Daynames[0] . '</th>';
}
for (my $i=1; $i<7; $i++) {
print "<th$class>" . $Daynames[$i] . '</th>';
}
if ($Mondayfirst) {
print "<th$class>" . $Daynames[0] . '</th>';
}
print "</tr>\n";
# Start the calendar rows
my $col = 0;
if ($Options{'nostyle'}) {
print "<tr>\n";
} else {
print "<tr class=\"rem-cal-row\">\n";
}
if ($first_col > 0) {
small_calendar($Prevmon, $Prevlen, $Options{'backurl'},
($Firstwkday - $Prevlen + 35) % 7);
$col++;
}
if ($last_col == 6) {
small_calendar($Nextmon, $Nextlen, $Options{'forwurl'},
($Firstwkday + $Numdays) % 7);
$col++;
}
if ($Options{'nostyle'}) {
$class = ' width="14%"';
} else {
$class = ' class="rem-empty"';
}
while ($col < $first_col) {
print("<td$class>&nbsp;</td>\n");
$col++;
}
for (my $day=1; $day<=$Numdays; $day++) {
draw_day_cell($day);
$col++;
if ($col == 7) {
$col = 0;
print "</tr>\n";
if ($day < $Numdays) {
if ($Options{'nostyle'}) {
print "<tr>\n";
} else {
print "<tr class=\"rem-cal-row\">\n";
}
}
}
}
if ($col) {
while ($col < 7) {
if ($col == 5) {
if ($first_col == 0) {
small_calendar($Prevmon, $Prevlen, $Options{'backurl'},
($Firstwkday - $Prevlen + 35) % 7);
} else {
print("<td$class>&nbsp;</td>\n");
}
} elsif ($col == 6) {
small_calendar($Nextmon, $Nextlen, $Options{'forwurl'},
($Firstwkday + $Numdays) % 7);
} else {
print("<td$class>&nbsp;</td>\n");
}
$col++;
}
print "</tr>\n";
}
# End the table
print "</table>\n";
}
sub draw_day_cell
{
my($day) = @_;
my $shade = $shades->[$day];
my $class;
if ($Options{'nostyle'}) {
$class = $classes->[$day] || '';
} else {
$class = $classes->[$day] || "rem-cell";
}
if ($shade) {
$shade = " style=\"background: $shade;\"";
} else {
$shade = "";
}
if ($class ne '') {
print "<td class=\"$class\"$shade>\n<p>";
} else {
print "<td valign=\"top\" $shade>\n<p>";
}
if ($moons->[$day]) {
my $phase = $moons->[$day]->{'phase'};
my $msg = $moons->[$day]->{'msg'};
$msg ||= '';
if ($msg ne '') {
$msg = '&nbsp;' . escape_html($msg);
}
my $img;
my $alt;
my $title;
if ($phase == 0) {
$img = 'newmoon.png';
$title = 'New Moon';
$alt = 'new';
} elsif ($phase == 1) {
$img = 'firstquarter.png';
$title = 'First Quarter';
$alt = '1st';
} elsif ($phase == 2) {
$img = 'fullmoon.png';
$alt = 'full';
$title = 'Full Moon';
} else {
$img = 'lastquarter.png';
$alt = 'last';
$title = 'Last Quarter';
}
if ($Options{'imgbase'}) {
$img = $Options{'imgbase'} . '/' . $img;
}
if ($Options{'nostyle'}) {
print("<div style=\"float: left\"><img border=\"0\" width=\"16\" height=\"16\" alt=\"$alt\" title=\"$title\" src=\"$img\">$msg</div>");
} else {
print("<div class=\"rem-moon\"><img border=\"0\" width=\"16\" height=\"16\" alt=\"$alt\" title=\"$title\" src=\"$img\">$msg</div>");
}
}
if ($Options{'nostyle'}) {
print "<div style=\"float: right\">$day</div></p>\n";
print "<p>&nbsp;</p>\n";
} else {
print "<div class=\"rem-daynumber\">$day</div></p>\n";
print "<p class=\"rem-entry\">&nbsp;</p>\n";
}
if ($days->[$day]) {
print(join("\n", @{$days->[$day]}));
}
print "</td>\n";
}
sub escape_html
{
my($in) = @_;
$in =~ s/\&/\&amp;/g;
$in =~ s/\</\&lt;/g;
@@ -104,313 +535,35 @@ sub escape_html {
return $in;
}
sub parse_options {
%Options = ();
GetOptions (\%Options, "help|h",
"version",
"border|b=i",
"cellspace|t=i",
"backurl|bu:s", "forwurl|fu:s",
"tableonly|to",
"prologue|p=s",
"append|a=s",
"bgcolor|g=s",
"fs=s", "fh=s", "ft=s", "fe=s", "fd=s",
"sh=i", "st=i", "se=i", "sd=i",
);
$Options{'border'} = "BORDER=" . ($Options{'border'} || 1);
$Options{'cellspace'} &&= "CELLSPACING=$Options{'cellspace'}";
$Options{'bgcolor'} &&= "BGCOLOR=$Options{'bgcolor'}";
parse_options();
if ($Options{'help'}) {
usage(0);
exit(0);
} elsif ($Options{'man'}) {
system("perldoc $0");
exit(0);
} elsif ($Options{'version'}) {
print "rem2html version $rem2html_version.\n";
exit(0);
}
sub parse_input {
local $where = 0;
local $msg;
local $type;
local $day;
@days = ();
@shades = ();
@moons = ();
while (<>) {
chomp($_);
if (/rem2(html|ps) begin/) {
} elsif (!$where) {
next;
} elsif ($where == 1) {
local ($month, $year);
($month, $year, $month_length, $firstday, $mfirst) = split(" ");
$caption = "$month, $year";
for $i ( 1 .. $month_length) { push(@days, ""); }
} elsif ($where == 2) {
@DayNames = split(" ");
} elsif ($where == 3) {
@prevsc = split(" ");
} elsif ($where == 4) {
@nextsc = split(" ");
} else {
return 1 if /rem2(html|ps) end/;
next if /^\#/;
next unless m/^(\d*).(\d*).(\d*)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s*(.*)$/;
$type = $4;
$msg = $8;
$day = $3;
if ($type eq "HTML") {
$days[$day] .= "$msg ";
} elsif ($type eq "MOON") {
my($phase, $text);
if ($msg =~ /^\s*(\d+)\s+\S+\s+\S+\s+(.*)$/) {
$phase = $1;
$text = $2;
} elsif ($msg =~ /^\s*(\d+)/) {
$phase = $1;
$text = "";
} else {
next;
}
next if ($phase > 3);
if ($phase == 0) {
$text = "<IMAGE SRC=\"$DefaultImageDir/newmoon.png\" ALT=\"New Moon\"" .
"WIDTH=16 HEIGHT=16> <FONT SIZE=\"-2\">" . escape_html($text);
} elsif ($phase == 1) {
$text = "<IMAGE SRC=\"$DefaultImageDir/firstquarter.png\" ALT=\"First Quarter\"" .
"WIDTH=16 HEIGHT=16> <FONT SIZE=\"-2\">" . escape_html($text);
} elsif ($phase == 2) {
$text = "<IMAGE SRC=\"$DefaultImageDir/fullmoon.png\" ALT=\"Full Moon\"" .
"WIDTH=16 HEIGHT=16> <FONT SIZE=\"-2\">" . escape_html($text);
} else {
$text = "<IMAGE SRC=\"$DefaultImageDir/lastquarter.png\" ALT=\"Last Quarter\"" .
"WIDTH=16 HEIGHT=16> <FONT SIZE=\"-2\">" . escape_html($text);
}
$moons[$day] = $text . "</FONT> ";
} elsif ($type eq "SHADE") {
my($red, $green, $blue);
if ($msg =~ /^\s*(\d+)\s+(\d+)\s+(\d+)\s*$/) {
$red = $1;
$green = $2;
$blue = $3;
} elsif ($msg =~ /^\s*(\d+)\s*$/) {
$red = $1;
$green = $1;
$blue = $1;
} else {
next;
}
next if ($red > 255 || $green > 255 || $blue > 255);
$shades[$day] = sprintf(" BGCOLOR=\"#%02X%02X%02X\"",
$red, $green, $blue);
} elsif ($type eq "COLOR") {
my($red, $green, $blue, $stuff);
if ($msg =~ /^\s*(\d+)\s+(\d+)\s+(\d+)\s*(.*)$/) {
$red = $1;
$green = $2;
$blue = $3;
$stuff = $4;
next if ($red > 255 || $green > 255 || $blue > 255);
$days[$day] .=
sprintf("<P><font color=\"#%02x%02x%02x\">",
$red, $green, $blue) .
escape_html($stuff) . "</font></P>";
} else {
next;
}
} elsif ($type eq "*") {
$msg = &escape_html($msg);
$days[$day] .= "<P>$msg</P>";
}
}
$where++;
}
if ($where) {
return 1;
}
return 0;
if (-t STDIN) {
print STDERR "$TIDY_PROGNAME: Input should not come from a terminal.\n\n";
usage(1);
}
sub output_header {
local ($title, $dayheader);
if (!$Options{'tableonly'}) {
print <<EndOfHTML;
<HTML>
<HEAD><TITLE>Reminders for $caption</TITLE></HEAD>
<BODY>
EndOfHTML
}
print <<EndOfHTML;
<!-- This output was produced by Rem2HTML $rem2html_version (written by
Don Schwarz <darkowl\@mcs.net>) and Remind (written by David F. Skoll). -->
EndOfHTML
if ($Options{'prologue'}) {
open(PROLOGUE, "< $Options{'prologue'}");
print while ( <PROLOGUE> );
close(PROLOGUE);
}
$caption = &format_font($caption, $Options{'ft'}, $Options{'st'} || "+1");
print <<EndOfHTML;
<TABLE $Options{'border'} $Options{'cellspace'} $Options{'bgcolor'} WIDTH=100%>
<CAPTION><STRONG>$caption</STRONG></CAPTION>
<TR>
EndOfHTML
$mfirst || &print_day_header($DayNames[0]);
for($i=1; $i<7; $i++) {
&print_day_header($DayNames[$i]);
}
$mfirst && &print_day_header($DayNames[0]);
print " </TR>\n";
my $found_something = 0;
while(1) {
last if (!parse_input());
start_output() unless $found_something;
$found_something = 1;
output_calendar();
}
if ($found_something) {
end_output();
exit(1);
} else {
print STDERR "$TIDY_PROGNAME: Could not find any calendar data on STDIN.\n";
exit(1);
}
sub output_footer {
print "</TABLE>\n";
if ($Options{'append'}) {
open(EPILOGUE, "< $Options{'append'}");
print while ( <EPILOGUE> );
close(EPILOGUE);
}
unless ($Options{'tableonly'}) {
print <<EndOfHTML;
</BODY>
</HTML>
EndOfHTML
}
}
sub output_data {
local ($endday, $prevday, $nextday, $week, $weekday);
local ($element, $day, $msg, $fday);
$firstday -= $mfirst;
if ($firstday < 0) { $firstday += 7; }
$endday = $firstday + $month_length;
$endweek = $endday + (6 - ($endday % 7));
$endday %= 7;
if ( $firstday > 1 ) {
$prevday = 0;
$nextday = 1;
} elsif ($endday ? ($endday < 5) : !$firstday) {
$prevday = $endweek - 1;
$nextday = $endweek;
} else {
$prevday = 0;
$nextday = $endweek;
}
for $week ( 0..5 ) {
print " <TR>\n";
for $weekday ( 0..6 ) {
$element = ($week * 7) + ($weekday * 1);
$day = $element - $firstday + 1;
$msg = $days[$day];
$msg = $msg ? &format_font($msg, $Options{'fe'}, $Options{'se'})
: " <BR> <BR> <BR> <BR>";
$fday = &format_font($day, $Options{'fd'}, $Options{'sd'} || -1);
if ($day > 0 && $day <= $month_length) {
print <<EndOfHTML;
<TD HEIGHT="120" VALIGN=TOP WIDTH=14%$shades[$day]>
<P ALIGN=RIGHT>$moons[$day]$fday</P>
$msg
</TD>
EndOfHTML
} elsif ($element == $prevday) {
&small_calendar(@prevsc, 1, $Options{'backurl'});
} elsif ($element == $nextday) {
&small_calendar(@nextsc, 2, $Options{'forwurl'});
} else {
print " <TD WIDTH=14%><BR></TD>";
}
}
print " </TR>\n";
last if $day >= $month_length && $element >= $nextday;
}
}
sub small_calendar {
local ($scname, $scn, $which, $url) = @_;
local ($scstart, $l, $week, $weekday, $tday);
$scname = "<A HREF=\"$url\">$scname</A>", if $url;
$scname = &format_font($scname, $Options{'fs'}, -2);
if ($which == 1) {
$scstart = $firstday - ($scn % 7);
if ($scstart < 0) { $scstart += 7; }
} else {
$scstart = $firstday + ($month_length % 7);
if ($scstart > 6) { $scstart -= 7; }
}
print <<EndOfHTML;
<TD WIDTH=14% VALIGN=TOP>
<TABLE WIDTH=100%>
<CAPTION><STRONG>$scname</STRONG></CAPTION>
<TR>
EndOfHTML
$mfirst || &print_day_header(substr($DayNames[0], 0, 1), 1);
for ($i=1; $i<7; $i++) {
&print_day_header(substr($DayNames[$i], 0, 1), 1);
}
$mfirst && &print_day_header(substr($DayNames[0], 0, 1), 1);
print "</TR>\n";
for $week ( 0..5 ) {
print " <TR>\n";
for $weekday ( 0..6 ) {
$tday = ($week * 7) + ($weekday * 1) - $scstart + 1;
$tday = "", if $tday <= 0 || $tday > $scn;
print " <TD WIDTH=14%><FONT SIZE=-2>$tday</FONT></TD>\n";
}
print " </TR>\n";
last if $tday >= $scn;
}
print <<EndOfHTML;
</TABLE>
</TD>
EndOfHTML
}
sub format_font {
local ($text, $font, $size) = @_;
if (!$text) {
return "";
} elsif ($font && $size) {
return "<FONT FACE=$font SIZE=$size>$text</FONT>";
} elsif ($font) {
return "<FONT FACE=$font>$text</FONT>";
} elsif ($size) {
return "<FONT SIZE=$size>$text</FONT>";
} else {
return $text;
}
}
sub print_day_header {
local ($dheader, $small) = @_;
if ($small) {
$dheader = &format_font($dheader, $Options{'fs'}, -2);
} else {
$dheader = &format_font($dheader, $Options{'fh'}, $Options{'sh'});
}
print " <TH WIDTH=14%>$dheader</TH>\n";
}

View File

@@ -8,11 +8,11 @@ set now now()
banner %
MSG <HEAD>%
MSG <TITLE>Sunrise in Ottawa</TITLE>%
MSG <TITLE>Sunrise in [$Location]</TITLE>%
MSG </HEAD>%
MSG <BODY>
MSG <H1>Sunrise in Ottawa</H1>
MSG <H1>Sunrise in [$Location]</H1>
set tod sunrise(today())
set tom sunrise(today()+1)
@@ -34,7 +34,7 @@ set fn iif(diff==0, "now", diff <0, "ago", "from now")
set iw iif(diff<0, "was", "is")
set aw iif(tod==tom, " as well.", ".")
msg Today is %w, %d %m, %y.<P>
msg The local time in Ottawa is [now].<P>
msg The local time in [$Location] is [now].<P>
msg Sunrise today [iw] at [tod]; in other words, [hstr][astr][mstr] [fn].<P>
msg Sunrise tomorrow is at [tom][aw]<P>
msg The daylight portion of tomorrow will be [slen] today.<P>

View File

@@ -9,11 +9,11 @@ set now now()
banner %
MSG <HEAD>%
MSG <TITLE>Sunset in Ottawa</TITLE>%
MSG <TITLE>Sunset in [$Location]</TITLE>%
MSG </HEAD>%
MSG <BODY>
MSG <H1>Sunset in Ottawa</H1>
MSG <H1>Sunset in [$Location]</H1>
set tod sunset(today())
set tom sunset(today()+1)
@@ -35,7 +35,7 @@ set fn iif(diff==0, "now", diff <0, "ago", "from now")
set iw iif(diff<0, "was", "is")
set aw iif(tod==tom, " as well.", ".")
msg Today is %w, %d %m, %y.<P>
msg The local time in Ottawa is [now].<P>
msg The local time in [$Location] is [now].<P>
msg Sunset today [iw] at [tod]; in other words, [hstr][astr][mstr] [fn].<P>
msg Sunset tomorrow is at [tom][aw]<P>
msg The daylight portion of tomorrow will be [slen] today.<P>