Difference between revisions of "GeSHi"
(Testing "GeSHi") |
(+stub) |
||
Line 43: | Line 43: | ||
?> | ?> | ||
</php> | </php> | ||
+ | |||
+ | {{stub}} |
Revision as of 16:22, 17 December 2005
<php> <?php
- vim: ts=8:sw=4:sts=4:et
- MediaWiki GeSHiColor version 0.0
- Copyright (c) 2005 Aran Clary Deltac
- http://arandeltac.com/MediaWiki_GeSHiColor
- Distributed under that same terms as MediaWiki itself.
include_once('geshi/geshi.php');
$wgExtensionFunctions[] = "wfGeSHiColorExtension";
function wfGeSHiColorExtension() {
global $wgParser; $wgParser->setHook( "code", "codeHook" ); $wgParser->setHook( "php", "phpHook" ); $wgParser->setHook( "perl", "perlHook" ); $wgParser->setHook( "bash", "bashHook" ); $wgParser->setHook( "mysql", "mysqlHook" ); $wgParser->setHook( "html", "htmlHook" );
}
function hookCode( $code, $args ) {
$type = ; if ($args['type']) { $type=$args['type']; } return formatCode( $code, $type );
}
function formatCode( $code, $type ) {
if (!$type) { die('No language type defined for code block.'); } $geshi =& new GeSHi( trim($code), $type ); return $geshi->parse_code();
}
function phpHook ( $code ) { return formatCode( $code, 'php' ); } function perlHook ( $code ) { return formatCode( $code, 'perl' ); } function bashHook ( $code ) { return formatCode( $code, 'bash' ); } function mysqlHook ( $code ) { return formatCode( $code, 'mysql' ); } function htmlHook ( $code ) { return formatCode( $code, 'html' ); }
?> </php>
This article is curently a "stub". This means it is an incomplete article needing further elaboration.
I always welcome suggestions, comments, and criticism. If you have something to contribute to this site, please follow this link: Contributing Information. Thank you!