Difference between revisions of "GeSHi"
(+stub) |
(disabled) |
||
| (3 intermediate revisions by one other user not shown) | |||
| Line 1: | Line 1: | ||
| + | Note: This extension has been disabled. | ||
| + | |||
<php> | <php> | ||
<?php | <?php | ||
| Line 21: | Line 23: | ||
$wgParser->setHook( "mysql", "mysqlHook" ); | $wgParser->setHook( "mysql", "mysqlHook" ); | ||
$wgParser->setHook( "html", "htmlHook" ); | $wgParser->setHook( "html", "htmlHook" ); | ||
| + | # Christoph's additions, 17-Dec-2005 | ||
| + | $wgParser->setHook( "css", "cssHook" ); | ||
} | } | ||
| Line 40: | Line 44: | ||
function mysqlHook ( $code ) { return formatCode( $code, 'mysql' ); } | function mysqlHook ( $code ) { return formatCode( $code, 'mysql' ); } | ||
function htmlHook ( $code ) { return formatCode( $code, 'html' ); } | function htmlHook ( $code ) { return formatCode( $code, 'html' ); } | ||
| + | # Christoph's additions, 17-Dec-2005 | ||
| + | function cssHook ( $code ) { return formatCode( $code, 'css' ); } | ||
?> | ?> | ||
</php> | </php> | ||
| + | |||
| + | <css> | ||
| + | /* --- CSS --- */ | ||
| + | |||
| + | div#main { color:#fff; } | ||
| + | </css> | ||
| + | |||
| + | ==Possible Languages== | ||
| + | * actionscript-french | ||
| + | * actionscript | ||
| + | * ada | ||
| + | * apache | ||
| + | * applescript | ||
| + | * asm | ||
| + | * asp | ||
| + | * bash | ||
| + | * blitzbasic | ||
| + | * c | ||
| + | * c_mac | ||
| + | * caddcl | ||
| + | * cadlisp | ||
| + | * cpp | ||
| + | * csharp | ||
| + | * css-gen.cfg | ||
| + | * [[GeSHi/CSS|css]] | ||
| + | * d | ||
| + | * delphi | ||
| + | * diff | ||
| + | * div | ||
| + | * dos | ||
| + | * eiffel | ||
| + | * freebasic | ||
| + | * gml | ||
| + | * html4strict | ||
| + | * ini | ||
| + | * inno | ||
| + | * [[GeSHi/Java|java]] | ||
| + | * javascript | ||
| + | * lisp | ||
| + | * lua | ||
| + | * matlab | ||
| + | * mpasm | ||
| + | * mysql | ||
| + | * nsis | ||
| + | * objc | ||
| + | * ocaml-brief | ||
| + | * ocaml | ||
| + | * oobas | ||
| + | * oracle8 | ||
| + | * pascal | ||
| + | * perl | ||
| + | * php-brief | ||
| + | * php | ||
| + | * python | ||
| + | * qbasic | ||
| + | * ruby | ||
| + | * scheme | ||
| + | * sdlbasic | ||
| + | * smarty | ||
| + | * sql | ||
| + | * vb | ||
| + | * vbnet | ||
| + | * vhdl | ||
| + | * visualfoxpro | ||
| + | * xml | ||
| + | |||
{{stub}} | {{stub}} | ||
| + | [[Category:Sandbox]] | ||
Latest revision as of 10:25, 30 July 2006
Note: This extension has been disabled.
<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" ); # Christoph's additions, 17-Dec-2005 $wgParser->setHook( "css", "cssHook" );
}
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' ); }
- Christoph's additions, 17-Dec-2005
function cssHook ( $code ) { return formatCode( $code, 'css' ); }
?> </php>
<css> /* --- CSS --- */
div#main { color:#fff; } </css>
Possible Languages
- actionscript-french
- actionscript
- ada
- apache
- applescript
- asm
- asp
- bash
- blitzbasic
- c
- c_mac
- caddcl
- cadlisp
- cpp
- csharp
- css-gen.cfg
- css
- d
- delphi
- diff
- div
- dos
- eiffel
- freebasic
- gml
- html4strict
- ini
- inno
- java
- javascript
- lisp
- lua
- matlab
- mpasm
- mysql
- nsis
- objc
- ocaml-brief
- ocaml
- oobas
- oracle8
- pascal
- perl
- php-brief
- php
- python
- qbasic
- ruby
- scheme
- sdlbasic
- smarty
- sql
- vb
- vbnet
- vhdl
- visualfoxpro
- xml
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!