[pmwiki-users] Category Markup

DaveG pmwiki at solidgone.com
Fri Dec 16 23:32:09 CST 2005


I'm having trouble with regular expression replacement.

Start String : "Tags: a,b, c"
Result String: "Tags: [[!a]],[[!b]], [[!c]]"

$ROSPatterns["/^Tag(s?):\\s([A-Za-z0-9]\s?)+([,]\s?([A-Za-z0-9]\s?)+)*$/i"] 
= "Tags: [[!\$2]]";

I used some tools to verify my comma separted list expression, and it 
appears okay. I'm not sure how to perform the varying length 
substitution on the right side of the assignment.

  ~ ~ Dave

Patrick R. Michaud wrote:
> On Fri, Dec 16, 2005 at 11:09:07PM -0500, DaveG wrote:
> 
>>In order make the category markup a little more user friendly, and in 
>>order to get the categories in the header, I created a markup:
>>
>>   Markup('^Tags:', 'directives', '/^Tag(s?):\s(.*)/ie',
>>      "PZZ(\$GLOBALS['Categories']=format_Categories('$2'))");
>>
>>that takes: "Tags: tag1, tag2, tag3"
>>
>>and creates the a $GLOBAL in the normal pmwiki format "[[!tag1]], 
>>[[!tag2]], [[!tag3]]"
>>
>>I then reference the $GLOBAL in the skin template header.
>>
>>Great. Works fine. Until... clearly the problem is that when I use 
>>"(:pagelist '[[!{$Name}]]' list=normal:)" in the Category.GroupFooter, 
>>no pages are listed. 
> 
> 
> Maybe use (:pagelist link=Category.{$Name} list=normal:) instead?
> It's also usually faster.
> 
> 
>>Alternatively, is there a mechanism in PmWiki to convert text (or apply 
>>a 'markup' like function to the text) to true PmWiki format when the 
>>user pushes save, and then convert to simple format when the user hits Edit?
> 
> 
> Yes, via the $ROSPatterns array ("replace on save" -- see 
> http://www.pmwiki.org/wiki/PmWiki/EditVariables).
> 
> Pm
> 




More information about the pmwiki-users mailing list