includes/wikiengine/parse_mediawiki.php
changeset 1130 c308b471ed82
parent 1127 4b858862c35c
child 1131 adfbe522c95f
equal deleted inserted replaced
1129:d56a55a3011b 1130:c308b471ed82
   204                 >
   204                 >
   205                 (?: (?R) | .*? )*</\\1>
   205                 (?: (?R) | .*? )*</\\1>
   206               )
   206               )
   207                 ;sx";
   207                 ;sx";
   208                 
   208                 
   209     $text = preg_replace($regex, '<_paragraph_bypass>$0</_paragraph_bypass>', $text);
   209     // using preg_replace here sometimes gives us empty strings probably because we're using $0
       
   210     // in the replace formatter. so we'll just take care of it explicitly here with preg_match_all
       
   211     // and good ole str_replace_once.
       
   212     if ( preg_match_all($regex, $text, $matches) )
       
   213     {
       
   214       foreach ( $matches[0] as $match )
       
   215       {
       
   216         $text = str_replace_once($match, '<_paragraph_bypass>' . $match . '</_paragraph_bypass>', $text);
       
   217       }
       
   218     }
       
   219     
   210     RenderMan::tag_unstrip('_paragraph_bypass', $text, $_nw, true);
   220     RenderMan::tag_unstrip('_paragraph_bypass', $text, $_nw, true);
   211     
   221     
   212     // This is potentially a hack. It allows the parser to stick in <_paragraph_bypass> tags
   222     // This is potentially a hack. It allows the parser to stick in <_paragraph_bypass> tags
   213     // to prevent the paragraph parser from interfering with pretty HTML generated elsewhere.
   223     // to prevent the paragraph parser from interfering with pretty HTML generated elsewhere.
   214     RenderMan::tag_strip('_paragraph_bypass', $text, $_nw);
   224     RenderMan::tag_strip('_paragraph_bypass', $text, $_nw);