Skip to content

Commit fd490cc

Browse files
committed
Small cleanups
1 parent 410afbc commit fd490cc

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

Tools/scripts/README

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ pdeps.py Print dependencies between Python modules
4747
pickle2db.py Load a pickle generated by db2pickle.py to a database
4848
pindent.py Indent Python code, giving block-closing comments
4949
ptags.py Create vi tags file for Python modules
50+
pycolorize Python syntax highlighting with HTML output.
5051
pydoc3 Python documentation browser
5152
pysource.py Find Python source files
5253
redemo.py Basic regular expression demonstration facility

Tools/scripts/pycolorize.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,17 +66,25 @@ def colorize(source):
6666
}
6767

6868
default_html = '''\
69-
<html><head><style type="text/css">
69+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
70+
"http://www.w3.org/TR/html4/strict.dtd">
71+
<html>
72+
<head>
73+
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
74+
<title> Python Code </title>
75+
<style type="text/css">
7076
%s
71-
</style></head>
77+
</style>
78+
</head>
7279
<body>
7380
%s
74-
</body></html>
81+
</body>
82+
</html>
7583
'''
7684

7785
def build_page(source, html=default_html, css=default_css):
7886
'Create a complete HTML page with colorized Python source code'
79-
css_str = ''.join(['%s %s\n' % item for item in css.items()])
87+
css_str = '\n'.join(['%s %s' % item for item in css.items()])
8088
result = colorize(source)
8189
return html % (css_str, result)
8290

0 commit comments

Comments
 (0)