Index: trunk/extensions/ProofreadPage/ProofreadPage.php |
— | — | @@ -285,21 +285,18 @@ |
286 | 286 | /** |
287 | 287 | * Return the ordered list of links to ns-0 from an index page |
288 | 288 | */ |
289 | | -function pr_parse_index_links( $index_title, $parser ){ |
| 289 | +function pr_parse_index_links( $index_title ){ |
290 | 290 | |
291 | 291 | $rev = Revision::newFromTitle( $index_title ); |
292 | 292 | $text = $rev->getText(); |
293 | | - |
294 | | - # We use Parser::replaceVariables to expand templates |
295 | | - # However this method has a side effect on wgParser->mOutput->mTemplates, |
296 | | - # To avoid this, we instanciate a temporary ParserOutput object |
297 | | - $saved_output = $parser->mOutput; |
298 | | - $parser->mOutput = new ParserOutput; |
| 293 | + # Instanciate a new parser object to avoid side effects of $parser->replaceVariables |
| 294 | + $parser = new Parser; |
| 295 | + $parser->clearState(); |
| 296 | + $parser->mOptions = new ParserOptions(); |
| 297 | + $parser->setTitle( $index_title ); |
299 | 298 | $rtext = $parser->replaceVariables( $text ); |
300 | | - $parser->mOutput = $saved_output; |
301 | 299 | $text_links_pattern = "/\[\[([^:\|]*?)(\|(.*?)|)\]\]/i"; |
302 | 300 | preg_match_all( $text_links_pattern, $rtext, $text_links, PREG_PATTERN_ORDER ); |
303 | | - |
304 | 301 | return $text_links; |
305 | 302 | } |
306 | 303 | |
— | — | @@ -727,7 +724,6 @@ |
728 | 725 | $out = ''; |
729 | 726 | |
730 | 727 | list( $links, $params, $attributes ) = pr_parse_index( $index_title ); |
731 | | - $text_links = pr_parse_index_links( $index_title, $parser ); |
732 | 728 | |
733 | 729 | if( $from || $to ) { |
734 | 730 | |
— | — | @@ -810,6 +806,7 @@ |
811 | 807 | } |
812 | 808 | |
813 | 809 | if( $header ) { |
| 810 | + $text_links = pr_parse_index_links( $index_title ); |
814 | 811 | $h_out = '{{:MediaWiki:Proofreadpage_header_template'; |
815 | 812 | $h_out .= "|value=$header"; |
816 | 813 | //find next and previous pages in list |