Elements based HTML template renderer
Project description
Introduction
A Spigot/Paper library dedicated for simplifying commands registration for your plugin!
See the documentation to see more advanced examples!
Join the support discord and visit the #programming channel for questions,
contributions and ideas. Feel free to make pull requests with missing/new features, fixes, etc
Getting started
- Install the dependencie
pip install temel
- Define templates
CustomButton.html
<div id="custom-button" style="background-color: green">
<button>{{name}}</button>
</div>
Layout.html
<div id="layout">
<header>
Header section
<slot.header/>
</header>
<article>
<slot.content/>
</article>
</div>
Page.html
<layout>
<layout.header>
Page Header Message
</layout.header>
<layout.content>
{{% for button in buttons %}}
<CustomButton name={{button.name}}/>
{{% endfor %}}
</layout.content>
</layout>
- Call the renderer
import temel
if __name__ == '__main__':
context = {
'buttons': [
{
'name': 'Home'
},
{
'name': 'Settings'
},
{
'name': 'Profile'
}]
}
temel.load_templates('C:\\templates')
output = temel.parse("Page.html", context)
with open('output.html', 'w') as f:
f.write(output)
- See the output file
<div id="layout">
<header>
Header section
<layout.header>
Page Header Message
</layout.header>
</header>
<article>
<layout.content>
<div id="custom-button" style="background-color: green">
<button>Home</button>
</div>
<div id="custom-button" style="background-color: green">
<button>Settings</button>
</div>
<div id="custom-button" style="background-color: green">
<button>Profile</button>
</div>
</layout.content>
</article>
</div>
Contributing
Library documentation for contributors
Your improvements are welcome! Feel free to open an issue or pull request.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file temel-1.0.3.tar.gz.
File metadata
- Download URL: temel-1.0.3.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
26edddb436ade1b30ac036fd5bc7cdeb51825f049bd3ddc1f7168e989d08dcff
|
|
| MD5 |
b62d82c75c1063ac1ce03d32e3890c03
|
|
| BLAKE2b-256 |
1c167c7c8186bda6f49c48275cae8b0ef7e9a6c7a0bcbd9a7c9ee3f4ee5c37cc
|
File details
Details for the file temel-1.0.3-py3-none-any.whl.
File metadata
- Download URL: temel-1.0.3-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6cadf1cd0b897618e6b03292678f3a9619ddbe6e07984980c2f83111cf532d13
|
|
| MD5 |
a2f0736beeaa7d55bc86a39e693663c5
|
|
| BLAKE2b-256 |
e040b729891bd7d2acd8de861a7aab62b302d1b9832e2100d836f3c9d7d6862e
|