<commit_before>// converters
var converters = module.exports = {};

function generateHeader(repeat) {
    return function (input, json2md) {
        return "#".repeat(repeat) + " " + json2md(input);
    }
}

function indent(content, spaces, ignoreFirst) {
    var lines = content;
    if (typeof content === "string") {
        lines = content.split("\n");
    }

    if (ignoreFirst) {
        if (lines.length <= 1) {
            return lines.join("\n");
        }
        return lines[0] + "\n" + indent(lines.slice(1), spaces, false);
    }

    return lines.map(function (c) {
        return " ".repeat(spaces) + c;
    }).join("\n");
}

function emphasisFormats( text ) {
  return {
    strong: '**',
    italic: '*',
  };
}

function parseTextFormat( text ) {
  var formats = emphasisFormats();
  var formated = text.replace(/\<\/?strong\>/gi, formats.strong );
  formated = formated.replace(/\<\/?bold\>/gi, formats.strong );
  formated = formated.replace(/\<\/?em\>/gi, formats.italic );
  formated = formated.replace(/\<\/?italic\>/gi, formats.italic );
  return formated;
}

// Headings
converters.h1 = generateHeader(1);
converters.h2 = generateHeader(2);
converters.h3 = generateHeader(3);
converters.h4 = generateHeader(4);
converters.h5 = generateHeader(5);
converters.h6 = generateHeader(6);

converters.blockquote = function (input, json2md) {
    return json2md(input, "> ") + "\n";
};

converters.img = function (input, json2md) {
    if (Array.isArray(input)) {
        return json2md(input, "", "img");
    }
    if (typeof input === "string") {
        return converters.img({ source: input, title: "" });
    }
    input.title = input.title || "";
    return "![" + input.title + "](" + input.source + ")\n";
};

converters.ul = function (input, json2md) {
    for (var i = 0, c = ""; i < input.length; ++i) {
        c += "\n - " + parseTextFormat( indent( json2md(input[i]), 4, true) );
    }
    return c + "\n";<commit_msg>Update code to match code style<commit_after>// converters
var converters = module.exports = {};

function generateHeader(repeat) {
    return function (input, json2md) {
        return "#".repeat(repeat) + " " + json2md(input);
    }
}

function indent(content, spaces, ignoreFirst) {
    var lines = content;
    if (typeof content === "string") {
        lines = content.split("\n");
    }

    if (ignoreFirst) {
        if (lines.length <= 1) {
            return lines.join("\n");
        }
        return lines[0] + "\n" + indent(lines.slice(1), spaces, false);
    }

    return lines.map(function (c) {
        return " ".repeat(spaces) + c;
    }).join("\n");
}

function parseTextFormat ( text ) {
    var formats = {
        strong: "**"
        ,italic: "*"
    };
    var formated = text.replace(/\<\/?strong\>/gi, formats.strong );
    formated = formated.replace(/\<\/?bold\>/gi, formats.strong );
    formated = formated.replace(/\<\/?em\>/gi, formats.italic );
    formated = formated.replace(/\<\/?italic\>/gi, formats.italic );
    return formated;
}

// Headings
converters.h1 = generateHeader(1);
converters.h2 = generateHeader(2);
converters.h3 = generateHeader(3);
converters.h4 = generateHeader(4);
converters.h5 = generateHeader(5);
converters.h6 = generateHeader(6);

converters.blockquote = function (input, json2md) {
    return json2md(input, "> ") + "\n";
};

converters.img = function (input, json2md) {
    if (Array.isArray(input)) {
        return json2md(input, "", "img");
    }
    if (typeof input === "string") {
        return converters.img({ source: input, title: "" });
    }
    input.title = input.title || "";
    return "![" + input.title + "](" + input.source + ")\n";
};

converters.ul = function (input, json2md) {
    for (var i = 0, c = ""; i < input.length; ++i) {
        c += "\n - " + parseTextFormat( indent( json2md(input[i]), 4, true) );
    }
    return c + "\n";
{'fraction_non_alphanumeric': 0.18843572534847702, 'fraction_numerical': 0.012906556530717605, 'mean_word_length': 2.8290513833992095, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3577209', 'n_tokens_mistral': 1327, 'n_tokens_neox': 1305, 'n_words': 279}