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

web-interface.assets.77dd68f6396b8ab4ce2c238d6ddb5354.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="",d="",b=0,g=0,k=0,w=0,x=0,v=0,T=0,R=0,O=0,q=!1,C=!1,I=!1,_=!1,j={0:0},B=[],F=!1,S=function(){a&&a.value&&"string.regexp"!==a.type&&(a.value=a.value.replace(/^\s*/,""))},K=function(){h=h.replace(/ +$/,"")},L=function(){h=h.trimRight(),m=!1};null!==i;){if(R=n.getCurrentTokenRow(),n.$rowTokens,a=n.stepForward(),void 0!==i){if(y=i.value,x=0,I="style"===d||"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[b]=y,S(),f=!0,y.match(/^(else|elseif)$/)&&h.match(/\}[\s]*$/)&&(L(),p=!0)):"paren.lparen"===i.type?(S(),"{"===y.substr(-1)&&(f=!0,q=!1,C||(O=1)),"{"===y.substr(0,1)&&(p=!0,"["!==h.substr(-1)&&"["===h.trimRight().substr(-1)?(L(),p=!1):")"===h.trimRight().substr(-1)?L():K())):"paren.rparen"===i.type?(x=1,"}"===y.substr(0,1)&&("case"===B[b-1]&&x++,"{"===h.trimRight().substr(-1)?L():(p=!0,I&&(O+=2))),"]"===y.substr(0,1)&&"}"!==h.substr(-1)&&"}"===h.trimRight().substr(-1)&&(p=!1,w++,L()),")"===y.substr(0,1)&&"("!==h.substr(-1)&&"("===h.trimRight().substr(-1)&&(p=!1,w++,L()),K()):"keyword.operator"!==i.type&&"keyword"!==i.type||!y.match(/^(=|==|===|!=|!==|&&|\|\||and|or|xor|\+=|.=|>|>=|<|<=|=>)$/)?"punctuation.operator"===i.type&&";"===y?(L(),S(),f=!0,I&&O++):"punctuation.operator"===i.type&&y.match(/^(:|,)$/)?(L(),S(),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")?(K(),S()):r(i,"tag-close")?(K(),"/>"===y&&(p=!0)):"keyword"===i.type&&y.match(/^(case|default)$/)&&F&&(x=1):(L(),p=!0):(L(),S(),p=!0,f=!0),m&&(!i.type.match(/^(comment)$/)||y.substr(0,1).match(/^[/#]$/))&&(!i.type.match(/^(string)$/)||y.substr(0,1).match(/^['"]$/))){if(w=k,b>g)for(w++,s=b;s>g;s--)j[s]=w;else b"===y)&&(O=_&&a&&""===y&&-1===u.indexOf(d)&&b--,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