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)

ffevo 04-03-2006 10:04 PM

This is a problem I am having with ALL code on my forums including the code that your modification uses. In the first attachment you will see that there is a large space at the bottom of all the code.

That was the first issue.

You will also see that all the code used with YOUR modification does not get highlighted at ALL AND is on one line. You can see that on the second attachment.

I also wanted to change the highlight colors of ALL code including PHP. I also wanted to change the default font for highlighted code from courier new to something else. I use 10px font size and courier new is just too small for 10px. I would like to change the font face NOT the size.

Delphiprogrammi 04-25-2006 02:56 PM

everytime you update Geshi it stops working ?????

PHP Code:

if (!function_exists('handle_bbcode_highlight'))
{
 function 
handle_bbcode_highlight(&$parser$code$type)
 {
  global 
$vbulletin$vbphrase$stylevar$show;
  static 
$codefind1$codereplace1$codefind2$codereplace2;
  
$code $parser->strip_front_back_whitespace($code1);
  if (!
is_array($codefind))
  {
   
$codefind1 = array(
    
'<br>',  // <br> to nothing
    
'<br />' // <br /> to nothing
   
);
   
$codereplace1 = array(
    
'',
    
''
   
);
   
$codefind2 = array(
    
'&gt;',  // &gt; to >
    
'&lt;',  // &lt; to <
    
'&quot;'// &quot; to ",
    
'&amp;'// &amp; to &
    
'[',    // [ to [
    
']',    // ] to ]
   
);
   
$codereplace2 = array(
    
'>',
    
'<',
    
'"',
    
'&',
    
'[',
    
']',
   );
  }
  
$code trim(str_replace($codefind1$codereplace1$code));
  
$blockheight $parser->fetch_block_height($code) + 18// fetch height of block element
  
$code str_replace($codefind2$codereplace2$code); // finish replacements
  
$path DIR '/includes/geshi/';
  
//$code = geshi_highlight($code, $type, $path, true);
  
$geshi = new GeSHi($code$type$path);
  
$geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);
  
$geshi->set_url_for_keyword_group($group$url);
  
$geshi->set_link_target('_BLANK'$styles); 
  
$tabs 4;
  
$geshi->set_header_type(GESHI_HEADER_DIV);
  
$geshi->set_tab_width($tabs);
  
$code $geshi->parse_code();
  
$code preg_replace('/&amp;#([0-9]+);/''&#$1;'$code);
  
$code str_replace(array('['']'"\n"), array('['']'''), $code);
  
$template $parser->printthread 'bbcode_highlight_printthread' 'bbcode_highlight';
  eval(
'$html = "' fetch_template($template) . '";');
  return 
$html;
 }
}
$this->tag_list['option']['highlight'] = array(
 
'callback' => 'handle_external',
 
'strip_empty' => true,
 
'stop_parse' => true,
 
'disable_smilies' => true,
 
'disable_wordwrap' => true,
 
'strip_space_after' => 1,
 
'external_callback' => 'handle_bbcode_highlight'
);
require_once(
DIR '/includes/geshi.php'); 

still the php keywords are not linked :mad: damn it

blueaura 05-04-2006 02:59 PM

Any way to get this to plug into the code button? The by doign [code] example code [/ code] it would automatically replace it with [highlight=Java] example code [/ highlight].

This would be much easier for less technical forum users to work and means the admin could limit the syntax highlighting to one specific language like Java if you run a Java programming forum.

Previously I got Geshi to work on the code button but I had to hack the php code for BBcode. Nice to see a more friendly way to get Geshi in there now anyway.

ffevo: You can change fonts and colours by editing the php.php file or what ever language you are using in /incudes/geshi

Also would like to suggest the following changes
Code:

if (!is_array($codefind))
        {
            $codefind1 = array(
                '<br>',        // <br> to nothing
                '<br />'    // <br /> to nothing
            );
            $codereplace1 = array(
                '',
                ''
            );

            $codefind2 = array(
                '&gt;',        // &gt; to >
                '&lt;',        // &lt; to <
                '&quot;',    // &quot; to ",
                '&amp;',    // &amp; to &
                '& #91;',    // without the space after the &
                '& #93;',    // ] without the space after the &

            );
            $codereplace2 = array(
                '>',
                '<',
                '"',
                '&',
                '[',
                ']',
            );
        }

It sorts out the issue with square brackets.

EDIT: you can edit includes/class_bbcode.php to get the plugin to use [code] with a bit of hacking. Can't be doign with that at the moment so I'm back at my own method. The author of this mod may want to explore this though.

kirupa 05-04-2006 04:54 PM

So, basically, does the highlighter work in vBulletin 3.5.4? I recall not being able to get it to work in an earlier vB 3.5.x version, so I have delayed updating my boards because of it.

blueaura 05-04-2006 05:55 PM

Quote:

Originally Posted by kirupa
So, basically, does the highlighter work in vBulletin 3.5.4? I recall not being able to get it to work in an earlier vB 3.5.x version, so I have delayed updating my boards because of it.

Yes it works

bullzeye 07-16-2006 10:04 PM

Is there any way to change the location of Geshi? For use with other parts of our site we had a directory /lib where geshi can be found and for update work and similarity on out other parts we want to place geshi in the folder /lib/geshi. I changed the path and the require_once in the xml-file of this plugin to lib/geshi (for $path) and require_once('lib/gehsi/geshi.php'). Installation was no problem and it seems that this gets parsed correctly but there is no highlightning only a gray Background with line numbers. I hope it is possible to understand what i want.

Excuse my bad english.

StarShaper 08-16-2006 06:30 PM

Quote:

Originally Posted by bullzeye
Is there any way to change the location of Geshi?

You have to change the include path. Just edit the plugin code.

There is a problem with this product. If you do a manual cache update of all Postings all geshi Code Blocks are deleted.

zylstra 12-27-2006 08:56 AM

Quote:

Originally Posted by digitalpoint (Post 768095)
I changed it to be CODE instead of HIGHLIGHT (more natural to me) and I added a little extra to have it intercept the normal PHP and HTML tag calls. :)

digitalpoint, care to share your modification with us?

zylstra 12-27-2006 10:51 AM

When I place
Code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html dir="ltr" lang="en">
<head>
<base href="http://www.example.com/" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />

inside the tags with the html4strict option I get
Code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[ur l="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd[/ur l]">
<html dir="ltr" lang="en">
<head>
<base href="[ur l="http://www.example.com/"]http://www.example.com/[/ur l]" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />

without the space between the "ur" and the "l". It seems that URLs are parsed into links within code blocks, but this fails inside the Geshi parsed code. How do I turn off URL parsing within code blocks?

vB.org parses URLs inside posts, but not inside code blocks. This is how I want my site to work also.

Test: http://www.example.com/

zylstra 12-27-2006 05:21 PM

I discovered that the automatic URL linking is due to the WYSIWYG interface in IE: http://www.vbulletin.com/forum/bugs3...2018&status=60 .


All times are GMT. The time now is 07:46 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.02961 seconds
  • Memory Usage 1,781KB
  • 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
  • (1)bbcode_php_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