Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

# HTMLy Elm inspired HTML generator for Python.

## From the doctest. Creating a tag.

>>> tag = div([], [])
>>> render(tag)
'<div ></div>'

Creating a self closing tag. >>> render(hr([])) ‘<hr />’

Tag can have a content. >>> render(div([], [text(‘content’)])) ‘<div >content</div>’ >>> render(text(‘content’)) ‘content’

You can use some attributes for the tag. >>> render(div([lang(‘tr’), id_(‘content’), class_(‘bar’), attribute(‘data-value’, ‘foo’)], [])) ‘<div lang=”tr” id=”content” class=”bar” data-value=”foo”></div>’

You can have them both. >>> render(div([lang(‘tr’)], [text(‘content’)])) ‘<div lang=”tr”>content</div>’

You can have more content. >>> render(div([], [ nav([], []), text(‘Hello’), hr([])])) ‘<div ><nav ></nav>Hello<hr /></div>’

You can now start having composable abstractions as below. You can have your own list item which takes content, without need of extra attributes and list syntax for content. >>> _li = lambda item: li([], [text(item)]) >>> litems = lambda items: [_li(item) for item in items ]

Abstracting again just because we can. >>> _ul = lambda items: ul([], litems(items)) >>> render(_ul([‘Bob’, ‘Mary’, ‘Joe’])) ‘<ul ><li >Bob</li><li >Mary</li><li >Joe</li></ul>’

Nested Elements >>> render(div([], [div([], [p([], [text(‘a paragraph’)])])])) ‘<div ><div ><p >a paragraph</p></div></div>’

>>> render(html([],
...             [ head([],
...                    [ title([],
...                            [text('Awesome Website')]),
...                      script([src('/script.js')], [])
...                    ]),
...               body([],
...                    [ header([],
...                             [ img([src('/logo.png')]) ]),
...                      div([], [text('Content Here')]),
...                      footer([],
...                             [hr([]),
...                              text('Copyright 2019')])
...                      ])
...               ]))
'<html ><head ><title >Awesome Website</title><script src="/script.js"></script></head><body ><header ><img src="/logo.png"/></header><div >Content Here</div><footer ><hr />Copyright 2019</footer></body></html>'

Metadata

Release files for htmly 0.3dev

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for htmly 0.3dev
File Size Uploaded Provenance Actions
htmly-0.3dev.tar.gz 2.3 kB Without provenance Details for htmly-0.3dev.tar.gz

Release files / htmly-0.3dev.tar.gz

Download URL htmly-0.3dev.tar.gz
Size 2.3 kB
Tags Source
SHA-256 checksum
How to use checksums
169523a31d41864b9fcc7648850011dcf1e156bcde36dfab5a4d537173c18180
BLAKE2b-256 checksum
How to use checksums
7847600191509c0161ef8c4ea07bb304496207f877a9effc1c27b390756920b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

Security for htmly 0.3dev

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page