No description
Find a file
2025-05-05 22:04:16 +03:00
tests Move to uv for management 2025-05-05 21:49:39 +03:00
.gitignore Switch to pyproject.toml 2023-06-29 21:04:42 +03:00
CHANGES.rst Prepare release v0.10 2025-05-05 22:04:16 +03:00
lektor_chameleon.py Prepare release v0.10 2025-05-05 22:04:16 +03:00
LICENSE.txt Prepare release v0.10 2025-05-05 22:04:16 +03:00
pyproject.toml Prepare release v0.10 2025-05-05 22:04:16 +03:00
README.rst Reword the filter functions in the readme 2024-04-29 00:00:16 +03:00
uv.lock Prepare release v0.10 2025-05-05 22:04:16 +03:00

lektor-chameleon
================

lektor-chameleon is a plugin for the `Lektor <https://www.getlektor.com>`_
static site generator
that makes is possible to write the templates
using `Chameleon <https://chameleon.readthedocs.io/>`_.

To use the plugin, add it to your project::

  lektor plugin add lektor-chameleon

Templates must have the ``.pt`` file extension.

Usage examples:

.. code:: html

   <html lang="${this.alt}">

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

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

All custom Lektor filters are available as functions:

- `asseturl <https://www.getlektor.com/docs/api/templates/filters/asseturl/>`_
- `dateformat <https://www.getlektor.com/docs/api/templates/filters/dateformat/>`_
- `datetimeformat <https://www.getlektor.com/docs/api/templates/filters/datetimeformat/>`_
- `latformat <https://www.getlektor.com/docs/api/templates/filters/latformat/>`_
- `latlongformat <https://www.getlektor.com/docs/api/templates/filters/latlongformat/>`_
- `longformat <https://www.getlektor.com/docs/api/templates/filters/longformat/>`_
- `markdown <https://www.getlektor.com/docs/api/templates/filters/markdown/>`_
- `tojson <https://www.getlektor.com/docs/api/templates/filters/tojson/>`_
- `url <https://www.getlektor.com/docs/api/templates/filters/url/>`_

For convenience, the following Jinja filters have also been made available
as functions:

- `filesizeformat <https://jinja.palletsprojects.com/en/3.0.x/templates/#jinja-filters.filesizeformat>`_
- `indent <https://jinja.palletsprojects.com/en/3.0.x/templates/#jinja-filters.indent>`_
- `striptags <https://jinja.palletsprojects.com/en/3.0.x/templates/#jinja-filters.striptags>`_
- `truncate <https://jinja.palletsprojects.com/en/3.0.x/templates/#jinja-filters.truncate>`_
- `wordwrap <https://jinja.palletsprojects.com/en/3.0.x/templates/#jinja-filters.wordwrap>`_

Usage examples:

.. code:: html

   <a href="${url('/')}">Home page</a>

   <a href="${url('/', alt=this.alt)">link text</a>

   <link rel="stylesheet" href="${asseturl('/static/custom.css')}"/>

   <div tal:content="striptags(this.body)">Shortened body text</div>

   <div tal:replace="indent(this.body.html, 2)">Page body</div>

   <body>
     ${ structure:wordwrap(this.body.html, width=72) }
   </body>