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)

sidhighwind 08-09-2007 12:14 AM

So after 2+ hours of working on this I finally found a solution, it's not very clean as you have to edit a class file from vbulletin but such is life.

This is done with version 3.6.7 PL1

open up includes/class_bbcode_alt.php

1. Replace the second foreach loop in the `vB_BbCodeParser_Wysiwyg` function on line 82 with this code:
PHP Code:

        foreach (array('code''php''html','highlight') AS $pre_tag)
        {
            if (isset(
$this->tag_list['no_option']["$pre_tag"]))
            {
                
$this->tag_list['no_option']["$pre_tag"]['callback'] = 'handle_preformatted_tag';
                unset(
$this->tag_list['no_option']["$pre_tag"]['html'], $this->tag_list['option']["$pre_tag"]['strip_space_after']);
            }

            if (isset(
$this->tag_list['option']["$pre_tag"]))
            {
                
$this->tag_list['option']["$pre_tag"]['callback'] = 'handle_preformatted_tag';
                unset(
$this->tag_list['option']["$pre_tag"]['html'], $this->tag_list['option']["$pre_tag"]['strip_space_after']);
            }
        } 

2. Replace `handle_preformatted_tag` function with this code on line 179
PHP Code:

    function handle_preformatted_tag($code)
    {
        
$current_tag =& $this->current_tag;

        if(
$current_tag['option']) {
            return 
"[$current_tag[name]=$current_tag[option]]" $this->emulate_pre_tag($code) . "[/$current_tag[name]]";
        } else {
            return 
"[$current_tag[name]]" $current_tag['option']. " "$this->emulate_pre_tag($code) . "[/$current_tag[name]]";
        }
    } 


waldbauer.com 08-10-2007 07:33 AM

Hello !

Where can i define the WIDTH of code display ?
In Firefox it looks a little bit too small -> http://www.waldbauer.com/vb/showthre...=5552#post5552

EDIT: I see the auto feature has a problem with IE, which correct size in px to use instead ?

Vertex [HW-F] 08-16-2007 08:06 AM

]Hi all!

I have successfully installed Advanced Syntax Highlighting (THX Andreas) with all the modifcations read in the posts above (THX guys).

I need to fix at least one more thing: If I use the extended editor, copy paste a colored text and use the [highlight=XXX] vb Code tag the color format (and any othe format) doesn't get delete like using the [php] vb Code tag.

example:
[highlight=vb][color=red]coloredtext[/color][/highlight]
[php]coloredtext[/php]


Now i want to fix [highlight=XXX] to work like [php], because inserting preformated code nukes the text between the [highlight] tags.

However I can't find where [php] removes the other codes. Can anyone tell me where I can find this, please.

THX for help!

Vertex [HW-F] 08-17-2007 05:31 AM

]I did it! With help from vBulletin-germany I could find the line where you need to add the code.

Simply add it to the html and php keywords in functions_wysiwyg.php.

So replace:
Code:

'#\[(html|php)\]((?>[^\[]+?|(?R)|.))*\[/\\1\]#siUe',                                // strip html from php tags
to (whatever your tagsname is, here I added highlight)
Code:

'#\[(html|php|highlight)\]((?>[^\[]+?|(?R)|.))*\[/\\1\]#siUe',                                // strip html from php tags

Dean C 10-21-2007 01:55 PM

Quote:

Originally Posted by kirupa (Post 856259)
Hi everyone,
Where would I add this code to enable only [as] functionality:
Code:

       
        if (!function_exists('handle_bbcode_as'))
        {
            function handle_bbcode_as(&$parser, $code, $type)
            {
                return handle_bbcode_highlight( $parser, $code, 'ActionScript' );
            }
        }
       
        $this->tag_list['no_option']['ActionScript'] = array(
            'callback' => 'handle_external',
            'strip_empty' => true,
            'stop_parse' => true,
            'disable_smilies' => true,
            'disable_wordwrap' => true,
            'strip_space_after' => 1,
            'external_callback' => 'handle_bbcode_as'
        );

I've looked everywhere, and I can't figure out where in vb 3.5.2 the above code would be included.

EDIT: Nevermind - I fixed it. I had to add it to the XML file itself. Everything works now :)

:surprised:

Could anyone explain exactly how to add an [actionscript] tag please? With documented steps. The information in this thread on how-to do it are very sparse :) Thanks

Coders Shack 01-22-2008 08:00 PM

Quote:

Originally Posted by James Edwards (Post 1250042)
I can confirm that this works in 3.6.4; you can update the range of available languages by grabbing the latest version of "geshi.php" and the "geshi" directory from the developer's site -- http://qbnz.com/highlighter/

I fixed the square bracket issue (which also happens with percentage symbols) by adding the following line to the parse_code function in geshi.php (just before "// Initialise various stuff"):

PHP Code:

$code str_replace(array('['']''%'), array('['']''%'), $code); 

(Can't get the entitities to show up unparsed - the first array of replacements should be numeric entities 91, 93 and 37)

PHP Code:

    $code str_replace(array('&#'.'91'.';''&#'.'93'.';''&#'.'37'.';'), array(chr(91), chr(93), chr(37) ), $code); 

works wonders.

the browser parses the characters, so the line of code i posted should work via copy & paste

Sph1nX 03-27-2008 06:56 PM

Installed successfully on 3.6.8 pl2 =)
Last problem is, I want to make the [highlight=vb] to [vb]
If I try to use a custom bbcode like [vb] which replaces [highlight=vb]{param}[/highlight] it doesn`t work :(
Someone knows how to make this working? German/English help for me would be nice :D

xEnco 04-17-2008 03:34 PM

Hi guys, I'm using vBulletin 3.70 RC3 and installed this hack. I tried to make a vB Tag and a button for the editor.
The normal code for highlighting is [highlight=vb]My VB code[/highlight], so I made a new vB Tag with the following content: [highlight=vb]{param}[/highlight]
But the problem is when I click on the button and add my text it doesnt highlight anything and just shows [highlight=vb]My Text[/highlight]
Do you know how to fix this?

Dashman 05-20-2008 02:03 PM

Will this work with 3.7.0 ?!

waldbauer.com 06-02-2008 01:54 PM

Hello ! I recently reinstalled this plugin on 3.7.1 but my codeblocks are to width - how can i reduce the codewidthto fit my screen ?


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

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.01229 seconds
  • Memory Usage 1,772KB
  • 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
  • (3)bbcode_code_printable
  • (4)bbcode_php_printable
  • (2)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