“MediaWiki:Gadget-prism-plugin-javadoclike.js”的版本间的差异

来自萌娘共享
跳转至: 导航搜索
(代码变动:2d5d0ae3 - feat(Gadget/prism): 新的代码高亮工具 (#443) by U:AnnAngela, co-authored-by: GH:github-actions[bot],U:Bhsd
1个标签由机器人或全自动脚本执行的操作
 
(代码变动:2d5d0ae - 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-plugin-javadoclike/MediaWiki:Gadget-prism-plugin-javadoclike.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>}}';  
+
var _addText = '{{GHIACode|page=GHIA:MoegirlPediaInterfaceCodes/blob/master/src/gadgets/prism-plugin-javadoclike/MediaWiki:Gadget-prism-plugin-javadoclike.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>}}';  
  
 
/* <pre> */
 
/* <pre> */

2024年4月8日 (一) 18:40的版本

/**
 * -------------------------------------------------------------------------
 * !!! DON'T MODIFY THIS PAGE MANUALLY, YOUR CHANGES WILL BE OVERWRITTEN !!!
 * -------------------------------------------------------------------------
 */
var _addText = '{{GHIACode|page=GHIA:MoegirlPediaInterfaceCodes/blob/master/src/gadgets/prism-plugin-javadoclike/MediaWiki:Gadget-prism-plugin-javadoclike.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>}}'; 

/* <pre> */

"use strict";
(function (Prism) {
    var javaDocLike = Prism.languages.javadoclike = {
        'parameter': {
            pattern: /(^[\t ]*(?:\/{3}|\*|\/\*\*)\s*@(?:arg|arguments|param)\s+)\w+/m,
            lookbehind: true
        },
        'keyword': {
            pattern: /(^[\t ]*(?:\/{3}|\*|\/\*\*)\s*|\{)@[a-z][a-zA-Z-]+\b/m,
            lookbehind: true
        },
        'punctuation': /[{}]/
    };
    function docCommentSupport(lang, callback) {
        var tokenName = 'doc-comment';
        var grammar = Prism.languages[lang];
        if (!grammar) {
            return;
        }
        var token = grammar[tokenName];
        if (!token) {
            var definition = {};
            definition[tokenName] = {
                pattern: /(^|[^\\])\/\*\*[^/][\s\S]*?(?:\*\/|$)/,
                lookbehind: true,
                alias: 'comment'
            };
            grammar = Prism.languages.insertBefore(lang, 'comment', definition);
            token = grammar[tokenName];
        }
        if (token instanceof RegExp) {
            token = grammar[tokenName] = { pattern: token };
        }
        if (Array.isArray(token)) {
            for (var i = 0, l = token.length; i < l; i++) {
                if (token[i] instanceof RegExp) {
                    token[i] = { pattern: token[i] };
                }
                callback(token[i]);
            }
        }
        else {
            callback(token);
        }
    }
    function addSupport(languages, docLanguage) {
        if (typeof languages === 'string') {
            languages = [languages];
        }
        languages.forEach(function (lang) {
            docCommentSupport(lang, function (pattern) {
                if (!pattern.inside) {
                    pattern.inside = {};
                }
                pattern.inside.rest = docLanguage;
            });
        });
    }
    Object.defineProperty(javaDocLike, 'addSupport', { value: addSupport });
    javaDocLike.addSupport(['java', 'javascript', 'php'], javaDocLike);
}(Prism)); 

/* </pre> */