From ed8623d1138f71df3504d47f465ac6b311342a96 Mon Sep 17 00:00:00 2001 From: Andrew Garrett Date: Sat, 31 Jan 2009 01:59:13 +0000 Subject: [PATCH] Allow af_public_comments to be wikitext. Relatedly, add parseInline function to OutputPage, to avoid duplicating the same awful regex in wfMsgExt. --- includes/OutputPage.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 2c0d617a2e..f50d0fdebb 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -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( '/^

(.*)\n?<\/p>\n?/sU', $parsed, $m ) ) { + $parsed = $m[1]; + } + + return $parsed; + } + /** * @param Article $article * @param User $user -- 2.20.1