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.

44 lines
3.0 KiB
Python

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

def headerwrite(output,title,headerone,desc,main=False,local=False,single=False,ficnostring=False):
header = open(output, "a")
header.write("<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"UTF-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n<link rel=\"stylesheet\" href=\"")
if local:
header.write("/home/mdd/Documents/proj/fic-archive/build/")
else:
header.write("/fic/")
header.write("archive.css\">\n<link rel=\"me\" href=\"https://ple.praze.net/users/tre\">\n<link rel=\"alternate\" type=\"application/rss+xml\" title=\"Tré's fic archive\" href=\"https://tre.praze.net/fic/feed.xml\">\n<meta name=\"theme-color\" content=\"#edc4c4\" />\n<title>" + title + "</title>\n<meta property=\"og:title\" content=\"Trés fanfiction\">\n<meta property=\"og:type\" content=\"website\">\n<meta property=\"og:image\" content=\"https://tre.praze.net/ab.png\">\n<meta name=\"description\" property=\"og:description\" content=\"Fanfiction on tre.praze.net\">\n<meta property=\"og:locale\" content=\"en_GB\">\n<meta property=\"og:site_name\" content=\"tre.praze.net\">\n<meta name=\"fediverse:creator\" content=\"@tre@praze.net\">\n")
if single:
header.write("<link rel=\"alternate\" type=\"application/activity+json\" href=\"https://fed.brid.gy/r/https://tre.praze.net/fic/single/" + ficnostring + "/\"")
header.write("<noscript>\n<style>.jsonly{display:none;}</style>\n</noscript>\n</head>\n<body>\n<div id=\"content\">\n<div id=\"inside\">\n<noscript>\n<div id=\"warning\">\n<p><b>Warning:</b> this part of my site is <b>18+</b>. Fics contain NSFW material and mature themes (death, suicide, mental illness, incest …). Browse at your own risk.</p>\n</div>\n</noscript>\n<h1>" + headerone + "</h1>\n" + desc + "\n")
if not main:
header.write("<p>\n<a href=\"")
if local:
header.write("/home/mdd/Documents/proj/fic-archive/build/index.html")
else:
header.write("/fic")
header.write("\">main page\n</a>\n</p>\n")
header.write("<hr>\n")
header.close()
def footerwrite(output,main=False,local=False):
footer = open(output, "a")
footer.write("</div>\n<footer>\n<hr>\n")
if not main:
footer.write("<p>\n<a href=\"")
if local:
footer.write("/home/mdd/Documents/proj/fic-archive/build/index.html")
else:
footer.write("/fic")
footer.write("\">main page\n</a>\n</p>\n")
footer.write("<img src=\"")
if local:
footer.write("/home/mdd/Documents/proj/fic-archive/build/emacs.jpg")
else:
footer.write("/fic/emacs.jpg")
footer.write("\">\n</footer>\n</div>\n<script>\nif (localStorage.getItem(\"ageVerified\") == null) { window.location = `")
if local:
footer.write("/home/mdd/Documents/proj/fic-archive/build/")
else:
footer.write("/fic/")
footer.write("verify/index.html?returnto=${window.location}`; }\n</script>\n</body>\n</html>")
footer.close()