Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.5 > vBulletin 3.5 Add-ons

Reply
 
Thread Tools
Advanced Syntax Highlighting - BBCode [highlight] Details »»
Advanced Syntax Highlighting - BBCode [highlight]
Version: 1.00, by Andreas Andreas is offline
Developer Last Online: Jan 2023 Show Printable Version Email this Page

Version: 3.5.0 RC1 Rating:
Released: 07-27-2005 Last Update: Never Installs: 143
Uses Plugins Template Edits
Additional Files Is in Beta Stage  
No support by the author.

Advanced Syntax Highlighting
This Hack provides a [highlight] BBCode to highlight a wide range of Languages such as XML, HTML, Java, Javascript, SQL and so on.
It uses GeSHi, which is included in this ZIP.

Details
1 Product XML with 2 Plugins and 2 Templates

Please only click Install if you actually have installed/are using this Hack, and click Uninstall whan you don't use it any longer!

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #92  
Old 07-18-2008, 10:42 PM
TheRayden TheRayden is offline
 
Join Date: Apr 2004
Location: Belgium
Posts: 38
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hey all,

I've run into a strange problem with this. As you can see on the attachement, the colored code continues after the highlight should end. Any idea what could be causing this?
Reply With Quote
  #93  
Old 07-20-2008, 10:15 PM
FleyerShaver FleyerShaver is offline
 
Join Date: Apr 2008
Posts: 3
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Does this Addon work correctly with 3.7.2pl1?
Reply With Quote
  #94  
Old 08-28-2008, 08:44 PM
DevFuture.de DevFuture.de is offline
 
Join Date: Mar 2007
Location: Bad Essen
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Plugin works fine with 3.7.3.

But i am still figguring out how to get some buttons into the editor.

1) You cant use the build-in method to add the bbcode, because the 'normal' tag is just given out, no highlight will be made.

2) You cant just change the toolbar_on template within the buttonmenu, and add a new entry with _cmd_wrap0_BBCODENAME=language, because then it will be

[BBCODENAME=language][/BBCODENAME=language]

instead of



so we need to change the vbulletin_textedit.js file, because there the choise will be made what to happen with our string.

But i cant find a solution that work. Is there somebody who can help me?

Thank you very much.


Developed a Solution. Check next Post.
Reply With Quote
  #95  
Old 08-31-2008, 01:19 PM
DevFuture.de DevFuture.de is offline
 
Join Date: Mar 2007
Location: Bad Essen
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Alright, i found a solution for the Button-Problem.

Just follow the Tutorial, and you will be able to use the Highlighter with the latest vBulletin (3.7.3 i think). You maybe find other information on this, but thats the only code which works perfectly with the WYSIWYG-Editor AND the normal Codeeditor. It allows you to select already inserted Code and wraps your Selection between the Tags, instead of replacing your code.

Step 1) Download the uncompressed Javascript Package of your Customer Center

Step 2) Open the File /clientscript/vbulletin_textedit.js

Step 3) Edit the File

Search for


Code:
        /**
        * Insert Email Link
        */
(its around Line 1890, if you haven?t modified it)

after this function enter the following:

Code:
        /**
        * Insert Visual Basic .NET Quellcode [(c) 2008 Dennis Alexander Petrasch, EntwickelerGemein.de]
        */
        this.vbnet = function(e)
        {
            var selection = this.get_selection();
            return this.insert_text('[highlight=VB.net]' + selection + '[/highlight]');
        };

        /**
        *  Insert Visual C# Quellcode [(c) 2008 Dennis Alexander Petrasch, EntwickelerGemein.de]
        */
        this.csharp = function(e)
        {
            var selection = this.get_selection();
            return this.insert_text('[highlight=Csharp]' + selection + '[/highlight]');
        };

        /**
        * Insert XML Quellcode [(c) 2008 Dennis Alexander Petrasch, EntwickelerGemein.de]
        */
        this.xml = function(e)
        {
            var selection = this.get_selection();
            return this.insert_text('[highlight=XML]' + selection + '[/highlight]');
        };
You can replace the XML Csharp oder VB.net Statement, if you want to highlight another language.

Search for

Code:
case 'insertimage':
(its around Line 2633, if you already paste the content below)

Insert following Code, after the Case statement

Code:
        // (c) 2008 Dennis Alexander Petrasch [http://www.EntwickelerGemein.de]
        case 'vbnet':
                {
                    var selection = this.get_selection();
                    this.wrap_tags('highlight', 'VB.net', selection);
                    return;
                }

                case 'csharp':
                {
                    var selection = this.get_selection();
                    this.wrap_tags('highlight', 'CSharp', selection);
                    return;
                }

                case 'xml':
                {
                    var selection = this.get_selection();
                    this.wrap_tags('highlight', 'xml', selection);
                    return;
                }
Just save the File and upload it to your Server. Now you need to edit your Editor-Template in your Editor.

Step 4) Edit the editor_toolbar_on template in ACP

Select Styles and Templates, then Search for template. Enter "editor_toolbar_on" and do a search. Remember to edit the template in all your Styles!

Search for:

