Bartosz Dziewoński has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/321697

Change subject: mw.jqueryMsg: Match behavior when key does not exist to PHP
......................................................................

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
---
M resources/src/mediawiki/mediawiki.jqueryMsg.js
M tests/qunit/suites/resources/mediawiki/mediawiki.jqueryMsg.test.js
2 files changed, 18 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/97/321697/1

diff --git a/resources/src/mediawiki/mediawiki.jqueryMsg.js 
b/resources/src/mediawiki/mediawiki.jqueryMsg.js
index 2646cff..cad59b8 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 caaef83..7fa9478 100644
--- a/tests/qunit/suites/resources/mediawiki/mediawiki.jqueryMsg.test.js
+++ b/tests/qunit/suites/resources/mediawiki/mediawiki.jqueryMsg.test.js
@@ -669,7 +669,7 @@
                mw.config.set( 'wgUserLanguage', oldUserLang );
        } );
 
-       QUnit.test( 'Int', 4, function ( assert ) {
+       QUnit.test( 'Int', 6, function ( assert ) {
                var newarticletextSource = 'You have followed a link to a page 
that does not exist yet. To create the page, start typing in the box below (see 
the [[{{Int:Foobar}}|foobar]] for more info). If you are here by mistake, click 
your browser\'s back button.',
                        expectedNewarticletext,
                        helpPageTitle = 'Help:Foobar';
@@ -706,9 +706,22 @@
 
                assert.equal(
                        formatParse( 'uses-missing-int' ),
-                       '[doesnt-exist]',
+                       '⧼doesnt-exist⧽',
                        'int: where nested message does not exist'
                );
+
+               mw.messages.set( 'uses-bad-int', '{{int:doesnt<>exist}}' );
+
+               assert.equal(
+                       formatParse( 'uses-bad-int' ),
+                       '⧼doesnt&lt;&gt;exist⧽',
+                       'int: where nested message is invalid, HTML escaping'
+               );
+               assert.equal(
+                       formatText( 'uses-bad-int' ),
+                       '⧼doesnt<>exist⧽',
+                       'int: where nested message is invalid, no HTML escaping 
in text format'
+               );
        } );
 
        QUnit.test( 'Ns', 4, function ( assert ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/321697
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I90390e014b897084692fb1a86a5a8bcefd93ff11
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <matma....@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to