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 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()
def convert(self, converter): e = xsc.Frag( xml.XML(), "\n", html.DocTypeXHTML10transitional(), "\n", html.html( html.head( meta.contenttype(), html.title( "Python code coverage", ul4.if_("filename"), ": ", ul4.printx("filename"), ul4.else_(), " (", ul4.print_("format(timestamp, '%Y-%m-%d')"), ")", ul4.end("if"), ), meta.stylesheet(href="/coverage.css"), meta.stylesheet(href="/coverage_sortfilelist.css"), htmlspecials.javascript(src="/coverage.js"), ), html.body( html.div( html.div( html.a( htmlspecials.autoimg(src="http://www.python.org/images/python-logo.gif", alt="Python", border=0), href="http://www.python.org/", ), class_="logo", ), html.div( ul4.for_("(i, item) in enumerate(crumbs)"), html.span( html.span( ul4.if_("i"), ">", ul4.else_(), "\xbb", ul4.end("if"), class_="bullet", ), ul4.if_("item.href"), html.a(ul4.printx("item.title"), href=ul4.printx("item.href")), ul4.else_(), html.span(ul4.printx("item.title"), class_="here"), ul4.end("if"), ul4.end("for"), class_="crumb", ), class_="crumbs", ), class_="header", ), html.div( self.content, class_="content", ), onload=ul4.attr_if(ul4.printx("onload"), cond="onload"), ), ), ) 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()
font-size: 11px; line-height: 18px; 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")
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")