python source -> html
Eddie Corns
eddie at holyrood.ed.ac.uk
Mon Dec 16 13:02:35 EST 2002
More information about the Python-list mailing list
Mon Dec 16 13:02:35 EST 2002
- Previous message (by thread): python source -> html
- Next message (by thread): python source -> html
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"Achim Domma" <achim.domma at syynx.de> writes: >Hi, >I'm looking for a tool, which converts python source code to html, to show >examples on a webpage. Any idea? >regards, >Achim As a related aside - when I was playing with some javascript for a work related project which involved creating a web page for viewing large amounts of data by using folding I thought to myself "Hmm I could use this to create a foldable viewer for Python code". I had hoped to just modify an existing py2html type thing and just insert my own code. This turned out to be rather hard, even trying some of the source code parsers turned out to involve orders of magnitude more effort to do the job properly than I expected so I abandoned it. At some point I may try going back to a simple regex version even though it won't work on all sources. Anyway, grumbling aside, a test version of a formatted page is viewable here: <A"href=http://homepages.ed.ac.uk/eddie/d.html">http://homepages.ed.ac.uk/eddie/d.html</A> The page was a part of the pydoc code which was chosen only because it was big enough to generate a reasonable test. Some notes BEFORE you click! o This was done weeks ago and I can't remember exactly what state the system was in when I created this particular file but it should show you what was intended. o To the best of my knowledge and ability it uses only standards compliant javascript and CSS which means (the last time I checked) that currently only Mozilla displays it properly (well I didn't check Opera etc. but I do know that IE couldn't do it). o It's not fast. o As a testing hack it detects key-presses to pop-up an inline menu (this one bit that IE really screws up on). The options are: find - highlight lines containing search string - unfolds any level that is needed in order to make each line visible expand/collapse all - should be obvious expand/collapse selected - the last node you clicked on to expand or collapse it will select that item (should be highlighted in red) o It's not finished! o The points where folding is done are currently only def and class I think, the final version was to support anything that could be indented. Anyone who wants to is welcome to play with it. I have some simple Python classes for creating the relevant javascript, that may be more complete - I'll have to dig it out and check. Perhaps I'll have another go at finishing the whole thing during the yuletide hols. Eddie
- Previous message (by thread): python source -> html
- Next message (by thread): python source -> html
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list