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.4.1a0.tar.gz
(29.1 kB
view details)
File details
Details for the file domgen-0.4.1a0.tar.gz.
File metadata
- Download URL: domgen-0.4.1a0.tar.gz
- Upload date:
- Size: 29.1 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 |
d99336cde124c288d31d36708bc0c04578ce35a7222d841cb55f7796d15395d2
|
|
| MD5 |
752bf9a3ba4ef3e0097641e86ea325e4
|
|
| BLAKE2b-256 |
d9a1fb7c404c238186cfcc36af6dd37538af373a5bdc1e8f19f73bc0c056762a
|