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

Joachim Durchholz jo at durchholz.org
Mon Apr 24 02:31:25 CDT 2006


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.

Regards,
Jo




More information about the pmwiki-users mailing list