Date formats: What Wikipublisher knows about dates
What shortcuts are available for displaying dates in wiki pages?
Woodcut from the early 19th century
Since it’s the spring equinox in the southern hemisphere, this week’s tip looks at the calendar recipe — wikilog — and in particular how this turns short dates into long dates. Date markup shows the usage. To see the full calendar recipe in action, visit the News section.
Text that looks like a numeric date is translated into a long date form. The markup rule tries hard to do this only when the date is not part of a longer string, such as a website address: http://www.example.com/2008-09-21 does what you would want it to. The markup only applies to yyyy mm dd dates: dates like 21–09–2008 are not changed.
The separator character is configurable using the $DateSeparatorPattern variable. By default this is set to “[-.\/]” — on this site, the forward stroke (/) separator is disabled. The site administrator can do this by redefining the $DateSeparatorPattern in local/config.php above the line that loads the Wikipublisher extensions. For example, to recognise the stroke and the period as date separators, but not the hyphen, add the following line at the start of local/config.php:
$DateSeparatorPattern = '[\/.]';
You can suppress the markup for individual dates either by wrapping the date in [= and =]: 2008-09-21; or by adding an invisible stop (backtick-period): 2008–09–21. Alert readers will notice that these produce slightly different output. Can you see the difference?