Allow af_public_comments to be wikitext.
authorAndrew Garrett <werdna@users.mediawiki.org>
Sat, 31 Jan 2009 01:59:13 +0000 (01:59 +0000)
committerAndrew Garrett <werdna@users.mediawiki.org>
Sat, 31 Jan 2009 01:59:13 +0000 (01:59 +0000)
Relatedly, add parseInline function to OutputPage, to avoid duplicating the same awful regex in wfMsgExt.

includes/OutputPage.php

index 2c0d617..f50d0fd 100644 (file)
@@ -645,6 +645,18 @@ class OutputPage {
                return $parserOutput->getText();
        }
 
+       /** Parse wikitext, strip paragraphs, and return the HTML. */
+       public function parseInline( $text, $linestart = true, $interface = false ) {
+               $parsed = $this->parse( $text, $linestart, $interface );
+
+               $m = array();
+               if ( preg_match( '/^<p>(.*)\n?<\/p>\n?/sU', $parsed, $m ) ) {
+                       $parsed = $m[1];
+               }
+
+               return $parsed;
+       }
+
        /**
         * @param Article $article
         * @param User    $user