57 lines
2 KiB
Python
57 lines
2 KiB
Python
from xml.etree.ElementTree import Element, SubElement
|
|
from xml.etree import ElementTree
|
|
|
|
def getLayoutXML():
|
|
root = Element("html")
|
|
root.set("lang","en")
|
|
head = SubElement(root, "head")
|
|
body = SubElement(root, "body")
|
|
title = SubElement(head, "title")
|
|
title.text = "%(title)s"
|
|
charset = SubElement(head, "meta")
|
|
charset.set("charset","utf-8")
|
|
link1 = SubElement(head, "link")
|
|
link1.set("rel", "stylesheet")
|
|
link1.set("type", "text/css")
|
|
link1.set("media", "screen and (max-width: 1023px)")
|
|
link1.set("href", "mobilestyle.css")
|
|
link2 = SubElement(head, "link")
|
|
link2.set("rel", "stylesheet")
|
|
link2.set("type", "text/css")
|
|
link2.set("media", "screen and (min-width: 1024px)")
|
|
link2.set("href", "mainstyle.css")
|
|
meta = SubElement(head, "meta")
|
|
meta.set("name", "viewport")
|
|
meta.set("content", "width=device-width, initial-scale=1.0")
|
|
topLink = SubElement(body, "a")
|
|
topLink.set("id", "top")
|
|
title2 = SubElement(body, "h1")
|
|
title2.text = "%(title)s"
|
|
table = SubElement(body, "div")
|
|
table.set("class", "table")
|
|
tablerow = SubElement(table, "div")
|
|
tablerow.set("class", "tablerow")
|
|
navspoiler = SubElement(tablerow, "div")
|
|
navspoiler.set("class", "spoiler")
|
|
navspoiler.set("tabindex", "1")
|
|
navspoiler.text = "Navigation"
|
|
nav = SubElement(tablerow, "nav")
|
|
nav.set("class","spoilerContent")
|
|
nav.text="%(nav)s"
|
|
main = SubElement(tablerow, "main")
|
|
main.text="%(main)s"
|
|
asidespoiler = SubElement(tablerow, "div")
|
|
asidespoiler.set("class", "spoiler")
|
|
asidespoiler.set("tabindex", "2")
|
|
aside = SubElement(tablerow, "aside")
|
|
aside.set("class", "spoilerContent")
|
|
aside.text="%(aside)s"
|
|
footer = SubElement(body, "footer")
|
|
footer.text="%(footer)s"
|
|
upbar = SubElement(body, "a")
|
|
upbar.set("class", "upbar")
|
|
upbar.set("href", "#top")
|
|
upbar.set("style", "float:right")
|
|
upbar.text=u"↑"
|
|
|
|
return ElementTree.tostring(root)
|