A new way to generates html code using class methods in python
Project description
MyPy8TML
A new way to create a html code inside python
Status of project: in progress...
Download
$pip install mypy8tml
Easy start
Generating a simple code:
from mypy_8tml import MyPy8TML
html = MyPy8TML()
html.h1['Hello world']()
code = html.generate()
print(code)
- Use MyPy8TML( ) to start the class
- Call the property (name of tag)
- Put content betwen the tag using -> []
- close tag calling the class -> ()
Using flask to render code
So let's do a form
Remember to download Flask firt
pip install flask
Pyhton code:
from flask import Flask, render_template_string
from mypy_8tml import MyPy8TML
app = Flask(__name__)
register = MyPy8TML().init_html('Form', 'pt')
register.div.in_class('flex-box')\
.form.in_class('form')\
.h1[' Just a simple form']()\
.p['e-mail :'](-1).input.in_type('email')()\
.p['password :'](-1).input.in_type('password')()\
.button.in_type('submit')['submit']()
@app.route('/')
def index():
return render_template_string(register.generate())
app.run(debug=True)
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
mypy8tml-0.1.1.tar.gz
(10.1 kB
view hashes)