472,800 Members | 1,096 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,800 software developers and data experts.

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 2739
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: David Opstad | last post by:
I have a question about text rendering I'm hoping someone here can answer. Is there a way of doing linguistically correct rendering of Unicode strings in Python? In simple cases like Latin or...
3
by: John Hunter | last post by:
matplotlib is a 2D plotting library for python. You can use matplotlib interactively from a python shell or IDE, or embed it in GUI applications (WX, GTK, and Tkinter). matplotlib supports many...
40
by: Shufen | last post by:
Hi all, Can someone who has use PHP before and know quite well about the language, tell me what are the stuffs that Python offers and PHP doesn't. A few examples will be nice. I know about the...
10
by: Andrew Dalke | last post by:
Is there an author index for the new version of the Python cookbook? As a contributor I got my comp version delivered today and my ego wanted some gratification. I couldn't find my entries. ...
71
by: tomy_baseo | last post by:
I'm new to HTML and want to learn the basics by learning to code by hand (with the assistance of an HTML editor to eliminate repetitive tasks). Can anyone recommend a good, basic HTML editor that's...
29
by: 63q2o4i02 | last post by:
Hi, I'm interested in using python to start writing a CAD program for electrical design. I just got done reading Steven Rubin's book, I've used "real" EDA tools, and I have an MSEE, so I know what...
39
by: cm_gui | last post by:
Python is slow. Almost all of the web applications written in Python are slow. Zope/Plone is slow, sloow, so very slooow. Even Google Apps is not faster. Neither is Youtube. Facebook and...
1
by: bruce | last post by:
Hi Paul... Thanks for the reply. Came to the same conclusion a few minutes before I saw your email. Another question: tr=d.xpath(foo) gets me an array of nodes.
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.