ace.define("ace/ext/beautify/php_rules",["require","exports","module","ace/token_iterator"], function(require, exports, module) { "use strict"; var TokenIterator = require("ace/token_iterator").TokenIterator; exports.newLines = [{ type: 'support.php_tag', value: '' }, { type: 'paren.lparen', value: '{', indent: true }, { type: 'paren.rparen', breakBefore: true, value: '}', indent: false }, { type: 'paren.rparen', breakBefore: true, value: '})', indent: false, dontBreak: true }, { type: 'comment' }, { type: 'text', value: ';' }, { type: 'text', value: ':', context: 'php' }, { type: 'keyword', value: 'case', indent: true, dontBreak: true }, { type: 'keyword', value: 'default', indent: true, dontBreak: true }, { type: 'keyword', value: 'break', indent: false, dontBreak: true }, { type: 'punctuation.doctype.end', value: '>' }, { type: 'meta.tag.punctuation.end', value: '>' }, { type: 'meta.tag.punctuation.begin', value: '<', blockTag: true, indent: true, dontBreak: true }, { type: 'meta.tag.punctuation.begin', value: '' ){ context = 'php'; } else if( token.type == 'support.php_tag' && token.value == '?>' ){ context = 'html'; } else if( token.type == 'meta.tag.name.style' && context != 'css' ){ context = 'css'; } else if( token.type == 'meta.tag.name.style' && context == 'css' ){ context = 'html'; } else if( token.type == 'meta.tag.name.script' && context != 'js' ){ context = 'js'; } else if( token.type == 'meta.tag.name.script' && context == 'js' ){ context = 'html'; } nextToken = iterator.stepForward(); if (nextToken && nextToken.type.indexOf('meta.tag.name') == 0) { nextTag = nextToken.value; } if ( lastToken.type == 'support.php_tag' && lastToken.value == '' ) { dontBreak = false; } lastTag = tag; lastToken = token; token = nextToken; if (token===null) { break; } } return code; }; }); ace.define("ace/ext/beautify",["require","exports","module","ace/token_iterator","ace/ext/beautify/php_rules"], function(require, exports, module) { "use strict"; var TokenIterator = require("ace/token_iterator").TokenIterator; var phpTransform = require("./beautify/php_rules").transform; exports.beautify = function(session) { var iterator = new TokenIterator(session, 0, 0); var token = iterator.getCurrentToken(); var context = session.$modeId.split("/").pop(); var code = phpTransform(iterator, context); session.doc.setValue(code); }; exports.commands = [{ name: "beautify", exec: function(editor) { exports.beautify(editor.session); }, bindKey: "Ctrl-Shift-B" }]; }); (function() { ace.require(["ace/ext/beautify"], function() {}); })();