Kaydet (Commit) ecea0fb1 authored tarafından Raymond Hettinger's avatar Raymond Hettinger

Use new-style string formatting for the HTML template

üst f57baaba
...@@ -79,13 +79,13 @@ default_html = '''\ ...@@ -79,13 +79,13 @@ default_html = '''\
<html> <html>
<head> <head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8"> <meta http-equiv="Content-type" content="text/html;charset=UTF-8">
<title> %s </title> <title> {title} </title>
<style type="text/css"> <style type="text/css">
%s {css}
</style> </style>
</head> </head>
<body> <body>
%s {body}
</body> </body>
</html> </html>
''' '''
...@@ -95,7 +95,7 @@ def build_page(source, title='python', css=default_css, html=default_html): ...@@ -95,7 +95,7 @@ def build_page(source, title='python', css=default_css, html=default_html):
css_str = '\n'.join(['%s %s' % item for item in css.items()]) css_str = '\n'.join(['%s %s' % item for item in css.items()])
result = colorize(source) result = colorize(source)
title = cgi.escape(title) title = cgi.escape(title)
return html % (title, css_str, result) return html.format(title=title, css=css_str, body=result)
if __name__ == '__main__': if __name__ == '__main__':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment