Index: trunk/phase3/includes/parser/Parser.php |
— | — | @@ -493,6 +493,22 @@ |
494 | 494 | } |
495 | 495 | |
496 | 496 | /** |
| 497 | + * Get the wikitext of a page as though it was transcluded. |
| 498 | + * |
| 499 | + * Specifically <includeonly> etc. are parsed, redirects are followed, comments |
| 500 | + * are removed, but templates arguments and parser functions are untouched. |
| 501 | + * |
| 502 | + * This is not called by the parser itself, see braceSubstitution for its transclusion. |
| 503 | + * |
| 504 | + * @public |
| 505 | + */ |
| 506 | + function getTransclusionText( $title ) { |
| 507 | + list($text, $title) = $this->getTemplateDom( $title ); |
| 508 | + $flags = PPFrame::NO_ARGS | PPFrame::NO_TEMPLATES; |
| 509 | + return $this->getPreprocessor()->newFrame()->expand( $text, $flags ); |
| 510 | + } |
| 511 | + |
| 512 | + /** |
497 | 513 | * Get a random string |
498 | 514 | * |
499 | 515 | * @private |
Index: trunk/phase3/includes/EditPage.php |
— | — | @@ -227,22 +227,13 @@ |
228 | 228 | * @return string The contents of the page. |
229 | 229 | */ |
230 | 230 | protected function getPreloadedText( $preload ) { |
| 231 | + global $wgParser; |
231 | 232 | if ( !empty( $this->mPreloadText ) ) { |
232 | 233 | return $this->mPreloadText; |
233 | | - } elseif ( $preload === '' ) { |
234 | | - return ''; |
235 | 234 | } else { |
236 | 235 | $preloadTitle = Title::newFromText( $preload ); |
237 | 236 | if ( isset( $preloadTitle ) && $preloadTitle->userCanRead() ) { |
238 | | - $rev = Revision::newFromTitle( $preloadTitle ); |
239 | | - if ( is_object( $rev ) ) { |
240 | | - $text = $rev->getText(); |
241 | | - // TODO FIXME: AAAAAAAAAAA, this shouldn't be implementing |
242 | | - // its own mini-parser! -ævar |
243 | | - $text = preg_replace( '~</?includeonly>~', '', $text ); |
244 | | - return $text; |
245 | | - } else |
246 | | - return ''; |
| 237 | + return $wgParser->getTransclusionText( $preloadTitle ); |
247 | 238 | } |
248 | 239 | } |
249 | 240 | } |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -825,6 +825,7 @@ |
826 | 826 | * (bug 18758) API read of watchlist's wl_notificationtimestamp |
827 | 827 | * (bug 20809) Expose EditFormPreloadText via the API |
828 | 828 | * (bug 18427) Comment (edit summary) parser option for API |
| 829 | +* (bug 5210) preload parser should parse <noinclude> (as well as <includeonly>) |
829 | 830 | |
830 | 831 | === Languages updated in 1.16 === |
831 | 832 | |