src/pyams_skin/resources/js/ext/ace/ext-beautify.min.js
changeset 566 a1707c607eec
parent 565 318533413200
child 567 bca1726b1d85
--- a/src/pyams_skin/resources/js/ext/ace/ext-beautify.min.js	Sun Jul 19 02:02:20 2020 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-ace.define("ace/ext/beautify",["require","exports","module","ace/token_iterator"],function(e,S,t){"use strict";function B(e,t){return-1<e.type.lastIndexOf(t+".xml")}var F=e("../token_iterator").TokenIterator;S.singletonTags=["area","base","br","col","command","embed","hr","html","img","input","keygen","link","meta","param","source","track","wbr"],S.blockTags=["article","aside","blockquote","body","div","dl","fieldset","footer","form","head","header","html","nav","ol","p","script","section","style","table","tbody","tfoot","thead","ul"],S.beautify=function(e){for(var t,r,a,o=new F(e,0,0),s=o.getCurrentToken(),n=e.getTabString(),i=S.singletonTags,c=S.blockTags,u=!1,m=!1,l=!1,p="",f="",b="",d=0,y=0,h=0,g=0,k=0,$=0,w=0,x=0,v=!1,T=!1,R=!1,O=!1,q={0:0},C={},I=function(){t&&t.value&&"string.regexp"!==t.type&&(t.value=t.value.trim())},_=function(){p=p.replace(/ +$/,"")},j=function(){p=p.trimRight(),u=!1};null!==s;){if(w=o.getCurrentTokenRow(),o.$rowTokens,t=o.stepForward(),void 0!==s){if(f=s.value,k=0,R="style"===b||"ace/mode/css"===e.$modeId,B(s,"tag-open")?(T=!0,t&&(O=-1!==c.indexOf(t.value)),"</"===f&&(O&&!u&&x<1&&x++,R&&(x=1),O=!(k=1))):B(s,"tag-close")?T=!1:B(s,"comment.start")?O=!0:B(s,"comment.end")&&(O=!1),!T&&!x&&"paren.rparen"===s.type&&"}"===s.value.substr(0,1)&&x++,w!==r&&(x=w,r&&(x-=r)),x){for(j();0<x;x--)p+="\n";u=!0,!B(s,"comment")&&!s.type.match(/^(comment|string)$/)&&(f=f.trimLeft())}if(f){if("keyword"===s.type&&f.match(/^(if|else|elseif|for|foreach|while|switch)$/)?(C[d]=f,I(),l=!0,f.match(/^(else|elseif)$/)&&p.match(/\}[\s]*$/)&&(j(),m=!0)):"paren.lparen"===s.type?(I(),"{"===f.substr(-1)&&(v=!(l=!0),T||(x=1)),"{"===f.substr(0,1)&&(m=!0,"["!==p.substr(-1)&&"["===p.trimRight().substr(-1)?(j(),m=!1):")"===p.trimRight().substr(-1)?j():_())):"paren.rparen"===s.type?(k=1,"}"===f.substr(0,1)&&("case"===C[d-1]&&k++,"{"===p.trimRight().substr(-1)?j():(m=!0,R&&(x+=2))),"]"===f.substr(0,1)&&"}"!==p.substr(-1)&&"}"===p.trimRight().substr(-1)&&(m=!1,g++,j()),")"===f.substr(0,1)&&"("!==p.substr(-1)&&"("===p.trimRight().substr(-1)&&(m=!1,g++,j()),_()):"keyword.operator"!==s.type&&"keyword"!==s.type||!f.match(/^(=|==|===|!=|!==|&&|\|\||and|or|xor|\+=|.=|>|>=|<|<=|=>)$/)?"punctuation.operator"===s.type&&";"===f?(j(),I(),l=!0,R&&x++):"punctuation.operator"===s.type&&f.match(/^(:|,)$/)?(j(),I(),u=!(l=!0)):"support.php_tag"!==s.type||"?>"!==f||u?B(s,"attribute-name")&&p.substr(-1).match(/^\s$/)?m=!0:B(s,"attribute-equals")?(_(),I()):B(s,"tag-close")&&(_(),"/>"===f&&(m=!0)):(j(),m=!0):(j(),I(),l=m=!0),u&&(!s.type.match(/^(comment)$/)||f.substr(0,1).match(/^[/#]$/))&&(!s.type.match(/^(string)$/)||f.substr(0,1).match(/^['"]$/))){if(g=h,y<d)for(g++,a=d;y<a;a--)q[a]=g;else d<y&&(g=q[d]);for(y=d,h=g,k&&(g-=k),v&&!$&&(g++,v=!1),a=0;a<g;a++)p+=n}if("keyword"===s.type&&f.match(/^(case|default)$/)&&(C[d]=f,d++),"keyword"===s.type&&f.match(/^(break)$/)&&C[d-1]&&C[d-1].match(/^(case|default)$/)&&d--,"paren.lparen"===s.type&&($+=(f.match(/\(/g)||[]).length,d+=f.length),"keyword"===s.type&&f.match(/^(if|else|elseif|for|while)$/)?(v=!0,$=0):!$&&f.trim()&&"comment"!==s.type&&(v=!1),"paren.rparen"===s.type)for($-=(f.match(/\)/g)||[]).length,a=0;a<f.length;a++)d--,"}"===f.substr(a,1)&&"case"===C[d]&&d--;m&&!u&&(_(),"\n"!==p.substr(-1)&&(p+=" ")),p+=f,l&&(p+=" "),l=m=u=!1,(B(s,"tag-close")&&(O||-1!==c.indexOf(b))||B(s,"doctype")&&">"===f)&&(x=O&&t&&"</"===t.value?-1:1),B(s,"tag-open")&&"</"===f?d--:B(s,"tag-open")&&"<"===f&&-1===i.indexOf(t.value)?d++:B(s,"tag-name")?b=f:B(s,"tag-close")&&"/>"===f&&-1===i.indexOf(b)&&d--,r=w}}s=t}p=p.trim(),e.doc.setValue(p)},S.commands=[{name:"beautify",exec:function(e){S.beautify(e.session)},bindKey:"Ctrl-Shift-B"}]}),ace.require(["ace/ext/beautify"],function(e){"object"==typeof module&&"object"==typeof exports&&module&&(module.exports=e)});