468,317 Members | 1,589 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,317 developers. It's quick & easy.

python html rendering

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
4 2583
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
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
"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
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.

Similar topics

6 posts views Thread by David Opstad | last post: by
3 posts views Thread by John Hunter | last post: by
40 posts views Thread by Shufen | last post: by
10 posts views Thread by Andrew Dalke | last post: by
71 posts views Thread by tomy_baseo | last post: by
29 posts views Thread by 63q2o4i02 | last post: by
39 posts views Thread by cm_gui | last post: by
1 post views Thread by bruce | last post: by
reply views Thread by NPC403 | last post: by
1 post views Thread by howard w | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.