HTML in Pure Python
Project description
pyhtmlify
pyhtmlify is a Python package that allows you to write HTML code with Pure Python. This package was mainly made for the osd Project for simplicity. Heres how to do it. This package isn't completely finished, as we are still adding heaps of stuff and more HTML tags to this project.
1. Installation
You can install pyhtml using pip
pip install pyhtmlify
This will install the latest version of pyhtmlify.
2. How to use
pyhtmlify is quite easy to use. It is similar to html, but without all of the <> and other things involved. To do so, make a python file starting with html- and pyhtml will pick it up.
For pyhtml to pick up the file to generate the html code for you, you need to have a index function inside of your script. Like this for example:
import pyhtmlify.HTMLTags.tags as ph
def index():
return ph.div(
ph.h1("Welcome to My Website"),
ph.input(type="text", placeholder="Enter your name"),
)
That is all you need for the script side. Now onto the html conversion
3. PY to HTML Conversion
To convert python index functions into html documents, pyhtml comes with a pyhtml command to use. In the terminal, to generate html code for all the html- files, run
pyhtmlify generate -f folder
The -f flag specifies the output folder, and there are some other flags and commands that are coming up. However, you you dont use the -f flag, the program automatically defaults to /html. All file names of the html files are the same name as the python script.
4. Contribution
If you would like to contribute to this project, please check out the issues and contact me at peggundev@gmail.com, or come check out osd and join the discord community!
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
Hashes for pyhtmlify-0.1.6-py3-none-any.whl
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 | 2e65cfcaf64464ea1bfecb22e15c35de936313f88319edb2981ff10cbd87b163 |
|
| MD5 | deecc13e9679d54d7f871df45a4d8807 |
|
| BLAKE2b-256 | 18b96d406f9a75a7b0e6354a7d34cc3316cd98f14af9bd83c70be2b044132df9 |