Python in, HTML out.
Project description
htmlclasses
Python in, HTML out.
There are templating engines making it possible to write code in HTML template files. However, I would very much prefer to be able to write Python that gets converted to HTML rather than write Python-like mini language engulfed in HTML.
Version
0.2.0
Goals
Generating valid HTML from pure Python code.
Non-goals
Features geared toward JavaScript.
- I find using 2 intertwined languages too cumbersome.
- JavaScript is heavily overused and misused. I don't want to add to the problem.
Installation
pip install htmlclasses
Developing
This project is managed with poetry: https://github.com/python-poetry/poetry
git clone git@github.com:uigctaw/htmlclasses.git
poetry install
Running tests
./check_all.sh
Examples
Hello World
This Python code:
from htmlclasses.htmlclasses import E
class html(E):
class head:
pass
class body:
class p:
TEXT = 'Hello, world!'
Produces this HTML code:
<html>
<head/>
<body>
<p>Hello, world!</p>
</body>
</html>
Which renders as:
Hello, world!
Alternatives
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
htmlclasses-0.2.0.tar.gz
(4.3 kB
view hashes)
Built Distribution
Close
Hashes for htmlclasses-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 35767eda3a0faaafe5e3da373538dbd76b60e0d4fc6d88a2d00d8da45af29573 |
|
MD5 | d398b56dd541c0bed6208342bee18a69 |
|
BLAKE2b-256 | 03448a7eac7b0eaabd5f513e86fa66fbdd56a2ebfdc44be2e4f516d82a5dbb30 |