Mirrors: Programmatic Assembly of XML, Javascript and CSV Data

Dave Gurnell

dave at untyped

Mirrors is a collection of macro-based syntaxes for rendering content for web applications. The library currently supports the rendering of XML (including browser-compatible XHTML), Javascript 1.5 and CSV data. Future support is planned for CSS level 3.

Important: changes to time rendering in Mirrors 2.4:

Mirrors 2.4 makes a subtle change in the way SRFI 19 times are rendered in XML and CSV output. The old behaviour was to use SRFI 19’s time-utc->date and time-tai->date functions to convert the time to a date, and then use date->string to render the date as a string.

The disadvantage of that approach is the original approach is that it always creates dates according to the current time zone offset. This means that, for example, time-utcs representing timestamps in the middle of winter, can be rendered using daylight saving time if your application is running in the middle of Summer.

Mirrors’ new approach is to use the wrapped time/date handling functions from (planet untyped/unlib/date). This module, which is essentially a wrapper for (planet bzlib/date-tz), converts times to dates using the immediate time zone for the current locale. Winter times will always be rendered using a winter time zone offset, and summer times will always be rendered using a summer time zone offset.

The default locale is "GB" but it can be overridden using the current-tz parameter. A complete list of locales can be obtained using the tz-names procedure. Both of these forms are provided by (planet bzlib/date-tz) and reprovided by (planet untyped/unlib/date).