|
1 <?php |
|
2 /************************************************************************************* |
|
3 * latex.php |
|
4 * ----- |
|
5 * Original Author: efi |
|
6 * modified by Matthias Pospiech (mail@matthiaspospiech.de) |
|
7 ************************************************************************************* |
|
8 * |
|
9 * This file is not yet part of GeSHi. (and is not compatible to the 1.1+ branch) |
|
10 * |
|
11 * GeSHi is free software; you can redistribute it and/or modify |
|
12 * it under the terms of the GNU General Public License as published by |
|
13 * the Free Software Foundation; either version 2 of the License, or |
|
14 * (at your option) any later version. |
|
15 * |
|
16 * GeSHi is distributed in the hope that it will be useful, |
|
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
19 * GNU General Public License for more details. |
|
20 * |
|
21 * You should have received a copy of the GNU General Public License |
|
22 * along with GeSHi; if not, write to the Free Software |
|
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
24 * |
|
25 ************************************************************************************/ |
|
26 |
|
27 if (isset($this) && is_a($this, 'GeSHi')) { |
|
28 $this->set_symbols_highlighting(false); |
|
29 $this->set_numbers_highlighting(false); |
|
30 } |
|
31 |
|
32 $language_data = array ( |
|
33 'LANG_NAME' => 'LaTeX', |
|
34 'COMMENT_SINGLE' => array(1 => '%'), |
|
35 'COMMENT_MULTI' => array(), |
|
36 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, |
|
37 'QUOTEMARKS' => array(), |
|
38 'ESCAPE_CHAR' => '', |
|
39 'KEYWORDS' => array( |
|
40 ), |
|
41 'SYMBOLS' => array( |
|
42 '.', ',','\\',"~", "{", "}", "[", "]", "$" |
|
43 ), |
|
44 'CASE_SENSITIVE' => array( |
|
45 GESHI_COMMENTS => true, |
|
46 1 => false, |
|
47 2 => false, |
|
48 3 => false, |
|
49 4 => false, |
|
50 ), |
|
51 'STYLES' => array( |
|
52 'KEYWORDS' => array( |
|
53 ), |
|
54 'COMMENTS' => array( |
|
55 1 => 'color: #808080; font-style: italic;' |
|
56 ), |
|
57 'ESCAPE_CHAR' => array( |
|
58 ), |
|
59 'BRACKETS' => array( |
|
60 ), |
|
61 'STRINGS' => array( |
|
62 ), |
|
63 'NUMBERS' => array( |
|
64 ), |
|
65 'METHODS' => array( |
|
66 ), |
|
67 'SYMBOLS' => array( |
|
68 ), |
|
69 'REGEXPS' => array( |
|
70 1 => 'color: #00A000; font-weight: bold;', // Math inner |
|
71 2 => 'color: #800000; font-weight: normal;', // \keyword #202020 |
|
72 3 => 'color: #2222D0; font-weight: normal;', // {...} |
|
73 4 => 'color: #2222D0; font-weight: normal;', // [Option] |
|
74 5 => 'color: #00A000; font-weight: normal;', // Mathe #CCF020 |
|
75 6 => 'color: #F00000; font-weight: normal;', // Structure \begin |
|
76 7 => 'color: #F00000; font-weight: normal;', // Structure \end |
|
77 8 => 'color: #F00000; font-weight: normal;', // Structure: Labels |
|
78 //9 => 'color: #F00000; font-weight: normal;', // Structure |
|
79 10 => 'color: #0000D0; font-weight: bold;', // Environment |
|
80 11 => 'color: #0000D0; font-weight: bold;', // Environment |
|
81 ), |
|
82 'SCRIPT' => array( |
|
83 ) |
|
84 ), |
|
85 'URLS' => array( |
|
86 ), |
|
87 'OOLANG' => false, |
|
88 'OBJECT_SPLITTERS' => array( |
|
89 ), |
|
90 'REGEXPS' => array( |
|
91 // Math inner |
|
92 1 => array( |
|
93 GESHI_SEARCH => "(\\\\begin\\{)(equation|displaymath|eqnarray|subeqnarray|math|multline|gather|align|alignat|flalign )(\\})(.*)(\\\\end\\{)(equation|displaymath|eqnarray|subeqnarray|math|multline|gather|align|alignat|flalign)(\\})", |
|
94 GESHI_REPLACE => '\\4', |
|
95 GESHI_MODIFIERS => 's', |
|
96 GESHI_BEFORE => '\1\2\3', |
|
97 GESHI_AFTER => '\5\6\7' |
|
98 ), |
|
99 // \keywords |
|
100 2 => array( |
|
101 GESHI_SEARCH => "(\\\\)([a-zA-Z]+)", |
|
102 GESHI_REPLACE => '\1\2', |
|
103 GESHI_MODIFIERS => '', |
|
104 GESHI_BEFORE => '', |
|
105 GESHI_AFTER => '' |
|
106 ), |
|
107 // {parameters} |
|
108 3 => array( |
|
109 GESHI_SEARCH => "(\\{)(.*)(\\})", |
|
110 GESHI_REPLACE => '\2', |
|
111 GESHI_MODIFIERS => '', |
|
112 GESHI_BEFORE => '\1', |
|
113 GESHI_AFTER => '\3' |
|
114 ), |
|
115 // [Option] |
|
116 4 => array( |
|
117 GESHI_SEARCH => "(\[)(.+)(\])", |
|
118 GESHI_REPLACE => '\2', |
|
119 GESHI_MODIFIERS => '', |
|
120 GESHI_BEFORE => '\1', |
|
121 GESHI_AFTER => '\3' |
|
122 ), |
|
123 // Mathe mit $ ... $ |
|
124 5 => array( |
|
125 GESHI_SEARCH => "(\\$)(.+)(\\$)", |
|
126 GESHI_REPLACE => '\1\2\3', |
|
127 GESHI_MODIFIERS => '', |
|
128 GESHI_BEFORE => '', |
|
129 GESHI_AFTER => '' |
|
130 ), |
|
131 // Structure begin |
|
132 6 => array( |
|
133 GESHI_SEARCH => "(\\\\begin)(?=[^a-zA-Z])", |
|
134 GESHI_REPLACE => '\\1', |
|
135 GESHI_MODIFIERS => '', |
|
136 GESHI_BEFORE => '', |
|
137 GESHI_AFTER => '\\2' |
|
138 ), |
|
139 // Structure end |
|
140 7 => array( |
|
141 GESHI_SEARCH => "(\\\\end)(?=[^a-zA-Z])", |
|
142 GESHI_REPLACE => '\\1', |
|
143 GESHI_MODIFIERS => '', |
|
144 GESHI_BEFORE => '', |
|
145 GESHI_AFTER => '\\2' |
|
146 ), |
|
147 //Structure: Label |
|
148 8 => array( |
|
149 GESHI_SEARCH => "(\\\\)(label|pageref|ref|cite)(?=[^a-zA-Z])", |
|
150 GESHI_REPLACE => '\\1\\2', |
|
151 GESHI_MODIFIERS => '', |
|
152 GESHI_BEFORE => '', |
|
153 GESHI_AFTER => '\\3' |
|
154 ), |
|
155 // Structure: sections |
|
156 /*9 => array( |
|
157 GESHI_SEARCH => "(\\\\)(part|chapter|section|subsection|subsubsection|paragraph|subparagraph)(?=[^a-zA-Z])", |
|
158 GESHI_REPLACE => '\1\\2', |
|
159 GESHI_MODIFIERS => '', |
|
160 GESHI_BEFORE => '', |
|
161 GESHI_AFTER => '\\3' |
|
162 ),*/ |
|
163 // environment begin |
|
164 10 => array( |
|
165 GESHI_SEARCH => "(\\\\begin)(\\{)(.*)(\\})", |
|
166 GESHI_REPLACE => '\\3', |
|
167 GESHI_MODIFIERS => '', |
|
168 GESHI_BEFORE => '', |
|
169 GESHI_AFTER => '' |
|
170 ), |
|
171 // environment end |
|
172 11 => array( |
|
173 GESHI_SEARCH => "(\\\\end)(\\{)(.*)(\\})", |
|
174 GESHI_REPLACE => '\\3', |
|
175 GESHI_MODIFIERS => '', |
|
176 GESHI_BEFORE => '', |
|
177 GESHI_AFTER => '' |
|
178 ), |
|
179 |
|
180 // --------------------------------------------- |
|
181 ), |
|
182 'STRICT_MODE_APPLIES' => GESHI_NEVER, |
|
183 'SCRIPT_DELIMITERS' => array( |
|
184 ), |
|
185 'HIGHLIGHT_STRICT_BLOCK' => array( |
|
186 ) |
|
187 ); |
|
188 |
|
189 ?> |