tool to convert java code to HTML for wiki

U

usenetjb

anyone know of a tool that will take java code and format it into html.
think wiki for developers, so they need to be able to read the code
snippets in a readable format in the wiki (mediawiki)

thx
 
R

Roedy Green

anyone know of a tool that will take java code and format it into html.
think wiki for developers, so they need to be able to read the code
snippets in a readable format in the wiki (mediawiki)

I do all the time. I render small bits of Java into HTML and longer
files into compressed serialised token files rendered by an Applet
that scrolls them.

See http://mindprod.com/jgloss/jdisplay.html
 
H

Hal Rosser

usenetjb said:
anyone know of a tool that will take java code and format it into html.
think wiki for developers, so they need to be able to read the code
snippets in a readable format in the wiki (mediawiki)

thx

Just cut and paste the code into the html page - and put <pre> tags around
the code.
wouldn't that work?
 
A

Andrew Thompson

Hal said:
....
Just cut and paste the code into the html page - and put <pre> tags around
the code.
wouldn't that work?

Sure would. E.G.

<html>
<body>
<pre>
....the source code..
</pre>
</body>
</html>

...Would be a valid page containing source code that would
retain the tabs, spacing and line breaks of the original.

Of course, Roedy does some nice transforms on the source to
highlight a variety of aspects of the code (keywords, method
exits, ..) more like an IDE would.
 
T

Torkel Franzen

Hal Rosser said:
Just cut and paste the code into the html page - and put <pre> tags around
the code.
wouldn't that work?

Not quite. You also need to replace some < with &lt;.
 
A

Andrew McDonagh

Hal said:
Just cut and paste the code into the html page - and put <pre> tags around
the code.
wouldn't that work?

even simpler, in MediaWiki, just start each line with a space, then
everything is treated as code and formatted appropriately...
 
T

Thomas Schodt

Hal said:
Just cut and paste the code into the html page - and put <pre> tags around
the code.
wouldn't that work?

Use the wiki <verbatim> </verbatim> tags,
that will escape funny stuff ('<','>','&', etc.)
 
T

Thomas Schodt

Thomas said:
Use the wiki <verbatim> </verbatim> tags,
that will escape funny stuff ('<','>','&', etc.)

Except OFC you can't have "</verbatim>" in the text...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,023
Latest member
websitedesig25

Latest Threads

Top