You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
3.1 KiB
Python
61 lines
3.1 KiB
Python
import colorsys
|
|
import variables
|
|
from pathlib import Path
|
|
|
|
"""
|
|
Generate the skeleton for a games backlog HTML page.
|
|
"""
|
|
|
|
home = str(Path.home())
|
|
|
|
def headerwrite(output,section,local=False):
|
|
header = open(output, "a")
|
|
rgb = colorsys.hls_to_rgb((variables.gamehue)/360,0.3,0.45)
|
|
hexstring = ""
|
|
for element in rgb:
|
|
hexstring += str(hex(int(element * 255)))[2:]
|
|
header.write("<!DOCTYPE html>\n<html lang=\"en\" style=\"--active-base: hsl(" + str(variables.gamehue) + ", 45%, 30%); --active-secondary: hsl(" + str(variables.gamehue) + ", 15%, 30%); --active-accent: hsl(" + str(variables.gamehue) + ", 90%, 70%);\">\n <head>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width,initial-scale=1\">\n <meta name=\"theme-color\" content=\"#" + hexstring + "\">\n <title>Static backlog</title>\n <link rel=\"alternate\" type=\"application/rss+xml\" title=\"Static backlog\" href=\"" + variables.gameserverpath + "feed.xml\">\n <link href=\"")
|
|
if local:
|
|
header.write(variables.localpath + "gamebuild/")
|
|
else:
|
|
header.write(variables.gameserverpath)
|
|
header.write("backloggery.css\" rel=\"stylesheet\">\n </head>\n <body>\n <div id=\"app\">\n <div class=\"profile\">\n <aside>\n <div>\n <div id=\"about_note\">\n <h2>About</h2>\n <div class=\"markdown\"><p>" + variables.gamedescription + "</p></div>\n </div>\n </div>\n </aside>\n <main>\n <section>\n <div class=\"tabs\">\n")
|
|
header.write(" <a href=\"")
|
|
if section == "backlog":
|
|
header.write("\" class=\"router-link-exact-active router-link-active\" aria-current=\"page")
|
|
else:
|
|
if local:
|
|
header.write(variables.localpath + "gamebuild/backlog/index.html")
|
|
else:
|
|
header.write(variables.gameserverpath + "backlog")
|
|
header.write("\">Backlog</a>\n <a ")
|
|
if section == "library":
|
|
header.write("class=\"router-link-exact-active router-link-active\" aria-current=\"page\" href=\"")
|
|
else:
|
|
if section == "sublibrary":
|
|
header.write("class=\"router-link-active\" aria-current=\"page\" ")
|
|
header.write("href=\"")
|
|
if local:
|
|
header.write(variables.localpath + "gamebuild/library/index.html")
|
|
else:
|
|
header.write(variables.gameserverpath + "library")
|
|
header.write("\">Library</a>\n <a href=\"")
|
|
if section == "history":
|
|
header.write("\" class=\"router-link-exact-active router-link-active\" aria-current=\"page")
|
|
else:
|
|
if local:
|
|
header.write(variables.localpath + "gamebuild/history/index.html")
|
|
else:
|
|
header.write(variables.gameserverpath + "history")
|
|
header.write("\">History</a>\n </div>\n")
|
|
header.close()
|
|
|
|
def footerwrite(output):
|
|
footer = open(output, "a")
|
|
footer.write(" </section>\n </main>\n </div>\n </div>\n </body>\n</html>\n")
|
|
footer.close()
|
|
|
|
if __name__ == "__main__":
|
|
headerwrite("gamebuild/backlog/index.html","backlog",True)
|
|
footerwrite("test.html")
|