Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.5 > vBulletin 3.5 Add-ons
FAQ Community Calendar Today's Posts Search

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
  #82  
Old 08-09-2007, 12:14 AM
sidhighwind's Avatar
sidhighwind sidhighwind is offline
 
Join Date: Oct 2001
Posts: 31
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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]]";
        }
    } 
Reply With Quote
  #83  
Old 08-10-2007, 07:33 AM
waldbauer.com waldbauer.com is offline
 
Join Date: Apr 2007
Location: Vienna
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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 ?
Reply With Quote
  #84  
Old 08-16-2007, 08:06 AM
Vertex [HW-F] Vertex [HW-F] is offline
 
Join Date: Jul 2004
Posts: 2
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

]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!
Reply With Quote
  #85  
Old 08-17-2007, 05:31 AM
Vertex [HW-F] Vertex [HW-F] is offline
 
Join Date: Jul 2004
Posts: 2
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

]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
Reply With Quote
  #86  
Old 10-21-2007, 01:55 PM
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Location: England
Posts: 9,071
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kirupa View Post
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
Reply With Quote
  #87  
Old 01-22-2008, 08:00 PM
Coders Shack Coders Shack is offline
 
Join Date: Apr 2007
Location: Culver City, CA
Posts: 807
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by James Edwards View Post
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
Reply With Quote
  #88  
Old 03-27-2008, 06:56 PM
Sph1nX Sph1nX is offline
 
Join Date: Jul 2007
Location: Berlin, Germany
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #89  
Old 04-17-2008, 03:34 PM
xEnco xEnco is offline
 
Join Date: Apr 2008
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #90  
Old 05-20-2008, 02:03 PM
Dashman Dashman is offline
 
Join Date: May 2008
Posts: 30
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Will this work with 3.7.0 ?!
Reply With Quote
  #91  
Old 06-02-2008, 01:54 PM
waldbauer.com waldbauer.com is offline
 
Join Date: Apr 2007
Location: Vienna
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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 ?
Reply With Quote
Reply


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 08:25 PM.


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.07318 seconds
  • Memory Usage 2,342KB
  • 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
  • (3)bbcode_code
  • (4)bbcode_php
  • (2)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