[pmwiki-users] (:noteblock:) problem

Joachim Durchholz jo at durchholz.org
Wed Apr 13 07:35:01 CDT 2005


Sebastian Siedentopf wrote:

> Am 13.04.2005 7:34 Uhr schrieb "Patrick R. Michaud" unter
> <pmichaud at pobox.com>:
> 
> 
>>The HTML being produced by (:noteblock:) on your site is
>>badly broken with incorrectly placed <p> and </p> tags, and
>>that's probably what is causing IE so much trouble. ...
> 
> 
>>I looked briefly at the (:noteblock:) code but it looks a bit
>>too involved for me to debug at the moment.  I suspect a well-placed
>>call to Keep(...) might resolve the problem.
> 
> 
> 
> The table generated by something like this:
> 
> Markup('note','directives','/\(:note\s(.*?):\)/e', "notefct('$1')");
>   
> function notefct($Message){
>  $a="some <multiline wiki markup> text"
>  $b="some <multiline wiki markup> text"
>  
>  $out= "<table class='x'><tr><td  class='y'>".$a."</td></tr><tr><td
> 
>>".$b.</td></tr></table>";
> 
>  
>  return $out;
> }
> 
> should not be placed into <p> </p> tags.
> 
> I'm aware of the Keep() function but I have to admit, i haven't examined
> what Keep() is really doing and how it works, so it is probably my fault.

<boring technical stuff>

Keep stuffs its parameter into an internal array and returns a string 
that (roughly) reads "token<array index>token" where 'token' is a string 
that's known to not match any markup syntax; if the result of Keep() is 
then returned as the replacement for a PmWiki markup, it will simply be 
carried through markup processing unchanged.

The last step of markup processing replaces all the keep tokens with the 
strings stored for them.

</boring technical stuff>

The effect is that Keep() will prevent PmWiki from applying its markup 
rules on its contents.

In general, if you design a PmWiki markup, you should consider the 
replacement text. Those parts of the text that may (again) contain 
PmWiki markup should be left as is, the rest should be protected via Keep().

In the above example, the HTML should be protected with Keep(), and 
(depending on what exactly you meant) $a and $b might have to be 
constructed like in

   $a = Keep('some ') . '<multiline wiki markup> . Keep(' text');

or left as is.

> Maybe there is a simple Keep() solution.  I will look after it.

HTH
Jo



More information about the pmwiki-users mailing list