File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ pdeps.py Print dependencies between Python modules
4747pickle2db.py Load a pickle generated by db2pickle.py to a database
4848pindent.py Indent Python code, giving block-closing comments
4949ptags.py Create vi tags file for Python modules
50+ pycolorize Python syntax highlighting with HTML output.
5051pydoc3 Python documentation browser
5152pysource.py Find Python source files
5253redemo.py Basic regular expression demonstration facility
Original file line number Diff line number Diff line change @@ -66,17 +66,25 @@ def colorize(source):
6666}
6767
6868default_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
7785def 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
You can’t perform that action at this time.
0 commit comments