[pmwiki-users] A few technical questions

Ryan Varick rvarick at gmail.com
Mon Nov 14 17:33:30 CST 2005

> > My next issue is with the digest
> > (http://www.ryanvarick.com/Blog/Digest).  I'm using this code to
> > expand the (:blogdigest:) directive.
> >
> > Markup('blogdigest', 'directives',
> >     "/^\(:blogdigest?\s+($GroupPattern)[.\/]($NamePattern):\)\s*$/e",
> >     "'<:block>'.view_blog_digest(\$pagename,'$1','$2')");
> > ...
> > view_blog_digest() reads in a wiki page, runs a regex against it, and
> > finally runs the result through MarkupToHTML().  It then returns the
> > formatted HTML.  My problem is that somewhere, in PmWiki, conversion
> > seems to be happenning again.  That is, links that are stored as [[wik
> > links]] are converted to <a href>s by my code, then PmWiki goes
> > through and expands the URL again, as you can see on the digest page.
> >
> > I'm probably using Markup() wrong, so what should I do fix this?
> You probably want to be using Keep(), which preserves text so that
> PmWiki doesn't do any further processing of the text.  Otherwise,
> PmWiki is seeing the urls in the resulting text and placing
> <a ...> tags around them as it is supposed to.

I believe Keep() is exactly what I want.  Would you mind helping me
figure out how to use it?  Markup() takes four arguments; I'm not sure
what the first two are for, but I gather the last to, $pat and $rep,
are the pattern and the thing that replaces the pattern.

Keep(), on the other hand, takes two arguments, which I cannot figure
out how to use.

So I have two questions:  how do I structure a call to Keep(), and how
does Keep() fit into the larger picture?  The Markup() call quoted
above does just about everything I want:  the pattern is replaced by
the result of the function call to view_blog_digest() (which itself
relies on the captures from the regular expression defined as $pat). 
Can I put Keep() before that?  I'm not sure what the "<:block>" thing
is all about.


More information about the pmwiki-users mailing list