From 975d15932a21829192eb20aadacf9294ea66e5de Mon Sep 17 00:00:00 2001 From: rocketslime11 Date: Fri, 13 Jun 2014 20:49:41 -0400 Subject: [PATCH] added HTML Generator script added "Minetest Mod HTML Generator.py", and made a small fix to "README.md" --- Minetest Mod HTML Generator.py | 70 ++++++++++++++++++++++++++++++++++ README.md | 2 +- 2 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 Minetest Mod HTML Generator.py diff --git a/Minetest Mod HTML Generator.py b/Minetest Mod HTML Generator.py new file mode 100644 index 0000000..a3c0fd8 --- /dev/null +++ b/Minetest Mod HTML Generator.py @@ -0,0 +1,70 @@ +""" +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"] + author = mod["Author"] + depends = mod["Depends"] + forum = mod["Forum"] + database = mod["Database"] + gitHub = mod["GitHub"] + +#Wrtie HTML code from mod list +def writeHTML(): + + #Prints general beginning HTML + #Note that "style.css" can be used to style the generated page + print("List of Mods
") + + #Prints info for each mod + for modName, mod in master_dict.items(): + print("

" + mod["Name"] + "

") + print("") + print("
") + + #Prints general ending HTML code + print("
") + +#Open data file and get master directory from data file +data_file = "Mod_Data.txt" +global master_dict +master_dict = {} +master_dict = json.load(open(data_file)) + +#Grab mod info +grabMod("brazier") + +writeHTML() diff --git a/README.md b/README.md index 76ec08a..43e099a 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ A set of python scripts for making a data file with information on Minetest mods. -##Libraries +##Libraries Required - json ##Mod Info