Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/frodo821/Rattlepy
A easy-to-use pure python HTML template engine
https://github.com/frodo821/Rattlepy
Last synced: 4 months ago
JSON representation
A easy-to-use pure python HTML template engine
- Host: GitHub
- URL: https://github.com/frodo821/Rattlepy
- Owner: frodo821
- License: mit
- Created: 2019-02-14T11:46:51.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-04-22T02:32:03.000Z (almost 6 years ago)
- Last Synced: 2024-09-20T15:27:43.879Z (5 months ago)
- Language: Python
- Homepage: https://rattlepy.readthedocs.io/en/latest
- Size: 251 KB
- Stars: 9
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGELOG
- License: LICENSE
Awesome Lists containing this project
- awesome-python-html - frodo821/Rattlepy - to-use pure python HTML template engine (Libraries / General HTML Generation)
- awesome-python-html - frodo821/Rattlepy - to-use pure python HTML template engine (Libraries / General HTML Generation)
README
Rattle.py - A Pure Python HTML Template Engine for HTML
=======================================================.. image:: https://readthedocs.org/projects/rattlepy/badge/?version=latest
:target: https://rattlepy.readthedocs.io/en/latest/?badge=latest
:alt: Documentation StatusRattle.py is a pure python templating library for html.
And this library has no special notation like Django or Jinja.
For example:.. code-block:: HTML
Hello, Rattle.py!
Hello, Rattle.py!
The above HTML equals to below Python code with rattle.py:
.. code-block:: python
greeting = "Hello, Rattle.py!"
with html() as html:
with head():
with title():
text(greeting)
with body():
with h1(className="heading"):
text(greeting)# show as HTML
print(html)And then, you can also make reusable components by yourself:
.. code-block:: python
def greet(name):
with node("div", className="greet-wrapper") as component:
with node("h1"):
text(f"Hello, {name}=san")
with node("button", className="ok-btn"):
text("ok!")
return component# and using:
with greet("User"): passEnjoy!