Translate Python Code to HTML
Project description
piNet
Translate Python Code to HTML
piNet is a python module built to work with seamlessly Web Development frameworks like Django and Flask. This module renders Python code to HTML
Features
- Compatible with Python 3
- Supports all tags and global attributes supported by HTML 5
- HTML files can either be rendered or can be exported from Python File
- Does not require any dependencies to be installed
Installation
piNet requires Python 3 to run so make sure you're using latest version of PIP and Python
pip install piNet
Usage
from pinet import *
obejct = html("Hello World") # Generates HTML object with 'Hello World' as Title
page_to_be_exported = object.render(
object.h1(name="heading_1", id="heading_1", clas="heading_1").render(
object.p(name="paragraph", id="paragraph", clas="paragraph").render(
"Text in first Paragraph"
),
object.a(href="https://any_link", target='_blank').render(
object.p(name="paragraph", id="paragraph", clas="paragraph").render(
"Text in Second Paragraph"
)
)
)
)
export_html(page_to_be_exported, 'filename.html')
Above code generates a HTML file in current working directory named filename.html
The contnts of the file would be as follows
<!DOCTYPE html>
<html>
<head>
<title>Hello world</title>
</head>
<body>
<h1 name="heading_1" id="heading_1" class="heading_1">
<p name="paragraph" id="paragraph" class="paragraph">
Text in first Paragraph
</p>
<a href="https://any_link" target="_blank">
<p name="paragraph" id="paragraph" class="paragraph">
Text in Second Paragraph
</p>
</a>
</h1>
</body>
</html>
Bugs
Since module is still in Beta testing so few tags are yet to be added. Please let me knnow if you encounter any bug, crash, etc. or If you have any suggestion feel free to let me know.
License
GNU General Public License
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 Distributions
Built Distribution
File details
Details for the file pinet-0.2.3-py3-none-any.whl
.
File metadata
- Download URL: pinet-0.2.3-py3-none-any.whl
- Upload date:
- Size: 17.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b063040487764d56e62e1dc932d07292b055276185ba42e9463fde30cf5c8e94 |
|
MD5 | da1f6360242f091ddd7cf97d6f0acb26 |
|
BLAKE2b-256 | f9cb86463a221f68a1540240009ac600e84acb6935db6007c6ec33cf17e0a069 |