Page MenuHomePhabricator

jqueryMsg can not parse wikilink with parameters in page name
Closed, ResolvedPublic

Description

jqueryMsg can not handle a message with source:

[[Special:GettingStarted/task/$1|Try another article ►]]

and a string parameter (e.g. 'copyedit').

This works fine on the server. It renders to:

<a href="/wiki/Special:GettingStarted/task/copyedit" title="Special:GettingStarted/task/copyedit">Try another article ►</a>

I suspect that support for replacements in such places needs to be broadened in general. Right now, EXTLINKPARAM is a related special case.

See Also: T45510: jqueryMsg can not handle external links/wikilinks with dollar signs in the URL/target

Details

Reference
bz47395
Related Gerrit Patches:

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 1:18 AM
bzimport added a project: MediaWiki-JavaScript.
bzimport set Reference to bz47395.
bzimport added a subscriber: Unknown Object (MLST).
  • Bug 51388 has been marked as a duplicate of this bug. ***
  • Bug 53346 has been marked as a duplicate of this bug. ***

Confirmed. I tested the following code on Google Chrome console

mw.loader.using( 'mediawiki.jqueryMsg', function(){

mw.messages.set( {
  bug47395a: '[[$1|Text]]',
  bug47395b: '[[link|$1]]'
} );
alert(
  mw.message( 'bug47395a', 'ABC' ).plain() + ': ' +
  mw.message( 'bug47395a', 'ABC' ).parse() + '\n' +
  mw.message( 'bug47395b', 'ABC' ).plain() + ': ' +
  mw.message( 'bug47395b', 'ABC' ).parse()
);

} );

and got the following message on Portuguese Wikipedia:

[[ABC|Text]]: bug47395a: Parse error at position 0 in input: [[$1|Text]]
[[link|ABC]]: <a title="link" href="/wiki/link">ABC</a>

  • Bug 58961 has been marked as a duplicate of this bug. ***
onei added a comment.Apr 29 2014, 10:30 PM

For anyone interested, you can workaround this until this is fixed:

mw.loader.using( 'mediawiki.jqueryMsg', function () {

mw.messages.set( {
    foo: '[[$1]]'
} );

var msg = mw.message( 'foo', 'bar' ).plain();
// [[bar]]

mw.messages.set( {
    'some-random-message': msg
} );

msg = mw.message( 'some-random-message' ).parse();
// <a title="bar" href="/wiki/bar">bar</a>

console.log( msg );

} );

matmarex updated the task description. (Show Details)Jan 20 2015, 7:45 AM
matmarex set Security to None.
matmarex removed a subscriber: Unknown Object (MLST).
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptOct 4 2015, 7:17 PM
matmarex renamed this task from jqueryMsg can not parse wikilink with dollar sign in page name to jqueryMsg can not parse wikilink with parameters in page name.Oct 5 2015, 12:19 PM

Change 243637 had a related patch set uploaded (by Bartosz Dziewoński):
Refactor handling of replacements/parameters in links

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

Change 243637 merged by jenkins-bot:
mediawiki.jqueryMsg: Refactor handling of replacements/parameters in links

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

matmarex closed this task as Resolved.Oct 6 2015, 11:57 AM

This bug is referenced by code in mediawiki.feedback/feedback.js. One assumes that can be fixed now?