Debian Codegraph @

extensions/VisualEditor/modules/ve-mw/ui/ve.ui.MWWikitextTransferRegistry.js

raw symbols SCIP
1 /*!
2 * VisualEditor MediaWiki WikitextTransferRegistry and registrations.
3 *
4 * @copyright See AUTHORS.txt
5 * @license The MIT License (MIT); see LICENSE.txt
6 */
7
8 /**
9 * Heuristic patterns which attempts to discover wikitext, without
10 * incurring too many false positives.
11 *
12 * Rules can be regular expressions or strings
13 */
14 ve.ui.mwWikitextTransferRegistry = new OO.Registry();
15
16 ve.ui.mwWikitextTransferRegistry.register(
17 'heading',
18 // ==...== on a single line of max 80 characters
19 /(^\s*(={2,6})[^=\r\n]{1,80}\2\s*$)/m
20 );
21
22 ve.ui.mwWikitextTransferRegistry.register(
23 'internalLink',
24 '[['
25 );
26
27 ve.init.platform.getInitializedPromise().done( () => {
28 ve.ui.mwWikitextTransferRegistry.register(
29 'externalLink',
30 // [url label]
31 new RegExp(
32 '\\[' + ve.init.platform.getUnanchoredExternalLinkUrlProtocolsRegExp().source + '\\S+ [^\\]]+\\]',
33 'i'
34 )
35 );
36 } );
37
38 ve.ui.mwWikitextTransferRegistry.register(
39 'template',
40 '{{'
41 );