Skip to main content

Chameleon support for templating in Lektor.

Project description

This plugin makes it possible to write Lektor templates using Chameleon. It achieves this by replacing the Jinja renderer with the Chameleon renderer during template rendering.

The names defined in the Jinja environment are available in Chameleon templates:

<!-- Jinja -->
<h1>{{ this.title }}</h1>

<!-- Chameleon -->
<h1>${ this.title }</h1>

<!-- or -->
<h1 tal:content="this.title">Page title</h1>

<!-- Jinja -->
{{ bag('translate', this.alt, 'message') }}

<!-- Chameleon -->
<span tal:replace="bag('translate', this.alt, 'message')">message</span>

Many Lektor and Jinja filters are also available:

<!-- Jinja -->
<link rel="stylesheet" href="{{ '/static/custom.css'|url }}"/>

<!-- Chameleon -->
<link rel="stylesheet" href="${ '/static/custom.css'|url }"/>

Filters also accept parameters:

<!-- Jinja -->
<a href="{{ '.'|url(alt=this.alt) }}">link text</a>

<!-- Chameleon -->
<a href="${ '.'|url(alt=this.alt) }">link text</a>

But filter parameters must be given as keyword parameters:

<!-- incorrect -->
<div tal:replace="this.body|indent(4)">Page body</div>

<!-- correct -->
<div tal:replace="this.body|indent(width=4)">Page body</div>

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

lektor-chameleon-0.2.tar.gz (2.5 kB view hashes)

Uploaded Source

Supported by

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