* (bug 18758) API read of watchlist's wl_notificationtimestamp
* (bug 20809) Expose EditFormPreloadText via the API
* (bug 18427) Comment (edit summary) parser option for API
+* (bug 5210) preload parser should parse <noinclude> (as well as <includeonly>)
=== Languages updated in 1.16 ===
* @return string The contents of the page.
*/
protected function getPreloadedText( $preload ) {
+ global $wgParser;
if ( !empty( $this->mPreloadText ) ) {
return $this->mPreloadText;
- } elseif ( $preload === '' ) {
- return '';
} else {
$preloadTitle = Title::newFromText( $preload );
if ( isset( $preloadTitle ) && $preloadTitle->userCanRead() ) {
- $rev = Revision::newFromTitle( $preloadTitle );
- if ( is_object( $rev ) ) {
- $text = $rev->getText();
- // TODO FIXME: AAAAAAAAAAA, this shouldn't be implementing
- // its own mini-parser! -ævar
- $text = preg_replace( '~</?includeonly>~', '', $text );
- return $text;
- } else
- return '';
+ return $wgParser->getTransclusionText( $preloadTitle );
}
}
}
return $text;
}
+ /**
+ * Get the wikitext of a page as though it was transcluded.
+ *
+ * Specifically <includeonly> etc. are parsed, redirects are followed, comments
+ * are removed, but templates arguments and parser functions are untouched.
+ *
+ * This is not called by the parser itself, see braceSubstitution for its transclusion.
+ *
+ * @public
+ */
+ function getTransclusionText( $title ) {
+ list($text, $title) = $this->getTemplateDom( $title );
+ $flags = PPFrame::NO_ARGS | PPFrame::NO_TEMPLATES;
+ return $this->getPreprocessor()->newFrame()->expand( $text, $flags );
+ }
+
/**
* Get a random string
*