Skip to main content

Fast HTML Abstraction and Generator for Python

Project description

webfast

Fast HTML Abstraction and Generator for Python.

You're building the next big thing and definitely writing the perfect HTML file is not on the priority.

WebFast let's you create HTML documents on the go and inside your Python scripts! It is built on top of wbuilder plus with another level of abstraction, so you can code with no trouble of messing up with closing tags--it's quick and easy.

Here's a sample syntax:

page[".selector"] = "tag #id.class1.class2.class3 data-x='10' data-y='false' style='font-size:12px;color:#000;' hidden > inner text"

And scroll down below for more examples.

Official Release

WebFast can now be used on your Python projects through PyPi by running pip command on a Python-ready environment.

pip install -U webfast

Current version is 1.0.0, but more updates are coming soon.

This is compatible with Python 3.9+, and will require other third-party libraries during installation.

Usage

Import Package

from webfast import WebFast

Initialization

page = WebFast()
page = WebFast("home.html")

Import Package

page["head"] = "title > WebFast v1.0"

Import Package Basically, you set the parent selector to append the new element.

# create container box
page["body"] = "div #content"
page["#content"] = "div #box.container.light"

# create the popup text
page["#box"] = "div #title.header > WebFast"
page["#box"] = "div .message data-default='Lorem impsum...' > Hello, world!"

# populate the action buttons
page["#box"] = "div #action.btn-list"
page["#action"] = "button #btn1.btn.btn-no style='background-color:#b22222;' > CLOSE"
page["#action"] = "button #btn2.btn.btn-yes > CONTINUE"

Setting Properties

page["html"] = "lang=en"
page["body"] = "#canvas"
html = page.build()
print(html)

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

webfast-1.0.1.tar.gz (4.5 kB view hashes)

Uploaded Source

Built Distribution

webfast-1.0.1-py3-none-any.whl (4.9 kB view hashes)

Uploaded Python 3

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