beautify your shared code on the fly

Not shared java code, but, I have made a PHP script which utilises regex to pretty-print Java source code on the fly. Now if you want to show off your code in colour you can, and very easily.

Naturally, CSS is used for the colours - so changing them to suite your preferred style is simple.

http://showsrc.sourceforge.net/

The script is GPL’d.

Cheers,

Will.

Nice, but what about putting your script online?

would be nice to acome on your website and to put source code in a text area, and then getting the html code in output in another text area :wink:

good idea :slight_smile: I’ll see what I can do

I have also added line numbers (optional) to the script which I’ll release soon.

Will.

ok - here it is: http://showsrc.sourceforge.net/wshowsrc.php

Either upload a file, link to one (for some reason this doesn’t work on SF) or paste it in. Then you can simply view the HTML source of your output.

Will.

the new changes (line numbers and the “wshowsrc.php” online version) are in CVS - I’ll make a release when I get the time.

Nice :slight_smile:

Thanks.

stay tuned, got something even better coming :slight_smile:

Will.

Ok, I’ve put the script on a server which doesn’t mind downloading the file to display. And for the hell of it, I got a domain as well :slight_smile:

Check out: http://showsrc.com/ :slight_smile:

I’ve also made it dead easy now to link to ones sources. Lets say you want to provide someone the HTML version of the souce code which resides here: http://jtank.net/src/src/net/jtank/io/Ini.java .

Simply prepend “http://showsrc.com/$” to it (so that you get http://showsrc.com/$http://jtank.net/src/src/net/jtank/io/Ini.java) and bob’s your uncle :slight_smile:

Could it be any easier? Of course this isn’t a replacement for those who are showing a lot of source and will install a local version of the script, but for people with only a few sources to display it saves the hassle of uploading and configuring the script.

Cheers,

Will.

Updates: The script now sports linkable line numbers :slight_smile:

I’m releasing version 2.1 as soon as SF gets it’s act together and fixes whatever current problem it is having with the DB.

Example:
http://showsrc.com/$http://jtank.net/src/src/net/jtank/io/Ini.java#120

Cheers,

Will.

Sweet. If only we could get the {code} tags on this message board to format as well.

[quote]Sweet. If only we could get the {code} tags on this message board to format as well.
[/quote]
I’ll second that

that’d be nice :slight_smile: Well it’s open source, and really only uses regexp so technically quite possible, but we’re probably just dreaming.

I’ve uploaded a zip and bz2 of the code now too btw:

Will.

Afraid I only just found an excuse to use this, its flippin ace! Really really useful! Nice work!

On the server I’m using the PHP version reports an error if the index referenced doesn’t exist in an array so I had to add a couple of checks on whether the index “showlines” existed in the $_GET array, and default it didn’t.

Even so, great! super! useful! brilliant!

Thanks William,

Kev

Kev,

glad you liked it ;D thanks.

mind if you send me a .diff of your changes so I can incorporate them?

Cheers,

Will.

edit: typo