Show ParserOutput warning instead of on the actual page output for ignored display...
authorGlaisher <glaisher.wiki@gmail.com>
Sun, 22 May 2016 17:30:07 +0000 (22:30 +0500)
committerGlaisher <glaisher.wiki@gmail.com>
Sun, 22 May 2016 17:45:56 +0000 (22:45 +0500)
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
languages/i18n/qqq.json
tests/parser/parserTests.txt

index d8bd42e..1718557 100644 (file)
@@ -460,14 +460,14 @@ class CoreParserFunctions {
                                return '';
                        }
                } else {
-                       $parser->addTrackingCategory( 'restricted-displaytitle-ignored' );
                        $converter = $parser->getConverterLanguage()->getConverter();
-                       return '<span class="error">' .
+                       $parser->getOutput()->addWarning(
                                wfMessage( 'restricted-displaytitle',
                                        // Message should be parsed, but this param should only be escaped.
                                        $converter->markNoConversion( wfEscapeWikiText( $text ) )
-                               )->inContentLanguage()->text() .
-                               '</span>';
+                               )->text()
+                       );
+                       $parser->addTrackingCategory( 'restricted-displaytitle-ignored' );
                }
        }
 
index 5e07644..24f1c9e 100644 (file)
        "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 &lt;indicator name=\"''unique-identifier''\">''content''&lt;/indicator>] parser tag is used incorrectly.",
        "version": "{{doc-special|Version}}\n{{Identical|Version}}",
        "version-summary": "{{doc-specialpagesummary|version}}",
index 5fffde3..785791e 100644 (file)
@@ -20655,7 +20655,6 @@ this is not the the title
 !! html/php
 Screen
 <p>this is not the the title
-<span class="error"><strong>Warning:</strong> Display title "whatever" was ignored since it is not equivalent to the page's actual title.</span>
 </p>
 !! end