Skip to main content

LibDOM is a Python library that abstracts all modern HTML tags, enabling you to build dynamic HTML documents programmatically. With a clean and intuitive Framework, LibDOM simplifies web development by allowing you to generate and manipulate HTML entirely in Python. Perfect for creating dynamic, maintainable, and responsive web pages.

Project description

LibDOM

LibDOM is a Python library that abstracts HTML tags, allowing you to create dynamic HTML documents in a simple and programmatic way. With LibDOM, you can generate HTML structures entirely in Python, bringing clarity and flexibility to web development.

Key Features

  • Complete Abstraction: Supports all HTML tags (non-obsolete).
  • Flexibility: Ideal for creating dynamic web pages that require frequent updates.
  • Productivity: Reduces repetitive code, simplifies maintenance, and accelerates development.

Example

from libdom.Elements import *
from libdom.Styles import *

html = Html(
    Head(
        Style({
            "body": {
                Margin: "0",
                Padding: "0",
                Display: "flex",
                JustifyContent: "center",
                AlignItems: "center"
            },
            
            ".div": {
                Border: "1px solid black",
                BackgroundColor: "red",
                "&:hover": {
                    BackgroundColor: "blue"
                }
            }
        })
    ),
    Body(
        Div(
            P("Hello World"),
            **{ Div.Attribute.Class: "div" }
        )
    )
)

print(html)

#<html>
#    <head>
#        <style>
#            body {
#                margin: 0;
#                padding: 0;
#                display: flex;
#                justify-content: center;
#                align-items: center;
#            }
#            #div {
#                border: 1px solid black;
#                background-color: red;
#                &:hover {
#                    background-color: blue;
#                }
#            }
#        </style>
#    </head>
#    <body>
#        <div class="div">
#            <p>
#                Hello World
#            </p>
#        </div>
#    </body>
#</html>

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

libdom-0.1.2.tar.gz (22.5 kB view details)

Uploaded Source

Built Distribution

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

LibDOM-0.1.2-py3-none-any.whl (23.0 kB view details)

Uploaded Python 3

File details

Details for the file libdom-0.1.2.tar.gz.

File metadata

  • Download URL: libdom-0.1.2.tar.gz
  • Upload date:
  • Size: 22.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.7

File hashes

Hashes for libdom-0.1.2.tar.gz
Algorithm Hash digest
SHA256 2ca44f023967fc1d43e991251858555454650708398abe29c413c8476383b220
MD5 646700b80266db3a45eb6828fbe39e94
BLAKE2b-256 806645ab3c3cce54cdf6a7a99a138bf8fe085e3aafee3d5b699452397c91365c

See more details on using hashes here.

File details

Details for the file LibDOM-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: LibDOM-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 23.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.7

File hashes

Hashes for LibDOM-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4d795173d8c70bc337ad704f5a1fa1d1201d0096570d2b17e53b9e1d8e3504f6
MD5 762c7c5ba07b2a8d8b76ec6c8b966d9d
BLAKE2b-256 a5ea20357d3ad7f3bbb5d701e2dd367292529b1a3697b4d58cd9fc06dce0a0c6

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