added Table of Contents generator

modified "minetest_mod_html_generator.py" so that it outputs a table of
contents at the top of the page with each mod name having a link to its
section on the page, each mod section also now has an id based on its
name to allow for linking to specific sections
master
rocketslime11 2014-06-15 18:22:54 -04:00
parent 422f39f16a
commit 63fb61811f
1 changed files with 13 additions and 1 deletions

View File

@ -29,10 +29,22 @@ def writeHTML():
#Prints general beginning HTML
#Note that "style.css" can be used to style the generated page
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("<h2>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>")
#Ouputs list header
html_code.append("<h2>List of Mods</h2>")
#Prints info for each mod in alphabetical order
for modName, mod in sorted(master_dict.items()):
html_code.append("<h3>" + mod["Name"] + "</h3>")
html_code.append("<h3 id=\"" + mod["Name"] + "\">" + mod["Name"] + "</h3>")
html_code.append("<ul>")
html_code.append("<li>" + "Folder Name: " + mod["Folder"] + "</li>")
html_code.append("<li>" + "Author: " + mod["Author"] + "</li>")