[pmwiki-users] Controlling the format of wikiwords

John Rankin john.rankin at affinity.co.nz
Thu May 29 17:40:52 CDT 2008

>I am seeking an easy way to change the output of wikiword links 
>and in particular changing <span class='wikiword'> ... </span> 
>to something else. This is currently hard-coded.
>What if scripts/wikiwords.php did something like this:
>   '<span class="wikiword">$WikiLink</span>');
>Any suggestions?

To clarify why this is a problem:

If the recipe redefines the wikilink markup rule,
it needs to say:

if (@$LinkWikiWords || IsEnabled($EnableWikiWords, 0))
    Markup('wikilink', ...);

The call has to happen *after* config.php sets the
wikiword link status. But the rest of the recipe has
to load at the start of config.php, so there needs to 
be an extra instruction to administrators to move the
instructions that set the wikiword link status, or
split the recipe into 2 pieces.

So a more robust solution is to define a new rule
that patches <span class='wikiword'> ... </span>
after Keeps have been restored. Changing the
behaviour of a previously-applied rule after the
event is rationally OK, but emotionally painful.

OTOH redefining a $LinkWikiWordsFmt variable is
simple and safe. If wikiwords are disabled, it has
no effect, so it doesn't need to know if they are
enabled or disabled.

My conclusion is that as the code currently stands,
the best option is a fix-up rule that changes the
<span class='wikiword'> into something else.

Is there a better way?
John Rankin

More information about the pmwiki-users mailing list