$out = $this->getOutput();
if ( !$source->isGood() ) {
- $out->addWikiText( "<p class=\"error\">\n" .
- $this->msg( 'importfailed', $source->getWikiText() )->parse() . "\n</p>" );
+ $out->addWikiText( "<div class=\"error\">\n" .
+ $this->msg( 'importfailed', $source->getWikiText() )->parse() . "\n</div>" );
} else {
$importer = new WikiImporter( $source->value, $this->getConfig() );
if ( !is_null( $this->namespace ) ) {
$statusRootPage = $importer->setTargetRootPage( $this->rootpage );
if ( !$statusRootPage->isGood() ) {
$out->wrapWikiMsg(
- "<p class=\"error\">\n$1\n</p>",
+ "<div class=\"error\">\n$1\n</div>",
[
'import-options-wrong',
$statusRootPage->getWikiText(),
if ( $exception ) {
# No source or XML parse error
$out->wrapWikiMsg(
- "<p class=\"error\">\n$1\n</p>",
+ "<div class=\"error\">\n$1\n</div>",
[ 'importfailed', $exception->getMessage() ]
);
} elseif ( !$result->isGood() ) {
# Zero revisions
$out->wrapWikiMsg(
- "<p class=\"error\">\n$1\n</p>",
+ "<div class=\"error\">\n$1\n</div>",
[ 'importfailed', $result->getWikiText() ]
);
} else {
if ( !$message->isDisabled() ) {
$contLang = MediaWikiServices::getInstance()->getContentLanguage();
$this->getOutput()->addWikiTextTidy(
- Html::rawElement( 'p',
+ Html::rawElement( 'div',
[
'lang' => $contLang->getHtmlCode(),
'dir' => $contLang->getDir()
],
"\n" . $message->plain() . "\n"
- ),
- /* $lineStart */ false,
- /* $interface */ false
+ )
);
}
}
$op->addWikiText( 'a' );
}
+ /**
+ * @covers OutputPage::addWikiMsg
+ */
+ public function testAddWikiMsg() {
+ $msg = wfMessage( 'parentheses' );
+ $this->assertSame( '(a)', $msg->rawParams( 'a' )->plain() );
+
+ $op = $this->newInstance();
+ $this->assertSame( '', $op->getHTML() );
+ $op->addWikiMsg( 'parentheses', "<b>a" );
+ // This is known to be bad unbalanced HTML; this will be fixed
+ // by I743f4185a03403f8d9b9db010ff1ee4e9342e062 (T198214)
+ $this->assertSame( "<p>(<b>a)\n</p>", $op->getHTML() );
+ }
+
+ /**
+ * @covers OutputPage::wrapWikiMsg
+ */
+ public function testWrapWikiMsg() {
+ $msg = wfMessage( 'parentheses' );
+ $this->assertSame( '(a)', $msg->rawParams( 'a' )->plain() );
+
+ $op = $this->newInstance();
+ $this->assertSame( '', $op->getHTML() );
+ $op->wrapWikiMsg( '[$1]', [ 'parentheses', "<b>a" ] );
+ // This is known to be bad unbalanced HTML; this will be fixed
+ // by I743f4185a03403f8d9b9db010ff1ee4e9342e062 (T198214)
+ $this->assertSame( "<p>[(<b>a)]\n</p>", $op->getHTML() );
+ }
+
/**
* @covers OutputPage::addParserOutputMetadata
*/