diff --git a/server.py b/server.py index bab37d1..05a67a2 100755 --- a/server.py +++ b/server.py @@ -131,6 +131,16 @@ def static_html(name): linkheaders = ["; rel=preload; as=style"] keys = removeIdentical(FormsDict.decode(request.query)) + with open("website/" + name + ".html") as htmlfile: + html = htmlfile.read() + + # apply global substitutions + with open("website/common/footer.html") as footerfile: + footerhtml = footerfile.read() + with open("website/common/header.html") as headerfile: + headerhtml = headerfile.read() + html = html.replace("
diff --git a/website/common/footer.html b/website/common/footer.html new file mode 100644 index 0000000..88d8980 --- /dev/null +++ b/website/common/footer.html @@ -0,0 +1,13 @@ + diff --git a/website/common/header.html b/website/common/header.html new file mode 100644 index 0000000..cee4d3c --- /dev/null +++ b/website/common/header.html @@ -0,0 +1,86 @@ + + + + + + diff --git a/website/issues.html b/website/issues.html index 9853bdc..149d977 100644 --- a/website/issues.html +++ b/website/issues.html @@ -4,7 +4,6 @@",footerhtml + "").replace("",headerhtml + "") + # If a python file exists, it provides the replacement dict for the html file if os.path.exists("website/" + name + ".py"): #txt_keys = SourceFileLoader(name,"website/" + name + ".py").load_module().replacedict(keys,DATABASE_PORT) @@ -141,23 +151,20 @@ def static_html(name): linkheaders.append("<" + resource["file"] + ">; rel=preload; as=" + resource["type"]) # apply key substitutions - with open("website/" + name + ".html") as htmlfile: - html = htmlfile.read() - for k in txt_keys: - if isinstance(txt_keys[k],list): - # if list, we replace each occurence with the next item - for element in txt_keys[k]: - html = html.replace(k,element,1) - else: - html = html.replace(k,txt_keys[k]) - - response.set_header("Link",",".join(linkheaders)) - return html + for k in txt_keys: + if isinstance(txt_keys[k],list): + # if list, we replace each occurence with the next item + for element in txt_keys[k]: + html = html.replace(k,element,1) + else: + html = html.replace(k,txt_keys[k]) - - # Otherwise, we just serve the html file + + response.set_header("Link",",".join(linkheaders)) - return static_file("website/" + name + ".html",root="") + + return html + #return static_file("website/" + name + ".html",root="") #set graceful shutdown signal.signal(signal.SIGINT, graceful_exit) diff --git a/website/artist.html b/website/artist.html index f14fa13..c563d2e 100644 --- a/website/artist.html +++ b/website/artist.html @@ -4,7 +4,6 @@
-