<commit_before>function cleanUpText(codebox){
    /// Not currently used
    /// Strips a whole IPython session of input and output prompts
    //escape quotation marks
    codebox = codebox.replace(/"/g, "\'");

    // newlines
    codebox = codebox.replace(/[\r\n|\r|\n]$/g, ""); // remove at end
    codebox = codebox.replace(/[\r\n|\r|\n]+/g, "\\n");
    // prompts
    codebox = codebox.replace(/In \[\d+\]: /g, "");
    codebox = codebox.replace(/Out \[\d+\]: /g, "");

return codebox;
}

function cleanQuotes(text){
    /// Replace all single and double quotes with one escaped backslash
    return text.replace(/["|']/g, "\\'");
}

function scrapeText(codebox){
    /// Returns input lines cleaned of prompt1 and prompt2
    var lines = codebox.split('\n');
    var newlines = new Array();
    $.each(lines, function() {
        if (this.match(/^In \[\d+]: /)){
            newlines.push(cleanQuotes(this.replace(/^(\s)*In \[\d+]: /,"")));
        }
        else if (this.match(/^(\s)*...:/)){
            newlines.push(cleanQuotes(this.replace(/^(\s)*...: /,"")));
        }

    }
            );
    return newlines.join('\\n');
}

$(document).ready(            
        function() {
    // grab all code boxes
    var ipythoncode = $(".highlight-ipython");
    $.each(ipythoncode, function() {
        //var codebox = cleanUpText($(this).text());
        var codebox = scrapeText($(this).text());
        // give them a facebox pop-up with plain text code   <commit_msg>DOC: Fix javascript for variable . continuation lines<commit_after>function cleanUpText(codebox){
    /// Not currently used
    /// Strips a whole IPython session of input and output prompts
    //escape quotation marks
    codebox = codebox.replace(/"/g, "\'");

    // newlines
    codebox = codebox.replace(/[\r\n|\r|\n]$/g, ""); // remove at end
    codebox = codebox.replace(/[\r\n|\r|\n]+/g, "\\n");
    // prompts
    codebox = codebox.replace(/In \[\d+\]: /g, "");
    codebox = codebox.replace(/Out \[\d+\]: /g, "");

return codebox;
}

function cleanQuotes(text){
    /// Replace all single and double quotes with one escaped backslash
    return text.replace(/["|']/g, "\\'");
}

function scrapeText(codebox){
    /// Returns input lines cleaned of prompt1 and prompt2
    var lines = codebox.split('\n');
    var newlines = new Array();
    $.each(lines, function() {
        if (this.match(/^In \[\d+]: /)){
            newlines.push(cleanQuotes(this.replace(/^(\s)*In \[\d+]: /,"")));
        }
        else if (this.match(/^(\s)*.+:/)){
            newlines.push(cleanQuotes(this.replace(/^(\s)*.+: /,"")));
        }

    }
            );
    return newlines.join('\\n');
}

$(document).ready(            
        function() {
    // grab all code boxes
    var ipythoncode = $(".highlight-ipython");
    $.each(ipythoncode, function() {
        //var codebox = cleanUpText($(this).text());
        var codebox = scrapeText($(this).text());
        // give them a facebox pop-up with plain text code   
{'fraction_non_alphanumeric': 0.202, 'fraction_numerical': 0.0013333333333333333, 'mean_word_length': 2.2869660460021906, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '901800', 'n_tokens_mistral': 979, 'n_tokens_neox': 962, 'n_words': 226}