FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Suggestions
   Website, Reference, Example Suggestions
(Moderator: REAS)
   color code example?
« Previous topic | Next topic »

Pages: 1 2 
   Author  Topic: color code example?  (Read 5705 times)
nay

WWW
color code example?
« on: Sep 13th, 2004, 9:46pm »

hi
 
sorry if this has been brought up before but i find that when i look at the examples i need to cut and paste them into the IDE as the color makes them so much easier to read. Maybe it would be a good idea to have the code examples and reference color coded in the same way?
 
REAS


WWW
Re: color code example?
« Reply #1 on: Sep 15th, 2004, 4:17am »

I agree it is a good idea. I just haven't taken the time to do it yet.
 
nay

WWW
Re: color code example?
« Reply #2 on: Sep 15th, 2004, 3:27pm »

cool, i guess it is a pretty tedious job.i hope there's an easier method than manually changing the colour of the html!
 
cello

marcello3d WWW
Re: color code example?
« Reply #3 on: Sep 15th, 2004, 5:23pm »

I wrote a genric php based code syntax colorizer thing a while back using regular expressions... I'm sure it could be ported to perl or whatever if one is interested.
 
Marcello
 
fjen

WWW
Re: color code example?
« Reply #4 on: Sep 15th, 2004, 7:26pm »

cool. i'm in ... send me the php and i'll processify it ...
/F
 
cello

marcello3d WWW
Re: color code example?
« Reply #5 on: Sep 15th, 2004, 9:36pm »

demo
 
files
 
Marcello
 
fjen

WWW
Re: color code example?
« Reply #6 on: Sep 15th, 2004, 10:36pm »

aha ... you already made this to work with processing. i thought i'd port it to do that ... not much to do for me then.
 
mKoser

WWW Email
Re: color code example?
« Reply #7 on: Sep 20th, 2004, 12:27am »

this would indeed be a really nice feature - well done!
 
i just gave your script a go with this piece of code:
Code:

background(255);
  translate(width/2, height/2 - h/2, 0);
   
  if(mousePressed){
    targetRot = 90;
  }else{
    targetRot = 0;
  }
   
  if(curRot != targetRot){
    curRot += (targetRot - curRot)/rotSpeed;
  }
   
  rotateX(radians(-15));
  rotateY(radians(curRot));
   
  noStroke();
  drawNum();
   
  if(showGrid) drawGrid();

 
and it does something strange when it meets the != ...hmmm.
 
I really like the links to the different commands! Allthough it would be nice if there were no underlining under the links.
 
Would it be possible to write a generic php-script which takes a .PDE-file as a parameter and then displays it with colour-syntax?
 
ie. something like: showcode.php?mysource.pde
 
* * * * *
 
or maybe the code could even be spit out as a HTML-file with colour syntax and links instead of the .PDE file?
 
my 2 cents,
+ mikkel
 

mikkel crone koser | www.beyondthree.com | http://processing.beyondthree.com
cello

marcello3d WWW
Re: color code example?
« Reply #8 on: Sep 20th, 2004, 1:51am »

The glitch appears to be related to me using 'class' as a keyword... I'll see what I can do on that one.  Regular expressions aren't the perfect way to do this, but certainly an easy way.
 
Disabling underline is extremely simple, just change the style sheet.
 
It is possibly to write a generic php script... after all, that is a generic php script already.  You just need to merely pass the contents of a file to the function rather than the contents of the form.
 
Marcello
 
fjen

WWW
Re: color code example?
« Reply #9 on: Sep 20th, 2004, 5:43pm »

changed small pieces in the code ... source:
http://www.florianjenett.de/p55/syntax_color/
 
here's the link (temporary):
http://www.florianjenett.de/p55/syntax_color/link.php?url=
 
use like this:
http://www.florianjenett.de/p55/syntax_color/link.php?url=www.some.domai n.ext/path/to/some/applet/thesource.pde
 
 
example:
http://www.florianjenett.de/p55/syntax_color/link.php?url=www.florianjen ett.de/p55/../p55/scrolling_fastT_2/scrolling_fastT_2.pde
 
this is just for testing purposes at the moment ...
 
/F
« Last Edit: Sep 20th, 2004, 6:07pm by fjen »  
REAS


WWW
Re: color code example?
« Reply #10 on: Sep 20th, 2004, 7:56pm »

This is wonderful Florian and Marcello,
 
I don't have the time to integrate this into the website generation pipeline, but I'm happy to give you the files and support if you have the motivation. The examples on the Processing website are generated from a directory taken directly from my Sketchbook. The PDE is parsed and placed into a generated HTML file and the JAR is simply copied over. If you're interested, I can post the files.
 
+ Casey
 
 
cello

marcello3d WWW
Re: color code example?  
« Reply #11 on: Sep 20th, 2004, 8:58pm »

I don't see why not.  Motivated sure, but having time is another issue.  
 
P5 is like a bad addiction.
 
Marcello
 
fjen

WWW
Re: color code example?
« Reply #12 on: Sep 20th, 2004, 9:07pm »

sure. count me in ...
 
mail [at] florianjenett [dot] de
 
not a bad addiction, rather an everyday need .. like food.
 
fjen

WWW
Re: color code example?
« Reply #13 on: Sep 20th, 2004, 11:57pm »

added a testfile ... by far not complete, working on it ...
it's here:
 
http://www.florianjenett.de/p55/syntax_color/link.php
 
[update 001]    added new integer and float coloring
[update 002]    better handling of pde_keywords
« Last Edit: Sep 21st, 2004, 7:08am by fjen »  
fjen

WWW
Re: color code example?
« Reply #14 on: Sep 21st, 2004, 7:06am »

processing online code colorizer:
http://www.florianjenett.de/p55/syntax_color/link.php
(go there, paste url to your .pde, hit submit)
 
i think i removed most errors ... can you check with your online code?
 
best,
F
 
Pages: 1 2 

« Previous topic | Next topic »