protection block

EmanueleQuinto - October 8, 2005 - 15:11
Project:Wiki
Version:4.6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:EmanueleQuinto
Status:active
Description

It seems that {{{ }}} don't works properly on multiline.

It assumed that you wrote

{{{
bla bla this non changed [temp | http:www.whatnow.org]
bla bla other non changed [temp | http:www.whatnow.org]
}}}

you get

bla bla this non changed [temp | http:www.whatnow.org]
bla bla other non changed [temp | http:www.whatnow.org]

But if you write

{{{ bla bla this non changed [temp | http:www.whatnow.org]
bla bla other non changed [temp | http:www.whatnow.org]
}}}

bla bla other non changed [temp | http:www.whatnow.org]

Maybe it's rught but in the lines

    // protect everthing within "{{{" and "}}}" as is
    // multi line case:
    if (preg_match("/^{{{(.*)/", $tmpline, $matches) && !preg_match("/}}}/", $tmpline, $matches)) {
      $isprotect = TRUE;
      $html .= _wiki_set_output_mode("pre", WIKI_ZERO_LEVEL, 0);
      $html .= htmlspecialchars($matches[1]). "\n";
      continue;

We are using $matches[1] fromt the first preg_match. I'm not a php expert but the second pre_match seems to reset first one.

So if you simply remove $matches from the last preg_match as

    if (preg_match("/^{{{(.*)/", $tmpline, $matches) && !preg_match("/}}}/", $tmpline)) {

it works and

{{{bla bla this non changed [temp | http:www.whatnow.org]
bla bla other non changed [temp | http:www.whatnow.org]
}}}

output

bla bla this non changed [temp | http:www.whatnow.org]
bla bla other non changed [temp | http:www.whatnow.org]

 
 

Drupal is a registered trademark of Dries Buytaert.