Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ecea0fb

Browse files
committed
Use new-style string formatting for the HTML template
1 parent f57baab commit ecea0fb

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

Tools/scripts/pycolorize.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,13 @@ def colorize(source):
7979
<html>
8080
<head>
8181
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
82-
<title> %s </title>
82+
<title> {title} </title>
8383
<style type="text/css">
84-
%s
84+
{css}
8585
</style>
8686
</head>
8787
<body>
88-
%s
88+
{body}
8989
</body>
9090
</html>
9191
'''
@@ -95,7 +95,7 @@ def build_page(source, title='python', css=default_css, html=default_html):
9595
css_str = '\n'.join(['%s %s' % item for item in css.items()])
9696
result = colorize(source)
9797
title = cgi.escape(title)
98-
return html % (title, css_str, result)
98+
return html.format(title=title, css=css_str, body=result)
9999

100100

101101
if __name__ == '__main__':

0 commit comments

Comments
 (0)