# HG changeset patch # User Dan # Date 1243639859 14400 # Node ID 9e3258dfae1548cc5d8f82060212e1e1a5f89b08 # Parent c715631f809a90cf2401dffd119bfb485deeeec1 Updated GeSHi. w00t. diff -r c715631f809a -r 9e3258dfae15 plugins/GeSHi.php --- a/plugins/GeSHi.php Sun Feb 10 19:00:04 2008 -0500 +++ b/plugins/GeSHi.php Fri May 29 19:30:59 2009 -0400 @@ -22,13 +22,7 @@ global $db, $session, $paths, $template, $plugins; // Common objects $GLOBALS['geshi_supported_formats'] = array( - 'abap', 'blitzbasic', 'cpp-qt', 'd', 'idl', 'lua', 'ocaml', 'python', 'smalltalk', 'vhdl', 'actionscript', 'bnf', 'csharp', - 'eiffel', 'ini', 'm68k', 'oobas', 'qbasic', 'smarty', 'visualfoxpro', 'ada', 'caddcl', 'fortran', 'inno', 'matlab', - 'oracle8', 'rails', 'sql', 'winbatch', 'apache', 'cadlisp', 'css', 'freebasic', 'io', 'mirc', 'pascal', 'reg', 'tcl', 'xml', - 'applescript', 'cfdg', 'delphi', 'genero', 'java5', 'mpasm', 'perl', 'robots', 'text', 'xpp', 'asm', 'cfm', 'diff', 'gml', 'java', - 'mysql', 'per', 'ruby', 'thinbasic', 'z80', 'asp', 'c_mac', 'div', 'groovy', 'javascript', 'nsis', 'php-brief', 'sas', 'tsql', - 'autoit', 'c', 'dos', 'haskell', 'latex', 'objc', 'php', 'scheme', 'vbnet', 'bash', 'cpp', 'dot', 'html', 'lisp', - 'ocaml-brief', 'plsql', 'sdlbasic', 'vb' + 'abap', 'actionscript3', 'actionscript', 'ada', 'apache', 'applescript', 'apt_sources', 'asm', 'asp', 'autoit', 'avisynth', 'bash', 'basic4gl', 'bf', 'blitzbasic', 'bnf', 'boo', 'caddcl', 'cadlisp', 'cfdg', 'cfm', 'cil', 'c_mac', 'cobol', 'c', 'cpp', 'cpp-qt', 'csharp', 'css', 'delphi', 'diff', 'div', 'dos', 'dot', 'd', 'eiffel', 'email', 'fortran', 'freebasic', 'genero', 'gettext', 'glsl', 'gml', 'gnuplot', 'groovy', 'haskell', 'hq9plus', 'html', 'idl', 'ini', 'inno', 'intercal', 'io', 'java5', 'java', 'javascript', 'kixtart', 'klonec', 'klonecpp', 'latex', 'lisp', 'lolcode', 'lotusformulas', 'lotusscript', 'lscript', 'lua', 'm68k', 'make', 'matlab', 'mirc', 'mpasm', 'mxml', 'mysql', 'nsis', 'objc', 'ocaml-brief', 'ocaml', 'oobas', 'oracle11', 'oracle8', 'pascal', 'perl', 'per', 'php-brief', 'php', 'pic16', 'pixelbender', 'plsql', 'povray', 'powershell', 'progress', 'prolog', 'providex', 'python', 'qbasic', 'rails', 'reg', 'robots', 'ruby', 'sas', 'scala', 'scheme', 'scilab', 'sdlbasic', 'smalltalk', 'smarty', 'sql', 'tcl', 'teraterm', 'text', 'thinbasic', 'tsql', 'typoscript', 'vbnet', 'vb', 'verilog', 'vhdl', 'vim', 'visualfoxpro', 'visualprolog', 'whitespace', 'winbatch', 'xml', 'xorg_conf', 'xpp', 'z80' ); // Knock out the existing tag support @@ -56,20 +50,21 @@ global $geshi_supported_formats; $codeblocks = array(); $sf = '(' . implode('|', $geshi_supported_formats) . ')'; - preg_match_all('/([\w\W]*?)<\/code>/ms', $text, $matches); + $regexp = '/<(code|source) (?:type|lang)="?' . $sf . '"?>(.*?)<\/\\1>/s'; + preg_match_all($regexp, $text, $matches); // for debug /* if ( strstr($text, '' . htmlspecialchars(print_r($matches, true)) . '
' . htmlspecialchars($text) . '
' . htmlspecialchars('/([\w\W]*?)<\/code>/')); + die('processing codes:
' . htmlspecialchars(print_r($matches, true)) . '
' . htmlspecialchars($text) . '
' . htmlspecialchars($regexp)); */ foreach ( $matches[0] as $i => $match ) { $codeblocks[$i] = array( 'match' => $match, - 'lang' => $matches[1][$i], - 'code' => $matches[2][$i] + 'lang' => $matches[2][$i], + 'code' => $matches[3][$i] ); $text = str_replace_once($match, "{GESHI_BLOCK:$i:$random_id}", $text); } @@ -95,10 +90,13 @@ $did_header_tweak = true; global $template; $template->add_header('