]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Small cleanups
authorRaymond Hettinger <python@rcn.com>
Sun, 1 Jul 2012 05:19:04 +0000 (22:19 -0700)
committerRaymond Hettinger <python@rcn.com>
Sun, 1 Jul 2012 05:19:04 +0000 (22:19 -0700)
Tools/scripts/README
Tools/scripts/pycolorize.py

index eb28a9e1f4ae473b17fbcfb0f8abaa4f58c2d75e..e7e2ddeafbf3d7f2b165d207444eb48c5c879b65 100644 (file)
@@ -47,6 +47,7 @@ pdeps.py                Print dependencies between Python modules
 pickle2db.py            Load a pickle generated by db2pickle.py to a database
 pindent.py              Indent Python code, giving block-closing comments
 ptags.py                Create vi tags file for Python modules
+pycolorize              Python syntax highlighting with HTML output.
 pydoc3                  Python documentation browser
 pysource.py             Find Python source files
 redemo.py               Basic regular expression demonstration facility
index 6edd223c293bea0f9531c5d6bdc0831c8091e742..c5c96110d82ccb283389b19a99e2120296be5c06 100755 (executable)
@@ -66,17 +66,25 @@ default_css = {
 }
 
 default_html = '''\
-<html><head><style type="text/css">
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+          "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
+<title> Python Code </title>
+<style type="text/css">
 %s
-</style></head>
+</style>
+</head>
 <body>
 %s
-</body></html>
+</body>
+</html>
 '''
 
 def build_page(source, html=default_html, css=default_css):
     'Create a complete HTML page with colorized Python source code'
-    css_str = ''.join(['%s %s\n' % item for item in css.items()])
+    css_str = '\n'.join(['%s %s' % item for item in css.items()])
     result = colorize(source)
     return html % (css_str, result)