- # First pass--just handle <nowiki> sections, pass the rest off
- # to doWikiPass2() which does all the real work.
- #
- # $cacheArticle - assume this text is the main text for the given article
- #
- function addWikiText( $text, $linestart = true, $cacheArticle = NULL )
- {
- global $wgParser, $wgParserCache, $wgUser, $wgTitle;
-
- $parserOutput = $wgParser->parse( $text, $wgTitle, $this->mParserOptions, $linestart );
- if ( $cacheArticle ) {
+ /**
+ * Convert wikitext to HTML and add it to the buffer
+ * Default assumes that the current page title will
+ * be used.
+ */
+ function addWikiText( $text, $linestart = true ) {
+ global $wgTitle;
+ $this->addWikiTextTitle($text, $wgTitle, $linestart);
+ }
+
+ function addWikiTextWithTitle($text, &$title, $linestart = true) {
+ $this->addWikiTextTitle($text, $title, $linestart);
+ }
+
+ function addWikiTextTitle($text, &$title, $linestart) {
+ global $wgParser, $wgUseTidy;
+ $parserOutput = $wgParser->parse( $text, $title, $this->mParserOptions, $linestart );
+ $this->mLanguageLinks += $parserOutput->getLanguageLinks();
+ $this->mCategoryLinks += $parserOutput->getCategoryLinks();
+ if ( $parserOutput->getCacheTime() == -1 ) {
+ $this->enableClientCache( false );
+ }
+ $this->addHTML( $parserOutput->getText() );
+ }
+
+ /**
+ * Add wikitext to the buffer, assuming that this is the primary text for a page view
+ * Saves the text into the parser cache if possible
+ */
+ function addPrimaryWikiText( $text, $cacheArticle ) {
+ global $wgParser, $wgParserCache, $wgUser, $wgTitle, $wgUseTidy;
+
+ $parserOutput = $wgParser->parse( $text, $wgTitle, $this->mParserOptions, true );
+
+ $text = $parserOutput->getText();
+
+ if ( $cacheArticle && $parserOutput->getCacheTime() != -1 ) {