includes/wikiformat.php
changeset 1217 feeb49aa6270
parent 1174 def792dd9b1b
child 1227 bdac73ed481e
equal deleted inserted replaced
1216:4125e19d3b27 1217:feeb49aa6270
   101   public function render($text)
   101   public function render($text)
   102   {
   102   {
   103     $parser_class = "Carpenter_Parse_" . ucwords($this->parser);
   103     $parser_class = "Carpenter_Parse_" . ucwords($this->parser);
   104     $renderer_class = "Carpenter_Render_" . ucwords($this->renderer);
   104     $renderer_class = "Carpenter_Render_" . ucwords($this->renderer);
   105     
   105     
   106     // empty?
   106     // empty? (don't remove this. the parser will shit bricks later about rules returning empty strings)
   107     if ( trim($text) === '' )
   107     if ( trim($text) === '' )
   108       return $text;
   108       return $text;
   109     
   109     
   110     // include files, if we haven't already
   110     // include files, if we haven't already
   111     if ( !class_exists($parser_class) )
   111     if ( !class_exists($parser_class) )
   157       // execute rule
   157       // execute rule
   158       $text_before = $text;
   158       $text_before = $text;
   159       $text = $this->perform_render_step($text, $rule, $parser, $renderer);
   159       $text = $this->perform_render_step($text, $rule, $parser, $renderer);
   160       if ( empty($text) )
   160       if ( empty($text) )
   161       {
   161       {
   162         trigger_error("Wikitext was empty after rule \"$rule\"; restoring backup", E_USER_WARNING);
   162         trigger_error("Wikitext was completely empty after rule \"$rule\"; restoring backup", E_USER_WARNING);
   163         $text = $text_before;
   163         $text = $text_before;
   164       }
   164       }
   165       unset($text_before);
   165       unset($text_before);
   166       
   166       
   167       // run posthooks
   167       // run posthooks
   176             // *sigh*
   176             // *sigh*
   177             $text = '';
   177             $text = '';
   178           }
   178           }
   179         }
   179         }
   180       }
   180       }
   181     }
   181       
       
   182       RenderMan::tag_strip_push('final', $text, $final_stripdata);
       
   183     }
       
   184     
       
   185     RenderMan::tag_unstrip('final', $text, $final_stripdata);
   182     
   186     
   183     // run posthooks
   187     // run posthooks
   184     foreach ( $this->hooks as $hook )
   188     foreach ( $this->hooks as $hook )
   185     {
   189     {
   186       if ( $hook['when'] === PO_LAST )
   190       if ( $hook['when'] === PO_LAST )