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 API, 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 all modern (non-obsolete) 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 modern HTML tags.
  • 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"),
            cls="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.0.3.tar.gz (20.7 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.0.3-py3-none-any.whl (21.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for libdom-0.0.3.tar.gz
Algorithm Hash digest
SHA256 d712d2cbcf82a0973ecb9128faab5cec9cbe91fc157250ef797fe4dcf0255e7f
MD5 ac995e6b1c55a60ff5489ee9d50d0fbc
BLAKE2b-256 22dc0ee694c5ff5a71c8a8c3a9999a4349b40be4623aa0c5eef7f0e48659afcb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: LibDOM-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 21.1 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.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3cb570f21dd536a9dda1f8f01805993aaa25772870a9dbf6b0afd194da219bc3
MD5 d89509f519070c98b5e992bae4b3371e
BLAKE2b-256 34ca07b4b42592b9241347fcc9ba00f588183d71ae97c189f6e33353c3149c87

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