Simple HTML5 document builder.
Project description
HTML5Builder
HTML5Builder is a Python module for simply generating strings of HTML5 documents and document fragments.
Requirement
- Python 2.7 or above
Installation
pip install html5builder
Basic Usage
>>> from html5builder import HTML5Builder
>>> tag = HTML5Builder()
>>> img = tag.img(src='image.jpg')
>>> str(img)
'<img src="image.jpg">'
>>> anchor = tag.a([img, 'link'], cls='link', href='target.html')
>>> str(anchor)
'<a href="target.html" class="link"><img src="image.jpg">link</a>'
>>> div = tag.div()
>>> div.child.append(anchor)
>>> str(div)
'<div><a href="target.html" class="link"><img src="image.jpg">link</a></div>'
>>> doc = tag.html([tag.head(''), tag.body('')], lang='ja')
>>> str(tag.doctype + str(doc))
'<!DOCTYPE html><html lang="ja"><head></head><body></body></html>'
Documentation
Documentation is available online.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
html5builder-0.1.0.tar.gz
(3.1 kB
view hashes)
Built Distribution
Close
Hashes for html5builder-0.1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f05f61800763c53e21cd4641578ac897b82a15797c23ea49fad169bafcdd5825 |
|
MD5 | 6d1aefecd55fa209561cbe9488900be8 |
|
BLAKE2b-256 | 83af52343266c31c774ee8657eb063fd368e4dd2bdc688a350edcc0daeadd4e1 |