Syntax Highlighter

All new MODs released in our MOD Database will be announced in here. All support for released MODs needs to take place in the Customisations Database.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTICE: This forum is only for the announcement of new releases and/or updates of MODs. Any MOD support should be obtained through the Customisations Database in the support area designated for each MOD.

A direct link to support for each MOD is in the first post of the respective topic.
Bogey
Registered User
Posts: 419
Joined: Wed Sep 19, 2007 2:31 am

Re: Syntax Highlighter

Post by Bogey » Tue Feb 16, 2010 6:21 am

Mardag wrote:Thanks for the MOD :) It's great. I've got 3 questions:

1) At first, I had line numbers and now they are gone. What happened?
The numbered lines are not the default params. To get numbered lines you got to declare it in the params of the bbCode

[syntax lang="php" lines="geshi-f"]<?php echo 'Hello World'; ?>[/syntax]

To get the numbered lines by default, do the following:

OPEN: includes/hooks/hook_syntax_highlighter.php
FIND:

Code: Select all

	var $params = array();
REPLACE WITH:

Code: Select all

	var $params = array('lines' => 'f');
Mardag wrote:2) Why can't I use the MOD using for example [php]<?php echo ""; ?>[/php]? I have to use [syntax=php]<?php echo ""; ?> [/syntax] instead.
You can... do be able to do that:

OPEN: includes/hooks/hook_syntax_highlighter.php
FIND:

Code: Select all

	var $auto_add_tags = false;
REPLACE WITH:

Code: Select all

	var $auto_add_tags = true;
annab wrote:Isn't syntax highlighting already built into phpbb3? I use the normal code=php and it works just fine.
Not only is this highlighter has more languages, it is more advanced... I would prefer that phpBB has this by default rather then what they have.
tvrsh wrote:Hello, I have some little problem with this mod.
When I press Select button it select all the code, but with "Parsed in ... seconds, using GeSHi ...".
So when I paste this selected code somewhere there is one unnecessary string with Geshi info.

And one more question: How can I replace "Using ... Syntax Highlighting" string to string with Syntax, Select, Expand buttons. So it became like this:
Syntax: [ Download ] [ Show ] [ Select ] [ Toggle ] Using %1$s Syntax Highlighting

some code

Parsed in 0.022 seconds, using GeSHi 1.0.8.4
I eliminated that line altogether and replaced Syntax: with the name of the language that is being highlighted. Here is how you do that.

OPEN: includes/hooks/hook_syntax_highlighter.php
FIND:

Code: Select all

$header = '<div style="text-align: center; width: auto; font-family: Verdana, Arial, sans-serif; color: #808080; font-size: 12px; font-weight: bold; background-color: #f0f0ff; border-bottom: 1px solid #d0d0d0; padding: 2px;">' . sprintf($user->lang['XS_BBC_USING_SYNTAX'], '<span style="color: #900;">' . $syntax . '</span>') . '</div>';
REPLACE WITH:

Code: Select all

//$header = '<div style="text-align: center; width: auto; font-family: Verdana, Arial, sans-serif; color: #808080; font-size: 12px; font-weight: bold; background-color: #f0f0ff; border-bottom: 1px solid #d0d0d0; padding: 2px;">' . sprintf($user->lang['XS_BBC_USING_SYNTAX'], '<span style="color: #900;">' . $syntax . '</span>') . '</div>';
(Or just delete that line altogether).

And to replace the Syntax: with the language name being highlighted, you would:

OPEN: includes/hooks/hook_syntax_highlighter.php
FIND:

Code: Select all

$str .= '<div class="syntax-header" id="codehdr2_' . $code_id . '" style="position: relative;"><b>' . $user->lang['XS_BBC_SYNTAX'] . '</b>:' . (empty($item['params']['file']) ? '' : ' (' . htmlspecialchars($item['params']['file']) . ')') . $download_text . ' [ <a href="javascript:void(0)" onclick="xs_show_hide(\'code_' . $code_id . '\', \'code2_' . $code_id . '\', \'\'); xs_show_hide(\'codehdr_' . $code_id . '\', \'codehdr2_' . $code_id . '\', \'\')">' . $user->lang['XS_BBC_HIDE'] . '</a> ]' . ( ($load_expand == true) ? '<script type="text/javascript">SXBB[id].writeCmd();</script>' : '') . '</div>';
REPLACE WITH:

Code: Select all

$str .= '<div class="syntax-header" id="codehdr2_' . $code_id . '" style="position: relative;"><b>' . strtoupper($syntax) . '</b>:' . (empty($item['params']['file']) ? '' : ' (' . htmlspecialchars($item['params']['file']) . ')') . $download_text . ' [ <a href="javascript:void(0)" onclick="xs_show_hide(\'code_' . $code_id . '\', \'code2_' . $code_id . '\', \'\'); xs_show_hide(\'codehdr_' . $code_id . '\', \'codehdr2_' . $code_id . '\', \'\')">' . $user->lang['XS_BBC_HIDE'] . '</a> ]' . ( ($load_expand == true) ? '<script type="text/javascript">SXBB[id].writeCmd();</script>' : '') . '</div>';
For all of you who might not have noticed, all of the options used for this highlighter is in includes/hooks/hook_syntax_highlighter.php. So if you want to change, add or remove something, you would be editing that file.

User avatar
tvrsh
Registered User
Posts: 7
Joined: Sat Jan 30, 2010 5:48 am
Location: Russian Federation, Podolsk
Contact:

Re: Syntax Highlighter

Post by tvrsh » Sat Feb 20, 2010 5:39 pm

Bogey, thank you.
Have fun.
-
Eggdrop/Windrop TCL scripts archive: http://egghelp.ru/
Forum: http://forum.egghelp.ru/

Bogey
Registered User
Posts: 419
Joined: Wed Sep 19, 2007 2:31 am

Re: Syntax Highlighter

Post by Bogey » Sat Feb 20, 2010 6:03 pm

tvrsh wrote:Bogey, thank you.
Yup :)

CherryJimbo
Registered User
Posts: 105
Joined: Mon Mar 01, 2010 10:01 pm

Re: Syntax Highlighter

Post by CherryJimbo » Wed Mar 03, 2010 11:02 pm

Is it possible to change the size of the compressed box? So that when its compressed, more than just 4 lines are visible?

User avatar
tvrsh
Registered User
Posts: 7
Joined: Sat Jan 30, 2010 5:48 am
Location: Russian Federation, Podolsk
Contact:

Re: Syntax Highlighter

Post by tvrsh » Wed Mar 10, 2010 4:05 pm

CherryJimbo wrote:Is it possible to change the size of the compressed box? So that when its compressed, more than just 4 lines are visible?
OPEN: includes/hooks/hook_syntax_highlighter.php

FIND:

Code: Select all

        $load_expand = ( (count($temp_text) <= 4) ? false : true); 
And change 4 to your amount of lines.
Have fun.
-
Eggdrop/Windrop TCL scripts archive: http://egghelp.ru/
Forum: http://forum.egghelp.ru/

CherryJimbo
Registered User
Posts: 105
Joined: Mon Mar 01, 2010 10:01 pm

Re: Syntax Highlighter

Post by CherryJimbo » Wed Mar 10, 2010 4:25 pm

I already have that set to 11, and all it does is, if the number of code lines is more than 11, it puts them into that compressed box. What I want to do is actually change how many lines that compressed box shows.

User avatar
UseLess
Registered User
Posts: 521
Joined: Mon Jul 22, 2002 7:26 pm
Location: North East UK

Re: Syntax Highlighter

Post by UseLess » Thu Mar 11, 2010 10:16 pm

Greetings,

Code: Select all

# 
#-----[ OPEN ]-------------------------------------------------------
#

classes/scripts/select_expand_bbcodes.js

# 
#-----[ FIND ]-------------------------------------------------------
#

	this.size = this.min = 70;	// --- Adjust MINIMUM_BLOCK_HEIGHT here :-)

# 
#-----[ IN-LINE FIND ]----------------------------------------------- 
# 

70

# 
#-----[ IN-LINE REPLACE WITH ]--------------------------------------- 
# 

150

# 
#-----[ SAVE/CLOSE ALL FILES ]--------------------------------------- 
# 
# EoM
The 150 will then show 11 lines...
Movie Quote:
It's not the years honey, it's the mileage...
phpBB 3 Mods @ phpBBStyles

CherryJimbo
Registered User
Posts: 105
Joined: Mon Mar 01, 2010 10:01 pm

Re: Syntax Highlighter

Post by CherryJimbo » Thu Mar 11, 2010 11:51 pm

Thank you very much, exactly what I was after :)

User avatar
UseLess
Registered User
Posts: 521
Joined: Mon Jul 22, 2002 7:26 pm
Location: North East UK

Re: Syntax Highlighter

Post by UseLess » Fri Mar 12, 2010 5:05 pm

Greetings,

There's a new version available here: http://www.phpbbstyles.co.uk/info/viewt ... ?f=16&t=86 for testing before it gets submitted for validation.

If you find any issues with it then either register/post on my forum or if you don't wish to register then use this: http://www.phpbbstyles.co.uk/contacts.php to let me know what the issue is.

PLEASE: Do not post in this topic if you find any issues with the latest version use the methods previously mentioned to let me know about any issues.

If you do wish to register and want to report an issue you can do so by replying to the post here and there is a Help Generator you can use to generate your post.
Movie Quote:
It's not the years honey, it's the mileage...
phpBB 3 Mods @ phpBBStyles

User avatar
UseLess
Registered User
Posts: 521
Joined: Mon Jul 22, 2002 7:26 pm
Location: North East UK

Re: Syntax Highlighter

Post by UseLess » Sun Mar 14, 2010 3:41 pm

Greetings,

After having read the changes to the mod validation requirements I have decided not to update this mod.

Support will be provided for the last release version which is 1.0.12 but 1.0.14 will not be released and will not be submitted for validation by the phpBB MOD Team.
Movie Quote:
It's not the years honey, it's the mileage...
phpBB 3 Mods @ phpBBStyles

User avatar
euer GEHIRN
Registered User
Posts: 17
Joined: Mon May 25, 2009 9:22 pm
Location: Germany

Re: Syntax Highlighter

Post by euer GEHIRN » Sun Mar 14, 2010 5:14 pm

UseLess wrote:Greetings,

After having read the changes to the mod validation requirements I have decided not to update this mod.

Support will be provided for the last release version which is 1.0.12 but 1.0.14 will not be released and will not be submitted for validation by the phpBB MOD Team.
hmmm .. this is a shame. :cry: but thx for
mfg brain_

-sorry for my bad english-

Markstar
Registered User
Posts: 72
Joined: Mon May 01, 2006 6:26 pm

Re: Syntax Highlighter

Post by Markstar » Fri Mar 19, 2010 12:16 pm

Hi,
this MOD is great and I have it working in 3.0.6. I read the whole thread because I had some questions and pretty much all of them were answered on page 6 - thanks Bogey, tvrsh and of course UseLess! :D

Just a few more questions remain:
1) Very sad to hear that you have decided not to release new versions of Syntax Highlighter. :cry:
You did link to another page but I could not find any downloads... so are you really not offering new versions anymore? Doesn't that mean Syntax Highlighter is dead? :o

2) How do I get the "[ Select ]" button on all code boxes and not only the "expanded ones" (where $load_expand is true)? Manually setting $load_expand to true works, but of course boxes with less code are too big then. :? Is there some other way?

3) I can't get the line numbers to work, neither by using [syntax="cpp" lines="geshi-f"]code[/syntax] nor by changing $params (I tried 'f' and 'n'). Does it work for everybody else? Could it be because I have $auto_add_tags = true? I would really like to have line numbers enabled by default. :)


Thank you in advance!

Edit: I tried to register at the http://www.phpbbstyles.co.uk but even though I completed the registration (even though I never heard of Nick Cutter before), I never got a confirmation email. :|

User avatar
UseLess
Registered User
Posts: 521
Joined: Mon Jul 22, 2002 7:26 pm
Location: North East UK

Re: Syntax Highlighter

Post by UseLess » Fri Mar 19, 2010 1:18 pm

Greetings,

1. No.

2. No sure I follow you here. The select option works but it will also select all the numbers and header/footer text. It's easier to use the 'download' option to download the contents of the syntax block.

3. [syntax lang="cpp" lines="f"] < cpp code in here >[/syntax] will work...

4. Check your junk mail folder.
Movie Quote:
It's not the years honey, it's the mileage...
phpBB 3 Mods @ phpBBStyles

Markstar
Registered User
Posts: 72
Joined: Mon May 01, 2006 6:26 pm

Re: Syntax Highlighter

Post by Markstar » Fri Mar 19, 2010 2:34 pm

Thank you for your quick reply!
UseLess wrote:Greetings,

1. No.
Sorry...was that a "no" to the "will you offer future versions" or "no" to "is SH dead"? :oops:
2. No sure I follow you here. The select option works but it will also select all the numbers and header/footer text. It's easier to use the 'download' option to download the contents of the syntax block.
The reason I'm asking is that I have disabled [ Download ] and I just want the user to be able to copy the code to the clipboard. I moved the GeSHi notice to the phpBB footer, so [ Select ] should not include anything other than the code itself.
3. [syntax lang="cpp" lines="f"] < cpp code in here >[/syntax] will work...
Yes, that works. :) Now I would really like to make this the standard view so that the line numbers are always shown, without users having to set the option when posting.
4. Check your junk mail folder.
I have, 2 new messages in there, but they really were junk. :?

Thanks for your help!

User avatar
UseLess
Registered User
Posts: 521
Joined: Mon Jul 22, 2002 7:26 pm
Location: North East UK

Re: Syntax Highlighter

Post by UseLess » Fri Mar 19, 2010 3:54 pm

Greetings,

1. The latter.

2. Select will include the line numbers, if shown, which is why, in the version I use, I removed the 'select' option and left the 'download' option so the code can be downloaded with the layout intact with no line numbers or anything else included. It's also handier if you specify a filename so the downloaded code can be opened directly in a appropriate application. But if you want to stick with the select option then I'd suggest using another select script that doesn't include the line numbers.

3. In the 'if ... else ...' where the lines parameter is checked change the 'else' default 'no line numbers' to whatever lines you want 'normal' or 'fancy'.

4. Reminder sent...
Movie Quote:
It's not the years honey, it's the mileage...
phpBB 3 Mods @ phpBBStyles

Locked

Return to “[3.0.x] MOD Database Releases”

cron