S2OJ/web/js/ace-editor/mode-mediawiki.js

8 lines
9.5 KiB
JavaScript
Raw Normal View History

2023-01-30 10:47:44 +00:00
ace.define("ace/mode/mediawiki_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text_highlight_rules").TextHighlightRules,s=function(){this.$rules={start:[{include:"#switch"},{include:"#redirect"},{include:"#variable"},{include:"#comment"},{include:"#entity"},{include:"#emphasis"},{include:"#tag"},{include:"#table"},{include:"#hr"},{include:"#heading"},{include:"#link"},{include:"#list"},{include:"#template"}],"#hr":[{token:"markup.bold",regex:/^[-]{4,}/}],"#switch":[{token:"constant.language",regex:/(__NOTOC__|__FORCETOC__|__TOC__|__NOEDITSECTION__|__NEWSECTIONLINK__|__NONEWSECTIONLINK__|__NOWYSIWYG__|__NOGALLERY__|__HIDDENCAT__|__EXPECTUNUSEDCATEGORY__|__NOCONTENTCONVERT__|__NOCC__|__NOTITLECONVERT__|__NOTC__|__START__|__END__|__INDEX__|__NOINDEX__|__STATICREDIRECT__|__NOGLOBAL__|__DISAMBIG__)/}],"#redirect":[{token:["keyword.control.redirect","meta.keyword.control"],regex:/(^#REDIRECT|^#redirect|^#Redirect)(\s+)/}],"#variable":[{token:"storage.type.variable",regex:/{{{/,push:[{token:"storage.type.variable",regex:/}}}/,next:"pop"},{token:["text","variable.other","text","keyword.operator"],regex:/(\s*)(\w+)(\s*)((?:\|)?)/},{defaultToken:"storage.type.variable"}]}],"#entity":[{token:"constant.character.entity",regex:/&\w+;/}],"#list":[{token:"markup.bold",regex:/^[#*;:]+/,push:[{token:"markup.list",regex:/$/,next:"pop"},{include:"$self"},{defaultToken:"markup.list"}]}],"#template":[{token:["storage.type.function","meta.template","entity.name.function","meta.template"],regex:/({{)(\s*)([#\w: ]+)(\s*)/,push:[{token:"storage.type.function",regex:/}}/,next:"pop"},{token:["storage","meta.structure.dictionary","support.type.property-name","meta.structure.dictionary","punctuation.separator.dictionary.key-value","meta.structure.dictionary","meta.structure.dictionary.value"],regex:/(\|)(\s*)([a-zA-Z-]*)(\s*)(=)(\s*)([^|}]*)/,push:[{token:"meta.structure.dictionary",regex:/(?=}}|[|])/,next:"pop"},{defaultToken:"meta.structure.dictionary"}]},{token:["storage","meta.template.value"],regex:/(\|)(.*?)/,push:[{token:[],regex:/(?=}}|[|])/,next:"pop"},{include:"$self"},{defaultToken:"meta.template.value"}]},{defaultToken:"meta.template"}]}],"#link":[{token:["punctuation.definition.tag.begin","meta.tag.link.internal","entity.name.tag","meta.tag.link.internal","string.other.link.title","meta.tag.link.internal","punctuation.definition.tag"],regex:/(\[\[)(\s*)((?:Category|Wikipedia)?)(:?)([^\]\]\|]+)(\s*)((?:\|)*)/,push:[{token:"punctuation.definition.tag.end",regex:/\]\]/,next:"pop"},{include:"$self"},{defaultToken:"meta.tag.link.internal"}]},{token:["punctuation.definition.tag.begin","meta.tag.link.external","meta.tag.link.external","string.unquoted","punctuation.definition.tag.end"],regex:/(\[)(.*?)([\s]+)(.*?)(\])/}],"#comment":[{token:"punctuation.definition.comment.html",regex:/<!--/,push:[{token:"punctuation.definition.comment.html",regex:/-->/,next:"pop"},{defaultToken:"comment.block.html"}]}],"#emphasis":[{token:["punctuation.definition.tag.begin","markup.italic.bold","punctuation.definition.tag.end"],regex:/(''''')(?!')(.*?)('''''|$)/},{token:["punctuation.definition.tag.begin","markup.bold","punctuation.definition.tag.end"],regex:/(''')(?!')(.*?)('''|$)/},{token:["punctuation.definition.tag.begin","markup.italic","punctuation.definition.tag.end"],regex:/('')(?!')(.*?)(''|$)/}],"#heading":[{token:["punctuation.definition.heading","entity.name.section","punctuation.definition.heading"],regex:/(={1,6})(.+?)(\1)(?!=)/}],"#tag":[{token:["punctuation.definition.tag.begin","entity.name.tag","meta.tag.block.ref","punctuation.definition.tag.end"],regex:/(<)(ref)((?:\s+.*?)?)(>)/,caseInsensitive:!0,push:[{token:["punctuation.definition.tag.begin","entity.name.tag","meta.tag.block.ref","punctuation.definition.tag.end"],regex:/(<\/)(ref)(\s*)(>)/,caseInsensitive:!0,next:"pop"},{include:"$self"},{defaultToken:"meta.tag.block.ref"}]},{token:["punctuation.definition.tag.begin","entity.name.tag","meta.tag.block.nowiki","punctuation.definition.t
ace.require(["ace/mode/mediawiki"], function(m) {
if (typeof module == "object" && typeof exports == "object" && module) {
module.exports = m;
}
});
})();