-@CTX.contextmanager
-def html(title, **kw):
- """
- Context manager for HTML output.
-
- Keyword arguments are output as HTTP headers (if no header has been written
- yet). A `<head>' element is written, and a `<body>' opened, before the
- context body is executed; the elements are closed off properly at the end.
- """
-
- kw = dict(kw, content_type = 'text/html')
- OUT.header(**kw)
-
- ## Write the HTML header.
- PRINT("""\
-<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01//EN'
- 'http://www.w3c.org/TR/html4/strict.dtd'>
-<html>
-<head>
- <title>%(title)s</title>
- <link rel=stylesheet type='text/css' media=screen href='%(style)s'>
- <meta http-equiv='Content-Script-Type' content='text/javascript'>
- <script type='text/javascript' src='%(script)s'></script>
-</head>""" % dict(title = html_quotify(title),
- style = static('chpwd.css'),
- script = static('chpwd.js')))
-
- ## Write the body.
- PRINT('<body>')
- yield None
- PRINT('''\
-
-<div class=credits>
- <a href="%(about)s">Chopwood</a>, version %(version)s:
- copyright © 2012 Mark Wooding
-</div>
-
-</body>
-</html>''' % dict(about = static('about.html'),
- version = VERSION))
-