class optionsCollection(Element):
    """
	Render a collection of select options
	"""
    xmlns = xmlns
    model = sims.Empty()

    class Attrs(Element.Attrs):
        class filter(xsc.TextAttr):
            pass

        class label(xsc.TextAttr):
            pass

        class name(xsc.TextAttr):
            pass

        class property(xsc.TextAttr):
            pass

        class style(xsc.TextAttr):
            pass

        class styleClass(xsc.TextAttr):
            pass

        class value(xsc.TextAttr):
            pass
class image(MouseElement):
    """
	image input
	"""
    xmlns = xmlns
    model = sims.Empty()

    class Attrs(MouseElement.Attrs):
        class align(xsc.TextAttr):
            pass

        class border(xsc.TextAttr):
            pass

        class bundle(xsc.TextAttr):
            pass

        class indexed(xsc.TextAttr):
            pass

        class locale(xsc.TextAttr):
            pass

        class page(xsc.TextAttr):
            pass

        class pageKey(xsc.TextAttr):
            pass

        class src(xsc.TextAttr):
            pass

        class srcKey(xsc.TextAttr):
            pass
Esempio n. 3
0
class author(xsc.Element):
    """
	Can be used to embed author information in the header. It will generate
	``<link rel="made"/>`` and ``<meta name="author"/>`` elements.
	"""
    xmlns = xmlns
    model = sims.Empty()

    class Attrs(xsc.Element.Attrs):
        class lang(xsc.TextAttr):
            pass

        class name(xsc.TextAttr):
            pass

        class email(xsc.TextAttr):
            pass

    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)
Esempio n. 4
0
class filetime(xsc.Element):
    """
	The time of the last modification of the file whose URL is in the attribute
	``href`` as a text node. This will always be an UTC timestamp.
	"""
    xmlns = xmlns
    model = sims.Empty()

    class Attrs(xsc.Element.Attrs):
        class href(xsc.URLAttr):
            """
			The URL of the file.
			"""
            required = True

        class format(xsc.TextAttr):
            """
			A :func:`strftime` compatible formatstring for formatting the timestamp.
			"""
            default = "%d. %b. %Y, %H:%M"

    def convert(self, converter):
        format = str(self["format"].convert(converter))
        return xsc.Text(self["href"].convert(converter).lastmodified(
            root=converter.root).strftime(format))
Esempio n. 5
0
class redirectpage(xsc.Element):
    xmlns = xmlns
    model = sims.Empty()

    class Attrs(xsc.Element.Attrs):
        class href(xsc.URLAttr):
            required = True

    langs = {
        "en":
        ("Redirection to ",
         "Your browser doesn't understand redirects. This page has been redirected to "
         ),
        "de":
        ("Weiterleitung auf ",
         "Ihr Browser unterstützt keine Weiterleitung. Diese Seite wurde weitergeleitet auf "
         )
    }

    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)
Esempio n. 6
0
class time(xsc.Element):
    """
	the current time (i.e. the time when :meth:`convert` is called). You can
	specify the format of the string in the attribute ``format``, which is a
	:func:`strftime` compatible string.
	"""
    xmlns = xmlns
    model = sims.Empty()

    class Attrs(xsc.Element.Attrs):
        class format(xsc.TextAttr):
            """
			A :func:`strftime` compatible formatstring for formatting the timestamp.
			"""
            default = "%d. %b. %Y, %H:%M"

        class utc(xsc.BoolAttr):
            """
			Should UTC be used or local time?
			"""

    def convert(self, converter):
        format = str(self["format"].convert(converter))
        if "utc" in self.attrs:
            f = datetime.datetime.utcnow
        else:
            f = datetime.datetime.now

        return xsc.Text(f().strftime(format))
class javascript(Element):
    """
	Render JavaScript validation based on the validation rules loaded by the
	ValidatorPlugIn.
	"""
    xmlns = xmlns
    model = sims.Empty()

    class Attrs(Element.Attrs):
        class cdata(xsc.TextAttr):
            pass

        class dynamicJavascript(xsc.TextAttr):
            pass

        class formName(xsc.TextAttr):
            pass

        class method(xsc.TextAttr):
            pass

        class page(xsc.TextAttr):
            pass

        class src(xsc.TextAttr):
            pass

        class staticJavascript(xsc.TextAttr):
            pass

        class htmlComment(xsc.TextAttr):
            pass
class options(Element):
    """
	struts html options element
	"""
    xmlns = xmlns
    model = sims.Empty()

    class Attrs(Element.Attrs):
        class collection(xsc.TextAttr):
            pass

        class filter(xsc.TextAttr):
            pass

        class labelName(xsc.TextAttr):
            pass

        class labelProperty(xsc.TextAttr):
            pass

        class name(xsc.TextAttr):
            pass

        class property(xsc.TextAttr):
            pass

        class style(xsc.TextAttr):
            pass

        class styleClass(xsc.TextAttr):
            pass
Esempio n. 9
0
class directive(xsc.Element):
    model = sims.Empty()
    register = False  # only serves as a base class

    def publish(self, publisher):
        yield publisher.encode("<%@ ")
        yield publisher.encode(self._publishname(publisher))
        yield from self.attrs.publish(publisher)
        yield publisher.encode("%>")
class include(xsc.Element):
	xmlns = xmlns
	model = sims.Empty()
	class Attrs(xsc.Element.Attrs):
		class src(xsc.URLAttr): pass

	def convert(self, converter):
		e = parse.tree(parse.URL(self["src"].forInput()), parse.Expat(ns=True), parse.Node())

		return e.convert(converter)
Esempio n. 11
0
class externalRef(base):
    """
	Reference to an extern pattern stored in a file.
	"""
    xmlns = xmlns
    model = sims.Empty()

    class Attrs(base.Attrs):
        class href(xsc.URLAttr):
            required = True
Esempio n. 12
0
class ref(base):
    """
	A :class:`ref` pattern refers to a definition from the nearest grammar
	ancestor.
	"""
    xmlns = xmlns
    model = sims.Empty()

    class Attrs(base.Attrs):
        class name(xsc.TextAttr):
            required = True
Esempio n. 13
0
class parentRef(base):
    """
	Escapes out of the current grammar and references a definition from the
	parent of the current grammar.
	"""
    xmlns = xmlns
    model = sims.Empty()

    class Attrs(base.Attrs):
        class name(xsc.TextAttr):
            required = True
Esempio n. 14
0
class declaration(xsc.Element):
    """
	The XML declaration as an element. This makes it possible to generate a
	declaration from within an XML file.
	"""
    xmlns = xmlns
    model = sims.Empty()

    def convert(self, converter):
        node = XML()
        return node.convert(converter)
class base(Element):
    """
	Document base URI
	"""
    xmlns = xmlns
    model = sims.Empty()

    class Attrs(Element.Attrs):
        class target(xsc.URLAttr):
            pass

        class server(xsc.TextAttr):
            pass
class filesize(xsc.Element):
	"""
	The size (in bytes) of the file whose URL is the attribute href as a
	text node.
	"""
	xmlns = xmlns
	model = sims.Empty()
	class Attrs(xsc.Element.Attrs):
		class href(xsc.URLAttr): required = True

	def convert(self, converter):
		size = self["href"].convert(converter).contentlength(root=converter.root)
		if size is not None:
			return xsc.Text(size)
		else:
			return xsc.Text("?")
Esempio n. 17
0
class flash(xsc.Element):
    xmlns = xmlns
    model = sims.Empty()

    class Attrs(xsc.Element.Attrs):
        class src(xsc.URLAttr):
            required = True

        class width(xsc.IntAttr):
            required = True

        class height(xsc.IntAttr):
            required = True

        class quality(xsc.TextAttr):
            default = "high"

        class bgcolor(xsc.ColorAttr):
            pass

    def convert(self, converter):
        target = converter.target
        e = target.object(
            target.param(name="movie", value=self.attrs.src),
            target.embed(
                src=self.attrs.src,
                quality=self.attrs.quality,
                bgcolor=self.attrs.bgcolor,
                width=self.attrs.width,
                height=self.attrs.height,
                type="application/x-shockwave-flash",
                pluginspage=
                "http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"
            ),
            classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
            codebase=
            "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0",
            width=self.attrs.width,
            height=self.attrs.height)

        # copy optional attributes
        for attrname in ("quality", "bgcolor"):
            if attrname in self.attrs:
                e.insert(
                    0, target.param(name=attrname, value=self.attrs[attrname]))

        return e.convert(converter)
