#!/bin/sh
# HTML calendar shell script
#
# This file is part of REMIND.
# Copyright (C) 1992-2026 by Dianne Skoll

echo "Content-Type: text/html"
echo ""

if [ "$1 $2" = " " ] ; then
$REMIND - <<'EOR'
set thismon monnum(today())
set thisyear year(today())
set nextmon iif(thismon+1 > 12, 1, thismon+1)
set nextyear iif(nextmon==1, thisyear+1, thisyear)
set lastmon iif(thismon-1 < 1, 12, thismon-1)
set lastyear iif(lastmon==12, thisyear-1, thisyear)
set nextmon mon(nextmon)
set lastmon mon(lastmon)
BANNER %
REM RUN $REMIND -iHTML=1 -p $DIR/hebdate.rem %m %y | %REM2HTML% --forwurl "cal_dispatch?hebhtml+[nextmon]+[nextyear]" --backurl "cal_dispatch?hebhtml+[lastmon]+[lastyear]" --imgbase "%IMAGEBASE%" --stylesheet rem-default.css --pngs
EOR

else

$REMIND - "$1" "$2" <<'EOR'
set thismon monnum(today())
set thisyear year(today())
set nextmon iif(thismon+1 > 12, 1, thismon+1)
set nextyear iif(nextmon==1, thisyear+1, thisyear)
set lastmon iif(thismon-1 < 1, 12, thismon-1)
set lastyear iif(lastmon==12, thisyear-1, thisyear)
set nextmon mon(nextmon)
set lastmon mon(lastmon)
BANNER %
REM RUN $REMIND -iHTML=1 -p $DIR/hebdate.rem %m %y | %REM2HTML% --forwurl "cal_dispatch?hebhtml+[nextmon]+[nextyear]" --backurl "cal_dispatch?hebhtml+[lastmon]+[lastyear]" --imgbase "%IMAGEBASE%" --stylesheet rem-default.css --pngs
EOR

fi

exit 0
