<commit_before>"""
Minetest Mod HTML Generator Program
"""

#Imports
import json

#Grabs dictionary of mod from master dictionary
def grabMod(modName):
    mod = master_dict[modName]
    return mod

#Extracts each part from mod dictionary
def extractMod(mod):
    name = mod["Name"]
    folder = mod["Folder"]
    author = mod["Author"]
    depends = mod["Depends"]
    forum = mod["Forum"]
    database = mod["Database"]
    gitHub = mod["GitHub"]
    categories = mod["Categories"]

#Wrtie HTML code from mod list
def writeHTML():

    html_code = [""]
    
    #Prints general beginning HTML
    #Note that "style.css" can be used to style the generated page
    html_code.append("<!DOCTYPE html>")
    html_code.append("<html><title>List of Mods</title><link rel=\"stylesheet\" href=\"style.css\" type=\"text/css\" /><body><div id=\"holder\">")

    #Outputs Table of Contents
    html_code.append("<div id=\"TableOfContents\">")
    html_code.append("<h2 id=\"TOC\">Table of Contents</h2>")
    html_code.append("<ul>")
    
    for modName, mod in sorted(master_dict.items()):
        html_code.append("<li><a href=\"#" + mod["Name"] + "\">" + mod["Name"] + "</a> - (" + mod["Folder"] + ")" + "</li>")

    html_code.append("</ul>")
    html_code.append("</div>")

    #Ouputs list header
    html_code.append("<h2 id=\"Mod List Header\">List of Mods</h2>")
    
    #Prints info for each mod in alphabetical order
    for modName, mod in sorted(master_dict.items()):
        html_code.append("<h3 class=\"mod\" id=\"" + mod["Name"] + "\">" + mod["Name"] + " [" + mod["Folder"] + "]</h3>")
        html_code.append("<ul>")
        html_code.append("<li>" + "Folder Name: " + mod["Folder"] + "</li>")
        html_code.append("<li>" + "Author: " + mod["Author"] + "</li>")
        html_code.append("<li>" + "Depends: " + mod["Depends"] + "</li>")
        
        #Prints values that are links as HTML links
        #Forum Topic
        if mod["Forum"] != "None":
            html_code.append("<li>" + "Forum Topic: " + "<a href=\"" + mod["Forum"] + "\">" + mod["Forum"] + "</a>" + "</li>")
        else:
            html_code.append("<li>" + "Forum Topic: None</li>")
            <commit_msg>updated html generator to take into account empty depends sections<commit_after>"""
Minetest Mod HTML Generator Program
"""

#Imports
import json

#Grabs dictionary of mod from master dictionary
def grabMod(modName):
    mod = master_dict[modName]
    return mod

#Extracts each part from mod dictionary
def extractMod(mod):
    name = mod["Name"]
    folder = mod["Folder"]
    author = mod["Author"]
    depends = mod["Depends"]
    forum = mod["Forum"]
    database = mod["Database"]
    gitHub = mod["GitHub"]
    categories = mod["Categories"]

#Wrtie HTML code from mod list
def writeHTML():

    html_code = [""]
    
    #Prints general beginning HTML
    #Note that "style.css" can be used to style the generated page
    html_code.append("<!DOCTYPE html>")
    html_code.append("<html><title>List of Mods</title><link rel=\"stylesheet\" href=\"style.css\" type=\"text/css\" /><body><div id=\"holder\">")

    #Outputs Table of Contents
    html_code.append("<div id=\"TableOfContents\">")
    html_code.append("<h2 id=\"TOC\">Table of Contents</h2>")
    html_code.append("<ul>")
    
    for modName, mod in sorted(master_dict.items()):
        html_code.append("<li><a href=\"#" + mod["Name"] + "\">" + mod["Name"] + "</a> - (" + mod["Folder"] + ")" + "</li>")

    html_code.append("</ul>")
    html_code.append("</div>")

    #Ouputs list header
    html_code.append("<h2 id=\"Mod List Header\">List of Mods</h2>")
    
    #Prints info for each mod in alphabetical order
    for modName, mod in sorted(master_dict.items()):
        html_code.append("<h3 class=\"mod\" id=\"" + mod["Name"] + "\">" + mod["Name"] + " [" + mod["Folder"] + "]</h3>")
        html_code.append("<ul>")
        html_code.append("<li>" + "Folder Name: " + mod["Folder"] + "</li>")
        html_code.append("<li>" + "Author: " + mod["Author"] + "</li>")

        if mod["Depends"] != "":
            html_code.append("<li>" + "Depends: " + mod["Depends"] + "</li>")
        else:
            html_code.append("<li>" + "Depends: None</li>")
        
        #Prints values that are links as HTML links
        #Forum Topic
        if mod["Forum"] != "None":
            html_code.append("<li>" + "Forum Topic: " + "<a href=\"" + mod["Forum"] + "\">" + mod["Forum"] + "</a>" + "</li>")
        else:
            html_code.append("<li>" + "Forum Topic: None</li>")
            
{'fraction_non_alphanumeric': 0.20171015128261346, 'fraction_numerical': 0.00263100197325148, 'mean_word_length': 3.015845070422535, 'pattern_counts': {'":': 3, '<': 73, '<?xml version=': 0, '>': 73, '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': '2621752', 'n_tokens_mistral': 1475, 'n_tokens_neox': 1484, 'n_words': 365}