Geoff's Not-So-Amazing HTML Calendar Programme

I first wrote this programme in Java in 2000, back when it was the only real programming language I knew. I have since rewritten it in C++, although now that I'm starting to learn bash, I realize it might be better suited to a shell script, or a Perl/Python/whatever script.

WARNING! This is an amazingly cheap hack. I wrote it in a very short time and haven't bothered fixing it up since I'm the only person who (admits to) using it. The programme is very unforgiving if its input isn't exactly to spec, and it will happily spew out mangled calendars. Everything is hard-coded--there are no configuration files or options. If you want to have a different header and footer (and you probably will), you'll have to write it into the code yourself and recompile. I'll improve on the code if anyone other than me actually uses this thing.

Source code (public domain): calendar.cpp (1.9 KB)

I've not bothered to write a Makefile for this, as there's only one source file, and there aren't any compile options. Just type g++ -o kalend calendar.cpp to compile.

The programme reads from standard input and writes to standard output, so a typical usage would be $ kalend < inputfile > outputfile.html.

The input file specifications are:

A short sample input follows (comments in {braces}):

September 2000

end

end

end     {blank days at the beginning of the month}

end

end
1   {the day's heading}
South Simcoe Amateur Astronomers Star Party     {the name of an event}
starparty                                       {the kind of event it is}
end
2
South Simcoe Amateur Astronomers Star Party
starparty
end
3   {an empty day}
end
4
Labour Day
holiday     {a different kind of event}
end
5 <IMG SRC="moon-first.gif" WIDTH=16 HEIGHT=16 ALT="First Quarter Moon">    {the day's heading can have anything in it}
Member's Observing Workshop (first clear night)
mow
end
{...cut text...}
12
end
13 <IMG SRC="moon-full.gif" WIDTH=16 HEIGHT=16 ALT="Full Moon">
end

end

end     {blank days at the end of the month}

end
eof     {the terminator}

The pages this programme generates are meant to be used with Cascading Style Sheets (CSS). If you edit the <SPAN> tag in a stylesheet called calendar.css, you can change the attributes of any type of event.


* Root Page * Programming * Calendar *