[Python-checkins] cpython: Use new-style string formatting for the HTML template
raymond.hettinger
python-checkins at python.org
Tue Jul 3 02:17:35 CEST 2012
http://hg.python.org/cpython/rev/2367ec12da2d
changeset: 77920:2367ec12da2d
user: Raymond Hettinger <python at rcn.com>
date: Mon Jul 02 17:17:16 2012 -0700
summary:
Use new-style string formatting for the HTML template
files:
Tools/scripts/pycolorize.py | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/Tools/scripts/pycolorize.py b/Tools/scripts/pycolorize.py
--- a/Tools/scripts/pycolorize.py
+++ b/Tools/scripts/pycolorize.py
@@ -79,13 +79,13 @@
<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 @@
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__':
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list