[pmwiki-users] Re: WikiCalendar date markup

John Rankin john.rankin at affinity.co.nz
Mon May 9 16:21:26 CDT 2005


On Monday, 9 May 2005 8:47 PM, Nate Cull <nate at natecull.org> wrote:
>
>For now I've just used this custom markup:
>
>Markup('magicdate','inline','/\[\[Calendar([\.\/])(\d\d\d\d\d\d\d
>\d)\]\]/e', "((IsDate('$2')) ? '[[Calendar$1$2|' . longdate('$2') .
>']]' : '$0')");
>
>which is based on wdate but changes only the title of links. It
>hardcodes the group Calendar so it's not good enough to put into the
>script itself, but worth adding to the page maybe?
>
>
Try adding the following to config.php /after/ you include wikilog.php:
Markup('daylink','>inline',
    "/\[\[((?:$GroupPattern\/)?($CalendarPattern))\]\]/e",
    "Keep(MakeDateLink(\$pagename,'$1',((IsDate('$2')) ? longdate('$2') : '$2')),'L')");

This is not super-elegant, but it means you can prevent accidental
date links by writing [[Group.yyyymmdd]] or [[group.yyyymmdd]] or
[[group/yyyymmdd]]. It only makes dates out of [[Group/yyyymmdd]]
and [[yyyymmdd]]. We can get more sophisticated if needed.

As to why I added yyyy-mm-dd -> long date, it's to support the 
wikiforms script, which often inserts dates, that you want to 
see displayed in a friendly manner.

Hope this clarifies.
-- 
JR
--
John Rankin






More information about the pmwiki-users mailing list