Skip to main content

Bootstrap Builder

This is just a small lil package to make building HTML with Python hopefully a lil easier.

>>> import bootstrap_builder as bb
>>> page = bb.HTMLPage(title="Bootstrap Builder")  # Make a page containing the head and body and etc
>>>
>>> # Time for navbar
>>> navbar_container = page.new_navbar()
>>> print(navbar_container)  # <nav class="navbar" />
>>> navbar_container['class'].append('navbar-expand-sm')  # Add 'navbar-expand-sm' to the class list
>>> print(navbar_container)  # <nav class="navbar navbar-expand-sm" />
>>> with navbar_container.new_navbar_nav() as navbar:
	_ = navbar.new_navbar_nav_item().new_child('a', 'Index', attrs={'href': '/index', 'class': 'nav-link'})  # You can add attrs inside new_XXX methods if you don't want to do it via __setitem__

>>> print(navbar_container)  # <nav class="navbar navbar-expand-sm" ><ul class="navbar-nav"><li class="nav-item"><a href="/index" class="nav-link">Index</a></li></ul></nav>
>>>
>>> child = page.new_child('div')
>>> child['data-test'] = 'test1'  # Add a new attr
>>> child['class'].append('owo')  # Add a new class
>>> print(child)  # <div data-test="test1" class="owo" />
>>>
>>> # Add some content to the tag
>>> child = page.new_child('div')
>>> _ = child.new_child('p', 'Nested Tag')  # This is a nested tag
>>> print(child)  # <div><p>Nested Tag</p></div>
>>>
>>> # We can also just add plain content
>>> child = page.new_child('div')
>>> _ = child.add_child('p', 'New Child')  # Like .new_child, but doesn't create a new object, just adds it to the object
>>> print(child)  # <div>New Child</div>
>>>

Release files for bootstrap-builder 0.0.5

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

Source distribution (sdist)

Source distribution for bootstrap-builder 0.0.5
File Size Uploaded
bootstrap-builder-0.0.5.tar.gz 4.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bootstrap-builder 0.0.5
File Interpreter ABI Platform
bootstrap_builder-0.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 10.8 kB

Release files / bootstrap-builder-0.0.5.tar.gz

Download URL bootstrap-builder-0.0.5.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
1e4bba7aa06bcc4b803ea1ff576ad22eee6d3fe15b2f3b2fc3a0551f2ed73209
BLAKE2b-256 checksum
How to use checksums
21e0dc7885504f2d1059f446d68f0531f49b844903880fde18bfb489e6692918
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.26.0 CPython/3.6.6

Release files / bootstrap_builder-0.0.5-py3-none-any.whl

Download URL bootstrap_builder-0.0.5-py3-none-any.whl
Size 6.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
06426a1fae5e7490afaa637e1a248045ab069486dcb9b26ab1b36c818a9601c9
BLAKE2b-256 checksum
How to use checksums
ea4c605702bb892f9e113757be9f716bd53268c28658cfb6aeb529f27dc02343
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.26.0 CPython/3.6.6

Release history Release notifications | RSS feed

This release

0.0.5 This release

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

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