html.xonsh/header.py

40 lines
1.4 KiB
Python
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/python
import datetime
import theme
class readHead():
#outHead = ""
sTime = []
sTitle = ""
sTheme = "basicTheme"
def __init__(self, sTitle, sTheme = "basicTheme"):
self.sTitle = sTitle
# self.outHead = ""
self.stime = []
self.sTheme = sTheme
def __str__(self):
return(str(self.genHead())) #TODO: Append CSS, navbar, sidebar, footer
# Start genHead()
def genHead(self):
# Generate html <head> element
getTime = datetime.datetime.now()
timeMod = str(getTime.strftime("%A, %B %d, %Y at %X UTC06:00")) #TODO: I don't want to hard-code this but the %z utc offset isn't printing
timeCreate = timeMod
headerStr = "<!DOCTYPE HTML>\n<html>\n<head>\n\t<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\"/>\n\t<title>"
headerStr1 = "</title>\n\t<meta name=\"generator\" content=\"HTML.xonsh https://git.nixnet.services/amber/html.xonsh\"/>\n\t<meta name=\"created\" content=\""
headerStr2 = "\">\n\t<meta name=\"changed\" content=\""
headerStr3 = "\n</head>\n<body>\n\t"
outHead = headerStr + str(self.sTitle) + headerStr1 + timeMod + headerStr2 + timeCreate
#append css
outHead = outHead + "\">" + str(theme.css())
outHead = outHead + headerStr3
return(outHead)