summaryrefslogtreecommitdiff
path: root/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.compat.php
blob: 98a1498b91dedc47133a8dd7e68188a8ee14770f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<?php
/**
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 * http://www.gnu.org/copyleft/gpl.html
 */

/**
 * Stub object for maintaining backward-compatibility with extensions
 * that have not been updated for version 2.0 of SyntaxHighlight_GeSHi
 * and for supporting GeSHi lexer names whenever they map naturally to
 * a Pygments lexer.
 */
class GeSHi {
	/** @var array A mapping of GeSHi lexer names to compatible Pygments lexers. */
	public static $compatibleLexers = array(
		// Assembler
		'arm'       => 'asm',
		'6502acme'  => 'asm',
		'6502tasm'  => 'asm',
		'6502kickass'=> 'asm',
		'68000devpac'=> 'asm',
		'dcpu16'    => 'asm',
		'm68k'      => 'asm',
		'mmix'      => 'nasm',
		'mpasm'     => 'asm',
		'pic16'     => 'asm',
		'z80'       => 'asm',

		// BASIC
		'xbasic'    => 'basic',
		'thinbasic' => 'basic',
		'sdlbasic'  => 'basic',
		'purebasic' => 'basic',
		'mapbasic'  => 'basic',
		'locobasic' => 'basic',
		'gwbasic'   => 'basic',
		'freebasic' => 'basic',
		'basic4gl'  => 'basic',
		'zxbasic'   => 'basic',
		'gambas'    => 'basic',
		'oobas'     => 'basic',
		'bascomavr' => 'basic',

		// C / C++
		'c_loadrunner' => 'c',
		'c_mac'        => 'c',
		'c_winapi'     => 'c',
		'upc'          => 'c',
		'cpp-qt'       => 'cpp',
		'cpp-winapi'   => 'cpp',
		'urbi'         => 'cpp',

		// HTML
		'html4strict' => 'html',
		'html5'       => 'html',

		// JavaScript
		'jquery'     => 'javascript',
		'ecmascript' => 'javascript',

		// Microsoft
		'vb'           => 'vbnet',
		'asp'          => 'aspx-vb',
		'visualfoxpro' => 'foxpro',
		'dos'          => 'bat',
		'visualprolog' => 'prolog',
		'reg'          => 'registry',

		// Miscellaneous
		'cadlisp'   => 'lisp',
		'j'         => 'objj',
		'java5'     => 'java',
		'php-brief' => 'php',
		'povray'    => 'pov',
		'pys60'     => 'python',
		'rails'     => 'ruby',
		'rpmspec'   => 'spec',
		'rsplus'    => 'splus',
		'bnf'       => 'ebnf',
		'gettext'   => 'pot',

		// ML
		'ocaml-brief' => 'ocaml',
		'standardml'  => 'sml',

		// Modula 2
		'modula3' => 'modula2',
		'oberon2' => 'modula2',

		// SQL
		'dcl'      => 'sql',
		'tsql'     => 'sql',
		'plsql'    => 'sql',
		'oracle11' => 'sql',
		'oracle8'  => 'sql',

		// REXX
		'oorexx'  => 'rexx',
		'netrexx' => 'rexx',

		// xpp is basically Java
		'xpp' => 'java',

		// bibtex is basically LaTeX
		'bibtex' => 'latex',
	);

	public function __construct( $html ) {
		$this->html = $html;
	}

	public function error() {
	}

	public function set_language( $language ) {
	}

	public function parse_code() {
		global $wgOut;
		$wgOut->addModuleStyles( 'ext.pygments' );
		return $this->html;
	}
}