[pmwiki-users] Trouble with ParseArgs

Patrick R. Michaud pmichaud at pobox.com
Mon Dec 12 13:33:58 CST 2005


On Mon, Dec 12, 2005 at 02:15:30PM -0500, Ryan R. Varick wrote:
> As recommended in an earlier thread, I am using ParseArgs for the new
> KOB directives.  I find that I multiple words are truncated, even when
> wrapped in quotes.  I think it has to do with either (1) the second
> argument I'm using for Markup or (2) slashes getting inserted into my
> match.
> 
> The basic format is:
> 
> (:blogentry title="TITLE" time="YYYY-MM-DD HH:MM" permalink="GROUP.PAGE":)
> 
> I'm parsing this via:
> 
> Markup("blogentry", "directives",
>   "/\(:blogentry\s+(.*):\)/e",
>   "format_kob_entrystart('$1')");

That needs to be:

    Markup("blogentry", "directives",
    Markup("blogentry", "directives",
      "/\(:blogentry\s+(.*):\)/e",
      "format_kob_entrystart(PSS('$1'))");

> A few questions:
> 
> (1)  How do I fix this?  ;-)

See above.

> (3)  Where are the slashes coming from?

When the "/e" option is given to a pattern, PHP automatically inserts
backslashes in front of any double-quotes or backslashes in the 
captured strings.  PmWiki provides the PSS() function ("PmWiki Strip
Slashes") in order to get rid of those backslashes.

> (2)  What is the second argument for Markup() all about?

It indicates when the current rule is supposed to execute relative
to other markup rules.  Getting the rules to execute in the
correct sequence is critical to having things work -- for example,
trail markup has to be processed before the references inside the
trail are converted into links.  So, "directives" here says
that this rule should run at the same time as other directives,
which is generally before inline, link, or block markups.  

If a markup needs to be executed before conditional markup, then
one would use "<if" for the second parameter.  

Take a look at http://www.pmwiki.org/wiki?action=ruleset to see
a list of the markup rules that PmWiki has defined, the ordering
argument, and the sequence in which they're executed.

Pm




More information about the pmwiki-users mailing list