[Pmwiki-users] Quoting http:/.... from within code invoke by $DoubleBrackets

Christian Ridderström chr
Sat Jan 24 07:03:54 CST 2004


On Sat, 24 Jan 2004, Christian Ridderstr?m wrote:

> Hi
> 
> Let's assume I have a this double bracket pattern:
> 	$DoubleBracket['/\\[\\[test\\]\\]/'] = 
> 		"<a href='http://www.something.org'>link</a>";
> 
> In this case, the final result will not be 'link' (where it's a link), 
> because some $LinkPatterns... will detect the 'http:' and manipulate it.
> 
> How could I prevent this from happening.
> Could I quote the output of the DoubleBracke-replacement somehow?  

Ok, I found an answer by remembering something Patrick wrote about 
release 0.5.27. The solution is to use the function Keep()
--- it could use small comment IMHO. Perhaps something like this:

/*
// Keep() stores the string argument and returns an intermediary string 
// that will not be affected by other patterns. Just before finally
// printing a page - i.e. in PrintText() - the intermediary string is 
// restored, thereby preserving the original string argument from any 
// additional transformations.
*/
function Keep($text) {
  global $KeepToken,$KPV,$KPCount;
  $KPCount++; $KPV[$KPCount]=$text;
  return $KeepToken.$KPCount.$KeepToken;
}

/Christian

-- 
Dr. Christian Ridderstr?m, +46-8-768 39 44       http://www.md.kth.se/~chr




More information about the pmwiki-users mailing list