Skip to main content

HTML generator for Flask applications. Make your HTML code more readable and easier to maintain.

Project description

Flask-HTML

Flask GitHub top language LICENCE Odya

HTML generator for Flask applications. Make your HTML code more readable and easier to maintain.

Installation

pip install flask_html

Usage

from flask_html import Page, Head
from flask_html.core import Style
from flask_html.tags import Body, Div, P
from flask import request
@app.route('/')
def index():
    head = Head('Title', ['link to css'],['link to js'], [{"meta_property": "value"}])
    page = Page(head)
    body = Body(page, styles=Style(color="red", padding_top="15px"),classes=['class1', 'class2'], id='body_id',elements=[
        Div(styles=Style(margin="10px"), classes=['class1', 'class2'], id='div_id', elements=[
            P(styles=Style(color="blue"), classes=['class1', 'class2'], id='p_id', elements=[
                "Hello World"
            ])
        ])
    ])
    return page.render(body, request)

Elements

Example of Div elements

"""Div HTML element

Args:
    styles (Style, optional): Inline css styles. Defaults to None.
    classes (List[str], optional): List of class names. Defaults to [].
    id (str, optional): Unique ID. Defaults to None.
    elements (List[object], optional): List of child elements. Defaults to [].
    props (Dict[str, str], optional): Additional tag properties. Defaults to {}.
"""
Div(styles=None, classes=[], id=None, elements=[], props={})

To Do

  • All HTML tags
  • Inline CSS
  • Classes
  • ID
  • Child elements
  • Additional tag properties
  • JS
  • Meta tags
  • Link tags
  • Title
  • Head
  • Body
  • Page
  • Element event listeners
  • DOM manipulation
  • More examples

License

This project is licensed under the MIT License (see the LICENSE file for details).

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

Flask-HTML-1.1.2.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

Flask_HTML-1.1.2-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file Flask-HTML-1.1.2.tar.gz.

File metadata

  • Download URL: Flask-HTML-1.1.2.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.0

File hashes

Hashes for Flask-HTML-1.1.2.tar.gz
Algorithm Hash digest
SHA256 693b5adcf516b5fd2499dc2d75827cfb21c6e0f4c712c4f4bd96b2bd32a2cdbe
MD5 eb9b9f8bd0b260d343ad4985e53247d3
BLAKE2b-256 aa79a48254ce5c3a842b020179e0589ac18eb79183aba1e1dc223df96202a4b1

See more details on using hashes here.

File details

Details for the file Flask_HTML-1.1.2-py3-none-any.whl.

File metadata

  • Download URL: Flask_HTML-1.1.2-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.0

File hashes

Hashes for Flask_HTML-1.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e4c906ad66dfd89bdb132da047459d3d97726016a8a8f7d04fb5ae62c8afb915
MD5 3f0a9c1068a4897e42127d360c1b6ca3
BLAKE2b-256 f8761a05655ee7a0bb32a79d4ea3d31740d77303f2cc272737b395c4a93cac2d

See more details on using hashes here.

Supported by

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