Monday, 5 May 2008

copy for HTML.

Processing has a "copy for discourse" feature and when it works it awesome. It takes the code in the pde file and formats it for the discourse board. But this doesn't help when you want to publish some code on the rest of the internet. Something like this
void setup(){
String myString = backwards("the quick brown fox");
}

String backwards(String s){
String t = "";
for(int i = s.length() - 1; i >= 0; i --){
t = t + s.charAt(i);
}
return t;
}

OMFG colour. Adds a lot to code doesn't it.

Well I thought that maybe other people might find this tool useful, so here is the pde that makes the pretty colored text above. It takes the contents of the "formated for discourse" clipboard and formats it for the web.
  1. Get your code and copy it for discourse.
  2. Run the copy for HTML pde.
  3. Paste into blog.
copy_to_HTML

Labels: ,

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home