XSS template language ===================== This language is used internally by the template compiler. >>> print render_xss("""\ ...
...
... Default content ...
...
""", content={'document-content': u"Dynamic content"})
Dynamic content
If we omit the slot from the passed content argument, the element is left untouched. >>> print render_xss("""\ ...
...
... Default content ...
...
""", content={})
Default content
If the xss:omit attribute is set, the tag will be replaced by the dynamic content. >>> print render_xss("""\ ...
...
... Default content ...
...
""", content={'document-content': u"Dynamic content"})
Dynamic content
When the xss:structure attribute is set, the dynamic content is not escaped. >>> print render_xss("""\ ...
...
... Default content ...
...
""", content={'document-content': u"Dynamic content"})
Dynamic content
Attributes may be dynamically applied to elements using the xss:attributes. >>> print render_xss("""\ ...
...
... Content ...
...
""", attributes={'example': {'class': 'example-class'}})
Content
As a special case, if "class" is a dynamic attribute, it will not override an existing "class" attribute on the element, but extend it (concatenate with a space character). >>> print render_xss("""\ ...
...
... Content ...
... ... Content ... ...
""", attributes={'example': {'id': 'new', 'class': 'additional-class'}})
Content
Content
We can supply multiple dynamic attribute identifiers, separated by a comma. >>> print render_xss("""\ ...
...
... Content ...
...
""", attributes={'example1': {'class': 'foo', 'style': 'bar'}, ... 'example2': {'class': 'bar', 'style': 'foo'}})
Content