Skip to main content

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', '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.

Release files for chameleon.html 0.9.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for chameleon.html 0.9.3
File Size Uploaded
chameleon.html-0.9.3.tar.gz 12.0 kB Details

Release files / chameleon.html-0.9.3.tar.gz

Download URL chameleon.html-0.9.3.tar.gz
Size 12.0 kB
Tags Source
SHA-256 checksum
How to use checksums
6f339fd9007969472187f7c545127c5b7b9ecafa5124ee046262e3f5e8484a41
BLAKE2b-256 checksum
How to use checksums
5323c436c31932651d7dd63fa2bf0dcc96cbbb6f6fb0c1c8e2295c7f90f270ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.9.3 This release

1 release file

0.9.2

1 release file

0.9.1

2 release files

0.9

1 release file

0.8

1 release file

0.7

1 release file

0.6

1 release file

0.5

1 release file

0.4

1 release file

0.3

1 release file

0.2

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page