[ABD] bbCODE tag language highlighting

Any abandoned MODs will be moved to this forum.

WARNING: MODs in this forum are not currently being supported or maintained by the original MOD author. Proceed at your own risk.
Forum rules
IMPORTANT: MOD Development Forum rules

WARNING: MODs in this forum are not currently being supported nor updated by the original MOD author. Proceed at your own risk.
User avatar
James78
Registered User
Posts: 811
Joined: Sat Jul 30, 2005 4:54 pm
Location: Washington, USA
Contact:

[ABD] bbCODE tag language highlighting

Post by James78 » Sun Feb 06, 2011 2:22 pm

Modification Name: bbCODE tag language highlighting
Author: James78

Modification Description:
This MOD takes the original BBCode CODE tag and makes it able to syntax highlight almost any language you can think of (200+!)

Modification Version: 1.0 RC

Requirements: GeSHi - Download (1.0.8.10)

Compatibility:
  • Works with 3.0.8+
Image
Image
Features:
  • Syntax highlighting in the CODE tag for 200+ languages!
  • Highlighted language indicated on CODE box
  • Line numbers (with feature to enable/disable in ACP)
Screenshots:
Image Image

Modification Download: Download

Bug? Please report all bugs to my bug tracker (you need an account to report bugs; register here), unless it's a support issue, or a small problem, like a packaging error. You will have to differentiate between installation/user error (and the like) and what could be a bug. While I will definitely maintain support for the MOD in this topic, I cannot do bug reports in topic as it gets very messy and disorganized (your post may get missed in a bunch of other posts).

Usage:
To enable/disable the line numbers:
Image

How to use in posts: (be sure to remove spaces in code tags)

Code: Select all

[ code=html4strict]<!-- HTML -->
<div style="width: 50px;">hi there</div>
<a href="https://www.phpbb.com">phpBB</a>[ /code]

[ code=cpp]// C++
int i= 0;
i++;[ /code]

[ code=delphi](* Delphi *)
repeat
  Inc( i, 2 );
until i>= 500;[ /code]

[ code=sql]-- SQL
SELECT *
  FROM phpbb_users
WHERE user_type= 1;[ /code]

[ code=dos]rem DOS
@echo off
fsutil fsinfo volumeinfo c:\
pause[ /code]

[ code=vb]' Visual Basic
Dim i As Long
On Error Goto 0[ /code]
Changelog:

Code: Select all

2011-02-22 - Version 0.9.21 BETA
- Added database updater script

2011-02-06 - Version 0.9.2 BETA
- Added line numbers (with feature to enable/disable in ACP)

2011-02-06 - Version 0.9.1 BETA
- Only import GeSHi if language was given
- Highlighted language is now displayed on CODE box

2011-02-06 - Version 0.9 BETA
- Released MOD into the wild
Special Thanks: AmigoJack
Last edited by James78 on Sat Sep 03, 2011 8:21 am, edited 33 times in total.
If you encounter what is/or you think is a bug, please report it to the phpBB Bug Tracker

User avatar
4_seven
I've Been Banned!
Posts: 5155
Joined: Wed Apr 30, 2008 1:41 am

Re: [BETA] bbCODE tag language highlighting

Post by 4_seven » Sun Feb 06, 2011 3:55 pm

brilliant work. which means the corporate work between AmigoJack and you ;)
Current Mods | Mod Base | php(BB) programming | No help via PM

User avatar
James78
Registered User
Posts: 811
Joined: Sat Jul 30, 2005 4:54 pm
Location: Washington, USA
Contact:

Re: [BETA] bbCODE tag language highlighting

Post by James78 » Sun Feb 06, 2011 10:15 pm

4_seven wrote:brilliant work. which means the corporate work between AmigoJack and you ;)
Thanks. :D Glad you enjoy it!
If you encounter what is/or you think is a bug, please report it to the phpBB Bug Tracker

Logman
Registered User
Posts: 38
Joined: Fri Jun 13, 2003 7:41 pm
Location: Czech Republic

Re: [BETA] bbCODE tag language highlighting

Post by Logman » Tue Feb 22, 2011 10:31 pm

Great mod, thanks. It's useful for many users and me.

btw, your installation instructions (0.9.2 BETA) does not contain a SQL directive, like

Code: Select all

DELETE FROM phpbb_config WHERE config_name = 'enable_code_lines';
INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('enable_code_lines', '0', '0');

User avatar
James78
Registered User
Posts: 811
Joined: Sat Jul 30, 2005 4:54 pm
Location: Washington, USA
Contact:

Re: [BETA] bbCODE tag language highlighting

Post by James78 » Tue Feb 22, 2011 11:43 pm

Logman wrote:Great mod, thanks. It's useful for many users and me.

btw, your installation instructions (0.9.2 BETA) does not contain a SQL directive, like

Code: Select all

DELETE FROM phpbb_config WHERE config_name = 'enable_code_lines';
INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('enable_code_lines', '0', '0');
Your welcome. ;) I made and included a database updater script as per your suggestion. :ugeek:
If you encounter what is/or you think is a bug, please report it to the phpBB Bug Tracker

Logman
Registered User
Posts: 38
Joined: Fri Jun 13, 2003 7:41 pm
Location: Czech Republic

Re: [BETA] bbCODE tag language highlighting

Post by Logman » Wed Feb 23, 2011 12:19 am

James78, it's great.

James78, do you know, how to change the default font color of general text for a codes defined as a GeSHi syntax language (non-keywords)? For example, in the code box with vb syntax have all unknown keywords shown as green. Can I define initial font color for GeSHi only?

User avatar
James78
Registered User
Posts: 811
Joined: Sat Jul 30, 2005 4:54 pm
Location: Washington, USA
Contact:

Re: [BETA] bbCODE tag language highlighting

Post by James78 » Wed Feb 23, 2011 12:35 am

That's a bit more difficult/advanced topic, however this section of the GeSHi documentation may be of some help (I hope). Specifically, check out the "Setting Keyword Styles" section in the documentation link I gave you.

If you only wanted to change the color for the VB language, you could simply go edit the VB language file in the includes/geshi/geshi directory.

Their demo appears to have these features, but I'm afraid I don't know how they've done it, but how they've most likely done it is by having a global CSS for the highlighting, then adding/removing/changing various CSS rules based on your selections.
Last edited by James78 on Wed Feb 23, 2011 9:21 pm, edited 1 time in total.
If you encounter what is/or you think is a bug, please report it to the phpBB Bug Tracker

Logman
Registered User
Posts: 38
Joined: Fri Jun 13, 2003 7:41 pm
Location: Czech Republic

Re: [BETA] bbCODE tag language highlighting

Post by Logman » Wed Feb 23, 2011 12:19 pm

Thanks for the tip, I tried to change the style directly in geshi.php file, but without success. Maybe it's a combination of several variables, but I tried everything :(

Finally, I had to write dirty line to geshi.php:

Code: Select all

      $endresult = str_replace(array('<SEMI>', '<PIPE>'), array(';', '|'), $endresult);
// ADD (VERY DIRTY METHOD):
		$endresult = '<span style="color:#000000;">' . $endresult . '</span>';
// <<--

Bluechimera
Registered User
Posts: 11
Joined: Fri May 06, 2011 6:44 am

Re: [RC] bbCODE tag language highlighting

Post by Bluechimera » Fri May 06, 2011 6:55 am

I really wish I didn't have to post this, cause I have searched high and low and cannot seem to find an answer. :oops:

Your syntax highlight mod is exactly what I am looking for to brighten up my forums (when my site officially launches)
I fought with AutoMod for hours before getting it to work properly (I use MSSQL with shared host 1&1 and my host is terrible! :lol: ) just so I could get your mod installed and geshi in the right location.

Now, my problem is, I have installed your mod and it said "successful".. but when i try to do the code tags for C++ it doesnt alter the keyword colors or anything at all. It looks exactly as it did before I installed the mod and put GeSHi in my root\includes\ folder.

I am using a customized style/theme for my forums, would that be a problem? I wouldn't think it would... but I am new to this.

I AM a novice programmer, but this is driving me batty. :)

Could anyone please offer me some help on this?

Thank you!

User avatar
James78
Registered User
Posts: 811
Joined: Sat Jul 30, 2005 4:54 pm
Location: Washington, USA
Contact:

Re: [RC] bbCODE tag language highlighting

Post by James78 » Fri May 06, 2011 9:58 pm

Clear your forum and template cache.
If you encounter what is/or you think is a bug, please report it to the phpBB Bug Tracker

Bluechimera
Registered User
Posts: 11
Joined: Fri May 06, 2011 6:44 am

Re: [RC] bbCODE tag language highlighting

Post by Bluechimera » Sun May 08, 2011 1:49 am

James78 wrote:Clear your forum and template cache.
hmm, I tried that and no cigar...

What I have noticed upon trying to uninstall... is that the files didnt seem to be copied to their correct locations when I used AutoMod I reinstalled and double checked... they were not in the location they were supposed to be in.

I will keep fiddling with it, please let me know if you have any other ideas.

Thanks so much! :)

**EDIT**

Ok, I had to manually install your mod and do some alterations to the style bbcode.html to get it to work with my forum style.
It looks a little funky with my color scheme, but i can figure it out from here.

Thank you for your time and trouble. :)

User avatar
James78
Registered User
Posts: 811
Joined: Sat Jul 30, 2005 4:54 pm
Location: Washington, USA
Contact:

Re: [RC] bbCODE tag language highlighting

Post by James78 » Sun May 08, 2011 3:44 am

I forgot to mention. You said you're using a different style. Changes are only made to Prosilver (and there's also a file for Subsilver too). But any other themes you have, alterations always have to be manually made for those.

Anyways, glad it works. Enjoy the mod!
If you encounter what is/or you think is a bug, please report it to the phpBB Bug Tracker

Bluechimera
Registered User
Posts: 11
Joined: Fri May 06, 2011 6:44 am

Re: [RC] bbCODE tag language highlighting

Post by Bluechimera » Sun May 08, 2011 5:53 am

Sorry to bother you again, but I have one more small question.

Is there a list you have compiled for all languages? I see that you have a few examples in screenshots, but do you have a full listing, or at least a partial?

like I know the code tags for C++ are

Code: Select all

[code=cpp]
cout << "Hello World" << endl;
[/code]

But, what about the many other languages you have inside here? :)

I would like to see a list if it is available to put in a sort of informational help area for future users,moderators, and myself.
I have looked over Geshi's docs and any other information on your wonderful mod; yet, I cannot seem to locate a listing.

If it doesn't exist, no big deal :)

Thanks again! :D

User avatar
James78
Registered User
Posts: 811
Joined: Sat Jul 30, 2005 4:54 pm
Location: Washington, USA
Contact:

Re: [RC] bbCODE tag language highlighting

Post by James78 » Sun May 08, 2011 5:11 pm

Inside the zip you downloaded is a .txt file which is a list of languages and the string to use in the code box.
If you encounter what is/or you think is a bug, please report it to the phpBB Bug Tracker

Bluechimera
Registered User
Posts: 11
Joined: Fri May 06, 2011 6:44 am

Re: [RC] bbCODE tag language highlighting

Post by Bluechimera » Sun May 08, 2011 7:29 pm

James78 wrote:Inside the zip you downloaded is a .txt file which is a list of languages and the string to use in the code box.
I went ahead and made that text file of jumbled text into a table for future users to reference.
feel free to make alterations if any mistakes were made in the translation and send them to me, and I will upload the new version. also, feel free to add the file to your packaged Mod.
It is in .docx (MS Office Word 2007+) format, if needed, I can change to .doc

I hope this helps someone else out :)

Screenshot:
Image

Download:
http://www.mediafire.com/?l9t2y17n6mjyv7h

Thanks for working on this great modification! :D

Locked

Return to “[3.0.x] Abandoned MODs”