var result = sequence( [
wikilinkPage,
pipe,
- expression
+ nOrMore( 1, expression )
] );
- return result === null ? null : [ result[ 0 ], result[ 2 ] ];
+ return result === null ? null : [ result[ 0 ], [ 'CONCAT' ].concat( result[ 2 ] ) ];
}
wikilinkContents = choice( [
return $( '<a>' ).attr( {
title: page,
href: url
- } ).text( anchor );
+ } )
+ // FIXME This means that you can't have anything with formatting inside a wikilink.
+ .text( anchor.jquery ? anchor.text() : anchor );
},
/**
( function ( mw, $ ) {
- var formatText, formatParse, formatnumTests, specialCharactersPageName, expectedListUsers, expectedEntrypoints,
+ var formatText, formatParse, formatnumTests, specialCharactersPageName, expectedListUsers,
+ expectedListUsersSitename, expectedEntrypoints,
mwLanguageCache = {},
hasOwn = Object.hasOwnProperty;
specialCharactersPageName = '"Who" wants to be a millionaire & live on \'Exotic Island\'?';
expectedListUsers = '注册<a title="Special:ListUsers" href="/wiki/Special:ListUsers">用户</a>';
+ expectedListUsersSitename = '注册<a title="Special:ListUsers" href="/wiki/Special:ListUsers">用户' +
+ mw.config.get( 'wgSiteName' ) + '</a>';
expectedEntrypoints = '<a href="https://www.mediawiki.org/wiki/Manual:index.php">index.php</a>';
'see-portal-url': '{{Int:portal-url}} is an important community page.',
'jquerymsg-test-statistics-users': '注册[[Special:ListUsers|用户]]',
+ 'jquerymsg-test-statistics-users-sitename': '注册[[Special:ListUsers|用户{{SITENAME}}]]',
'jquerymsg-test-version-entrypoints-index-php': '[https://www.mediawiki.org/wiki/Manual:index.php index.php]',
process( tasks, QUnit.start );
} );
- QUnit.test( 'Links', 6, function ( assert ) {
+ QUnit.test( 'Links', 7, function ( assert ) {
var expectedDisambiguationsText,
expectedMultipleBars,
expectedSpecialCharacters;
expectedSpecialCharacters,
'Special characters'
);
+
+ assert.htmlEqual(
+ formatParse( 'jquerymsg-test-statistics-users-sitename' ),
+ expectedListUsersSitename,
+ 'Piped wikilink with parser function in the text'
+ );
} );
// Tests that {{-transformation vs. general parsing are done as requested