Refactoring: add events array and remove recursion

Build an array of events instead of building up a string directly.

Remove recursion for multiple weekdays. Since the case of multiple
weekdays in one row ("TuTh") follows the same pattern as just one ("Tu"),
it is actually easier to treat the general case.

Move toward a more functional structure and less globals (still work to
do).
Formatting
Warning fixes
Fix script loading regression
Report hours of class per week
Combine "duplicate" classes (all same except room)

Also refactor escape_ics_text calls
Title case for room field: capitalize after hyphens

For example, BEAMISH-MUNRO now becomes Beamish-Munro, not Beamish-munro.
Make combining duplicates an option