Any tool to convert Python source code to HTML?

Miki Tebeka tebeka at cs.bgu.ac.il
Tue Feb 25 09:13:06 EST 2003


Hello, 
> VIM! (www.vim.org)
> 
> Vim can write any file that it can syntax-colorize (Python is among the 
> large set of recognised file types ofcourse) as colorized HTML.
> 
> Just type in command mode:
> 
> 	ru syntax/2html.vim
> 
> and save the generated HTML buffer.

You can use this script (will work for many other languages as well):
----------
#!/bin/bash

# Prepare files for code review
# Author: Miki Tebeka <tebeka at cs.bgu.ac.il>

if [ $# -lt 1 ]; then
	echo "usage: `basename $0` FILE[s]"
	exit 1
fi

for file in $*
do
	vim -c 'se nu' -c 'so $VIMRUNTIME/syntax/2html.vim' -c w -c 'qa!' $file
done
---------

HTH.
Miki




More information about the Python-list mailing list