mirror of
https://github.com/python/cpython.git
synced 2025-10-15 03:10:29 +00:00
Small cleanups
This commit is contained in:
parent
410afbc5d8
commit
fd490cc052
2 changed files with 13 additions and 4 deletions
|
@ -66,17 +66,25 @@ default_css = {
|
|||
}
|
||||
|
||||
default_html = '''\
|
||||
<html><head><style type="text/css">
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
||||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
|
||||
<title> Python Code </title>
|
||||
<style type="text/css">
|
||||
%s
|
||||
</style></head>
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
%s
|
||||
</body></html>
|
||||
</body>
|
||||
</html>
|
||||
'''
|
||||
|
||||
def build_page(source, html=default_html, css=default_css):
|
||||
'Create a complete HTML page with colorized Python source code'
|
||||
css_str = ''.join(['%s %s\n' % item for item in css.items()])
|
||||
css_str = '\n'.join(['%s %s' % item for item in css.items()])
|
||||
result = colorize(source)
|
||||
return html % (css_str, result)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue