Python2Html regex question

Gerard Flanagan grflanagan at yahoo.co.uk
Tue Aug 30 13:28:08 EDT 2005


Hello

I've been using the Html Formatter at
http://www.manoli.net/csharpformat to format c# code (paste your code
into the box, click the button and get html/css).  Is there anything
similar for Python code, does anyone know?

Either way, the (c#) source is available for the above formatter and it
looks like it would be straightforward to create a Python formatter by
extending a base class and providing the following three things:

1) a list of python keywords
2) a regex to match python comments
3) a regex to match python strings

Even my limited talents can handle the first, can anyone help me with
2) and 3)?

C# uses '@' where Python uses 'r' as a 'raw-input' prefix for regex's,
but I'm assuming the expressions themselves are the same in both
languages?

Thanks in advance.




More information about the Python-list mailing list