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 using the >> operator:
<!-- 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.1.tar.gz
(2.5 kB
view hashes)
Built Distribution
Close
Hashes for lektor_chameleon-0.1-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | be59d19125656cbf6f997438c6c81edb300cc667091e2c6bb0ded517b800262b |
|
MD5 | e503962af9daac960f56990b3aa7695f |
|
BLAKE2b-256 | b7af63b4dadea3a48de21836fe026b61e4808093f71b916104f1dea70364a9d4 |