Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/skitschy/pyHTML5builder
https://github.com/skitschy/pyHTML5builder
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/skitschy/pyHTML5builder
- Owner: skitschy
- License: mit
- Created: 2020-03-18T14:04:34.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-04-18T16:36:34.000Z (almost 5 years ago)
- Last Synced: 2024-10-11T09:23:36.966Z (4 months ago)
- Language: Python
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-python-html - skitschy/pyHTML5builder
- awesome-python-html - skitschy/pyHTML5builder
README
# HTML5Builder
HTML5Builder is a Python module
for simply generating strings of HTML5 documents and document fragments.## Requirement
* Python 2.7 or above
## Installation
```sh
pip install html5builder
```## Basic Usage
```python
'
>>> from html5builder import HTML5Builder
>>> tag = HTML5Builder()
>>> img = tag.img(src='image.jpg')
>>> str(img)
''
>>> anchor = tag.a([img, 'link'], cls='link', href='target.html')
>>> str(anchor)
'link'
>>> div = tag.div()
>>> div.child.append(anchor)
>>> str(div)
'
>>> doc = tag.html([tag.head(''), tag.body('')], lang='ja')
>>> str(tag.doctype + str(doc))
''
```## Documentation
Documentation is [available online](https://pyhtml5builder.readthedocs.io/).