code highlighting

For help on using the forums and feature requests for this site
User avatar
ghosttie
Posts: 181
Joined: Sat Aug 15, 2009 1:25 am
Location: Atlanta, GA, USA
Contact:

code highlighting

Postby ghosttie » Tue Aug 25, 2009 3:56 am

As this is a Jade forum, it would be really cool if the Code tag did Jade code highlighting, for example classes in green, literals in red, reserved words in blue etc.
I have a catapult. Give me all the money or I will fling an enormous rock at your head.

User avatar
BeeJay
Posts: 311
Joined: Tue Jun 30, 2009 2:42 pm
Location: Christchurch, NZ

Re: code highlighting

Postby BeeJay » Tue Aug 25, 2009 4:22 pm

That would be a nice option - not that I'm offering to code the changes necessary to support this... besides I don't have access to the source for these new forums anyway....

Unfortunately global constants would just have to go class color green as the forums don't have the meta-data to know if the upper-case-first-letter "word" is a class name or a global constant name like the IDE does. :)

Cheers,
BeeJay.

User avatar
ghosttie
Posts: 181
Joined: Sat Aug 15, 2009 1:25 am
Location: Atlanta, GA, USA
Contact:

Re: code highlighting

Postby ghosttie » Wed Aug 26, 2009 1:26 am

True, but it could highlight known classes and constants (i.e. Jade ones) correctly and leave unknown ones black
I have a catapult. Give me all the money or I will fling an enormous rock at your head.

allistar
Posts: 156
Joined: Fri Aug 14, 2009 11:02 am
Location: Mount Maunganui, Tauranga

Re: code highlighting

Postby allistar » Wed Aug 26, 2009 12:56 pm

I have some old Jade code that does this to Jade method source. It's pretty straightforward and could be converted to PHP is someone wants to put in the effort.

User avatar
ghosttie
Posts: 181
Joined: Sat Aug 15, 2009 1:25 am
Location: Atlanta, GA, USA
Contact:

Re: code highlighting

Postby ghosttie » Thu Aug 27, 2009 1:56 am

I'd be willing to give it a shot if we had confirmation from Jade that they were willing to install it in the forum
I have a catapult. Give me all the money or I will fling an enormous rock at your head.

admin
Site Admin
Posts: 9
Joined: Wed Jun 17, 2009 12:03 pm

Re: code highlighting

Postby admin » Wed Sep 09, 2009 8:59 am

I'd be willing to give it a shot if we had confirmation from Jade that they were willing to install it in the forum
Yes, we will install it if someone is willing to write one. A Jade syntax highlighter function would need to be written in PHP and produce html output similar to http://php.net/manual/en/function.highlight-string.php, outputting only <span> and <br /> html tags in XHTML 1.0 Strict and use css classes for colorization.

The bbcode code tag could specify jade code as follows:
Thanks
Jade Forums Admin

User avatar
ghosttie
Posts: 181
Joined: Sat Aug 15, 2009 1:25 am
Location: Atlanta, GA, USA
Contact:

Re: code highlighting

Postby ghosttie » Thu Sep 10, 2009 1:50 am

allistar, can you post your code highlighting code so I can take a look at it please?
I have a catapult. Give me all the money or I will fling an enormous rock at your head.

allistar
Posts: 156
Joined: Fri Aug 14, 2009 11:02 am
Location: Mount Maunganui, Tauranga

Re: code highlighting

Postby allistar » Thu Sep 10, 2009 9:19 am

No problem, I'll try and find the Jade database this code is in and I'll attach the class that does this highlighting.

allistar
Posts: 156
Joined: Fri Aug 14, 2009 11:02 am
Location: Mount Maunganui, Tauranga

Re: code highlighting

Postby allistar » Thu Sep 10, 2009 9:37 am

Attached is a zipped class extract for a class that was designed to show exception details from an exception on a webpage (it is used for Jade systems exposed on the web using JHP). It should br fairly easy to get working by itself: call the "set" method passing in: (false, sourceCode, 0, "", 0, 0) and then call getDisplay to return the HTML version of the method. This doesn't use style sheets at all - it returns the old style <font...> etc. tags. It shouldn't be too difficult to modify it to work in PHP. All I ask is that the resultant PHP class be made available to all who want it.

allistar
Posts: 156
Joined: Fri Aug 14, 2009 11:02 am
Location: Mount Maunganui, Tauranga

Re: code highlighting

Postby allistar » Thu Sep 10, 2009 9:37 am

Apparently the "board attachment quota has been reached". Once this is fixed I'll upload the file, otherwise provide me with an email address and I'll email it instead.


Return to “Forum Feedback and Help”

Who is online

Users browsing this forum: No registered users and 1 guest

cron