473,378 Members | 1,622 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 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 2770
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: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.