class loremipsum(xsc.Element):
	xmlns = xmlns
	model = sims.Empty()
	class Attrs(xsc.Element.Attrs):
		class len(xsc.IntAttr): pass

	text = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diem nonummy nibh euismod tincidnut ut lacreet dolore magna aliguam erat volutpat. Ut wisis enim ad minim veniam, quis nostrud exerci tution ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis te feugifacilisi. Duis antem dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zril delinit au gue duis dolore te feugat nulla facilisi. "

	def convert(self, converter):
		if "len" in self.attrs:
			chars = int(self["len"].convert(converter))
			count = (chars+len(self.text)-1)//len(self.text)
			text = count*self.text
			text = text[:chars]
		else:
			text = self.text.strip()
		return xsc.Text(text)
Esempio n. 19
0
class image(BaseElement):
    model = sims.Empty()

    class Attrs(BaseElement.Attrs, alignhvattrs):
        class uri(xsc.URLAttr):
            required = True

        class alt(xsc.TextAttr):
            pass

        class height(xsc.TextAttr):
            pass

        class width(xsc.TextAttr):
            pass

        class scale(xsc.TextAttr):
            pass
class hidden(PartMouseElement):
    """
	hidden form field
	"""
    xmlns = xmlns
    model = sims.Empty()

    class Attrs(PartMouseElement.Attrs):
        class accesskey(xsc.TextAttr):
            pass

        class indexed(xsc.TextAttr):
            pass

        class name(xsc.TextAttr):
            pass

        class write(xsc.TextAttr):
            pass
Esempio n. 21
0
class refresh(xsc.Element):
    """
	A refresh header.
	"""
    xmlns = xmlns
    model = sims.Empty()

    class Attrs(xsc.Element.Attrs):
        class secs(xsc.IntAttr):
            default = 0

        class href(xsc.URLAttr):
            pass

    def convert(self, converter):
        e = html.meta(http_equiv="Refresh",
                      content=(self.attrs["secs"], "; url=",
                               self.attrs["href"]))
        return e.convert(converter)
class errors(Element):
    """
	Displays error messages which have been generated from an action or a
	validation method
	"""
    xmlns = xmlns
    model = sims.Empty()

    class Attrs(Element.Attrs):
        class bundle(xsc.TextAttr):
            pass

        class locale(xsc.TextAttr):
            pass

        class name(xsc.TextAttr):
            pass

        class property(xsc.TextAttr):
            pass
Esempio n. 23
0
class cls(inline):
    """
	Use this class when referring to the object for which a class method has
	been called, e.g.::

		this function fooifies the class <cls/>.
	"""
    xmlns = xmlns
    model = sims.Empty()

    def convert_docbook(self, converter):
        e = converter.target.varname("cls")
        return e.convert(converter)

    def convert_html(self, converter):
        e = converter.target.code("cls", class_="cls")
        return e.convert(converter)

    def convert_fo(self, converter):
        e = converter.target.inline("cls", converter[self].codeattrs)
        return e.convert(converter)
Esempio n. 24
0
class empty(base):
    """
	Specifies empty content.
	"""
    xmlns = xmlns
    model = sims.Empty()
Esempio n. 25
0
class notAllowed(base):
    """
	Used to make extension points in patterns.
	"""
    xmlns = xmlns
    model = sims.Empty()
Esempio n. 26
0
class license(xsc.Element):
    xmlns = xmlns
    model = sims.Empty()
Esempio n. 27
0
class requires(xsc.Element):
    xmlns = xmlns
    model = sims.Empty()
Esempio n. 28
0
class permits(xsc.Element):
    xmlns = xmlns
    model = sims.Empty()
Esempio n. 29
0
class text(base):
    """
	Matches arbitrary text (one or more text nodes), including empty text.
	"""
    xmlns = xmlns
    model = sims.Empty()
Esempio n. 30
0
	class el1(xsc.Element):
		model = sims.Empty()