def convert(self, converter): def namekey(node): return str(node[name][0].content) dvds = xsc.Frag(self[dvd]).sorted(key=namekey) lds = xsc.Frag(self[ld]).sorted(key=namekey) with xsc.build(): with xsc.Frag() as e: +xml.XML() +html.DocTypeXHTML10transitional() with html.html(): with html.head(): +meta.contenttype() +html.title("Media") +meta.stylesheet(href="Media.css") with htmlspecials.plainbody(): +html.h1("Media") if lds: +html.h2(len(lds), " LDs") +html.ol(lds) if dvds: +html.h2(len(dvds), " DVDs") +html.ol(dvds) return e.convert(converter)
def convert(self, converter): target = converter.target (title, text) = self.langs.get(converter.lang, self.langs["en"]) url = self["href"] e = target.html( target.head(meta.contenttype(), target.title(title, url)), target.body(text, target.a(url, href=url))) return e.convert(converter)
def convert(self, converter): with xsc.build(): with xsc.Frag() as e: +html.DocTypeXHTML10transitional() with html.html(): with html.head(): +meta.contenttype() +html.title(self[title][0].content) +meta.stylesheet(href="root:python-quotes.css") +html.body( self[title], self[editor], self[description], self[quotation] ) return e.convert(converter)
def index(self): def isimg(name): if name.endswith(".gif") or name.endswith(".jpg") or name.endswith( ".png"): return os.path.isfile(os.path.join(self.directory, name)) return False names = [name for name in os.listdir(self.directory) if isimg(name)] names.sort() collect = xsc.Frag() i = 0 with xsc.build(): with xsc.Frag() as e: +xml.XML() +html.DocTypeXHTML10transitional() with html.html(): with html.head(): +meta.contenttype() +html.title("All images from ", doc.z(self.directory)) +html.link(rel="stylesheet", type="text/css", href="images.css") with html.body(): with htmlspecials.plaintable(): for name in names: collect.append( html.td( htmlspecials.autoimg(src=("/images/", name)), html.br(), name, align="center")) i += 1 if i == cols: +html.tr(collect) collect = xsc.Frag() i = 0 if collect: +html.tr(collect) return e.conv().bytes()
border: 1px solid #eee; background-color: #fafafa; padding: 1px 5px 2px 5px; overflow: auto; } """ now = datetime.datetime.now() node = xsc.Frag( html.h1( "Cronjobs ", html.span("(generated at %s)" % now.strftime("%d.%m.%Y %H:%M"), class_="note"))) for host in hosts: node.append(html.h2(host.name)) for (user, crontab) in sorted(host.getcrontabs()): node.append(html.h3(user, "@", host.name)) node.append(html.pre(crontab.decode("latin-1").strip())) node = xsc.Frag( xml.XML10(), "\n", html.head( meta.contenttype(), html.title("Cronjobs"), html.style(style, type="text/css"), ), html.body(node)) print e.asBytes(encoding="iso-8859-1")