From bacd87e4942baa34808a1b77d3b29bfdb566cc17 Mon Sep 17 00:00:00 2001 From: Glaisher Date: Sun, 22 May 2016 22:30:07 +0500 Subject: [PATCH] Show ParserOutput warning instead of on the actual page output for ignored display titles Ignored restricted DISPLAYTITLE warning isn't really relevant for the casual reader so don't show it in the page output. Instead show it above the edit box. Bug: T135949 Change-Id: I009dd865bec7b6e3a7492c49db97074483f93ee4 --- includes/parser/CoreParserFunctions.php | 8 ++++---- languages/i18n/qqq.json | 2 +- tests/parser/parserTests.txt | 1 - 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/includes/parser/CoreParserFunctions.php b/includes/parser/CoreParserFunctions.php index d8bd42edc5..1718557ab4 100644 --- a/includes/parser/CoreParserFunctions.php +++ b/includes/parser/CoreParserFunctions.php @@ -460,14 +460,14 @@ class CoreParserFunctions { return ''; } } else { - $parser->addTrackingCategory( 'restricted-displaytitle-ignored' ); $converter = $parser->getConverterLanguage()->getConverter(); - return '' . + $parser->getOutput()->addWarning( wfMessage( 'restricted-displaytitle', // Message should be parsed, but this param should only be escaped. $converter->markNoConversion( wfEscapeWikiText( $text ) ) - )->inContentLanguage()->text() . - ''; + )->text() + ); + $parser->addTrackingCategory( 'restricted-displaytitle-ignored' ); } } diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json index 5e076442b4..24f1c9ef45 100644 --- a/languages/i18n/qqq.json +++ b/languages/i18n/qqq.json @@ -3711,7 +3711,7 @@ "timezone-local": "Label to indicate that a time is in the user's local timezone.\n{{Identical|Local}}", "duplicate-defaultsort": "See definition of [[w:Sorting|sort key]] on Wikipedia. Parameters:\n* $1 - old default sort key\n* $2 - new default sort key", "duplicate-displaytitle": "Warning shown when a page has its display title set multiple times. Parameters:\n* $1 - old display title\n* $2 - new display title", - "restricted-displaytitle": "Warning shown a display title is ignored because it is not equivalent to its actual title. Parameters:\n* $1 - the ignored display title", + "restricted-displaytitle": "Warning shown when a display title is ignored because it is not equivalent to its actual title. Parameters:\n* $1 - the ignored display title", "invalid-indicator-name": "Warning shown when the [https://www.mediawiki.org/wiki/Help:Page_status_indicators <indicator name=\"''unique-identifier''\">''content''</indicator>] parser tag is used incorrectly.", "version": "{{doc-special|Version}}\n{{Identical|Version}}", "version-summary": "{{doc-specialpagesummary|version}}", diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index 5fffde3547..785791e11b 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -20655,7 +20655,6 @@ this is not the the title !! html/php Screen

this is not the the title -Warning: Display title "whatever" was ignored since it is not equivalent to the page's actual title.

!! end -- 2.20.1