示例#1
0
def test_publishurlattr():
	node = html.link(href=None)
	assert node.bytes(xhtml=1) == b"""<link />"""

	node = html.link(href="root:gurk.html")
	assert node.bytes(xhtml=1) == b"""<link href="root:gurk.html" />"""
	assert node.bytes(xhtml=1, base="root:gurk.html") == b"""<link href="" />"""
	assert node.bytes(xhtml=1, base="root:hurz.html") == b"""<link href="gurk.html" />"""
	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()
示例#3
0
 def convert(self, converter):
     e = xsc.Frag()
     if "name" in self.attrs:
         e.append(html.meta(name="author", content=self.attrs["name"]))
         if "lang" in self.attrs:
             e[-1].attrs["lang"] = self["lang"]
     if "email" in self.attrs:
         e.append(html.link(rel="made", href=("mailto:", self["email"])))
     return e.convert(converter)
	def convert(self, converter):
		e = xsc.Frag()
		if "name" in self.attrs:
			e.append(html.meta(name="author", content=self.attrs["name"]))
			if "lang" in self.attrs:
				e[-1].attrs["lang"] = self["lang"]
		if "email" in self.attrs:
			e.append(html.link(rel="made", href=("mailto:", self["email"])))
		return e.convert(converter)
示例#5
0
    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()
示例#6
0
 def convert(self, converter):
     e = html.link(self.attrs, rel="made", href=("mailto:", self["href"]))
     return e.convert(converter)
示例#7
0
 def convert(self, converter):
     e = html.link(self.attrs, rel="stylesheet", type="text/css")
     return e.convert(converter)
	def convert(self, converter):
		e = html.link(self.attrs, rel="made", href=("mailto:", self["href"]))
		return e.convert(converter)
	def convert(self, converter):
		e = html.link(self.attrs, rel="stylesheet", type="text/css")
		return e.convert(converter)