[pmwiki-users] Markup engine global improvement

Dominique Faure dominique.faure.1 at free.fr
Thu Jul 7 02:01:05 CDT 2005


At Thursday, July 07, 2005 2:29 AM [GMT+1=CET], John Rankin wrote:

> On Thursday, 7 July 2005 1:42 AM, Patrick R. Michaud
> <pmichaud at pobox.com> wrote:
>> On Wed, Jul 06, 2005 at 08:49:53AM +0200, Dominique Faure wrote:
>>> Following some threads about markup internal improvements (aka.
>>> Keep()), I was thinking of some major improvements that could be made
>>> to the engine itself:
>>> Encapsulate all the markup stuff into a class (as it has already been
>>> made for PageStore). This way, it could be a lot easier for the engine
>>> to generate something else than (x)html from wiki page: pdf,
>> latex, rss,...
>>
>> This would be much later in development, if ever.  It's just way outside
>> of the PmWikiPhilosophy and core.  Also, OO stuff tends to alienate a
>> lot of potential developers and people who may want to implement simple
>> customizations.  (Yes, this can be fixed somewhat with wrapper
>> scripts.)
>>
>> However, I'll also note that John Rankin has successfully done some
>> work in the area of creating and maintaining alternate output formats,
>> so it's definitely possible within the existing framework.
>>
>> Pm
>>
> Having used the PmWiki engine to transform wiki markup to a DTD
> other than xhtml, on the way to producing pdf, I can testify
> that the Markup(...) approach works beautifully. Indeed, through
> namespaces, you can even transform wiki markup into output that
> uses tags from more than one dtd and it can still, with care,
> just work.
>
> For an example, see
> http://intranet.affinity.co.nz/pmwiki2/index.php?n=Pdf2you.HomePage?action=print&format=pdf
>
> View the source to see the xml generated. This is done by
> substituting the stdmarkup.php and wikistyles.php in local/
> settings.
>
> We give this output to a pdf engine to create a printable version.
>
> --
> JR

I globally approve your points of view, but I was thinking that using 
polymorphism and heritance could be used also here to abstract the markup 
operations from the output format to produce. Anyway, following your "string 
or array" paradigm, this could be nice having a Markup "output mode" 
(whatever the way you implement it), aka:

Markup("'^",'inline',"/'\\^(.*?)\\^'/",
  array('html' => '<sup>$1</sup>',
        'latex' => '^{$1}'));

In a same mood, we could also apply something like this for the input 
regexp, defining an "input mode" and thus being able to handle several wiki 
syntaxes:

Markup("''",'inline',
  array('pmwiki' => "/''(.*?)''/",
        'other' => "/\*(.*?)\*"),
  array('html' => '<em>$1</em>',
        'latex' => '{\it $1}'));

That was just my 2c.
Regards,
Dominique





More information about the pmwiki-users mailing list