[pmwiki-users] Re: Re: Cookbook recipes updated for beta 19 compatibility
Patrick R. Michaud
pmichaud at pobox.com
Fri Jan 28 09:13:43 CST 2005
On Thu, Jan 27, 2005 at 10:13:48AM +1300, John Rankin wrote:
> On Thursday, 27 January 2005 4:00 AM, chr at home.se wrote:
> >For the administrator it'd be nice to be able to do something
> >like:
> > PreventMarkup('dropcaps', '^!', 'Q:');
>
> A function something like the following, perhaps:
>
> function PreventMarkup($markups) {
> global $MarkupTable;
> foreach ($markups as $m)
> if isset($MarkupTable[$m]) unset($MarkupTable[$m])
> else Markup($m,'');
> }
Better might be:
function DisableMarkup($markups) {
global $MarkupTable, $MarkupRules;
foreach ((array)$markups as $m)
$MarkupTable[$m] = array('cmd'=>'none');
unset($MarkupRules);
}
Differences:
- using "(array)$markups" in the foreach loop means that both
PreventMarkup('^!') and PreventMarkup(array('dropcaps', '^!', '^Q:'))
will work
- it saves the overhead of calling Markup by setting the $MarkupTable
array entries directly
- unset($MarkupRules) forces the system to rebuild the internal
translation table to account for the possibly deleted markup
- DisableMarkup seems more descriptive than PreventMarkup
> Assuming the above works, I suggest we add it to the extended markup
> recipe.
I'll go ahead and add this function to the default distribution.
> >Hmm... when I think about it... what about being able to disable markup
> >through markup? What if by adding the following to a wiki page
> > (:prevent-markup ^!:)
> >would disable that markup for that page? (This might be a can of worms of
> >course..)
Someone could certainly try it. In addition to calling DisableMarkup,
the directive would need to call PRR(), BuildMarkupRules(), and set
the value of $markrules in the MarkupToHTML script.
Plus it's interesting to speculation on what would happen with
(:prevent-markup prevent-markup:)
:-)
Pm
More information about the pmwiki-users
mailing list