Code:
<if condition="$show['php_bbcode']">
                <td><div class="imagebutton" id="{$editorid}_cmd_wrap0_php"><img src="$stylevar[imgdir_editor]/php.png" width="16" height="16" alt="$vbphrase[wrap_php_tags]" /></div></td>
            </if>
Add after this:

Quote:
Optional: If you like to add a seperator, then add the following code first

Code:
<td><img src="$stylevar[imgdir_editor]/separator.gif" width="6" height="16" alt="" /></td>
Code:
<td><div class="imagebutton" id="{$editorid}_cmd_vbnet"><img src="$stylevar[imgdir_editor]/vb.png" width="16" height="16" alt="Visual Basic .NET Quellcode einf?gen" /></div></td>
<td><div class="imagebutton" id="{$editorid}_cmd_xml"><img src="$stylevar[imgdir_editor]/xml.png" width="16" height="16" alt="XML Quellcode einf?gen" /></div></td>
<td><div class="imagebutton" id="{$editorid}_cmd_csharp"><img src="$stylevar[imgdir_editor]/cs.png" width="16" height="16" alt="Visual C# Quellcode einf?gen" /></div></td>

It works fine. Additionally, you can add some Phrases and so on, but this will work as well.

Remember to create some Icons for the Editor. Use the default Resolutionof 16x16 Pixels.

Quote:
I hope you enjoy this code, and it helps you to enchance the advanced Syntax Highlighter. If you need more information on this, please ask via mail or in my German .NET Development Board:

www.EntwicklerGemein.de
or via Mail
dennis@EntwicklerGemein.de
Reply With Quote
  #96  
Old 09-24-2008, 03:36 PM
DevFuture.de DevFuture.de is offline
 
Join Date: Mar 2007
Location: Bad Essen
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

There is an error while converting [ and ] - Characters. Here is the Solution:

Open the product-advhighlight.xml and find:

Code:
			$codefind2 = array(
				'&gt;',		// &gt; to >
				'&lt;',		// &lt; to <
				'&quot;',	// &quot; to ",
				'&amp;',	// &amp; to &
				'& #91;',    // [ to [ (remove the spacebar between & and #-Char)
				'& #93;',    // ] to ] (remove the spacebar between & and #-Char)
			);
and replace the text with

Code:
			$codefind2 = array(
				'&gt;',		// &gt; to >
				'&lt;',		// &lt; to <
				'&quot;',	// &quot; to ",
				'&amp;',	// &amp; to &
				'[',    // [ to [
				']',    // ] to ]
			);
and it works well.
Reply With Quote
  #97  
Old 10-16-2008, 02:29 PM
Xtrato's Avatar
Xtrato Xtrato is offline
 
Join Date: Feb 2005
Location: New Jersey
Posts: 510
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ok so can we change the variable of "hightlight" to like "language" or something like that?

Im trying to use WP and this to work just fine.

Example , in wordpress getti uses , <pre lang=css> and how would i make vBulletin or Wordpress hack to ether use similar post code?

thanks a bunch.
Reply With Quote
  #98  
Old 01-30-2009, 12:04 PM
DevFuture.de DevFuture.de is offline
 
Join Date: Mar 2007
Location: Bad Essen
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I still havent figured out a solution for the highlight-relacement, but it works still fine with Version 3.8.0./ 3.8.1, if you follow my instructions i postet some posts before.
Reply With Quote
  #99  
Old 02-17-2009, 10:02 AM
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Location: Manchester
Posts: 3,481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

DevFuture.de dou you know how to get it to auto indent the code?, i'm currently trying to use it for VBA (Microsofts version of VB) and i'm using teh vb.net language as the highlighting seems closest in that, but all the code stays "as is", it doesn't capitalize or indent the code so highlighted code still looks a bit messy.
Reply With Quote
  #100  
Old 02-21-2009, 08:58 AM
DevFuture.de DevFuture.de is offline
 
Join Date: Mar 2007
Location: Bad Essen
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hello Simon Lloyd,

I am sorry, i havent subscribed the topic, so that I just saw your entry now. I am sorry, but I dont know how to indent them. Normally this function is not provided by GeShi (afaik).

But it should worker proper, if you copy the Sourceode with indented style, and paste them into a thread. Normally it should be displayed intended then.
Reply With Quote
  #101  
Old 02-21-2009, 10:56 AM
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Location: Manchester
Posts: 3,481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by DevFuture.de View Post
Hello Simon Lloyd,

I am sorry, i havent subscribed the topic, so that I just saw your entry now. I am sorry, but I dont know how to indent them. Normally this function is not provided by GeShi (afaik).

But it should worker proper, if you copy the Sourceode with indented style, and paste them into a thread. Normally it should be displayed intended then.
Dev. thanks for getting back, you are right it isn't supported by geshi, however the geshi users say it has to be parsed by some other code to indent it, i know its not that simple as in VBA code the indentation is tiered, i.e (without the >'s)
Code:
For Each.....
>>>If............Then
>>>>>Do something
>>>>>>>If......then
>>>>>>>>>Do something
>>>>>>>End If
>>>End If
Next
it is possible as i have seen it at www.vbaexpress.com
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:42 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04730 seconds
  • Memory Usage 2,320KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (10)bbcode_code
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete