<commit_before>
/*
Contains all of the functions for the documentation pages.
*/

function veridoc_render_file_list(
    listData,
    container
){
    var toset = ""

    listData = listData.sort(function(a,b){
        if(a.path>=b.path){return 1;}
        else {return -1;}    });

    var i;
    for(i = 0; i < listData.length; i++)
    {
        var item = listData[i];
        
        toset += "<li>";
        if(item.parsed == "1"){
            toset += "<div class='status good'>Found</div>";
            if(item.success== "1"){
                toset += "<div class='status good'>Parsed</div>";
            } else {
                toset += "<div class='status bad'>Syntax Errors</div>";
            }
        } else {
            toset += "<div class='status bad'>Not Found</div>";
        }
        
        toset += "<div class='item'>"+item.path+"</div>";
        toset += "</li>"

    }

    container.innerHTML = toset;
}


function veridoc_render_module_list(
    listData,
    container
){
    var toset = ""

    listData = listData.sort(function(a,b){
        if(a.id>=b.id){return 1;}
        else {return -1;}
    });

    var i;
    for(i = 0; i < listData.length; i++)
    {
        var item = listData[i];
        
        toset += "<li>";
        toset += "<div class='item'>"+item.id+"</div>";
        toset += "</li>"

    }

    container.innerHTML = toset;
}

function veridoc_render_module_hierarchy(
    rootModule,
    container
){
    container.innerHTML += "<li>"+rootModule.id +"<ul class='indented'>";

    var i;
    for(i = 0; i < rootModule.children.length; i++)
    {
        container.innerHTML += "<li>"+rootModule.children[i].id+"</li>";
    }

    container.innerHTML += "</ul>";
    container.innerHTML += "</li>";
}

/*
Responsible for taking a JSON data structure and turning it into a list
on the list.html page.
*/
function veridoc_render_list(
    data
){
    var listType = data.listType;
    var listData = data.listData;
    var listTitle = data.listTitle;
    var listNotes = data.listNotes;

    document.getElementById('list-title').innerText = listTitle;
    document.getElementById('list-notes').innerText = listNotes;

    // This is a <ul> element
    var container = document.getElementById('list-container');
    container.innerHTML = "";

    if(listType == "file-manifest"){
        veridoc_render_file_list(listData, container);
    } else if (listType == "module-manifest") {
        veridoc_render_module_list(listData, container);  
    } else if (listType == "module-hierarchy") {
        veridoc_render_module_hierarchy(listData[0], container);  
    } else {
        container.innerText = "Error: unknown list type: "+listType;
    }
}<commit_msg>Can finally render hierarchy - needs better styling though.  On branch master  Your branch is ahead of 'origin/master' by 3 commits.    (use "git push" to publish your local commits)<commit_after>
/*
Contains all of the functions for the documentation pages.
*/

function veridoc_render_file_list(
    listData,
    container
){
    var toset = ""

    listData = listData.sort(function(a,b){
        if(a.path>=b.path){return 1;}
        else {return -1;}    });

    var i;
    for(i = 0; i < listData.length; i++)
    {
        var item = listData[i];
        
        toset += "<li>";
        if(item.parsed == "1"){
            toset += "<div class='status good'>Found</div>";
            if(item.success== "1"){
                toset += "<div class='status good'>Parsed</div>";
            } else {
                toset += "<div class='status bad'>Syntax Errors</div>";
            }
        } else {
            toset += "<div class='status bad'>Not Found</div>";
        }
        
        toset += "<div class='item'>"+item.path+"</div>";
        toset += "</li>"

    }

    container.innerHTML = toset;
}


function veridoc_render_module_list(
    listData,
    container
){
    var toset = ""

    listData = listData.sort(function(a,b){
        if(a.id>=b.id){return 1;}
        else {return -1;}
    });

    var i;
    for(i = 0; i < listData.length; i++)
    {
        var item = listData[i];
        
        toset += "<li>";
        toset += "<div class='item'>"+item.id+"</div>";
        toset += "</li>"

    }

    container.innerHTML = toset;
}

function veridoc_render_module_hierarchy(
    rootModule,
    container,
    depth
){
    container.innerHTML += "<li style=\"padding-left:"+(5+depth)+"px;\">"+
        rootModule.id;

    var i;
    for(i = 0; i < rootModule.children.length; i++)
    {
        veridoc_render_module_hierarchy(rootModule.children[i],container,
            depth+50);
    }

    container.innerHTML += "</li>";
}

/*
Responsible for taking a JSON data structure and turning it into a list
on the list.html page.
*/
function veridoc_render_list(
    data
){
    var listType = data.listType;
    var listData = data.listData;
    var listTitle = data.listTitle;
    var listNotes = data.listNotes;

    document.getElementById('list-title').innerText = listTitle;
    document.getElementById('list-notes').innerText = listNotes;

    // This is a <ul> element
    var container = document.getElementById('list-container');
    container.innerHTML = "";

    if(listType == "file-manifest"){
        veridoc_render_file_list(listData, container);
    } else if (listType == "module-manifest") {
        veridoc_render_module_list(listData, container);  
    } else if (listType == "module-hierarchy") {
        veridoc_render_module_hierarchy(listData[0], container,0);  
    } else {
        container.innerText = "Error: unknown list type: "+listType;
    }
}
{'fraction_non_alphanumeric': 0.1517412935323383, 'fraction_numerical': 0.004442075337597726, 'mean_word_length': 2.397103198551599, 'pattern_counts': {'":': 0, '<': 51, '<?xml version=': 0, '>': 49, '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': '5971768', 'n_tokens_mistral': 1812, 'n_tokens_neox': 1764, 'n_words': 400}