Warn when a restricted displaytitle is ignored
authorJackmcbarn <jackmcbarn@gmail.com>
Wed, 3 Sep 2014 14:25:47 +0000 (10:25 -0400)
committerJackmcbarn <jackmcbarn@gmail.com>
Sun, 8 May 2016 03:01:22 +0000 (03:01 +0000)
If a page contains a call to DISPLAYTITLE that is ignored because of
$wgRestrictDisplayTitle, output a warning.

Bug: 26546
Change-Id: I6ae6d5d0e567ba9c86e46c32240ee51a2ca5d8d1

includes/parser/CoreParserFunctions.php
languages/i18n/en.json
languages/i18n/qqq.json
tests/parser/parserTests.txt

index a55ddf3..3b8b513 100644 (file)
@@ -456,10 +456,18 @@ class CoreParserFunctions {
                                                $converter->markNoConversion( wfEscapeWikiText( $text ) )
                                        )->inContentLanguage()->text() .
                                        '</span>';
+                       } else {
+                               return '';
                        }
+               } else {
+                       $converter = $parser->getConverterLanguage()->getConverter();
+                       return '<span class="error">' .
+                               wfMessage( 'restricted-displaytitle',
+                                       // Message should be parsed, but this param should only be escaped.
+                                       $converter->markNoConversion( wfEscapeWikiText( $text ) )
+                               )->inContentLanguage()->text() .
+                               '</span>';
                }
-
-               return '';
        }
 
        /**
index 10072b9..10bf2c9 100644 (file)
        "timezone-local": "Local",
        "duplicate-defaultsort": "<strong>Warning:</strong> Default sort key \"$2\" overrides earlier default sort key \"$1\".",
        "duplicate-displaytitle": "<strong>Warning:</strong> Display title \"$2\" overrides earlier display title \"$1\".",
+       "restricted-displaytitle": "<strong>Warning:</strong> Display title \"$1\" was ignored since it is not equivalent to the page's actual title.",
        "invalid-indicator-name": "<strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.",
        "version": "Version",
        "version-summary": "",
index bc92b05..0a38088 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",
        "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 23bdbde..e8baa3f 100644 (file)
@@ -20592,6 +20592,7 @@ 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