Simple HTML templating for Python
Project description
Simple HTML templating for Python
from lys import L
print(L.body / (
L.h1 / 'What is love ?',
L.ul / (
L.li / 'Something in the air',
L.li / 'You can\'t catch it',
L.li / (
L.a(href="https://en.wikipedia.org/wiki/Love") / 'Keep trying'
),
),
))
To install, pip3 install lys
A few more tricks:
# use raw() to mark the content as already escaped
from lys import raw
L.p / raw('<script>alert("boo")</script>')
# attributes '_' are replaced with '-'
L.button(data_id=123) / 'click me'
# => <button data-id="123">click me</button>
# use shortcut to add classes and ids easily
L.button('#magic-button.very-big', onclick='add_it()') / 'Magic !'
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
lys-0.1.tar.gz
(3.0 kB
view hashes)