META-INF.web.lib.editor.xheditor_plugins.showdown.js Maven / Gradle / Ivy
var Showdown={extensions:{}},forEach=Showdown.forEach=function(c,d){if(typeof c.forEach=="function"){c.forEach(d)}else{var a,b=c.length;for(a=0;a?[ \t]*\n?[ \t]*(?:(\n*)["(](.+?)[")][ \t]*)?(?:\n+|(?=~0))/gm,function(U,Q,R,S,T){return Q=Q.toLowerCase(),L[Q]=e(R),S?S+T:(T&&(M[Q]=T.replace(/"/g,""")),"")}),P=P.replace(/~0/,""),P},r=function(Q){Q=Q.replace(/\n/g,"\n\n");var R="p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del|style|section|header|footer|nav|article|aside",P="p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|style|section|header|footer|nav|article|aside";return Q=Q.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del)\b[^\r]*?\n<\/\2>[ \t]*(?=\n+))/gm,t),Q=Q.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|style|section|header|footer|nav|article|aside)\b[^\r]*?<\/\2>[ \t]*(?=\n+)\n)/gm,t),Q=Q.replace(/(\n[ ]{0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,t),Q=Q.replace(/(\n\n[ ]{0,3}[ \t]*(?=\n{2,}))/g,t),Q=Q.replace(/(?:\n\n)([ ]{0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,t),Q=Q.replace(/\n\n/g,"\n"),Q},t=function(Q,R){var P=R;return P=P.replace(/\n\n/g,"\n"),P=P.replace(/^\n/,""),P=P.replace(/\n+$/g,""),P="\n\n~K"+(N.push(P)-1)+"K\n\n",P},u=function(P){P=B(P);var Q=G("
");return P=P.replace(/^[ ]{0,2}([ ]?\*[ ]?){3,}[ \t]*$/gm,Q),P=P.replace(/^[ ]{0,2}([ ]?\-[ ]?){3,}[ \t]*$/gm,Q),P=P.replace(/^[ ]{0,2}([ ]?\_[ ]?){3,}[ \t]*$/gm,Q),P=D(P),P=E(P),P=a(P),P=r(P),P=c(P),P},v=function(P){return P=H(P),P=w(P),P=g(P),P=z(P),P=x(P),P=i(P),P=e(P),P=J(P),P=P.replace(/ +\n/g,"
\n"),P},w=function(P){var Q=/(<[a-z\/!$]("[^"]*"|'[^']*'|[^'">])*>|)/gi;return P=P.replace(Q,function(R){var S=R.replace(/(.)<\/?code>(?=.)/g,"$1`");return S=q(S,"\\`*_"),S}),P},x=function(P){return P=P.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,y),P=P.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\]\([ \t]*()(.*?(?:\(.*?\).*?)?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,y),P=P.replace(/(\[([^\[\]]+)\])()()()()()/g,y),P},y=function(R,S,U,W,X,Y,Z,aa){aa==undefined&&(aa="");var ab=S,ac=U,P=W.toLowerCase(),Q=X,T=aa;if(Q==""){P==""&&(P=ac.toLowerCase().replace(/ ?\n/g," ")),Q="#"+P;if(L[P]!=undefined){Q=L[P],M[P]!=undefined&&(T=M[P])}else{if(!(ab.search(/\(\s*\)$/m)>-1)){return ab}Q=""}}Q=q(Q,"*_");var V='"+ac+"",V},z=function(P){return P=P.replace(/(!\[(.*?)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,A),P=P.replace(/(!\[(.*?)\]\s?\([ \t]*()(\S+?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,A),P},A=function(R,S,U,W,X,Y,Z,aa){var ab=S,ac=U,P=W.toLowerCase(),Q=X,T=aa;T||(T="");if(Q==""){P==""&&(P=ac.toLowerCase().replace(/ ?\n/g," ")),Q="#"+P;if(L[P]==undefined){return ab}Q=L[P],M[P]!=undefined&&(T=M[P])}ac=ac.replace(/"/g,"""),Q=q(Q,"*_");var V='",V},B=function(P){function Q(R){return R.replace(/[^\w]/g,"").toLowerCase()}return P=P.replace(/^(.+)[ \t]*\n=+[ \t]*\n+/gm,function(R,S){return G(''+v(S)+"
")}),P=P.replace(/^(.+)[ \t]*\n-+[ \t]*\n+/gm,function(R,S){return G(''+v(S)+"
")}),P=P.replace(/^(\#{1,6})[ \t]*(.+?)[ \t]*\#*\n+/gm,function(R,S,T){var U=S.length;return G("'+v(T)+" ")}),P},C,D=function(P){P+="~0";var Q=/^(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm;return O?P=P.replace(Q,function(V,W,R){var S=W,T=R.search(/[*+-]/g)>-1?"ul":"ol";S=S.replace(/\n{2,}/g,"\n\n\n");var U=C(S);return U=U.replace(/\s+$/,""),U="<"+T+">"+U+""+T+">\n",U}):(Q=/(\n\n|^\n?)(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/g,P=P.replace(Q,function(U,V,W,X){var Y=V,R=W,S=X.search(/[*+-]/g)>-1?"ul":"ol",R=R.replace(/\n{2,}/g,"\n\n\n"),T=C(R);return T=Y+"<"+S+">\n"+T+""+S+">\n",T})),P=P.replace(/~0/,""),P};C=function(P){return O++,P=P.replace(/\n{2,}$/,"\n"),P+="~0",P=P.replace(/(\n)?(^[ \t]*)([*+-]|\d+[.])[ \t]+([^\r]+?(\n{1,2}))(?=\n*(~0|\2([*+-]|\d+[.])[ \t]+))/gm,function(T,U,V,W,X){var Q=X,R=U,S=V;return R||Q.search(/\n{2,}/)>-1?Q=u(n(Q)):(Q=D(n(Q)),Q=Q.replace(/\n$/,""),Q=v(Q)),""+Q+" \n"}),P=P.replace(/~0/g,""),O--,P};var E=function(P){return P+="~0",P=P.replace(/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=~0))/g,function(T,U,Q){var R=U,S=Q;return R=I(n(R)),R=p(R),R=R.replace(/^\n+/g,""),R=R.replace(/\n+$/g,""),R=""+R+"\n
",G(R)+S}),P=P.replace(/~0/,""),P},F=function(P){return P+="~0",P=P.replace(/(?:^|\n)```(.*)\n([\s\S]*?)\n```/g,function(T,U,Q){var R=U,S=Q;return S=I(S),S=p(S),S=S.replace(/^\n+/g,""),S=S.replace(/\n+$/g,""),S=""+S+"\n
",G(S)}),P=P.replace(/~0/,""),P},G=function(P){return P=P.replace(/(^\n+|\n+$)/g,""),"\n\n~K"+(N.push(P)-1)+"K\n\n"},H=function(P){return P=P.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,function(U,V,Q,R,S){var T=R;return T=T.replace(/^([ \t]*)/g,""),T=T.replace(/[ \t]*$/g,""),T=I(T),V+""+T+"
"}),P},I=function(P){return P=P.replace(/&/g,"&"),P=P.replace(//g,">"),P=q(P,"*_{}[]\\",!1),P},J=function(P){return P=P.replace(/(\*\*|__)(?=\S)([^\r]*?\S[*_]*)\1/g,"$2"),P=P.replace(/(\*|_)(?=\S)([^\r]*?\S)\1/g,"$2"),P},a=function(P){return P=P.replace(/((^[ \t]*>[ \t]?.+\n(.+\n)*\n*)+)/gm,function(R,S){var Q=S;return Q=Q.replace(/^[ \t]*>[ \t]?/gm,"~0"),Q=Q.replace(/~0/g,""),Q=Q.replace(/^[ \t]+$/gm,""),Q=u(Q),Q=Q.replace(/(^|\n)/g,"$1 "),Q=Q.replace(/(\s*[^\r]+?<\/pre>)/gm,function(U,V){var T=V;return T=T.replace(/^ /mg,"~0"),T=T.replace(/~0/g,""),T}),G("\n"+Q+"\n
")}),P},c=function(T){T=T.replace(/^\n+/g,""),T=T.replace(/\n+$/g,"");var U=T.split(/\n{2,}/g),V=[],P=U.length;for(var Q=0;Q=0?V.push(R):R.search(/\S/)>=0&&(R=v(R),R=R.replace(/^([ \t]*)/g,"
"),R+="
",V.push(R))}P=V.length;for(var Q=0;Q=0){var S=N[RegExp.$1];S=S.replace(/\$/g,"$$$$"),V[Q]=V[Q].replace(/~K\d+K/,S)}}return V.join("\n\n")},e=function(P){return P=P.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g,"&"),P=P.replace(/<(?![a-z\/?\$!])/gi,"<"),P},g=function(P){return P=P.replace(/\\(\\)/g,s),P=P.replace(/\\([`*_{}\[\]()>#+-.!])/g,s),P},i=function(P){return P=P.replace(/<((https?|ftp|dict):[^'">\s]+)>/gi,'$1'),P=P.replace(/<(?:mailto:)?([-.\w]+\@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,function(Q,R){return j(l(R))}),P},j=function(P){var Q=[function(R){return""+R.charCodeAt(0)+";"},function(R){return""+R.charCodeAt(0).toString(16)+";"},function(R){return R}];return P="mailto:"+P,P=P.replace(/./g,function(R){if(R=="@"){R=Q[Math.floor(Math.random()*2)](R)}else{if(R!=":"){var S=Math.random();R=S>0.9?Q[2](R):S>0.45?Q[1](R):Q[0](R)}}return R}),P=''+P+"",P=P.replace(/">.+:/g,'">'),P},l=function(P){return P=P.replace(/~E(\d+)E/g,function(R,S){var Q=parseInt(S);return String.fromCharCode(Q)}),P},n=function(P){return P=P.replace(/^(\t|[ ]{1,4})/gm,"~0"),P=P.replace(/~0/g,""),P},p=function(P){return P=P.replace(/\t(?=\t)/g," "),P=P.replace(/\t/g,"~A~B"),P=P.replace(/~B(.+?)~A/g,function(U,V,Q){var R=V,S=4-R.length%4;for(var T=0;T