Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
3d0e030c
Commit
3d0e030c
authored
Jun 30, 2012
by
Raymond Hettinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Small cleanups
parent
7f78eeb8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
4 deletions
+13
-4
Tools/scripts/README
Tools/scripts/README
+1
-0
Tools/scripts/pycolorize.py
Tools/scripts/pycolorize.py
+12
-4
No files found.
Tools/scripts/README
View file @
3d0e030c
...
...
@@ -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
...
...
Tools/scripts/pycolorize.py
View file @
3d0e030c
...
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment