Add regex for detecting labelled external links in pasted wikitext

Bug: T134227
Change-Id: Icb390cca6f4ee299dd59ec5d15894b734879f394
This commit is contained in:
Ed Sanders 2016-05-04 16:20:05 +01:00
parent 0bc4aff46c
commit 47508d3245

View file

@ -20,11 +20,22 @@ ve.ui.mwWikitextTransferRegistry.register(
);
ve.ui.mwWikitextTransferRegistry.register(
'link',
'internalLink',
// [[...]] on a single line of max 80 characters
/\[\[.{1,80}\]\]/m
);
ve.init.platform.getInitializedPromise().done( function () {
ve.ui.mwWikitextTransferRegistry.register(
'externalLink',
// [url label]
new RegExp(
'\\[' + ve.init.platform.getUnanchoredExternalLinkUrlProtocolsRegExp().source + '\\S+ [^\\]]+\\]',
'i'
)
);
} );
ve.ui.mwWikitextTransferRegistry.register(
'template',
'{{'