3
* Syntax highlighting extension for MediaWiki 1.5 using GeSHi
4
* Copyright (C) 2005 Brion Vibber <brion@pobox.com>
5
* http://www.mediawiki.org/
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation; either version 2 of the License, or
10
* (at your option) any later version.
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
17
* You should have received a copy of the GNU General Public License along
18
* with this program; if not, write to the Free Software Foundation, Inc.,
19
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20
* http://www.gnu.org/copyleft/gpl.html
24
* @addtogroup Extensions
25
* @author Brion Vibber
27
* This extension wraps the GeSHi highlighter: http://qbnz.com/highlighter/
29
* Unlike the older GeSHi MediaWiki extension floating around, this makes
30
* use of the new extension parameter support in MediaWiki 1.5 so it only
31
* has to register one tag, <source>.
33
* A language is specified like: <source lang="c">void main() {}</source>
34
* If you forget, or give an unsupported value, the extension spits out
35
* some help text and a list of all supported languages.
37
* The extension has been tested with GeSHi 1.0.8 and MediaWiki 1.14a
41
if( !defined( 'MEDIAWIKI' ) )
44
$wgExtensionCredits['parserhook']['SyntaxHighlight_GeSHi'] = array(
45
'name' => 'SyntaxHighlight',
46
'svn-date' => '$LastChangedDate: 2008-09-28 10:30:45 -0500 (dim. 28 sept. 2008) $',
47
'svn-revision' => '$LastChangedRevision: 41349 $',
48
'author' => array( 'Brion Vibber', 'Tim Starling', 'Rob Church', 'Niklas Laxström' ),
49
'description' => 'Provides syntax highlighting using [http://qbnz.com/highlighter/ GeSHi Highlighter]',
50
'descriptionmsg' => 'syntaxhighlight-desc',
51
'url' => 'http://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi',
54
$dir = dirname(__FILE__) . '/';
55
$wgExtensionMessagesFiles['SyntaxHighlight_GeSHi'] = $dir . 'SyntaxHighlight_GeSHi.i18n.php';
56
$wgAutoloadClasses['SyntaxHighlight_GeSHi'] = $dir . 'SyntaxHighlight_GeSHi.class.php';
57
$wgHooks['ShowRawCssJs'][] = 'SyntaxHighlight_GeSHi::viewHook';
58
if ( defined( 'MW_SUPPORTS_PARSERFIRSTCALLINIT' ) ) {
59
$wgHooks['ParserFirstCallInit'][] = 'efSyntaxHighlight_GeSHiSetup';
61
$wgExtensionFunctions[] = 'efSyntaxHighlight_GeSHiSetup';
65
* Register parser hook
67
function efSyntaxHighlight_GeSHiSetup() {
69
$wgParser->setHook( 'source', array( 'SyntaxHighlight_GeSHi', 'parserHook' ) );