All Downloads are FREE. Search and download functionalities are using the official Maven repository.

web-interface.assets.a46e90b37415c639a6633f73e1cb1831.js Maven / Gradle / Ivy

There is a newer version: 6.0.1
Show newest version
ace.define("ace/ext/beautify",["require","exports","module","ace/token_iterator"],(function(require,exports,e){"use strict";var t=require("../token_iterator").TokenIterator;function r(e,t){return e.type.lastIndexOf(t+".xml")>-1}exports.singletonTags=["area","base","br","col","command","embed","hr","html","img","input","keygen","link","meta","param","source","track","wbr"],exports.blockTags=["article","aside","blockquote","body","div","dl","fieldset","footer","form","head","header","html","nav","ol","p","script","section","style","table","tbody","tfoot","thead","ul"],exports.beautify=function(e){for(var a,o,s,n=new t(e,0,0),i=n.getCurrentToken(),c=e.getTabString(),u=exports.singletonTags,l=exports.blockTags,m=!1,p=!1,f=!1,h="",y="",b="",d=0,g=0,k=0,x=0,w=0,v=0,T=0,R=0,O=0,q=!1,C=!1,I=!1,_=!1,j={0:0},B=[],F=function(){a&&a.value&&"string.regexp"!==a.type&&(a.value=a.value.replace(/^\s*/,""))},S=function(){h=h.replace(/ +$/,"")},K=function(){h=h.trimRight(),m=!1};null!==i;){if(R=n.getCurrentTokenRow(),n.$rowTokens,a=n.stepForward(),void 0!==i){if(y=i.value,w=0,I="style"===b||"ace/mode/css"===e.$modeId,r(i,"tag-open")?(C=!0,a&&(_=-1!==l.indexOf(a.value)),"0;O--)h+="\n";m=!0,r(i,"comment")||i.type.match(/^(comment|string)$/)||(y=y.trimLeft())}if(y){if("keyword"===i.type&&y.match(/^(if|else|elseif|for|foreach|while|switch)$/)?(B[d]=y,F(),f=!0,y.match(/^(else|elseif)$/)&&h.match(/\}[\s]*$/)&&(K(),p=!0)):"paren.lparen"===i.type?(F(),"{"===y.substr(-1)&&(f=!0,q=!1,C||(O=1)),"{"===y.substr(0,1)&&(p=!0,"["!==h.substr(-1)&&"["===h.trimRight().substr(-1)?(K(),p=!1):")"===h.trimRight().substr(-1)?K():S())):"paren.rparen"===i.type?(w=1,"}"===y.substr(0,1)&&("case"===B[d-1]&&w++,"{"===h.trimRight().substr(-1)?K():(p=!0,I&&(O+=2))),"]"===y.substr(0,1)&&"}"!==h.substr(-1)&&"}"===h.trimRight().substr(-1)&&(p=!1,x++,K()),")"===y.substr(0,1)&&"("!==h.substr(-1)&&"("===h.trimRight().substr(-1)&&(p=!1,x++,K()),S()):"keyword.operator"!==i.type&&"keyword"!==i.type||!y.match(/^(=|==|===|!=|!==|&&|\|\||and|or|xor|\+=|.=|>|>=|<|<=|=>)$/)?"punctuation.operator"===i.type&&";"===y?(K(),F(),f=!0,I&&O++):"punctuation.operator"===i.type&&y.match(/^(:|,)$/)?(K(),F(),y.match(/^(,)$/)&&T>0&&0===v?O++:(f=!0,m=!1)):"support.php_tag"!==i.type||"?>"!==y||m?r(i,"attribute-name")&&h.substr(-1).match(/^\s$/)?p=!0:r(i,"attribute-equals")?(S(),F()):r(i,"tag-close")&&(S(),"/>"===y&&(p=!0)):(K(),p=!0):(K(),F(),p=!0,f=!0),m&&(!i.type.match(/^(comment)$/)||y.substr(0,1).match(/^[/#]$/))&&(!i.type.match(/^(string)$/)||y.substr(0,1).match(/^['"]$/))){if(x=k,d>g)for(x++,s=d;s>g;s--)j[s]=x;else d"===y)&&(O=_&&a&&""===y&&-1===u.indexOf(b)&&d--,o=R}}i=a}h=h.trim(),e.doc.setValue(h)},exports.commands=[{name:"beautify",description:"Format selection (Beautify)",exec:function(e){exports.beautify(e.session)},bindKey:"Ctrl-Shift-B"}]})),ace.require(["ace/ext/beautify"],(function(e){"object"==typeof module&&"object"==typeof exports&&module&&(module.exports=e)}));




© 2015 - 2024 Weber Informatics LLC | Privacy Policy