[pmwiki-devel] Preventing Embedded Markup Expressions

DaveG pmwiki at solidgone.com
Sat Jul 3 16:29:15 CDT 2010


Is there a way to selectively prevent embedded markup expressions from 
being evaluated?

The issue arises when making a call to includesection 
(Cookbook/IncludeSection). We need to ensure that parameters which might 
contain quotes are encoded to prevent the quotes being considered an end 
of the parameter -- the markup expression bi_encode does this.

   (:includesection "#common-blog-head title='{(bi_encode {*$Title})}' 
entrydate='{*$:entrydate}' entrytags='{(bi_encode {*$:entrytags})}' 
entryauthor='{(bi_encode {*$:entryauthor})}' listformat=false ":)

However, in the example above, if the Title or Tags contain a string in 
parenthesis "this is a title (or is it)", then the string "or is it" is 
evaluated as a markup expression embedded with in the bi_encode expression.


So:
1] Is there a way to disable embedded markup expression handling in 
selected cases?

2] It seems to me that I may simply be approaching this the wrong way. 
I'm quoting the includesection parameters, which is causing the problem. 
Is there an alternate way to use includesection?


For reference here's bi_encode:
   $MarkupExpr['bi_encode'] = 'htmlentities(bi_IsNull(implode(\' \', 
$args)), ENT_QUOTES)';

and bi_IsNull (used for older versions of PmWiki):
   function bi_IsNull($e){ return (!empty($e) && substr($e,0,3)!='{*$' 
&& substr($e,0,2)!='{$' && substr($e,0,3)!='{=$' ?$e :''); }


  ~ ~ Dave



More information about the pmwiki-devel mailing list