2016-03-05 16:50:25 +00:00
|
|
|
/*!
|
|
|
|
* VisualEditor MediaWiki WikitextTransferRegistry and registrations.
|
|
|
|
*
|
2023-12-01 16:06:11 +00:00
|
|
|
* @copyright See AUTHORS.txt
|
2016-03-05 16:50:25 +00:00
|
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Heuristic patterns which attempts to discover wikitext, without
|
|
|
|
* incurring too many false positives.
|
|
|
|
*
|
|
|
|
* Rules can be regular expressions or strings
|
|
|
|
*/
|
|
|
|
ve.ui.mwWikitextTransferRegistry = new OO.Registry();
|
|
|
|
|
|
|
|
ve.ui.mwWikitextTransferRegistry.register(
|
|
|
|
'heading',
|
|
|
|
// ==...== on a single line of max 80 characters
|
|
|
|
/(^\s*(={2,6})[^=\r\n]{1,80}\2\s*$)/m
|
|
|
|
);
|
|
|
|
|
|
|
|
ve.ui.mwWikitextTransferRegistry.register(
|
2016-05-04 15:20:05 +00:00
|
|
|
'internalLink',
|
2016-11-30 18:07:50 +00:00
|
|
|
'[['
|
2016-03-05 16:50:25 +00:00
|
|
|
);
|
|
|
|
|
2024-04-30 16:44:25 +00:00
|
|
|
ve.init.platform.getInitializedPromise().done( () => {
|
2016-05-04 15:20:05 +00:00
|
|
|
ve.ui.mwWikitextTransferRegistry.register(
|
|
|
|
'externalLink',
|
2017-07-18 11:55:33 +00:00
|
|
|
// [url label]
|
|
|
|
new RegExp(
|
|
|
|
'\\[' + ve.init.platform.getUnanchoredExternalLinkUrlProtocolsRegExp().source + '\\S+ [^\\]]+\\]',
|
|
|
|
'i'
|
|
|
|
)
|
2016-05-04 15:20:05 +00:00
|
|
|
);
|
|
|
|
} );
|
|
|
|
|
2016-03-05 16:50:25 +00:00
|
|
|
ve.ui.mwWikitextTransferRegistry.register(
|
|
|
|
'template',
|
|
|
|
'{{'
|
|
|
|
);
|