A package for generating HTML and CSS
Project description
Domgen
Domgen is a library which can be used to generate minified HTML, with rich custom component support and material design components as standard.
To make a basic page's HTML code:
import dom
page_model = dom.HTML(
dom.Head(
dom.Title("My Glorious Test Page"),
dom.ExternalResourceLink(rel="stylesheet", href="assets/style.css")
),
dom.Body(
dom.ContentDivision(classes={"red", "centre"})(
"My red and centred content with",
dom.Button(onclick="alert('hello user')")(
"a button"
),
"in it",
)
)
)
page_code = page_model.serialise()
page_code_readable = page_model.serialise(minify=False)
<!-- page_code -->
<!DOCTYPE html><html><head><title>My Glorious Test Page</title><link rel="stylesheet" href="assets/style.css" /></head><body><div class="red centre">My red and centred content with<button onclick="alert('hello user')">a button</button>in it</div></body></html>
<!-- page_code_readable -->
<!DOCTYPE html>
<html>
<head>
<title>
My Glorious Test Page
</title>
<link rel="stylesheet" href="assets/style.css" />
</head>
<body>
<div class="red centre">
My red and centred content with
<button onclick="alert('hello user')">
a button
</button>
in it
</div>
</body>
</html>
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
domgen-0.3.0a0.tar.gz
(28.6 kB
view details)
File details
Details for the file domgen-0.3.0a0.tar.gz
.
File metadata
- Download URL: domgen-0.3.0a0.tar.gz
- Upload date:
- Size: 28.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cacc40da0ced7542ac1357362272c2f5366e6197be0b79c93137d6254a9518be |
|
MD5 | 631002f0c9f1ea917e45dc3cffae8517 |
|
BLAKE2b-256 | d9a718235be0828a0a2fabd93738594e6898b5d89302ce5968223126fc9dc582 |