Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Better code syntax highlighting Details »»
Better code syntax highlighting
Version: 0.04a, by Sarteck Sarteck is offline
Developer Last Online: Jun 2020 Show Printable Version Email this Page

Category: BB Code Enhancements - Version: 4.x.x Rating:
Released: 07-24-2012 Last Update: 07-31-2012 Installs: 41
Uses Plugins
Additional Files  
No support by the author.

This Modification is meant more as an example than an actual modification, but will work fine as is.

vBulletin by default has three "code" BB Codes.

The [CODE] tag simply gives us monospaced text.

The [HTML] and [PHP] tags give us some highlighted code that's highlighted pretty much how our webserver software decides how to highlight it. For "serious" coding, that's often insufficient.

GeSHi provides much more accurate highlighting and in a vast number of different languages. It's relatively simple to add these languages to your own BB Codes for highlighting, too.

Attached is the latest version of the GeSHi files, 1.0.8.10. You may go to their website at any time and download newer releases, though the latest was released well over a year ago. (I had to repackage it as a ZIP file, because vB.org doesn't accept tar.gz files.)

Download and extract this file. Upload the geshi.php file and the geshi folder to your FORUMROOT/includes folder.

Download the XML product file and Import it as you would a regular Product through your Admin Control Panel. It will install a plugin that contains BB Code functions for the following languages:
  • PHP (as [PHPS])
  • JavaScript (as [JSS])
  • CSS (as [CSSS])
  • SQL (as [SQLS])
  • C++ (as [CPPS])
  • HTML (as [HTMLS])
  • Java (as [JAVAS])
  • Tcl (as [TCLS])
  • BASH (as [BASHS])
(If you're wondering, the "S" stands for "Source".)

By looking through those examples, you can see how to easily add other languages GeSHi handles as well (Lua for some of you game programmers, for example).



This has really helped me communicate code stuff withmy Admins for our forum a lot better than the default vBulletin stuff, and it's nice to have for the coders at my forum as well.



Updated (25.JUL.12) [0.02a]
Included install and uninstall scripts that INSERT or DELETE the above BB Codes to/from your database. WARNING! If you have a BB Code named the same as one of the above that you do NOT want deleted, this product will delete that BB Code from the database if you use the Uninstall script. Just wanted to make that clear.

Updated (01.AUG.12) [0.03a]
Product was previously Disabled by default AND (even after enabling product) the Plugin was disabled. Both are now enabled by default.

Updated (01.AUG.12) [0.04a]
Fixed an error from 0.03a that gave SQL errors when trying to update the product. >_>

Download Now

File Type: zip geshi.zip (1.05 MB, 345 views)
File Type: xml product-cb_geshi_bbcode.xml (8.5 KB, 248 views)

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.
3 благодарности(ей) от:
conchemimare, Dr@gon

Comments
  #12  
Old 08-02-2012, 12:38 PM
tcarr9 tcarr9 is offline
 
Join Date: Jul 2010
Posts: 24
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks so much - installed and working nicely. I even modified it to include an AS3S tag for ActionScript3 since that is used on my forums frequently.
Reply With Quote
  #13  
Old 08-02-2012, 12:47 PM
Sarteck's Avatar
Sarteck Sarteck is offline
 
Join Date: Mar 2008
Posts: 304
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You're welcome, but thank the GeSHi coders more than me. :P All I did was show how to use it for vBulletin--they're the ones who provided such an awesome project. :3
Reply With Quote
  #14  
Old 08-06-2012, 06:58 PM
SolidSnakeLive SolidSnakeLive is offline
 
Join Date: Jul 2011
Posts: 15
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

How to add button for lua ?

I added a lines in XML file for lua

But the button didn't show up in Editor ... I have already put a pic for it !

Can you tell me how to add a button in editor or make this mod with buttons ?
Reply With Quote
  #15  
Old 08-07-2012, 02:16 AM
Sarteck's Avatar
Sarteck Sarteck is offline
 
Join Date: Mar 2008
Posts: 304
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

On the plugin GeSHi BB Codes (hook location bbcode_create), add the following:

PHP Code:


/// LUAS
$this->tag_list['no_option']['luas'] = array ();
$this->tag_list['no_option']['luas']['callback'] = 'handle_external';
$this->tag_list['no_option']['luas']['external_callback'] = 'handle_geshi_lua';
if (!
function_exists ('handle_geshi_lua'))
{
  function 
handle_geshi_lua(&$theobj, &$value, &$option)
  {
    
$code handle_geshi_code($value,'lua');
    return 
'<div class="bbcode_container"><div class="bbcode_description">Lua Code:</div><div style="max-height: 300px;" class="bbcode_code">'.$code.'</div></div>';
  }

In the Admin Control Panel, Custom BB Codes ---> Add New BB Code.
Title: Lua Source Code
BB Code Tag Name: luas
Replacement: {Placeholder}
Example: print("Herro World")
Description: Prints out Lua code all nicely formatted.
Use {option}: No
Button Image (Optional): --here is where you would specify a button image.
Remove Tag If Empty: Yes
Disable BB Code Within This BB Code: Yes (well, depends on if you want or not)
Disable Smilies Within This BB Code: Yes
Disable Word Wrapping Within This BB Code: No
Disable Automatic Link Parsing Within This BB Code: Yes

Then test it out.
Reply With Quote
Благодарность от:
SolidSnakeLive
  #16  
Old 08-07-2012, 04:14 AM
SolidSnakeLive SolidSnakeLive is offline
 
Join Date: Jul 2011
Posts: 15
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Sarteck View Post
On the plugin GeSHi BB Codes (hook location bbcode_create), add the following:

PHP Code:


/// LUAS
$this->tag_list['no_option']['luas'] = array ();
$this->tag_list['no_option']['luas']['callback'] = 'handle_external';
$this->tag_list['no_option']['luas']['external_callback'] = 'handle_geshi_lua';
if (!
function_exists ('handle_geshi_lua'))
{
  function 
handle_geshi_lua(&$theobj, &$value, &$option)
  {
    
$code handle_geshi_code($value,'lua');
    return 
'<div class="bbcode_container"><div class="bbcode_description">Lua Code:</div><div style="max-height: 300px;" class="bbcode_code">'.$code.'</div></div>';
  }

In the Admin Control Panel, Custom BB Codes ---> Add New BB Code.
Title: Lua Source Code
BB Code Tag Name: luas
Replacement: {Placeholder}
Example: print("Herro World")
Description: Prints out Lua code all nicely formatted.
Use {option}: No
Button Image (Optional): --here is where you would specify a button image.
Remove Tag If Empty: Yes
Disable BB Code Within This BB Code: Yes (well, depends on if you want or not)
Disable Smilies Within This BB Code: Yes
Disable Word Wrapping Within This BB Code: No
Disable Automatic Link Parsing Within This BB Code: Yes

Then test it out.
Well thanks for reply

But this did not work ...

There is no LUA button in editor

I did what you say exactly
Reply With Quote
  #17  
Old 08-07-2012, 04:52 AM
SolidSnakeLive SolidSnakeLive is offline
 
Join Date: Jul 2011
Posts: 15
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Its works the problem is I was using a plugin that add more buttons to editor such as pdf / flash / advanced colors ...etc

when i disabled it .... it works !

I don't know if there a solution to keep both works
Reply With Quote
  #18  
Old 08-07-2012, 10:44 AM
Sarteck's Avatar
Sarteck Sarteck is offline
 
Join Date: Mar 2008
Posts: 304
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hmm. What's the modification? Can you link it? Maybe I can modify my thing to be compatible with it (although I'm not sure why it would be incompatible).
Reply With Quote
  #19  
Old 08-22-2012, 03:35 AM
SolidSnakeLive SolidSnakeLive is offline
 
Join Date: Jul 2011
Posts: 15
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Sarteck View Post
Hmm. What's the modification? Can you link it? Maybe I can modify my thing to be compatible with it (although I'm not sure why it would be incompatible).
Its Editor tool addon

This Product :

http://www.wahtaljouf.com/wahtools/wah-tools-editor.zip

same but UTF-8 Encoding : http://www.wahtaljouf.com/wahtools/w...ditor-utf8.zip

Info : http://www.traidnt.net/vb/traidnt1998010/
Its in Arabic language not English but you can see the images to have the idea about this product
Reply With Quote
  #20  
Old 09-12-2012, 11:57 AM
SpikedRocker SpikedRocker is offline
 
Join Date: Jul 2009
Posts: 95
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

When I've tried using this mod, at least with the php code, it actually was causing an error when you try to load the thread. Has anyone else experienced this?
Reply With Quote
  #21  
Old 09-13-2012, 08:47 AM
SolidSnakeLive SolidSnakeLive is offline
 
Join Date: Jul 2011
Posts: 15
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Can you make this script looks like this codebox

http://forum.mtasa.com/viewtopic.php...=47798#p473505

appears as code with using lua highlight support & ofcource with rows id
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:34 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.09143 seconds
  • Memory Usage 2,358KB
  • Queries Executed 28 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (2)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (11)post_thanks_box
  • (3)post_thanks_box_bit
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (2)postbit_attachment
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete