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.
56 lines
3.4 KiB
Python
56 lines
3.4 KiB
Python
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")
|
|
header.write("<!DOCTYPE html>\n<html lang=\"en\" style=\"--active-base: #364563; --active-text: #FFFFFF; --active-text-50: #FFFFFF60; --active-text-25: #FFFFFF30; --active-secondary: #222a3a; --active-secondary-50: #222a3a80; --active-secondary-text: #FFFFFF; --active-secondary-text-50: #FFFFFF70; --active-secondary-text-25: #FFFFFF30; --active-accent: #00fffb; --active-accent-75: #00fffbc0; --active-accent-text: #000000DD; --beaten-color: hsla(0, 0%, 82%, 0.9); --completed-color: hsla(48, 80%, 82%, 0.9); --unplayed-color: hsla(200, 30%, 30%, 0.9); --unfinished-color: hsla(0, 38%, 35%, 0.9); --endless-color: hsla(275, 39%, 32%, 0.9); --platform-bw: none; --active-accent-shadow: #FFFFFF66; --retro-border: url('/img/border.png');\">\n <head>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width,initial-scale=1\">\n <meta name=\"theme-color\" content=\"#364563\">\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>Selfhostery</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\">" + variables.description + "</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")
|