python source -> html

Anand B Pillai abpillai at lycos.com
Mon Dec 16 06:07:12 EST 2002


If you are an emacs user like me, you would need only two files to
accomplish this. python-mode.el and htmlize-buffer.el 

python-mode.el is a python mode plugin for emacs.
htmlize-buffer dumps the current emacs buffer to an html file
maintaining the font face/size/style etc and also the colors.
You can even write an elisp function like below to automate the task.

(def save-as-html()
(interactive)
(require 'htmlize-buffer)
(htmlize-buffer)
(write-file (concat (buffer-file-name) ".html")))

Both are avaialable from Stephen's ell (Emacs lisp list)

http://www.anc.ed.ac.uk/~stephen/emacs/ell.html

Best Regards

Anand Pillai


Brian Quinlan <brian at sweetapp.com> wrote in message news:<mailman.1039985902.14114.python-list at python.org>...
> I've developed a very over-engineered source => styled-html generator:
> http://silvercity.sourceforge.net/
> 
> It uses the Scintilla styling engine so it can process source files in a
> variety of languages. It can also style portions of your source using a
> different language style, which is why I developed it in the first place
> e.g.
> 
> print 'Content-type: text/html'
> print
> print '''<html><head><title>foo</title></head>...'''
> 
> The contents of the second string could (optionally) be styled using the
> HTML styler.
> 
> It also creates hyperlinks whenever it finds URLs, PEPs or RFCs in your
> source. Here is an example:
> 
> http://www.sweetapp.com/cgi-bin/cgi-styler.py?source=../xmlrpc/xmlrpclib
> .py
> 
> 
> Cheers,
> Brian



More information about the Python-list mailing list