[pmwiki-devel] disabling and modifying markup for specific recipe output

Hans design5 at softflow.co.uk
Tue Aug 25 13:06:02 CDT 2009


I have been looking closer into the markup code and
done more testing, and found this provisional solution:

For DisableMarkup to work from within a function called by a markup
expression or directive (working on inline markup) I had to change
the following:

function MarkupToHTML(): no changes.
it was not necessary to move
   $markrules = BuildMarkupRules();
into the  while(count($lines)>0) loop

function BuildMarkupRules():
add
  unset($MarkupRules);
to the beginning.
remove line
  if (!$MarkupRules) {
and the closing } before the return $MarkupRules;

Basically $MarkupRules needed to be unset.
I wonder though why it should be  a global at all, the function
does return the markup rules without it being global.

function DisableMarkup():
remove line
  unset($MarkupRules);
This line does not work anyway, as the var is not declared global,
and it would make no difference if it were.

For Markup() to work from within a function, to
redefine an existing one, I needed to do these changes:

function Markup():
change line
  if ($pat && !isset($MarkupTable[$id]['pat'])) {
to
  if ($pat) {

Otherwise a modified pattern will not be registered,
as it already exists.

Please consider these changes.


Hans




More information about the pmwiki-devel mailing list