Skip to main content

Dynamic HTML template compiler with XSS language support.

Project description

This package implements a template compiler for dynamic HTML documents. In particular, it supports the XSS rule language which is used to associate elements with dynamic content.

XSS rule language

The XSS rule language uses a CSS-compliant syntax to let you match HTML elements using CSS selectors and set up dynamic content definitions.

To associate a template with a rule file, use the <link> tag:

<link rel="xss" type="text/xss" src="rules.xss" />

XSS files contain rules like the following:

html > head > title {
  name: document-heading;
  structure: true;
  attributes: document-attributes;
  mode: content;
}

This rule will associate the <title> tag with the dynamic content identifier “document-heading”, escape the inserted content and apply the dynamic attributes bound to the “document-attributes” identifier.

See the file template.txt within the package for documentation on how to render templates and provide dynamic content and attributes.

Syntax

Brief explanation of the properties in the XSS format:

@name        dynamic content slot name
@structure   if set to true, inserts content without escaping
@attributes  inserts dynamic attributes into tag
@mode        one of ('content', 'replace', 'append', 'prepend')

Resource rebase functionality

If a resource location adapter is available (see chameleon.html.interfaces.IResourceLocation), references resources (e.g. images, stylesheets, javascripts) will be “rebased” to the URL returned by the component.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chameleon.html-1.0b3.tar.gz (12.3 kB view details)

Uploaded Source

File details

Details for the file chameleon.html-1.0b3.tar.gz.

File metadata

File hashes

Hashes for chameleon.html-1.0b3.tar.gz
Algorithm Hash digest
SHA256 4d18de6d8c9f39fba2c2d96d68ec6bc7aada3b3b3e065f21ddeca169c9c1ae72
MD5 ebdff2382e0dc9c8c41ddcc4e6f3be2d
BLAKE2b-256 342a4cb346aad272f0c18d5ad6a1803e95b7737efb491e57f0b2c9d2465e7915

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page