Skip to main content

Create HTML documents using Pythonic syntax that mimics the real deal.

Project description

Domini

A small, simple package for generating HTML documents. The syntax aims to immitate HTML as closely as possible for legibility and easy of use.

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, you can use either the add method or the short-hand greater-than operator. The right-hand side can be either a tuple of elements or a lone element. These elements can be either other tags or plain strings.

ul(class_='todo')> (
    li()> 'Buy a fruit basket.',
    li()> (
        'Read', a(href='https://wikipedia.org/')> 'Wikipedia',
        'to learn more about things you may have not 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.

section()> ()

For open tags like <br> and <hr>, you simply do br() and hr().

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

domini-0.1.0.tar.gz (17.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

domini-0.1.0-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

Details for the file domini-0.1.0.tar.gz.

File metadata

  • Download URL: domini-0.1.0.tar.gz
  • Upload date:
  • Size: 17.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for domini-0.1.0.tar.gz
Algorithm Hash digest
SHA256 64c45811b7340e30a4c6b681b1fb6202f788926a6717b568faef6396bbc6ad85
MD5 10f1327f42dbcc972bda202c576a74f6
BLAKE2b-256 d10df5c66a82b929ec7855c73284f731a617c5e16cd21a01e0e1ab1d5bb957a2

See more details on using hashes here.

File details

Details for the file domini-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: domini-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 17.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for domini-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e64368fcc0929e596aa4f9b87b5ebdb03c921ad98249f7c20645fe36289cf3fb
MD5 2d5476ba49d2b89b2a40b7dc34c880e1
BLAKE2b-256 cce894155d3dd96432d083569e42b794ef0a8c4fa28232b02c09c1f93f59abcf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page