[pmwiki-users] allow my markup only on certain pages? (include context)

Lucian Wischik lu.gmane at wischik.com
Fri Nov 10 12:35:13 CST 2006


I'd like one of my custom markups to be allowed only on certain pages (ie. those
pages edited by me, not the ones edited by the public). I've done

Markup('lucianrule','_begin','/.../e', "lucianfun('$1')");

function lucianfun($t)
{ if ($pagename ...) return $t;
  return markup_applied($t);
}

The problem is to do with includes. At the moment my password-protected page has
(:include publicpage:) to show comments from the public inline. And my
"lucianrule" gets applied to that included text.

Is there any way to avoid this? To make my rule apply only to the original? I've
read through the archives on questions of include context and how difficult it
is. It seems that pmwiki added a call to Qualify(...) in its IncludeText to fix
up relative links, which is a kind of include-context, but it's not general
enough for my purposes.

Are there other solutions?

My current thought is to write (:includesafe publicpage:), where my
"includesafe" routine will call IncludeText and then crush all instances of my
custom markup in what it retrieves.



All this is in aid of include html in my pmwiki pages. I've read lots of
discussion on this topic in the mailing lists! And I saw the "EnableHTML"
cookbook. But it didn't seem quite right to me. My idea is instead to write

Markup('lucianrule','_begin','/<html>(.*)?<\/html>/se',
"Keep(htmlspecialchars_decode('$1'))");

Except that before executing htmlspecialchars, my markup will first check that
it's being executed on one of my personal pages.

I'd be grateful for any thoughts or suggestions on this approach.





More information about the pmwiki-users mailing list