[pmwiki-users] Help with replacing text

Petko Yotov 5ko at 5ko.fr
Mon Sep 17 18:14:52 CDT 2012


Ian MacGregor writes:
> I thought I would add the following line to the Site.NewPageTemplate:
> %color=#595959% [-monthdayyear-]%%
>
> and have the wiki convert that to:
> %color=#595959% [-September 17, 2012-]%%
>
> when I tried editing the page so I wouldn't have to add the current date. I  
> tried some ROSPatterns but I got errors and couldn't figure it out on my own.

The following may work:

  if($pagename != 'Site.NewPageTemplate') # not if editing the template
    $ROEPatterns['/\\[-monthdayyear-\\]/'] = strftime('[-%B %e, %Y-]');

If you have $ROEPatterns, in the pre-filled new page you will see the date
in the text area before saving the page; with $ROSPatterns you will see
[-monthdayyear-] which will be converted to the date when you save the page.

Petko




More information about the pmwiki-users mailing list