[pmwiki-users] Different Markup definitions for a section?

Stirling Westrup sti at pooq.com
Mon Apr 24 06:51:30 CDT 2006


Joachim Durchholz wrote:
> Stirling Westrup schrieb:
>> That won't work. I want to KEEP the existing markup when its outside the
>> special section, and change it inside. Thus:
>>
>> ! This is a normal heading
>> (:special-section:)
>> ! This is a completely different markup!
>> (:end-special-section:)
>> ! This is again the normal heading markup
>>
>> So, I need to have the entire set of Markups change while handling
>> special sections. Thats what I don't know how to do.
> 
> If the markup is of your own devising, you can set a flag in the handler 
> for (:special-section:), and have the ! markup check for that flag and 
> return the unchanged text if the flag is set.
> 
> Alternatively, (:special-section:) could eliminate the given markups 
> from the markup table, and (:end-special-section:) could reintroduce them.
> This would require some moderate PHP coding.
> Note that adding or removing a markup rule invalidates the rule table, 
> so PmWiki will automatically recompute rule ordering the next time it is 
> doing markup substitution; if there are many special sections on a 
> table, this might take too much time.
> 
> A third approach might be wrapping the markup entries. For each markup 
> that must be disabled inside special sections,
> * save the replacement data for that markup,
> * place your wrapper code as replacement data.
> The wrapper code would be something that checks the special-section 
> flag, and if it's set, it would return the original string, and if it's 
> not set, it would return the replacement string. (There are 
> ramifications if the original pattern uses the /e flag. It's all 
> feasible, but it does require serious PHP and regex knowledge.)
> 
> If you want to take any of these routes, I can look up what variables 
> and functions to use, and what pitfalls to avoid.
> 

Thanks for the info. I don't have any fear of PHP coding or regular
expressions. What I lack is detailed knowledge of the guts of the
markup-handling code inside PmWiki that I will be playing around with.

I had been thinking of going with something like option #2, but now I'm
thinking I may be better off with option #1, since some pages will
consist of nothing more than a dozen special sections in a row.





More information about the pmwiki-users mailing list