Firefox PHP

Module: BBcode GeSHi (code syntax highlighting)

Posted by Maurice Makaay 
OzX
Re: Module: BBcode GeSHi (code syntax highlighting)
October 01, 2008 09:27PM
Hi¡ great mod¡
but¡
I have a problem, to select different languages, I show the same color., perl,php,etc




Edit try to hand some of the php languages (perl, php), this genshi in the folder, but also continues to show me that color in default.

Why could happen?

Thanx¡



Edited 1 time(s). Last edit at 10/01/2008 09:44PM by OzX.
Re: Module: BBcode GeSHi (code syntax highlighting)
October 02, 2008 03:02AM
Sorry, but I have a hard time understanding what your question is. Do you want to assign different colors to the syntax highlighting? I can see that these default colors need improvement to make them better visible.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Module: BBcode GeSHi (code syntax highlighting)
October 06, 2008 01:40PM
I'm not sure if this is a request for this mod or for the bbcode mod, but is it possible to add the ability to display line numbers for plain text code?

Right now, if no code type is selected the output with line numbers is:[code number="3"] test [/code] (ie, the code block is simply not interpreted.)


Joe Curia (aka Azumandias)
Modules: l0Admin Mass Email00000000l000000Automatic Time Zones000ll.l00000Enhanced Custom Profiles0.00Google Calendar0000l.l000000Post Previews
000000000Admin Security Suite000000000000Check Modules for Upgrades0000External Authentication000000Group Auto-Email00000.00000Private Message Alerts
000000000Attachment Download Counter0000Custom Attachment Icons000ll.ll00Favorite Forums000000.00000Highlighted Search Terms0000Self-Delete Posts Option
000000000Attachment Watermarks0l00000000Custom Language Database00l.l.0Forum Lockdown00000.00000Ignore Forums0000000000000Threaded Tree View
000000000Automatic Message Pruning00.llll.00Easy Color Scheme Manager0l.l00Forum Subscriptions0000lll000Moderated User Group
Templates:lGeneric Integration000000000 0000Simple Rounded000000 00000000Tabbed Emerald




Edited 1 time(s). Last edit at 10/06/2008 01:41PM by Azumandias.
Re: Module: BBcode GeSHi (code syntax highlighting)
October 06, 2008 03:57PM
I think that would be a request for this module indeed. I guess it might need an extra formatting type. I'd have to look into that. I'm mainly a geshi user and don't know much about the internals.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Module: BBcode GeSHi (code syntax highlighting)
October 06, 2008 05:15PM
You put me into programming (or deprogramming) mode when you said that it might need an extra formatting type. I stripped a language file of all characteristics, called it plaintext.php and it was ready to go. This will allow the code block to have line numbers added without any other formatting taking place, other than the standard green brackets and purple numbers. Evidently those are built in.

So, with this file uploaded into the bbcode_geshi/geshi/geshi/ folder you can type [code="plaintext" number="2"]test[/code] and be good to go. However, you will need to do some work to your mod to have ready support for this. I see two ways:
  1. Edit the phorum_mod_bbcode_geshi_format function to recognize [code number="X"] as plaintext.
  2. Edit the editor tools addins to not set "Plain text" as NULL but rather to add the ="plaintext" to the code section.

Or you can disregard this and go a better way, hopefully aided in some small way by my work. ;-)


Joe Curia (aka Azumandias)
Modules: l0Admin Mass Email00000000l000000Automatic Time Zones000ll.l00000Enhanced Custom Profiles0.00Google Calendar0000l.l000000Post Previews
000000000Admin Security Suite000000000000Check Modules for Upgrades0000External Authentication000000Group Auto-Email00000.00000Private Message Alerts
000000000Attachment Download Counter0000Custom Attachment Icons000ll.ll00Favorite Forums000000.00000Highlighted Search Terms0000Self-Delete Posts Option
000000000Attachment Watermarks0l00000000Custom Language Database00l.l.0Forum Lockdown00000.00000Ignore Forums0000000000000Threaded Tree View
000000000Automatic Message Pruning00.llll.00Easy Color Scheme Manager0l.l00Forum Subscriptions0000lll000Moderated User Group
Templates:lGeneric Integration000000000 0000Simple Rounded000000 00000000Tabbed Emerald
Attachments:
open | download - plaintext.php (1.9 KB)
Re: Module: BBcode GeSHi (code syntax highlighting)
October 06, 2008 06:14PM
That's the exact first step to handle. Create a real plain text formatter. Thanks for that. For the rest of the requirements, I think that switching to the new bbcode parser will help a lot. In that parser, I can already assign syntax=plaintext as a default for the code block. That way, no special parsing has to be done to recognize the plain text format with line numbers. I can simply let GeSHi handle all formatting for code blocks. Additionally, it would strip quite a bit of code from the GeSHi mod, because a big part of its logic is parsing related.

I don't think this one would take an awful lot of work. I'll see if I can spend my lunch on it somewhere this week.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Module: BBcode GeSHi (code syntax highlighting)
November 11, 2008 10:30AM
Hi,

This plugin does not work at all for me. Code tags are not parsed, syntax neither and the drop down list does not appear.

What is wrong?

I have phorum-5.2.9a


Vincent
My website.
You want a Skype plugin (send notification through Skype) for your phorum, contact me.
Re: Module: BBcode GeSHi (code syntax highlighting)
November 11, 2008 10:47AM
Is it activated at all on the modules screen?

Did you check [code] or things like [code =php]?

If you did, was the language specified enabled on the settings page?

Did you enable "Extend the code button for the Editor Tools?" to enable the dropdown list?


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce



Edited 1 time(s). Last edit at 11/11/2008 11:08AM by Maurice Makaay.
Re: Module: BBcode GeSHi (code syntax highlighting)
November 11, 2008 11:11AM
hmm, looks like the code block can overtake the signature if not properly terminated. It would also appear that the escape character is not supported by the BBcode GeSHi module, thus \[code] works but not \[code=php] (unless sneaky [b][/b]'s are added).

EDIT: aww, you fixed it the easy way :-(


Joe Curia (aka Azumandias)
Modules: l0Admin Mass Email00000000l000000Automatic Time Zones000ll.l00000Enhanced Custom Profiles0.00Google Calendar0000l.l000000Post Previews
000000000Admin Security Suite000000000000Check Modules for Upgrades0000External Authentication000000Group Auto-Email00000.00000Private Message Alerts
000000000Attachment Download Counter0000Custom Attachment Icons000ll.ll00Favorite Forums000000.00000Highlighted Search Terms0000Self-Delete Posts Option
000000000Attachment Watermarks0l00000000Custom Language Database00l.l.0Forum Lockdown00000.00000Ignore Forums0000000000000Threaded Tree View
000000000Automatic Message Pruning00.llll.00Easy Color Scheme Manager0l.l00Forum Subscriptions0000lll000Moderated User Group
Templates:lGeneric Integration000000000 0000Simple Rounded000000 00000000Tabbed Emerald




Edited 1 time(s). Last edit at 11/11/2008 11:11AM by Joe Curia.
Re: Module: BBcode GeSHi (code syntax highlighting)
November 11, 2008 06:49PM
Yeah, I did ;-) The issue is that [code] is handled by the bbcode module, but the Geshi code highlighting module has its own bbcode parsing mechanism. That module was written before the new bbcode module was finished. The Geshi module needs a rewrite to let the BBcode module handle the parsing. After that, escaping would work.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Sorry, only registered users may post in this forum.

Click here to login