Skip to main content

Elements based HTML template renderer

Project description

Temel

🚀 Html elements server side renderer ️🚀

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

  1. Install the dependencie
pip install temel

  1. 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.article/>
    </article>
</div>

Page.html

<layout>

    <layout.header>
        Page Header Message
    </layout.header>

    <layout.article>
        {{% for button in buttons %}}
        <CustomButton name={{button.name}}/>
            {{% endfor %}}
    </layout.article>
</layout>

  1. Call the renderer
from temel import parse, load_templates

if __name__ == '__main__':
    context = {
        'buttons': [
            {
                'name': 'Home'
            },
            {
                'name': 'Settings'
            },
            {
                'name': 'Profile'
            }]
    }
    output = parse("Page.html", context)

    with open('output.html', 'w') as f:
        f.write(output)
  1. See the output file
<div id="layout">
    <header>
        Header section
        <layout.header>
            Page Header Message
        </layout.header>
    </header>
    <article>
        <layout.article>
            <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.article>
    </article>
</div>

Contributing

Library documentation for contributors

Your improvements are welcome! Feel free to open an issue or pull request.

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

temel-1.0.2.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

temel-1.0.2-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file temel-1.0.2.tar.gz.

File metadata

  • Download URL: temel-1.0.2.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

Hashes for temel-1.0.2.tar.gz
Algorithm Hash digest
SHA256 28a505ce58ef5289398b5ae1001dfe84e0fb64389891cd8c7b776a7e75acebad
MD5 f842561b21250e751533f0e2c298e33d
BLAKE2b-256 c10d984509e65955f6fdf999201e323db0251d28b8ac7cda50115bca6de39839

See more details on using hashes here.

File details

Details for the file temel-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: temel-1.0.2-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

Hashes for temel-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 37a77a22ac2602a53d5a36dc5bc0a1ee90233e17803e0f0ad92fcf8f8a882a69
MD5 6bcab279e29c5d5ec2c657cb9d126b46
BLAKE2b-256 632851c403713c258b1ce0faafd25605b8f3c87d474b6c93db526eee970626db

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page