From a6e8a2b4134b60d426af65260ab08ba4b4bb73ca Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bartosz=20Dziewo=C5=84ski?= Date: Tue, 15 Nov 2016 18:55:48 +0100 Subject: [PATCH] mw.jqueryMsg: Match behavior when key does not exist to PHP Follow-up to e681e5d8c974914f957e24fd29de5caf160152fb. This only affects the output of '{{int:}}' in jqueryMsg-parsed messages. See 184658eb32f6c5561cd3789716bd98c1e9f0ba04. Change-Id: I90390e014b897084692fb1a86a5a8bcefd93ff11 --- resources/src/mediawiki/mediawiki.jqueryMsg.js | 6 +++--- .../suites/resources/mediawiki/mediawiki.jqueryMsg.test.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/src/mediawiki/mediawiki.jqueryMsg.js b/resources/src/mediawiki/mediawiki.jqueryMsg.js index 2646cffe98..cad59b8f87 100644 --- a/resources/src/mediawiki/mediawiki.jqueryMsg.js +++ b/resources/src/mediawiki/mediawiki.jqueryMsg.js @@ -292,10 +292,10 @@ /** * Fetch the message string associated with a key, return parsed structure. Memoized. - * Note that we pass '[' + key + ']' back for a missing message here. + * Note that we pass '⧼' + key + '⧽' back for a missing message here. * * @param {string} key - * @return {string|Array} string of '[key]' if message missing, simple string if possible, array of arrays if needs parsing + * @return {string|Array} string of '⧼key⧽' if message missing, simple string if possible, array of arrays if needs parsing */ getAst: function ( key ) { var wikiText; @@ -303,7 +303,7 @@ if ( !this.astCache.hasOwnProperty( key ) ) { wikiText = this.settings.messages.get( key ); if ( typeof wikiText !== 'string' ) { - wikiText = '\\[' + key + '\\]'; + wikiText = '⧼' + key + '⧽'; } this.astCache[ key ] = this.wikiTextToAst( wikiText ); } diff --git a/tests/qunit/suites/resources/mediawiki/mediawiki.jqueryMsg.test.js b/tests/qunit/suites/resources/mediawiki/mediawiki.jqueryMsg.test.js index caaef83c1b..12181379f0 100644 --- a/tests/qunit/suites/resources/mediawiki/mediawiki.jqueryMsg.test.js +++ b/tests/qunit/suites/resources/mediawiki/mediawiki.jqueryMsg.test.js @@ -706,7 +706,7 @@ assert.equal( formatParse( 'uses-missing-int' ), - '[doesnt-exist]', + '⧼doesnt-exist⧽', 'int: where nested message does not exist' ); } ); -- 2.20.1