Here is a small script that exercises the etbuilder
module.
This script generates a small XHTML page that looks like this:
<html>
<head>
<title>Sample page<title>
<link href="/tcc/style.css" rel="stylesheet"/>
</head>
<body>
<h1 class='big-title'>Sample page title</h1>
<p>A paragraph containing a <a href='http://www.nmt.edu/'
>link to the NMT homepage</a>.</p>
</body>
</html>
The script follows.
#!/usr/bin/env python
from __future__ import print_function
from etbuilder import E, et, CLASS
page = E.html(
E.head(
E.title("Sample page"),
E.link(href='/tcc/style.css', rel='stylesheet')),
E.body(
E.h1(CLASS('big-title'), "Sample page title"),
E.p("A paragraph containing ", 1, " ",
E.a("link to the NMT homepage",
href='http://www.nmt.edu/'),
".")))
print(et.tostring(page, pretty_print=True, encoding=unicode), end='')