[pmwiki-users] Embedding (:directive:) inside of (:text_var: ... :)

The Editor editor at fast.st
Wed Apr 11 17:29:26 CDT 2007


On 4/11/07, The Editor <editor at fast.st> wrote:
> On 4/11/07, Patrick R. Michaud <pmichaud at pobox.com> wrote:
> > Several people have commented that they sometimes want/need
> > to place directives inside of hidden page text variables -- i.e.,
> > to do something like:
> >
> >     (:myvar: (:pagelist:) :)
> >
> > such that $:myvar returns a value of "(:pagelist:)".  Of
> > course, this doesn't work at present because the "(:...:)"'s
> > don't nest, so that the (:pagelist:) directive has the effect
> > of inadvertently closing off the page text variable.
> >
> > A couple of days ago I thought of an easy way that we could
> > avoid this problem by allowing multiple colons for markers
> > on page text variable directives.  Then the above could be
> > written as:
> >
> >     (::myvar: (:pagelist:) ::)
> >
> > This does the same as (:myvar: ... :), except that the presence
> > of "(::" at the beginning of the page text variable requires
> > a matching "::)" to close it.  This makes it easier to embed directives
> > inside of hidden page text variables.  And it can be generalized to
> > handle arbitrary numbers of colons:
> >
> >     (::::myvar:  I like colons!  ::::)
> >
> > Other directive markups that potentially have embedded
> > directives might also be able to use the multiple-colon approach.
> >
> > I personally don't have any use or need for this, but it
> > did occur to me and so I thought I'd mention it in case
> > there are a lot of others who could use it.  Implementing it
> > would be a minor change to the page text variables code.
> >
> > Thanks!
> >
> > Pm
>
>
> Pm, I would like this!  It would save me from having to use {( )} in
> text vars and then convert them back to directives.  Plus it makes it
> easier--as I can test live code, then just cut and paste it into the
> directive.  I think it would be great!
>
> Thanks!
>
> Cheers,
> Dan


On a related note (though maybe irrelevant now) the one markup I
couldn't transfer over was the directives one.  Maybe you can see what
I'm doing wrong.

$MarkupExpr['wiki'] = 'ZAPMwiki($params)';
function ZAPMwiki($p) {
	global $ZAPdirectives, $ZAPformdirectives;
	$c = substr($p, 0, strpos($p, " "));
	$p = substr($p, strpos($p, " "));
	$pmlist = explode(",", $ZAPdirectives);
	if (in_array($c, $pmlist)) return stripslashes("(:$c $p:)");
	if ((substr($c, 0, 3) == 'zap') && ($ZAPformdirectives == true))
return stripslashes("(:$c $p:)");
	return false;
	}
SDV($ZAPdirectives,
'table,tableend,cell,cellnr,include,if,pagelist,input,messages,redirect,title');
SDV($ZAPformdirectives, false);

For all appearances, $p is getting the whole value on "pagelist
group=Test" but $c is not finding the " " in it.  I tried the escape
replacement you suggested with no luck.  I will probably dump this if
you make the other change you are talking about but not sure why this
isn't working.  Did I miss something?

Cheers,
Dan

Cheers,
Dan



More information about the pmwiki-users mailing list