[REQ]Advanced Syntax Highlighting

skrazydogz

New Member
Here you go ;) and merry christmas :D

Codes from lastpage:

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

Code:
//################################################################
//20070518 -- brothercake mod commented these lines so we can control from geshi.php directly                
// $geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);
// $tabs = 4;
// $geshi->set_header_type(GESHI_HEADER_DIV);
// $geshi->set_tab_width($tabs);
//################################################################

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']);
            }
        }

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]]";
        }
    }

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

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

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'
	);
 

fwhite

New Member
where exactly would I put this code in the XML file?

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'
	);
 

abitbole

New Member
i really don't know ...
but it didn't work for me , maybe i miss something.
i guess i will search a custom bbcode for c++ , it will be easier :)
 
Top