Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 10 Replies) SyntaxHighlight 4 YaBB 2.4 (Read 12 times)
Carsten
God Member
*****
Offline


...to much YaMS

Posts: 3281
Location: Langå
Joined: Aug 2nd, 2002
Gender: Male
SyntaxHighlight 4 YaBB 2.4
Feb 5th, 2010 at 7:03am
Print Post  
This mod will implement "shjs" into YaBB to enable syntax highlighting for code in messages.

I've included support for C++,css, html, Java, Javascript, Pascal, Perl, php and SQL in this implementation.

Just add the 'code language' to the ubbc code start tag e.g.: [code perl]
If no 'code language' is added you'll see normal yabb code.

Be aware that if you use BoardMod to apply the mod you must first copy 'yabbc.js' from the 'yabbfiles' to the 'Sources' folder in your BoardMod structure.





Feb 6th, 2010 at 1:32am - beta 0.2 - now syntax highlighting in 'Live Preview' too. While at it i fixed the bug with code boxes not scrolling when more than 20 lines of code.

Feb 7th, 2010 at 3:20pm - beta 0.3 - added syntax highlighting in 'Live Preview' in PM posting page. Added support for C++, Pascal and SQL. Fixed code showing in PM list (as reported by Derek).

Feb 9th, 2010 at 12:15am - beta 0.4 - added code language selector to message (and PM) post page.

Mar 20th, 2010 at 8:24am - beta 0.4.3 - fixed bug in code wrapping.
« Last Edit: Apr 3rd, 2010 at 5:02pm by Carsten »  

syntax01.png ( 20 KB | Downloads )
syntax01.png
syntax02a.png ( 19 KB | Downloads )
syntax02a.png

If you knock your head against a brick wall and hear a hollow sound, it's not necessarily coming from the wall.
Back to top
 
IP Logged
 
Derek Barnstorm
God Member
*****
Offline



Posts: 1146
Location: Warwickshire
Joined: Mar 23rd, 2008
Gender: Male
Re: SyntaxHighlight 4 YaBB 2.4
Reply #1 - Feb 5th, 2010 at 4:44pm
Print Post  
This is super Carsten, thanks!

I've only ever come across this one before that might have been suitable, but it seemed quite buggy - this seems far superior.

All's working well from a quick test. Is there any chance that it could maybe work with live preview though?
  
Back to top
 
IP Logged
 
Carsten
God Member
*****
Offline


...to much YaMS

Posts: 3281
Location: Langå
Joined: Aug 2nd, 2002
Gender: Male
Re: SyntaxHighlight 4 YaBB 2.4
Reply #2 - Feb 6th, 2010 at 1:38am
Print Post  
beta 0.2 - now syntax highlighting in 'Live Preview' too. While at it i fixed the bug with code boxes not scrolling when more than 20 lines of code.

New zip package attached to first post.

@Derek - again, thanks for testing  Smiley
  

If you knock your head against a brick wall and hear a hollow sound, it's not necessarily coming from the wall.
Back to top
 
IP Logged
 
Captain John
Senior Member
****
Offline


Pass to Port !

Posts: 264
Location: Reno Beach
Joined: Jan 18th, 2007
Gender: Male
Re: SyntaxHighlight 4 YaBB 2.4
Reply #3 - Feb 6th, 2010 at 3:42pm
Print Post  
Carsten wrote on Feb 5th, 2010 at 7:03am:
Just add the 'code language' to the ubbc code start tag e.g.: [code perl]
If no 'code language' is added you'll see normal yabb code. 


maybe I don't understand ... you state if no code language added.. but your 2nd example uses "css" and no highlighting shown

looks like the top one is posted, bottom in edit

love this MOD !)
  

Love to live and love on the water
Back to top
 
IP Logged
 
Derek Barnstorm
God Member
*****
Offline



Posts: 1146
Location: Warwickshire
Joined: Mar 23rd, 2008
Gender: Male
Re: SyntaxHighlight 4 YaBB 2.4
Reply #4 - Feb 6th, 2010 at 9:52pm
Print Post  
Carsten wrote on Feb 6th, 2010 at 1:38am:
now syntax highlighting in 'Live Preview' too.

Great. Thanks! Everything seems to be working well.
  
Back to top
 
IP Logged
 
Derek Barnstorm
God Member
*****
Offline



Posts: 1146
Location: Warwickshire
Joined: Mar 23rd, 2008
Gender: Male
Re: SyntaxHighlight 4 YaBB 2.4
Reply #5 - Feb 6th, 2010 at 11:10pm
Print Post  
Actually, I've just spotted something:

If 'Enable extended PM controls for Members?' is enabled in Admin Center and 'View message text in list view of Personal Messages?' is checked in Profile - PM Preferences, when sending code in personal messages, you should get the 'Code Ripped Out' image (code1.gif) warning instead of the text when viewing the inbox - This doesn't work when sending code with Syntax Highlighting, you just get the code instead. See attached image.

I think you just need add something around here in MyCenter.pl:

Code
Select All
if ($immessage =~ /\[code\]/isg) {
    $codeimg = qq~<img src="$imagesdir\/code1.gif" alt="$inmes_imtxt{'84'}" title="$inmes_imtxt{'84'}" \/>&nbsp;~;
    $immessage =~ s/\[code\](.+?)\[\/code\]//ig;
} 

  

