[pmwiki-users] custom markup parameter issue

Patrick R. Michaud pmichaud at pobox.com
Fri Jan 12 06:39:04 CST 2007


On Fri, Jan 12, 2007 at 01:31:15PM +0100, info at hassanein.ch wrote:
> On 12.01.2007 at 12:00, you wrote:
> > If you want to execute a function on a pattern, you need to use the
> > /e option on the pattern, and enclose the code to be executed in
> > quotes.
> > Also, if $1 might contain quotes or backslashes in it, you'll
> > want to surround it with PSS().  Thus:
> >
> >     Markup('mymu', 'inline',
> >       '/_mymu_ (.*?) <u>mymu</u>/e',
> >       "myFunc(PSS('$1'))");
> 
> Thank you very much, now it works nearly perfect, as long as the whole
> strting is in 1 line.
> I need to have newlines between my custom markups, e.g.
> 
> mymu data 1
> data2
> data3
> mymu
> 
> How can I capture the string between the mymu's?

If you want to do this, you need to add a /s option to the pattern,
so that the '.' will also match newlines.

Also, the second parameter cannot be 'inline', but must instead
occur prior to the 'split' rule.  (The 'inline' rule occurs after
the text has been broken into individual lines for processing.)

Thus:

    Markup('mymu', '<split',
      '/_mymu_(.*?)_mymu_/es'
      "myFunc(PSS('$1'))");

Pm




More information about the pmwiki-users mailing list