[pmwiki-users] Category Markup

DaveG pmwiki at solidgone.com
Fri Dec 16 23:55:39 CST 2005


I abandoned the regex from hell, and used a function instead :) Is there 
such a thing as ReplaceOnEdit?

On http://www.pmwiki.org/wiki/PmWiki/EditVariables I tried to put a link 
to Cookbook/ROSPatterns. If I put the link on the same line/paragraph as 
the existing text, the link is undefined. Putting it on a new paragraph 
works fine. I suspect it's to do with the sample prior which has 
unclosed ]]?

Just out of interest would a regex have been possible?

  ~ ~ DaveG

DaveG wrote:
> 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
>>
> 
> _______________________________________________
> pmwiki-users mailing list
> pmwiki-users at pmichaud.com
> http://host.pmichaud.com/mailman/listinfo/pmwiki-users
> 




More information about the pmwiki-users mailing list