[ABD] bbGeSHi - a better syntax highlighter

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.
DarrenSW
Registered User
Posts: 58
Joined: Fri May 11, 2007 11:50 pm
Location: Sweden
Contact:

Re: [DEV] bbGeSHi - a better syntax highlighter

Post by DarrenSW »

That's something that needs to be fixed in the css-file for your style.

Add this to yours stylesheet.css file.

Code: Select all

.codebox ol {
margin-left: 30px;
}
expx
Registered User
Posts: 111
Joined: Mon Oct 30, 2006 9:16 am

Re: [DEV] bbGeSHi - a better syntax highlighter

Post by expx »

please can you do this for subSilver2 as well? I was going to install it but then I realised that only proSilver is in the install file :(
DarrenSW
Registered User
Posts: 58
Joined: Fri May 11, 2007 11:50 pm
Location: Sweden
Contact:

Re: [DEV] bbGeSHi - a better syntax highlighter

Post by DarrenSW »

New version is finished, see first topic.
expx wrote:please can you do this for subSilver2 as well? I was going to install it but then I realised that only proSilver is in the install file :(
Procedure is the same but I'll try to fix this soon.
expx
Registered User
Posts: 111
Joined: Mon Oct 30, 2006 9:16 am

Re: [DEV] bbGeSHi - a better syntax highlighter

Post by expx »

DarrenSW wrote:New version is finished, see first topic.
expx wrote:please can you do this for subSilver2 as well? I was going to install it but then I realised that only proSilver is in the install file :(
Procedure is the same but I'll try to fix this soon.

oh ok

so it's exactly the same only everything prosilver in the install file I change to subsilver2?
DarrenSW
Registered User
Posts: 58
Joined: Fri May 11, 2007 11:50 pm
Location: Sweden
Contact:

Re: [DEV] bbGeSHi - a better syntax highlighter

Post by DarrenSW »

expx wrote:oh ok
so it's exactly the same only everything prosilver in the install file I change to subsilver2?
There is some minor differences when you edit bbcode.html and stylesheet- files. Otherwise it's the same.
d4rk^
Registered User
Posts: 30
Joined: Wed Mar 31, 2004 7:15 pm

Re: [DEV] bbGeSHi - a better syntax highlighter

Post by d4rk^ »

Really great mod! But I have few suggestions and I think I have found a bug.

First of all, would it be possible to add an "Expand/Contract" option? Just like the Select Expand BBcodes MOD has.

Secondly, when you turn on the line numbers, an additional new line appears at the bottom - screenshot.
I'm not sure if it's a bug or a feature, but anyway I think the new line is quite unnecessary.
The new line disappears when you turn the line numbers off - screenshot.

I have also noticed, that when you post a code like this, you get something like this. Notice the space before [/code] and after the

Code: Select all

[/b] (you can't see it, but it's there) and the new lines caused by the additional spaces. I didn't type the spaces myself, they appeared automatically after pressing "Preview".

The new line isn't the bug itself, because a space after the [b][code ][/b] and in front of the [b]
[/b] WILL result in a new line in a clean version of phpBB 3 (without any MODs installed). I have checked it, and it only occurs with the bbGeSHi MOD installed.

My point is: the bug makes the spaces appear automatically after previewing or submitting the post.
And those spaces are creating additional and unnecessary new lines within the

Code: Select all

 tag.

Even when you delete them and submit the post, they appear again and again.
The only way of getting rid of the annoying new lines, is to post the code like this - [url=http://img71.imageshack.us/img71/759/ltwopostareply118460340mp2.jpg]screenshot[/url]. Notice the [code ] and 
tags are in the same line as the text is.

I hope everything is clear, although I could confuse you a bit. :P

PS: I'm using phpBB RC 3.
PPS: I've just checked and the bug with the spaces-new lines also occurs on your demo board.
DarrenSW
Registered User
Posts: 58
Joined: Fri May 11, 2007 11:50 pm
Location: Sweden
Contact:

Re: [DEV] bbGeSHi - a better syntax highlighter

Post by DarrenSW »

d4rk^ wrote:First of all, would it be possible to add an "Expand/Contract" option? Just like the Select Expand BBcodes MOD has.
I'll take a look on that.
d4rk^ wrote:Secondly, when you turn on the line numbers, an additional new line appears at the bottom
Should be fixed in latest (0.7.0) version.

And for the spaces on the empty lines... They are needed for displaying lines and line numbers correctly in some browsers.
d4rk^
Registered User
Posts: 30
Joined: Wed Mar 31, 2004 7:15 pm

Re: [DEV] bbGeSHi - a better syntax highlighter

Post by d4rk^ »

DarrenSW wrote: And for the spaces on the empty lines... They are needed for displaying lines and line numbers correctly in some browsers.
Awww, really? It doesn't look good in Firefox and Internet Explorer. And since I'm used to type the code tag above and under the code (and not in the same line), then I will have to correct it all the time. :/ Blah.

And speaking of which, did you see what happens when clicking on "Line number On/Off" while using IE 7? That's probably browser's fault and not the MOD's, but hell, IE is sooo incompatible with like... everything!


I have found few typos in the .txt files.

In install.txt:
modified version av GeSHI 1.0.7.20
What's the "av" word? Shouldn't it be "of"?
"GeSHI" - should be "GeSHi". :P Small letter "i".

As allways, be sure to make backup for the files that will be modified.
It should be "always", with only one letter "l".

COPY page_code.gif to TO phpbb_root_path/styles/prosilver/theme/images/page_code.gif
There's a second "to" word. One is written in capitals, and another one with small letters.


In Update_from_0.5.2.txt:
The same typo as the last one in install.txt:
COPY page_code.gif to TO phpbb_root_path/styles/prosilver/theme/images/page_code.gif
There's a second "to" word. One is written in capitals, and another one with small letters.



While I was installing your MOD I had small difficulties, because I wanted to keep the same exact "structure" as in the original unmodded files.
I mean, you didn't include tabs in most of the FIND/REPLACE/ADD code instructions, for example:

Code: Select all

#-----[ FIND ]------------------------------------------
#
$code = $this->bbcode_tpl('code_open') . $code . $this->bbcode_tpl('code_close');
which actually (in the original file) looks like this:

Code: Select all

		$code = $this->bbcode_tpl('code_open') . $code . $this->bbcode_tpl('code_close');
You know what I mean? You didn't include the tabs before most of the code in the phpBB files.
I had to add them manually, which is a bit annoying. ;) So maybe you could change the rest of the install instructions so they would include the tabs and hence it would be easier to manually install the MOD?

You DID include the tabs in some parts of the installation, for example:

Code: Select all

#-----[ OPEN ]--------------------------------------------------
#
styles/prosilver/template/forum_fn.js
#
#-----[ FIND ]---------------------------------------------------
#
	// Get ID of code block
	var e = a.parentNode.parentNode.getElementsByTagName('CODE')[0];
#
#-----[ REPLACE WITH ]------------------------------------------
#
	// Get ID of code block
	var e = a.parentNode.parentNode.getElementsByTagName('DIV')[0];

Also, for an easier installation you could put the additional files (and the folder) in a corresponding directories and place everything in a folder called "root". As far as I can see, most of the MODs use this kind of "method".

As for an example - this MOD has the thing I'm talking about.
If you are going to change it, then don't forget about modifying the installation instructions.


DarrenSW wrote:
cillinz wrote:And how to set default syntax ? :)
Default syntax, if none given, is plain text and it's set in the core code.
So how to change the default syntax in the core files? Is it difficult?


EDIT:
No matter if you hide the line numbers or not, when you copy the text, you get tabs in front of it.
Example:

With line numbers:

Code: Select all

       1. Test1
       2. Test2
       3. Test3
       4. Test4
       5. Test5
       6. Test6
       7. Test7
Without line numbers:

Code: Select all

    Test1
    Test2
    Test3
    Test4
    Test5
    Test6
    Test7
Is it a bug or what?


Sorry for such a long post. :P
cillinz
Registered User
Posts: 68
Joined: Sun Jan 16, 2005 11:29 am

Re: [DEV] bbGeSHi - a better syntax highlighter

Post by cillinz »

I have updated demo, there is a problem with code in code.
I typed

Code: Select all

[code=text][php]echo "man dzin";[/php]
[/code]
and i got a little troube look at:
http://stotis.net/siukslynas-f6/bbgeshi ... tml#p18259
stotis.net <- Lithuanian the best.
DarrenSW
Registered User
Posts: 58
Joined: Fri May 11, 2007 11:50 pm
Location: Sweden
Contact:

Re: [DEV] bbGeSHi - a better syntax highlighter

Post by DarrenSW »

d4rk^ wrote:And since I'm used to type the code tag above and under the code (and not in the same line), then I will have to correct it all the time. :/ Blah.
I see, you are thinking of rows directly after

Code: Select all

 and before [/code ] tags. I'll take a look on that.
[quote="d4rk^"]And speaking of which, did you see what happens when clicking on "Line number On/Off" while using IE 7?[/quote]
What do you mean? I know that left borders are there and that line-styling isn't showed but that's the problem of IE since it doesn't understand used javascript. It will be fixed however.
[quote="d4rk^"]No matter if you hide the line numbers or not, when you copy the text, you get tabs in front of it.[/quote]
Yeah, thats because Firefox includes them instead of line numbers.

Rest of yours comments (all typos and tabs in replacement code) will be fixed for the final version together with modx install file.
[quote="cillinz"]I have updated demo, there is a problem with code in code.
I typed
[code][code=text][php]echo "man dzin";[/php]
[/code][/quote]
Yeah, I'm aware of that problem and am working on it.
cillinz wrote:and i got a little troube look at:
http://stotis.net/siukslynas-f6/bbgeshi ... tml#p18259
That particular code highlighted in mIRC will cause problems in IE and Opera. If you however add a space before paranthesis on this line problems will go away.

Code: Select all

on *:text:*:#:{
d4rk^
Registered User
Posts: 30
Joined: Wed Mar 31, 2004 7:15 pm

Re: [DEV] bbGeSHi - a better syntax highlighter

Post by d4rk^ »

DarrenSW wrote:
d4rk^ wrote:And speaking of which, did you see what happens when clicking on "Line number On/Off" while using IE 7?
What do you mean? I know that left borders are there and that line-styling isn't showed but that's the problem of IE since it doesn't understand used javascript. It will be fixed however.
Left borders are or aren't there? And what left borders?
Anyway, you're more or less correct - look:

Before:

Image


After clicking "Line number Off":

Image


After clicking "Line number On":

Image

Yeah, the line styling disappears, and you can see an additional horizontal line at the top (when line numbers are off). And you can also see the vertical line (the separating one) disappearing when line numbers are on.

But it's all because of Internet Explorer... So is there any use of fixing stuff just because the browser is incompatible with it? :/ I mean, people are dumping IE for some way better browsers, so there are less and less people using it anyway. ;)
If only the fixes for IE won't create any additional bugs/problems, then I think it's all right...
DarrenSW wrote:
d4rk^ wrote:No matter if you hide the line numbers or not, when you copy the text, you get tabs in front of it.
Yeah, thats because Firefox includes them instead of line numbers.
So there's no fix for that?

DarrenSW wrote: Rest of yours comments (all typos and tabs in replacement code) will be fixed for the final version together with modx install file.
Cool, thanks!


But there's still one unanswered question:
How to change the default syntax?
DarrenSW
Registered User
Posts: 58
Joined: Fri May 11, 2007 11:50 pm
Location: Sweden
Contact:

Re: [DEV] bbGeSHi - a better syntax highlighter

Post by DarrenSW »

I was thinking about that vertical border between line numbers and code-lines when I said left border. :)
d4rk^ wrote:
DarrenSW wrote:Yeah, thats because Firefox includes them instead of line numbers.
So there's no fix for that?
There is a possible fix for that but I need to look at it just a little more.

Default syntax can be changed in message_parser.php file. Find:

Code: Select all

	function bbcode_parse_code($stx, &$code)
	{
		if ($stx == '')
		{
			$stx = 'text';
		}
And change 'text' to 'yours choosen syntax'.
d4rk^
Registered User
Posts: 30
Joined: Wed Mar 31, 2004 7:15 pm

Re: [DEV] bbGeSHi - a better syntax highlighter

Post by d4rk^ »

DarrenSW wrote:I was thinking about that vertical border between line numbers and code-lines when I said left border. :)
Hehe, so we though about the same line after all. ;)
DarrenSW wrote:
d4rk^ wrote:
DarrenSW wrote:Yeah, thats because Firefox includes them instead of line numbers.
So there's no fix for that?
There is a possible fix for that but I need to look at it just a little more.
OK, great!
DarrenSW wrote: Default syntax can be changed in message_parser.php file. Find:

Code: Select all

	function bbcode_parse_code($stx, &$code)
	{
		if ($stx == '')
		{
			$stx = 'text';
		}
And change 'text' to 'yours choosen syntax'.
Thanks, working good!


And thank you for all the fast replies and stuff! :)
cillinz
Registered User
Posts: 68
Joined: Sun Jan 16, 2005 11:29 am

Re: [DEV] bbGeSHi - a better syntax highlighter

Post by cillinz »

Any upcomming updates?
stotis.net <- Lithuanian the best.
DarrenSW
Registered User
Posts: 58
Joined: Fri May 11, 2007 11:50 pm
Location: Sweden
Contact:

Re: [DEV] bbGeSHi - a better syntax highlighter

Post by DarrenSW »

Yes, a new release will be out this week.
Locked

Return to “[3.0.x] Abandoned MODs”