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

import colorsys
import variables
from pathlib import Path
"""
Generate the skeleton for an HTML page.
"""
home = str(Path.home())
def headerwrite(output,section,local=False):
header = open(output, "a")
rgb = colorsys.hls_to_rgb((variables.hue)/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.hue) + ", 45%, 30%); --active-secondary: hsl(" + str(variables.hue) + ", 15%, 30%); --active-accent: hsl(" + str(variables.hue) + ", 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 <link href=\"https://fonts.googleapis.com/icon?family=Material+Icons\" rel=\"stylesheet\">\n <link href=\"https://fonts.googleapis.com/css?family=Lato|Teko|Titillium+Web\" rel=\"stylesheet\">\n <title>Static backlog</title>\n <link href=\"")
if local:
header.write(variables.localpath + "build/")
else:
header.write(variables.serverpath)
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.description + "</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 + "build/backlog/index.html")
else:
header.write(variables.serverpath + "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 + "build/library/index.html")
else:
header.write(variables.serverpath + "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 + "build/history/index.html")
else:
header.write(variables.serverpath + "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("build/backlog/index.html","backlog",True)
footerwrite("test.html")