.. _etgen.usage: ===== Usage ===== .. currentmodule:: etgen.html The :mod:`etgen.html` module defines an ElementTree Builder for generating HTML documents. .. data:: E The global ElementTree Builder object. Usage: >>> from etgen.html import E, tostring, tostring_pretty, CLASS >>> import lxml.usedoctest >>> html = E.html( ... E.head( E.title("Hello World") ), ... E.body( ... E.h1("Hello World !"), ... CLASS("main") ... ) ... ) >>> print (tostring_pretty(html))
First
Second
First
Second
``) with one ``
`` between each line. If optional `min_height` is
given, add empty lines if necessary.
Examples:
>>> from etgen.html import lines2p
>>> print(tostring(lines2p(['first', 'second'])))
first
second
first
second
a
b
c
d
e