“MediaWiki:Gadget-prism-language-regex.js”的版本间的差异

来自萌娘共享
跳转至: 导航搜索
(代码变动:2d5d0ae - feat(Gadget/prism): 新的代码高亮工具 (#443) by U:AnnAngela, co-authored-by: GH:github-actions[bot],U:Bhsd
1个标签由机器人或全自动脚本执行的操作
(代码变动:2d5d0ae3 - feat(Gadget/prism): 新的代码高亮工具 (#443) by U:AnnAngela, co-authored-by: GH:github-actions[bot],U:Bhsd
1个标签由机器人或全自动脚本执行的操作
 
第4行: 第4行:
 
  * -------------------------------------------------------------------------
 
  * -------------------------------------------------------------------------
 
  */
 
  */
var _addText = '{{GHIACode|page=GHIA:MoegirlPediaInterfaceCodes/blob/master/src/gadgets/prism-language-regex/MediaWiki:Gadget-prism-language-regex.js|user=[[U:AnnAngela]]|co-authors=GH:github-actions[bot]、[[U:Bhsd]]|longId=2d5d0ae30421796cfa323a02a78713c0ed261417|shortId=2d5d0ae|summary=feat(Gadget/prism): 新的代码高亮工具 (#443)|body=<nowiki>Co-authored-by: github-actions[bot] <41898282+github-actions[bot]📧users.noreply.github.com>↩Co-authored-by: Bhsd <55071315+bhsd-harry📧users.noreply.github.com></nowiki>}}';  
+
var _addText = '{{GHIACode|page=GHIA:MoegirlPediaInterfaceCodes/blob/master/src/gadgets/prism-language-regex/MediaWiki:Gadget-prism-language-regex.js|user=[[U:AnnAngela]]|co-authors=GH:github-actions[bot]、[[U:Bhsd]]|longId=2d5d0ae30421796cfa323a02a78713c0ed261417|shortId=2d5d0ae3|summary=feat(Gadget/prism): 新的代码高亮工具 (#443)|body=<nowiki>Co-authored-by: github-actions[bot] <41898282+github-actions[bot]📧users.noreply.github.com>↩Co-authored-by: Bhsd <55071315+bhsd-harry📧users.noreply.github.com></nowiki>}}';  
  
 
/* <pre> */
 
/* <pre> */

2024年4月16日 (二) 09:09的最新版本

/**
 * -------------------------------------------------------------------------
 * !!! DON'T MODIFY THIS PAGE MANUALLY, YOUR CHANGES WILL BE OVERWRITTEN !!!
 * -------------------------------------------------------------------------
 */
var _addText = '{{GHIACode|page=GHIA:MoegirlPediaInterfaceCodes/blob/master/src/gadgets/prism-language-regex/MediaWiki:Gadget-prism-language-regex.js|user=[[U:AnnAngela]]|co-authors=GH:github-actions[bot]、[[U:Bhsd]]|longId=2d5d0ae30421796cfa323a02a78713c0ed261417|shortId=2d5d0ae3|summary=feat(Gadget/prism): 新的代码高亮工具 (#443)|body=<nowiki>Co-authored-by: github-actions[bot] <41898282+github-actions[bot]📧users.noreply.github.com>↩Co-authored-by: Bhsd <55071315+bhsd-harry📧users.noreply.github.com></nowiki>}}'; 

/* <pre> */

"use strict";
(function (Prism) {
    var specialEscape = {
        pattern: /\\[\\(){}[\]^$+*?|.]/,
        alias: 'escape'
    };
    var escape = /\\(?:x[\da-fA-F]{2}|u[\da-fA-F]{4}|u\{[\da-fA-F]+\}|0[0-7]{0,2}|[123][0-7]{2}|c[a-zA-Z]|.)/;
    var charSet = {
        pattern: /\.|\\[wsd]|\\p\{[^{}]+\}/i,
        alias: 'class-name'
    };
    var charSetWithoutDot = {
        pattern: /\\[wsd]|\\p\{[^{}]+\}/i,
        alias: 'class-name'
    };
    var rangeChar = '(?:[^\\\\-]|' + escape.source + ')';
    var range = RegExp(rangeChar + '-' + rangeChar);
    var groupName = {
        pattern: /(<|')[^<>']+(?=[>']$)/,
        lookbehind: true,
        alias: 'variable'
    };
    Prism.languages.regex = {
        'char-class': {
            pattern: /((?:^|[^\\])(?:\\\\)*)\[(?:[^\\\]]|\\[\s\S])*\]/,
            lookbehind: true,
            inside: {
                'char-class-negation': {
                    pattern: /(^\[)\^/,
                    lookbehind: true,
                    alias: 'operator'
                },
                'char-class-punctuation': {
                    pattern: /^\[|\]$/,
                    alias: 'punctuation'
                },
                'range': {
                    pattern: range,
                    inside: {
                        'escape': escape,
                        'range-punctuation': {
                            pattern: /-/,
                            alias: 'operator'
                        }
                    }
                },
                'special-escape': specialEscape,
                'char-set': charSetWithoutDot,
                'escape': escape
            }
        },
        'special-escape': specialEscape,
        'char-set': charSet,
        'backreference': [
            {
                pattern: /\\(?![123][0-7]{2})[1-9]/,
                alias: 'keyword'
            },
            {
                pattern: /\\k<[^<>']+>/,
                alias: 'keyword',
                inside: {
                    'group-name': groupName
                }
            }
        ],
        'anchor': {
            pattern: /[$^]|\\[ABbGZz]/,
            alias: 'function'
        },
        'escape': escape,
        'group': [
            {
                pattern: /\((?:\?(?:<[^<>']+>|'[^<>']+'|[>:]|<?[=!]|[idmnsuxU]+(?:-[idmnsuxU]+)?:?))?/,
                alias: 'punctuation',
                inside: {
                    'group-name': groupName
                }
            },
            {
                pattern: /\)/,
                alias: 'punctuation'
            }
        ],
        'quantifier': {
            pattern: /(?:[+*?]|\{\d+(?:,\d*)?\})[?+]?/,
            alias: 'number'
        },
        'alternation': {
            pattern: /\|/,
            alias: 'keyword'
        }
    };
}(Prism)); 

/* </pre> */