[Python-checkins] cpython: Small cleanups
raymond.hettinger
python-checkins at python.org
Sun Jul 1 07:19:15 CEST 2012
http://hg.python.org/cpython/rev/d02588a26057
changeset: 77902:d02588a26057
user: Raymond Hettinger <python at rcn.com>
date: Sat Jun 30 22:19:04 2012 -0700
summary:
Small cleanups
files:
Tools/scripts/README | 1 +
Tools/scripts/pycolorize.py | 16 ++++++++++++----
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/Tools/scripts/README b/Tools/scripts/README
--- a/Tools/scripts/README
+++ b/Tools/scripts/README
@@ -47,6 +47,7 @@
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
diff --git a/Tools/scripts/pycolorize.py b/Tools/scripts/pycolorize.py
--- a/Tools/scripts/pycolorize.py
+++ b/Tools/scripts/pycolorize.py
@@ -66,17 +66,25 @@
}
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)
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list