demo/js/vendor/beautify-html.js
Function Beautifier
has 799 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function Beautifier(html_source, options, js_beautify, css_beautify) {
//Wrapper function to invoke all the necessary constructors and deal with the output.
html_source = html_source || '';
var multi_parser,
Function Parser
has 587 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function Parser() {
this.pos = 0; //Parser position
this.token = '';
this.current_mode = 'CONTENT'; //reflects the current Parser mode: TAG/CONTENT
File beautify-html.js
has 887 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/*jshint curly:false, eqeqeq:true, laxbreak:true, noempty:false */
/* AUTO-GENERATED. DO NOT MODIFY. */
/*
The MIT License (MIT)
Function get_tag
has 197 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
this.get_tag = function(peek) { //function to get a full tag and parse its type
var input_char = '',
content = [],
comment = '',
space = false,
Function beautify
has 135 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
this.beautify = function() {
multi_parser = new Parser(); //wrapping functions Parser
multi_parser.printer(html_source, indent_character, indent_size, wrap_line_length, brace_style); //initialize starting values
while (true) {
var t = multi_parser.get_token();
Function printer
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
this.printer = function(js_source, indent_character, indent_size, wrap_line_length, brace_style) { //handles input/output and some other printing functions
this.input = js_source || ''; //gets the input for the Parser
// HACK: newline parsing inconsistent. This brute force normalizes the input.
Function get_comment
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
this.get_comment = function(start_pos) { //function to return comment content in its entirety
// this is will have very poor perf, but will work for now.
var comment = '',
delimiter = '>',
matched = false;
Function get_content
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
this.get_content = function() { //function to capture regular content between tags
var input_char = '',
content = [],
handlebarsStarted = 0;
Function get_unformatted
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
this.get_unformatted = function(delimiter, orig_tag) { //function to return unformatted content in its entirety
if (orig_tag && orig_tag.toLowerCase().indexOf(delimiter) !== -1) {
return '';
}
var input_char = '';
Function get_token
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
this.get_token = function() { //initial handler for token-retrieval
var token;
if (this.last_token === 'TK_TAG_SCRIPT' || this.last_token === 'TK_TAG_STYLE') { //check if we need to format javascript
var type = this.last_token.substr(7);
Avoid deeply nested control flow statements. Open
Open
if (multi_parser.output[lastCheckedOutput].match(/{{#if/)) {
foundIfOnCurrentLine = true;
break;
}
Avoid deeply nested control flow statements. Open
Open
} else if (tag_check.charAt(0) === '!') { //peek for <! comment
// for comments content is already correct.
if (!peek) {
this.tag_type = 'SINGLE';
this.traverse_whitespace();
Avoid deeply nested control flow statements. Open
Open
if (!peek) {
this.record_tag(tag_check);
this.tag_type = 'STYLE';
}
Avoid deeply nested control flow statements. Open
Open
if (content[i] === ' ') {
first_attr = false;
break;
}
Consider simplifying this complex logical expression. Open
Open
if (content.length && content[content.length - 1] !== '=' && input_char !== '>' && space) {
//no space after = or before >
var wrapped = this.space_or_wrap(content);
var indentAttrs = wrapped && input_char !== '/' && !is_wrap_attributes_force;
space = false;
Function printer
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
this.printer = function(js_source, indent_character, indent_size, wrap_line_length, brace_style) { //handles input/output and some other printing functions
Avoid too many return
statements within this function. Open
Open
return token;
Avoid too many return
statements within this function. Open
Open
return [token, tag_name_type];
Avoid too many return
statements within this function. Open
Open
return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code));
Avoid too many return
statements within this function. Open
Open
if (code < 97) return code === 95;
Avoid too many return
statements within this function. Open
Open
if (code < 123) return true;
Avoid too many return
statements within this function. Open
Open
return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code));