diff options
author | Raymond Hettinger <python@rcn.com> | 2012-07-03 00:17:16 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2012-07-03 00:17:16 (GMT) |
commit | ecea0fb1739d4a85a235cee6013747742d9e9acb (patch) | |
tree | 3a066c8292a1ee0076acaa59d6631b46c2f5c0ad | |
parent | f57baaba496a48861ebf236f9416e42d3f95c1de (diff) | |
download | cpython-ecea0fb1739d4a85a235cee6013747742d9e9acb.zip cpython-ecea0fb1739d4a85a235cee6013747742d9e9acb.tar.gz cpython-ecea0fb1739d4a85a235cee6013747742d9e9acb.tar.bz2 |
Use new-style string formatting for the HTML template
-rwxr-xr-x | Tools/scripts/pycolorize.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Tools/scripts/pycolorize.py b/Tools/scripts/pycolorize.py index 3a9c95e..7a177b9 100755 --- a/Tools/scripts/pycolorize.py +++ b/Tools/scripts/pycolorize.py @@ -79,13 +79,13 @@ default_html = '''\ <html> <head> <meta http-equiv="Content-type" content="text/html;charset=UTF-8"> -<title> %s </title> +<title> {title} </title> <style type="text/css"> -%s +{css} </style> </head> <body> -%s +{body} </body> </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()]) result = colorize(source) title = cgi.escape(title) - return html % (title, css_str, result) + return html.format(title=title, css=css_str, body=result) if __name__ == '__main__': |