0
|
1 |
<?php
|
|
2 |
/*************************************************************************************
|
|
3 |
* latex.php
|
|
4 |
* -----
|
2
|
5 |
* Author: efi, Matthias Pospiech (matthias@pospiech.eu)
|
|
6 |
* Copyright: (c) 2006 efi, Matthias Pospiech (matthias@pospiech.eu), Nigel McNie (http://qbnz.com/highlighter)
|
|
7 |
* Release Version: 1.0.8.2
|
|
8 |
* Date Started: 2006/09/23
|
|
9 |
*
|
|
10 |
* LaTeX language file for GeSHi.
|
|
11 |
*
|
|
12 |
* CHANGES
|
|
13 |
* -------
|
|
14 |
* 2008/08/18 (1.0.8.1)
|
|
15 |
* - Changes in color and some additional command recognition
|
|
16 |
* - No special Color for Brackets, it is only distracting
|
|
17 |
* if color should be reintroduced it should be less bright
|
|
18 |
* - Math color changed from green to violett, since green is now used for comments
|
|
19 |
* - Comments are now colored and the only green. The reason for coloring the comments
|
|
20 |
* is that often important information is in the comments und was merely unvisible before.
|
|
21 |
* - New Color for [Options]
|
|
22 |
* - color for labels not specialised anymore. It makes sence in large documents but less in
|
|
23 |
* small web examples.
|
|
24 |
* - \@keyword introduced
|
|
25 |
* - Fixed \& escaped ampersand
|
|
26 |
* 2006/09/23 (1.0.0)
|
|
27 |
* - First Release
|
|
28 |
*
|
|
29 |
* TODO
|
|
30 |
* -------------------------
|
|
31 |
* *
|
|
32 |
*
|
0
|
33 |
*************************************************************************************
|
|
34 |
*
|
2
|
35 |
* This file is part of GeSHi.
|
0
|
36 |
*
|
|
37 |
* GeSHi is free software; you can redistribute it and/or modify
|
|
38 |
* it under the terms of the GNU General Public License as published by
|
|
39 |
* the Free Software Foundation; either version 2 of the License, or
|
|
40 |
* (at your option) any later version.
|
|
41 |
*
|
|
42 |
* GeSHi is distributed in the hope that it will be useful,
|
|
43 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
44 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
45 |
* GNU General Public License for more details.
|
|
46 |
*
|
|
47 |
* You should have received a copy of the GNU General Public License
|
|
48 |
* along with GeSHi; if not, write to the Free Software
|
|
49 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
50 |
*
|
|
51 |
************************************************************************************/
|
|
52 |
|
|
53 |
$language_data = array (
|
|
54 |
'LANG_NAME' => 'LaTeX',
|
2
|
55 |
'COMMENT_SINGLE' => array(
|
|
56 |
1 => '%'
|
|
57 |
),
|
0
|
58 |
'COMMENT_MULTI' => array(),
|
|
59 |
'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE,
|
|
60 |
'QUOTEMARKS' => array(),
|
|
61 |
'ESCAPE_CHAR' => '',
|
|
62 |
'KEYWORDS' => array(
|
|
63 |
),
|
|
64 |
'SYMBOLS' => array(
|
2
|
65 |
"&", "\\", "{", "}", "[", "]"
|
0
|
66 |
),
|
|
67 |
'CASE_SENSITIVE' => array(
|
2
|
68 |
GESHI_COMMENTS => false,
|
0
|
69 |
),
|
|
70 |
'STYLES' => array(
|
|
71 |
'KEYWORDS' => array(
|
|
72 |
),
|
|
73 |
'COMMENTS' => array(
|
2
|
74 |
1 => 'color: #2C922C; font-style: italic;'
|
0
|
75 |
),
|
|
76 |
'ESCAPE_CHAR' => array(
|
2
|
77 |
0 => 'color: #000000; font-weight: bold;'
|
0
|
78 |
),
|
|
79 |
'BRACKETS' => array(
|
|
80 |
),
|
|
81 |
'STRINGS' => array(
|
2
|
82 |
0 => 'color: #000000;'
|
0
|
83 |
),
|
|
84 |
'NUMBERS' => array(
|
|
85 |
),
|
|
86 |
'METHODS' => array(
|
|
87 |
),
|
|
88 |
'SYMBOLS' => array(
|
2
|
89 |
0 => 'color: #0000D0; '
|
0
|
90 |
),
|
|
91 |
'REGEXPS' => array(
|
2
|
92 |
1 => 'color: #8020E0; font-weight: normal;', // Math inner
|
|
93 |
2 => 'color: #C08020; font-weight: normal;', // [Option]
|
|
94 |
3 => 'color: #8020E0; font-weight: normal;', // Maths
|
|
95 |
4 => 'color: #800000; font-weight: normal;', // Structure: Labels
|
|
96 |
5 => 'color: #00008B; font-weight: bold;', // Structure (\section{->x<-})
|
|
97 |
6 => 'color: #800000; font-weight: normal;', // Structure (\section)
|
|
98 |
7 => 'color: #0000D0; font-weight: normal;', // Environment \end or \begin{->x<-} (brighter blue)
|
|
99 |
8 => 'color: #C00000; font-weight: normal;', // Structure \end or \begin
|
|
100 |
9 => 'color: #2020C0; font-weight: normal;', // {...}
|
|
101 |
10 => 'color: #800000; font-weight: normal;', // \%, \& etc.
|
|
102 |
11 => 'color: #E00000; font-weight: normal;', // \@keyword
|
|
103 |
12 => 'color: #800000; font-weight: normal;', // \keyword
|
0
|
104 |
),
|
|
105 |
'SCRIPT' => array(
|
|
106 |
)
|
|
107 |
),
|
|
108 |
'URLS' => array(
|
|
109 |
),
|
|
110 |
'OOLANG' => false,
|
|
111 |
'OBJECT_SPLITTERS' => array(
|
|
112 |
),
|
|
113 |
'REGEXPS' => array(
|
|
114 |
// Math inner
|
|
115 |
1 => array(
|
2
|
116 |
GESHI_SEARCH => "(\\\\begin\\{(equation|displaymath|eqnarray|subeqnarray|math|multline|gather|align|alignat|flalign)\\})(.*)(\\\\end\\{\\2\\})",
|
|
117 |
GESHI_REPLACE => '\3',
|
|
118 |
GESHI_MODIFIERS => 'Us',
|
|
119 |
GESHI_BEFORE => '\1',
|
|
120 |
GESHI_AFTER => '\4'
|
0
|
121 |
),
|
2
|
122 |
// [options]
|
0
|
123 |
2 => array(
|
2
|
124 |
GESHI_SEARCH => "(?<=\[).+(?=\])",
|
|
125 |
GESHI_REPLACE => '\0',
|
|
126 |
GESHI_MODIFIERS => 'Us',
|
0
|
127 |
GESHI_BEFORE => '',
|
|
128 |
GESHI_AFTER => ''
|
|
129 |
),
|
2
|
130 |
// Math mode with $ ... $
|
0
|
131 |
3 => array(
|
2
|
132 |
GESHI_SEARCH => "\\$.+\\$",
|
|
133 |
GESHI_REPLACE => '\0',
|
|
134 |
GESHI_MODIFIERS => 'Us',
|
0
|
135 |
GESHI_BEFORE => '',
|
|
136 |
GESHI_AFTER => ''
|
|
137 |
),
|
2
|
138 |
// Structure: Label
|
|
139 |
4 => "\\\\(?:label|pageref|ref|cite)(?=[^a-zA-Z])",
|
|
140 |
// Structure: sections
|
|
141 |
5 => array(
|
|
142 |
GESHI_SEARCH => "(\\\\(?:part|chapter|(?:sub){0,2}section|(?:sub)?paragraph|addpart|addchap|addsec)\*?\\{)(.*)(?=\\})",
|
|
143 |
GESHI_REPLACE => '\\2',
|
|
144 |
GESHI_MODIFIERS => 'U',
|
|
145 |
GESHI_BEFORE => '\\1',
|
|
146 |
GESHI_AFTER => ''
|
0
|
147 |
),
|
2
|
148 |
// Structure: sections
|
|
149 |
6 => "\\\\(?:part|chapter|(?:sub){0,2}section|(?:sub)?paragraph|addpart|addchap|addsec)\*?(?=[^a-zA-Z])",
|
|
150 |
// environment \begin{} and \end{} (i.e. the things inside the {})
|
|
151 |
7 => array(
|
|
152 |
GESHI_SEARCH => "(\\\\(?:begin|end)\\{)(.*)(?=\\})",
|
|
153 |
GESHI_REPLACE => '\\2',
|
|
154 |
GESHI_MODIFIERS => 'U',
|
|
155 |
GESHI_BEFORE => '\\1',
|
|
156 |
GESHI_AFTER => ''
|
0
|
157 |
),
|
2
|
158 |
// Structure \begin and \end
|
|
159 |
8 => "\\\\(?:end|begin)(?=[^a-zA-Z])",
|
|
160 |
// {parameters}
|
|
161 |
9 => array(
|
|
162 |
GESHI_SEARCH => "(?<=\\{)(?!<\|!REG3XP5!>).*(?=\\})",
|
|
163 |
GESHI_REPLACE => '\0',
|
|
164 |
GESHI_MODIFIERS => 'Us',
|
0
|
165 |
GESHI_BEFORE => '',
|
|
166 |
GESHI_AFTER => ''
|
|
167 |
),
|
2
|
168 |
// \%, \& usw.
|
|
169 |
10 => "\\\\(?:[_$%]|&)",
|
|
170 |
// \@keywords
|
|
171 |
11 => "(?<!<\|!REG3XP[8]!>)\\\\@[a-zA-Z]+\*?",
|
|
172 |
// \keywords
|
|
173 |
12 => "(?<!<\|!REG3XP[468]!>)\\\\[a-zA-Z]+\*?",
|
0
|
174 |
|
|
175 |
// ---------------------------------------------
|
|
176 |
),
|
|
177 |
'STRICT_MODE_APPLIES' => GESHI_NEVER,
|
|
178 |
'SCRIPT_DELIMITERS' => array(
|
|
179 |
),
|
|
180 |
'HIGHLIGHT_STRICT_BLOCK' => array(
|
2
|
181 |
),
|
|
182 |
'PARSER_CONTROL' => array(
|
|
183 |
'COMMENTS' => array(
|
|
184 |
'DISALLOWED_BEFORE' => '\\'
|
|
185 |
),
|
|
186 |
'ENABLE_FLAGS' => array(
|
|
187 |
'NUMBERS' => GESHI_NEVER,
|
|
188 |
'BRACKETS' => GESHI_NEVER
|
0
|
189 |
)
|
2
|
190 |
)
|
0
|
191 |
);
|
|
192 |
|
|
193 |
?>
|