Pseudo-formatters: one-time generated content


I'd like to discuss the idea - already suggested in the WakkaWiki community - of adding to Wikka a set of pseudo-formatters, taking care of one-time content generation. Whereas actual formatters interpret Wikka markup stored in the DB, pseudo-formatters only interpret some specific markup when a page is stored: the content is generated on-the-fly and stored in the database as ordinary Wikka content.

A couple of examples:

Short signature

Long signature
-- [2005-02-28 12:02]

[2005-02-28 12:02]


The code

The modifications required for this to work are quite silly. We just need to modify SavePage() in wikka.php, before the call to Query()

          // one-time formatter: signature
                        if ($user) {
                                $longsignature = '-- '.$user.' [##'.date("Y-m-d H:i").'##]';
                                $shortsignature = '-- '.$user;
                                $body = preg_replace("/::::/",$longsignature,$body);  
                                $body = preg_replace("/:::/",$shortsignature,$body);
          // one-time formatter: timestamp
                                $timestamp = '[##'.date("Y-m-d H:i").'##]';
                                $body = preg_replace("/::t::/",$timestamp,$body);  

A similar hack has to be done in the preview section of handlers/page/edit.php.
The timestamp markup is just an example, not something I would implement as such in Wikka (the format should be configurable).

As usual, what we need is a good markup (easy to remember, distinctive, expressive). If we choose to adopt :: as a tag for extensible markup, then the solution I propose here is not optimal.

Your thoughts?

There are 7 comments on this page. [Show comments]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki