1 (edited by zaher 2004-10-26 03:10)

Topic: Multi Syntax Highlighter for CODE tags

##
##
##     Mod title:  Multi Syntax Highlighter For PunBB
##
##     Mod version:  1
##     Works on PunBB:  1.4
##     Release date:  2004-14
##     Author:  zaher dirkey zaher@parmaja.com
##
##     Description:  Add multi Syntax Highlight for code tags to PunBB
##
##     Affected files:  parser.php
##
##     DISCLAIMER:  Please note that "mods" are not officially supported by
##                    PunBB. Installation of this modification is done at your
##                    own risk. Backup your forum database and any and all
##                    applicable files before proceeding.
##
##     Notes:          I am implemented only Delphi syntax for now,
##                    but you can write your favorite code syntax and send me to
##                    my email, keep in your mind to not use huge string variable
##                    i write the code to syntax a big file with out crash the
##                    server or using larg memory,is not as like another beautifiers.
##

because there is a code tag in the readme file i cant post it in a forum
so read the file from

download project file

http://www.parmaja.com/downloads/phpMultiSyn-1.0.2.zip

sample

http://www.parmaja.com/forum/viewtopic.php?id=31

if is there any bug post it in this topic

If your people come crazy, you will not need to your mind any more.

2

Re: Multi Syntax Highlighter for CODE tags

Nice mod, I can use this.

3

Re: Multi Syntax Highlighter for CODE tags

I have fix some bugs and some changes, Check out againg.

If your people come crazy, you will not need to your mind any more.

4 (edited by albn 2004-07-22 21:48)

Re: Multi Syntax Highlighter for CODE tags

I really, really like this mod, and I am messing around with it. So far, I did some changes, including being able to change the colors, the font and other things in a CSS class.

<?
$this->settings = array(
S_NONE => array('<span class=".S_NONE">',"</span>"),
S_KEYWORD => array('<span class=".S_KEYWORD">',"</span>"),
S_IDENTIFIER => array('<span class=".S_IDENTIFIER">',"</span>"),
S_NUMBER => array('<span class=".S_NUMBER">',"</span>"),
S_STRING => array('<span class=".S_STRING">',"</span>"),
S_STRING2 => array('<span class=".S_STRING2">',"</span>"),
S_SYMBOL => array('<span class=".S_SYMBOL">',"</span>"),
S_NUMBER => array('<span class=".S_NUMBER">',"</span>"),
S_OBJECT => array('<span class=".S_OBJECT">',"</span>"),
S_COMMENT1 => array('<span class=".S_COMMENT1">',"</span>"),
S_COMMENT2 => array('<span class=".S_COMMENT2">',"</span>"),
S_COMMENT3 => array('<span class=".S_COMMENT3">',"</span>"),
S_DIRECTIVE => array('<span class=".S_DIRECTIVE">',"</span>")
);
?>

I also am looking to some other stuff in RAFB's script which also does multi-syntax highlighting, and has some features on that I would like to add in this script as well such as the line numbers when outputted.

Since I am new to PHP, and I do learn from example, I have a question regarding the loops... for instance, when I wanted to highlight "(bleh)" and just wanted the parenthesis to be a different color but not the text inside of it, how is this done?

Thanks for all your hard work and helping newbies like me

Jack

GET ON THE TELEPHONE!!

5

Re: Multi Syntax Highlighter for CODE tags

1 - I am not good in php as you think, this syntax mod i have write in Delphi before ported to php.

2 - there are a forum to help u
http://punbb.org/forums/viewforum.php?id=26

If your people come crazy, you will not need to your mind any more.

6

Re: Multi Syntax Highlighter for CODE tags

- line numbers
may be in next version :-)

If your people come crazy, you will not need to your mind any more.

7 (edited by albn 2004-07-23 03:58)

Re: Multi Syntax Highlighter for CODE tags

May I help? It would be great fun big_smile

We have a lot in common because I use Delphi too smile smile

GET ON THE TELEPHONE!!

8

Re: Multi Syntax Highlighter for CODE tags

Yes, I am good with building Component and Objects in Delphi.
you can discussion with me in

http://punbb.org/forums/viewforum.php?id=26

If your people come crazy, you will not need to your mind any more.

9 (edited by zaher 2004-07-28 23:19)

Re: Multi Syntax Highlighter for CODE tags

I just added PHP syntax without using builtin function, so may i have many bugs,
please test it
http://www.parmaja.com/forum/viewtopic.php?pid=86#86

and try to post a code of php because i am not professional with its syntax, you can help me ;-)

If your people come crazy, you will not need to your mind any more.

10

Re: Multi Syntax Highlighter for CODE tags

I moved my work to PunRes.org

http://www.punres.org/viewtopic.php?id=32

If your people come crazy, you will not need to your mind any more.

11

Re: Multi Syntax Highlighter for CODE tags

Sounds good. I have not logged in a while because I working on a shopping cart... so let's see what I can do for you big_smile

GET ON THE TELEPHONE!!

12

Re: Multi Syntax Highlighter for CODE tags

I like who find a bug in my code for me,
in my job i have 3 employee testing and reporting errors, so thay call me Mr Bugs.

Bug -> its same in arabic pronunciation in same meaning smile

If your people come crazy, you will not need to your mind any more.

13

Re: Multi Syntax Highlighter for CODE tags

zaher: I am having the hardest time porting this code to another CMS I am using. I am not the bestin PHP, and I have been trying for three days to use this on RunCMS for quite some time.

I have studied the test code to highlight the code you want, but how can you make the BB code work... I have discovered not all BB's are the same...

GET ON THE TELEPHONE!!

14

Re: Multi Syntax Highlighter for CODE tags

I Have changed the parser.php that process [ CODE] tags
in any other BB try find where parsing CODE and change it, truly it hard to hack parser , i have more than 3 days to hacking PunBB parser and still not perfect for me.
May be you need a good sleeping and tea cup before start hacking big_smile

If your people come crazy, you will not need to your mind any more.

15

Re: Multi Syntax Highlighter for CODE tags

Thanks a lot brother. How did you do that? Regexp's are a serious pain to work with. I have been looking at other multi-syntax highlighters as well. I will update you on those. One uses PEAR and XML.

GET ON THE TELEPHONE!!

16

Re: Multi Syntax Highlighter for CODE tags

I taked the idea from SynEdit (Delphi), and put it in php class I can systax windows.pas without fail or take huge memory.

if i use RegEx that mean i must load the file in string before syntax it.

BTW, RunCMS had many downlaods, what file i must download it.

If your people come crazy, you will not need to your mind any more.

17

Re: Multi Syntax Highlighter for CODE tags

Oh, RunCMS does not have any, hence why I am trying to port your highlighter to it. I am also trying to make a karma system similar to the on AntiOnline uses. A friend made one for PHPbb, but the code is still very unstable.

Here are some you might find interesting:

http://www.blogcms.com/ and download the Donald trump version. It has the XML/PEAR highlighter I was telling you about.

and GeSHi:

http://www.phpbb.com/phpBB/viewtopic.php?t=217723

That is also made for PHPbb, but I would like to incorperate some of the code in there, although the functions and structure are completely different.

So that's why RUNCMS does not have it because it has not been done yet brother.

GET ON THE TELEPHONE!!

18 (edited by zaher 2004-10-26 03:17)

Re: Multi Syntax Highlighter for CODE tags

new release

http://www.parmaja.com/downloads/phpMultiSyn-1.0.2.zip

in 1.0.1
ADD : apache syntax

in 1.0.2
ADD : ini syntax
ADD : geshi integration


becuase i  am not trust my code and not support all languages yet, so i do it for who like geshi
open punbb_code_parser.php and add // to

//include('punbb_msh.php');

remove // from

include('punbb_geshi.php');

you can open punbb_geshi.php for mor confg Geshi

download Geshi from
http://optusnet.dl.sourceforge.net/sour … .1.tar.bz2

--------------------------
but i found that

this my page time execute on local computer CPU 350MH and 128MB RAM, i test it 3 time with Geshi and My Code phpMSH
Geshi
without line numbers
29.952
30.237
29.532

phpMSH
3.747
2.933
2.960

phpMSH is faster than Geshi 10 time  3/30, i hope my test is honest.

If your people come crazy, you will not need to your mind any more.