Metadata-Version: 2.1
Name: html-writer
Version: 1.0
Summary: A simple HTML writer
Home-page: https://github.com/KKawamura1/html_writer
Author: Keigo Kawamura
Author-email: kkawamura@logos.t.u-tokyo.ac.jp
License: UNKNOWN
Project-URL: Source, https://github.com/KKawamura1/html_writer
Keywords: HTML writer with markup simple
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Text Processing :: Markup :: HTML
Description-Content-Type: text/markdown

html-writer
---

Simple html writer class for python


## Description

You can write raw html with 'with' statements like:
```python
html = Html()
with html.tag('div'):
    with html.tag('p') as h:
        h += 'Hello world!'
# Here html has '<div><p>Hello world!</p></div>'
``` 

'with' syntax also serves human-readable indentation:
```python
html = Html()
with html.tag('div'):
    with html.tag('p') as h:
        h += 'Hello world!'
# Here html really has 
# <div>
#   <p>
#     Hello world!
#   </p>
# </div>
``` 


## Example
```python
from html_writer import Html
import datetime

head = Html()
head.self_close_tag('meta', attributes=dict(charset='utf-8'))
body = Html()
with body.tag('div'):
    with body.tag('p') as h:
        h += 'Hello World!'
with body.tag('dl'):
    body.tag_with_content('Today', name='dt')
    with body.tag('dt') as h:
        h += datetime.datetime.now().strftime('%y/%m/%d %H:%M:%S')
print(Html.html_template(head, body).to_raw_html(indent_size=2))
```

## Requirements
- Python >= 3.7.0

## Frequently Asked Questions

Q. Isn't it reinventing the wheel? :) :) :)

A. Enjoy coding!


