diff --git a/.forgejo/scripts/update-wiki.py b/.forgejo/scripts/update-wiki.py index 22eb01c..0f24cb1 100644 --- a/.forgejo/scripts/update-wiki.py +++ b/.forgejo/scripts/update-wiki.py @@ -48,6 +48,10 @@ for mod in glob.glob("pack/mods/*.toml"): mods[moddata["name"]] = moddata with open("wiki/Modlist.md", "w") as f: + if (count["server"] + count["client"] + count["both"]) == 0: + f.write("## No mods.") + return + f.write("## Total Count\r\n") f.write("") f.write("\r\n") @@ -60,20 +64,23 @@ with open("wiki/Modlist.md", "w") as f: f.write("") f.write("\r\n") - f.write("") - f.write("") - f.write("") - f.write("\r\n") + if count["both"] > 0: + f.write("") + f.write("") + f.write("") + f.write("\r\n") - f.write("") - f.write("") - f.write("") - f.write("\r\n") + if count["client"] > 0: + f.write("") + f.write("") + f.write("") + f.write("\r\n") - f.write("") - f.write("") - f.write("") - f.write("\r\n") + if count["server"] > 0: + f.write("") + f.write("") + f.write("") + f.write("\r\n") f.write("
" + str(count["server"] + count["client"] + count["both"]) + "
Shared" + str(count["both"]) + "
Shared" + str(count["both"]) + "
Client" + str(count["client"]) + "
Client" + str(count["client"]) + "
Server" + str(count["server"]) + "
Server" + str(count["server"]) + "
\r\n\r\n") @@ -98,6 +105,10 @@ with open("wiki/Modlist.md", "w") as f: f.write("\r\n") with open("wiki/Licenses.md", "w") as f: + if (count["server"] + count["client"] + count["both"]) == 0: + f.write("## No mods.") + return + for mod in mods: data = mods[mod] f.write("## " + mod + "\r\n") @@ -120,8 +131,8 @@ with open("wiki/Licenses.md", "w") as f: f.write("Unknown") f.write("\r\n") -if not os.path.exists("cache"): - os.makedirs("cache") +if not os.path.exists("cache"): + os.makedirs("cache") with open("cache/licenses.json", "w") as f: json.dump(cache, f) diff --git a/index.toml b/index.toml index a3a93b9..940aab1 100644 --- a/index.toml +++ b/index.toml @@ -2,7 +2,7 @@ hash-format = "sha256" [[files]] file = ".forgejo/scripts/update-wiki.py" -hash = "a2537719ef5fe405d7f84a2a2cd05b9892859d9b9f8cb1ecfcdbe07d49bc988d" +hash = "d295be0209e7643f7805cce1b58a86f94438b8118c0f8e064f689f8a272c5c73" [[files]] file = ".forgejo/workflows/update-wiki.yaml" diff --git a/pack.toml b/pack.toml index 9d556b9..852a3cb 100644 --- a/pack.toml +++ b/pack.toml @@ -6,7 +6,7 @@ pack-format = "packwiz:1.1.0" [index] file = "index.toml" hash-format = "sha256" -hash = "4d96fbb102e635b421e1217dfa5380c8c7d0b9a3c78737d626428e24d2ff7ac3" +hash = "bc5b1227f54e2138c594347a66ca53950c13611b07c86c06698fcb1baa5d3e8b" [versions] fabric = "0.16.5"