[pmwiki-users] Simple markup question...

Patrick R. Michaud pmichaud at pobox.com
Wed Sep 20 12:49:31 CDT 2006

On Wed, Sep 20, 2006 at 01:05:58PM -0400, The Editor wrote:
> What I meant was I thought of trying to add a NEW (custom) markup rule
> modeled on the [= =] rule, not that I would replace [= =] or in any
> way change its functionality.
> My obstacle was I could not figure out how to write it so the new
> markup rule would be triggered by (:keep text:).  That being the
> syntax I thought might work me, for this specific situation.
>      Markup('keep','>{$var}',"/(\n[^\\S\n]*)?\\[([=@])(.*?)\\2\\]/se",
>          "PreserveText('$2', PSS('$3'), '$1')");
> I changed the timing and name of it, but how do I change [= and =] to
> (:keep and :)? The expression matching in this markup in particular is
> quite complex.

Start with:

    Markup('varkeep', '>{$var}', 
      '/\\(:keep (.*?):\\)/e',


P.S.:  The reason the standard keep markup is complex is because we 
want PmWiki to do the right thing if someone does [@...@] inside of
[=...=] *or* vice-versa.    That means we can't process [@...@]
and [=...=] with sequential markup rules -- they have to be
processed within the same rule.  This rule is also complex because
we have to recognize when the [=...=] or [@...@] has leading
spaces, and migrate those appropriately.

More information about the pmwiki-users mailing list