CodeRippedOut.png ( 17 KB | Downloads )
CodeRippedOut.png
Back to top
 
IP Logged
 
Carsten
God Member
*****
Offline


...to much YaMS

Posts: 3281
Location: Langå
Joined: Aug 2nd, 2002
Gender: Male
Re: SyntaxHighlight 4 YaBB 2.4
Reply #6 - Feb 7th, 2010 at 3:26pm
Print Post  
beta 0.3 - added syntax highlighting in 'Live Preview' in PM posting page. Added support for C++, Pascal and SQL. Fixed code showing in PM list (as reported by Derek).

OBS! Changes are in almost all files involved!!

New zip package attached to first post.
  

If you knock your head against a brick wall and hear a hollow sound, it's not necessarily coming from the wall.
Back to top
 
IP Logged
 
Derek Barnstorm
God Member
*****
Offline



Posts: 1146
Location: Warwickshire
Joined: Mar 23rd, 2008
Gender: Male
Re: SyntaxHighlight 4 YaBB 2.4
Reply #7 - Feb 7th, 2010 at 5:39pm
Print Post  
Carsten wrote on Feb 7th, 2010 at 3:26pm:
added syntax highlighting in 'Live Preview' in PM posting page.

Ah, that one slipped past me, I didn't check that.

Carsten wrote on Feb 7th, 2010 at 3:26pm:
Fixed code showing in PM list (as reported by Derek).

Yep, works as it should now. Thanks!

  
Back to top
 
IP Logged
 
Carsten
God Member
*****
Offline


...to much YaMS

Posts: 3281
Location: Langå
Joined: Aug 2nd, 2002
Gender: Male
Re: SyntaxHighlight 4 YaBB 2.4
Reply #8 - Feb 9th, 2010 at 12:19am
Print Post  
beta 0.4 - added code language selector to message (and PM) post page.

New zip package attached to first post.
  

If you knock your head against a brick wall and hear a hollow sound, it's not necessarily coming from the wall.
Back to top
 
IP Logged
 
Jeff
God Member
*****
Offline


There are no bugs there
are only features

Posts: 2552
Joined: Jan 14th, 2005
Gender: Male
Re: SyntaxHighlight 4 YaBB 2.4
Reply #9 - Feb 9th, 2010 at 5:41am
Print Post  
Thats brilliant mod, Carsten. Will try later. Cool
  

greetings
Jeff
Back to top
WWW  
IP Logged
 
Carsten
God Member
*****
Offline


...to much YaMS

Posts: 3281
Location: Langå
Joined: Aug 2nd, 2002
Gender: Male
Re: SyntaxHighlight 4 YaBB 2.4
Reply #10 - Feb 9th, 2010 at 11:50am
Print Post  
Captain John wrote on Feb 6th, 2010 at 3:42pm:
looks like the top one is posted, bottom in edit
Exactement!  Wink

@Jeff - thanks - looking forward to your feedback  Smiley
  

If you knock your head against a brick wall and hear a hollow sound, it's not necessarily coming from the wall.
Back to top
 
IP Logged
 
Derek Barnstorm
God Member
*****
Offline



Posts: 1146
Location: Warwickshire
Joined: Mar 23rd, 2008
Gender: Male
Re: SyntaxHighlight 4 YaBB 2.4
Reply #11 - Feb 9th, 2010 at 5:18pm
Print Post  
Carsten wrote on Feb 9th, 2010 at 12:19am:
added code language selector to message (and PM) post page.

Cool. I like that new feature. Working good for me!
  
Back to top
 
IP Logged
 
Jeff
God Member
*****
Offline


There are no bugs there
are only features

Posts: 2552
Joined: Jan 14th, 2005
Gender: Male
Re: SyntaxHighlight 4 YaBB 2.4
Reply #12 - Feb 14th, 2010 at 10:24am
Print Post  
I have installed now and works great, Carsten. Attached German Patches.  Smiley

Mar 20th, 2010 at 9:00am
Edited:
Fix Spelling. German: Standard should be Standart Grin
« Last Edit: Mar 20th, 2010 at 9:00am by Jeff »  

greetings
Jeff
Back to top
WWW  
IP Logged
 
Carsten
God Member
*****
Offline


...to much YaMS

Posts: 3281
Location: Langå
Joined: Aug 2nd, 2002
Gender: Male
Re: SyntaxHighlight 4 YaBB 2.4
Reply #13 - Feb 23rd, 2010 at 12:50pm
Print Post  
Thanks Jet - i'll add it to the package when final.
  

If you knock your head against a brick wall and hear a hollow sound, it's not necessarily coming from the wall.
Back to top
 
IP Logged
 
Carsten
God Member
*****
Offline


...to much YaMS

Posts: 3281
Location: Langå
Joined: Aug 2nd, 2002
Gender: Male
Re: SyntaxHighlight 4 YaBB 2.4
Reply #14 - Mar 20th, 2010 at 8:25am
Print Post  
beta 0.4.3 - fixed bug in code wrapping.
  

If you knock your head against a brick wall and hear a hollow sound, it's not necessarily coming from the wall.
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint