By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
439,932 Members | 1,908 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 439,932 IT Pros & Developers. It's quick & easy.

python html rendering

P: n/a
Hi, Im looking for a way to display some python code
in html: with correct indentation, possibly syntax hiliting, dealing
correctly with multi-line comment, and... generating valid html code if
the python code itself deals with html (hence manipulates tag litterals.
Thanks for your help!

Oct 3 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Hi, Im looking for a way to display some python code
in html: with correct indentation, possibly syntax hiliting, dealing
correctly with multi-line comment, and... generating valid html code if
the python code itself deals with html (hence manipulates tag litterals.
Thanks for your help!
I haven't used it, but these seem promising:
http://aspn.activestate.com/ASPN/Coo.../Recipe/252170
http://silvercity.sourceforge.net/

Hope it helps.

Oct 4 '06 #2

P: n/a
Pierre,
Hi, Im looking for a way to display some python code
in html: with correct indentation, possibly syntax hiliting, dealing
correctly with multi-line comment,
<tongue - in - cheek - mode>
the usual way is to create your own web-framework
</tongue - in - cheek - mode>

If it is just "some" Python code and you have to do it "once", just
look at scite. Scite can colour your code, and you can export it as
HTML.

Harald

Oct 4 '06 #3

P: n/a
"GHUM" <ha**************@gmail.comwrote:
>Hi, Im looking for a way to display some python code
in html: with correct indentation, possibly syntax hiliting, dealing
correctly with multi-line comment,

<tongue - in - cheek - mode>
the usual way is to create your own web-framework
</tongue - in - cheek - mode>
Or you could use an existing web framework: Plone has the ability to
colour python code built-in.
If it is just "some" Python code and you have to do it "once", just
look at scite. Scite can colour your code, and you can export it as
HTML.
and if you need it more than once you can always find one of the existing
chunks of colouring code and modify/reuse it. See Plone's
PortalTransforms/transforms/python.py, or the MoinMoin code it was cribbed
from.

https://svn.plone.org/svn/archetypes...orms/python.py
Oct 4 '06 #4

P: n/a
Pierre Imbaud wrote:
Hi, Im looking for a way to display some python code
in html: with correct indentation, possibly syntax hiliting, dealing
correctly with multi-line comment, and... generating valid html code if
the python code itself deals with html (hence manipulates tag litterals.
Thanks for your help!
Take a look at Highlight [1], a program used successfully in the
otherwise Python-based open source project ViewVC [2]. Messing around
with IDEs (as others have suggested) just isn't necessary here.

Paul

[1] http://www.andre-simon.de/
[2] http://www.viewvc.org/

Oct 4 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.