vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=113)
-   -   Advanced Syntax Highlighting - BBCode [highlight] (https://vborg.vbsupport.ru/showthread.php?t=93071)

TheRayden 07-18-2008 10:42 PM

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?

FleyerShaver 07-20-2008 10:15 PM

Does this Addon work correctly with 3.7.2pl1?

DevFuture.de 08-28-2008 08:44 PM

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.

DevFuture.de 08-31-2008 01:19 PM

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

DevFuture.de 09-24-2008 03:36 PM

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.

Xtrato 10-16-2008 02:29 PM

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.

DevFuture.de 01-30-2009 12:04 PM

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.

Simon Lloyd 02-17-2009 10:02 AM

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.

DevFuture.de 02-21-2009 08:58 AM

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.

Simon Lloyd 02-21-2009 10:56 AM

Quote:

Originally Posted by DevFuture.de (Post 1750528)
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


All times are GMT. The time now is 03:52 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01216 seconds
  • Memory Usage 1,768KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (10)bbcode_code_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete