Domini
A small, simple package for generating HTML documents. The syntax aims to immitate HTML as closely as possible for legibility and ease of use.
Index
HTML
Attributes
Attributes without a value are entered as positional arguments.
Attributes with a value are entered as keyword arguments.
To specify attributes that collide with reserved Python keywords, append an underscore and it will be removed.
Python
from domini.html import dialog
dialog('open', class_='mydialog')
HTML
<dialog open class='mydialog'>
Content
To add children to an element, there are a few different methods you can use. The content can be either an iterable or a lone element. These elements can be either other tags or plain strings.
addadds the children to the current object.>returns a shallow copy of the element with the children added.>>returns a deep copy of the element with the children added.
ul(class_='todo')> (
li()> 'Buy a fruit basket.',
li()> (
'Read ', a(href='https://wikipedia.org/')> 'Wikipedia',
' to learn more about things you may not have otherwise cared about.',
),
)
Closing tags
A tag is only closed if content is provided. E.g. <p></p> as opposed to <p>. This can be an empty tuple.
p()> ()
For open tags like <br> and <hr>, you simply do br() and hr().
Event attributes
Enumerators for event attributes are available at domini.html.events. You can either use Event, which contains all different event attributes in one, or use an enumerator for a specific category of events.
from domini.html.events import (
# These are the categories.
WindowEvent, FormEvent, KeyboardEvent,
MouseEvent, DragEvent, ClipboardEvent,
MediaEvent, MiscEvent,
)
JavaScript
JSON type hints
Type hints for the types that are typically used to represent JSON data in Python.
# Either of the following JSON types;
# JSONBasic | JSONArray | JSONObject
from domini.js import JSON
# The basic, immutable types;
# None | bool | int | float | str.
from domini.js import JSONBasic
# List and dictionary of JSON values
# list[JSON] and dict[str, JSON]
from domini.js import JSONArray, JSONObject
Metadata
Release files for domini 0.11.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| domini-0.11.0.tar.gz | 20.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| domini-0.11.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 40.5 kB
Release files / domini-0.11.0.tar.gz
| Download URL | domini-0.11.0.tar.gz |
|---|---|
| Size | 20.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
528a2b723b2816ca6974d2327d3b8927cf6c3460c07cad63f3fd8ad7c9cd036d
|
|
BLAKE2b-256 checksum How to use checksums |
b1f94d0c823512720635ba203c7a58b4800c9ff912a7efc70641c2de65293515
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.3
|
Release files / domini-0.11.0-py3-none-any.whl
| Download URL | domini-0.11.0-py3-none-any.whl |
|---|---|
| Size | 20.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
62a37ca26e72ac5baa2cbfa728292229582da31ec214f3c896c9e1665b2f092e
|
|
BLAKE2b-256 checksum How to use checksums |
f4480e1a1d3d3a0b5e99358a00aa677825cf64a85af76cfc1350a7deae6bc17d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.3
|