tagz is a html tags builder
Project description
tagz
tagz
is an extremely simple library for building html documents without using templates,
just with python code.
from tagz import html, Page
page = Page(
lang="en",
body_element=html.body(
html.h1("Hello"),
html.div(
html.strong("world"),
),
html.a(
"example link",
html.i("with italic text"),
href="https://example.com/"
),
),
head_elements=(
html.meta(charset="utf-8"),
html.meta(name="viewport", content="width=device-width, initial-scale=1"),
html.title("tagz example page"),
html.link(href="/static/css/bootstrap.min.css"),
html.script(src="/static/js/bootstrap.bundle.min.js"),
html.style(
".container, .container-fluid {transition:opacity 600ms ease-in;}"
)
),
)
# `pretty=False` should be faster but performs not a human-readable result
print(page.to_html5(pretty=True))
writes something like this:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>
tagz example page
</title>
<link href="/static/css/bootstrap.min.css"/>
<script src="/static/js/bootstrap.bundle.min.js">
</script>
<style>
.container, .container-fluid {transition:opacity 600ms ease-in;}
</style>
</head>
<body>
<h1>
Hello
</h1>
<div>
<strong>
world
</strong>
</div>
<a href="https://example.com/">
example link
<i>
with italic text
</i>
</a>
</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
tagz-0.1.1.tar.gz
(4.0 kB
view details)
Built Distribution
tagz-0.1.1-py3-none-any.whl
(4.2 kB
view details)
File details
Details for the file tagz-0.1.1.tar.gz
.
File metadata
- Download URL: tagz-0.1.1.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.10.2 Darwin/22.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d89045b21987775016608b409105e84ba72e873efc320c05f09a083c629e120d |
|
MD5 | 3462cfed3f2a8c1593e3ccbed4f005cc |
|
BLAKE2b-256 | b1a85d0ede7ec3236ac41c9fedbe6d583726f8e1f1dbc6dc250df1916de79b66 |
File details
Details for the file tagz-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: tagz-0.1.1-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.10.2 Darwin/22.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a6a33037fbb240c11c7cd445a0305404da45e69d89190a3c34c08406af50c2c |
|
MD5 | f72a52436b1406eb739133204f7bc22a |
|
BLAKE2b-256 | 9dfe1b90bbc51a7b174c385d188a95e7add8fd5d5c74fc879bd6d3e35e0b3a55 |