?
Path : /home/admin/public_html/old/media/editors/codemirror/mode/tiddlywiki/ |
Current File : /home/admin/public_html/old/media/editors/codemirror/mode/tiddlywiki/tiddlywiki.min.js |
!function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)}(function(a){"use strict";a.defineMode("tiddlywiki",function(){function a(a,b,c){return b.tokenize=c,c(a,b)}function b(b,k){var v,w=b.sol();if(k.block=!1,v=b.peek(),w&&/[<\/\*{}\-]/.test(v)){if(b.match(u))return k.block=!0,a(b,k,e);if(b.match(p))return"quote";if(b.match(n)||b.match(o))return"comment";if(b.match(q)||b.match(r)||b.match(s)||b.match(t))return"comment";if(b.match(m))return"hr"}if(v=b.next(),w&&/[\/\*!#;:>|]/.test(v)){if("!"==v)return b.skipToEnd(),"header";if("*"==v)return b.eatWhile("*"),"comment";if("#"==v)return b.eatWhile("#"),"comment";if(";"==v)return b.eatWhile(";"),"comment";if(":"==v)return b.eatWhile(":"),"comment";if(">"==v)return b.eatWhile(">"),"quote";if("|"==v)return"header"}if("{"==v&&b.match(/\{\{/))return a(b,k,e);if(/[hf]/i.test(v)&&/[ti]/i.test(b.peek())&&b.match(/\b(ttps?|tp|ile):\/\/[\-A-Z0-9+&@#\/%?=~_|$!:,.;]*[A-Z0-9+&@#\/%=~_|$]/i))return"link";if('"'==v)return"string";if("~"==v)return"brace";if(/[\[\]]/.test(v)&&b.peek()==v)return b.next(),"brace";if("@"==v)return b.eatWhile(l),"link";if(/\d/.test(v))return b.eatWhile(/\d/),"number";if("/"==v){if(b.eat("%"))return a(b,k,c);if(b.eat("/"))return a(b,k,f)}if("_"==v&&b.eat("_"))return a(b,k,g);if("-"==v&&b.eat("-")){if(" "!=b.peek())return a(b,k,h);if(" "==b.peek())return"brace"}if("'"==v&&b.eat("'"))return a(b,k,d);if("<"!=v)return null;if(b.eat("<"))return a(b,k,i);b.eatWhile(/[\w\$_]/);var x=b.current(),y=j.propertyIsEnumerable(x)&&j[x];return y?y.style:null}function c(a,c){for(var d,e=!1;d=a.next();){if("/"==d&&e){c.tokenize=b;break}e="%"==d}return"comment"}function d(a,c){for(var d,e=!1;d=a.next();){if("'"==d&&e){c.tokenize=b;break}e="'"==d}return"strong"}function e(a,c){var d=c.block;return d&&a.current()?"comment":!d&&a.match(w)?(c.tokenize=b,"comment"):d&&a.sol()&&a.match(v)?(c.tokenize=b,"comment"):(a.next(),"comment")}function f(a,c){for(var d,e=!1;d=a.next();){if("/"==d&&e){c.tokenize=b;break}e="/"==d}return"em"}function g(a,c){for(var d,e=!1;d=a.next();){if("_"==d&&e){c.tokenize=b;break}e="_"==d}return"underlined"}function h(a,c){for(var d,e=!1;d=a.next();){if("-"==d&&e){c.tokenize=b;break}e="-"==d}return"strikethrough"}function i(a,c){var d,e,f;return"<<"==a.current()?"macro":(d=a.next())?">"==d&&">"==a.peek()?(a.next(),c.tokenize=b,"macro"):(a.eatWhile(/[\w\$_]/),e=a.current(),f=k.propertyIsEnumerable(e)&&k[e],f?(f.style,e):e):(c.tokenize=b,null)}var j={},k=function(){function a(a){return{type:a,style:"macro"}}return{allTags:a("allTags"),closeAll:a("closeAll"),list:a("list"),newJournal:a("newJournal"),newTiddler:a("newTiddler"),permaview:a("permaview"),saveChanges:a("saveChanges"),search:a("search"),slider:a("slider"),tabs:a("tabs"),tag:a("tag"),tagging:a("tagging"),tags:a("tags"),tiddler:a("tiddler"),timeline:a("timeline"),today:a("today"),version:a("version"),option:a("option"),"with":a("with"),filter:a("filter")}}(),l=/[\w_\-]/i,m=/^\-\-\-\-+$/,n=/^\/\*\*\*$/,o=/^\*\*\*\/$/,p=/^<<<$/,q=/^\/\/\{\{\{$/,r=/^\/\/\}\}\}$/,s=/^<!--\{\{\{-->$/,t=/^<!--\}\}\}-->$/,u=/^\{\{\{$/,v=/^\}\}\}$/,w=/.*?\}\}\}/;return{startState:function(){return{tokenize:b,indented:0,level:0}},token:function(a,b){if(a.eatSpace())return null;var c=b.tokenize(a,b);return c},electricChars:""}}),a.defineMIME("text/x-tiddlywiki","tiddlywiki")});