ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
css.php
Go to the documentation of this file.
1<?php
2/*************************************************************************************
3 * css.php
4 * -------
5 * Author: Nigel McNie (nigel@geshi.org), Zéfling (zefling@ikilote.net)
6 * Copyright: (c) 2004 Nigel McNie (http://qbnz.com/highlighter/)
7 * Release Version: 1.0.8.12
8 * Date Started: 2004/06/18
9 *
10 * CSS language file for GeSHi.
11 *
12 * CHANGES
13 * -------
14 * 2014/07/14 (1.0.8.12)
15 * - update for current CSS3 (properties, value, expression, unites & color)
16 * - remove pseudo class regex
17 * - add rules regex
18 * 2008/05/23 (1.0.7.22)
19 * - Added description of extra language features (SF#1970248)
20 * 2004/11/27 (1.0.3)
21 * - Added support for multiple object splitters
22 * 2004/10/27 (1.0.2)
23 * - Changed regexps to catch "-" symbols
24 * - Added support for URLs
25 * 2004/08/05 (1.0.1)
26 * - Added support for symbols
27 * 2004/07/14 (1.0.0)
28 * - First Release
29 *
30 * TODO (updated 2004/11/27)
31 * -------------------------
32 * * Improve or drop regexps for class/id highlighting
33 * * Re-look at keywords - possibly to make several CSS language
34 * files, all with different versions of CSS in them
35 *
36 *************************************************************************************
37 *
38 * This file is part of GeSHi.
39 *
40 * GeSHi is free software; you can redistribute it and/or modify
41 * it under the terms of the GNU General Public License as published by
42 * the Free Software Foundation; either version 2 of the License, or
43 * (at your option) any later version.
44 *
45 * GeSHi is distributed in the hope that it will be useful,
46 * but WITHOUT ANY WARRANTY; without even the implied warranty of
47 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
48 * GNU General Public License for more details.
49 *
50 * You should have received a copy of the GNU General Public License
51 * along with GeSHi; if not, write to the Free Software
52 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
53 *
54 ************************************************************************************/
55
57 'LANG_NAME' => 'CSS',
58 'COMMENT_SINGLE' => array(),
59 'COMMENT_MULTI' => array('/*' => '*/'),
60 'COMMENT_REGEXP' => array(
61 2 => "/(?<=\\()\\s*(?:(?:[a-z0-9]+?:\\/\\/)?[a-z0-9_\\-\\.\\/:]+?)?[a-z]+?\\.[a-z]+?(\\?[^\‍)]+?)?\\s*?(?=\\))/i"
62 ),
63 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE,
64 'QUOTEMARKS' => array('"', "'"),
65 'ESCAPE_CHAR' => '',
66 'ESCAPE_REGEXP' => array(
67 //Simple Single Char Escapes
68 //1 => "#\\\\[nfrtv\$\"\n\\\\]#i",
69 //Hexadecimal Char Specs
70 2 => "#\\\\[\da-fA-F]{1,6}\s?#i",
71 //Unicode Char Specs
72 //3 => "#\\\\u[\da-fA-F]{1,8}#i",
73 ),
74 'KEYWORDS' => array(
75 // properties
76 1 => array(
77 'align-content','align-items','align-self','all','animation',
78 'animation-delay','animation-direction','animation-duration',
79 'animation-fill-mode','animation-iteration-count','animation-name',
80 'animation-play-state','animation-timing-function',
81 'backface-visibility','background','background-attachment',
82 'background-blend-mode','background-clip','background-color',
83 'background-image','background-origin','background-position',
84 'background-repeat','background-size','border','border-bottom',
85 'border-bottom-color','border-bottom-left-radius',
86 'border-bottom-right-radius','border-bottom-style',
87 'border-bottom-width','border-collapse','border-color',
88 'border-image','border-image-outset','border-image-repeat',
89 'border-image-slice','border-image-source','border-image-width',
90 'border-left','border-left-color','border-left-style',
91 'border-left-width','border-radius','border-right',
92 'border-right-color','border-right-style','border-right-width',
93 'border-spacing','border-style','border-top','border-top-color',
94 'border-top-left-radius','border-top-right-radius',
95 'border-top-style','border-top-width','border-width','bottom',
96 'box-decoration-break','box-shadow','box-sizing','break-after',
97 'break-before','break-inside','caption-side','clear','clip',
98 'clip-path','color','columns','column-count','column-fill',
99 'column-gap','column-rule','column-rule-color','column-rule-style',
100 'column-rule-width','column-span','column-width','content',
101 'counter-increment','counter-reset','cursor','direction','display',
102 'empty-cells','filter','flex','flex-basis','flex-direction',
103 'flex-flow','flex-grow','flex-shrink','flex-wrap','float','font',
104 'font-family','font-feature-settings','font-kerning',
105 'font-language-override','font-size','font-size-adjust',
106 'font-stretch','font-style','font-synthesis','font-variant',
107 'font-variant-alternates','font-variant-caps',
108 'font-variant-east-asian','font-variant-ligatures',
109 'font-variant-numeric','font-variant-position','font-weight','grid',
110 'grid-area','grid-auto-columns','grid-auto-flow',
111 'grid-auto-position','grid-auto-rows','grid-column',
112 'grid-column-start','grid-column-end','grid-row','grid-row-start',
113 'grid-row-end','grid-template','grid-template-areas',
114 'grid-template-rows','grid-template-columns','height','hyphens',
115 'icon','image-rendering','image-resolution','image-orientation',
116 'ime-mode','justify-content','left','letter-spacing','line-break',
117 'line-height','list-style','list-style-image','list-style-position',
118 'list-style-type','margin','margin-bottom','margin-left',
119 'margin-right','margin-top','marks','mask','mask-type','max-height',
120 'max-width','min-height','min-width','mix-blend-mode','nav-down',
121 'nav-index','nav-left','nav-right','nav-up','object-fit',
122 'object-position','opacity','order','orphans','outline',
123 'outline-color','outline-offset','outline-style','outline-width',
124 'overflow','overflow-wrap','overflow-x','overflow-y',
125 'overflow-clip-box','padding','padding-bottom','padding-left',
126 'padding-right','padding-top','page-break-after','page-break-before',
127 'page-break-inside','perspective','perspective-origin',
128 'pointer-events','position','quotes','resize','right',
129 'shape-image-threshold','shape-margin','shape-outside',
130 'table-layout','tab-size','text-align','text-align-last',
131 'text-combine-horizontal','text-decoration','text-decoration-color',
132 'text-decoration-line','text-decoration-style','text-indent',
133 'text-orientation','text-overflow','text-rendering','text-shadow',
134 'text-transform','text-underline-position','top','touch-action',
135 'transform','transform-origin','transform-style','transition',
136 'transition-delay','transition-duration','transition-property',
137 'transition-timing-function','unicode-bidi','unicode-range',
138 'vertical-align','visibility','white-space','widows','width',
139 'will-change','word-break','word-spacing','word-wrap',
140 'writing-mode','z-index'
141 ),
142 // value
143 2 => array(
144 'absolute','activeborder','activecaption','after-white-space',
145 'ahead','alternate','always','appworkspace','aqua','armenian','auto',
146 'avoid','background','backwards','baseline','below','bidi-override',
147 'blink','block','block clear','block width','block-axis','bold',
148 'bolder','border','border-box','both','bottom','break-word','button',
149 'button-bevel','buttonface','buttonhighlight','buttonshadow',
150 'buttontext','capitalize','caption','captiontext','caret','center',
151 'checkbox','circle','cjk-ideographic','clip','close-quote',
152 'collapse','compact','condensed','content','content-box',
153 'continuous','crop','cross','crosshair','cursive','dashed','decimal',
154 'decimal-leading-zero','default','disc','discard','dot-dash',
155 'dot-dot-dash','dotted','double','down','e-resize','element',
156 'ellipsis','embed','end','expanded','extra-condensed',
157 'extra-expanded','fantasy','fast','fixed','forwards','georgian',
158 'graytext','groove','hand','hebrew','help','hidden','hide','higher',
159 'highlight','highlighttext','hiragana','hiragana-iroha',
160 'horizontal','icon','ignore','inactiveborder','inactivecaption',
161 'inactivecaptiontext','infinite','infobackground','infotext',
162 'inherit','initial','inline','inline-axis','inline-block',
163 'inline-table','inset','inside','intrinsic','invert','italic',
164 'justify','katakana','katakana-iroha','landscape','large','larger',
165 'left','level','lighter','lime','line-through','list-item','listbox',
166 'listitem','logical','loud','lower','lower-alpha','lower-greek',
167 'lower-latin','lower-roman','lowercase','ltr','marker','match',
168 'medium','menu','menulist','menulist-button','menulist-text',
169 'menulist-textfield','menutext','message-box','middle',
170 'min-intrinsic','mix','monospace','move','multiple','n-resize',
171 'narrower','ne-resize','no-close','no-close-quote','no-open-quote',
172 'no-repeat','none','normal','nowrap','nw-resize','oblique','once',
173 'open-quote','outset','outside','overline','padding','pointer',
174 'portrait','pre','pre-line','pre-wrap','push-button','radio',
175 'read-only','read-write','read-write-plaintext-only','relative',
176 'repeat','repeat-x','repeat-y','reverse','ridge','right','round',
177 'rtl','run-in','s-resize','sans-serif','scroll','scrollbar',
178 'scrollbarbutton-down','scrollbarbutton-left',
179 'scrollbarbutton-right','scrollbarbutton-up',
180 'scrollbargripper-horizontal','scrollbargripper-vertical',
181 'scrollbarthumb-horizontal','scrollbarthumb-vertical',
182 'scrollbartrack-horizontal','scrollbartrack-vertical',
183 'se-resize','searchfield','searchfield-close','searchfield-results',
184 'semi-condensed','semi-expanded','separate','serif','show','single',
185 'skip-white-space','slide','slider-horizontal','slider-vertical',
186 'sliderthumb-horizontal','sliderthumb-vertical','slow','small',
187 'small-caps','small-caption','smaller','solid','space','square',
188 'square-button','start','static','status-bar','stretch','sub',
189 'super','sw-resize','table','table-caption','table-cell',
190 'table-column','table-column-group','table-footer-group',
191 'table-header-group','table-row','table-row-group','text',
192 'text-bottom','text-top','textfield','thick','thin',
193 'threeddarkshadow','threedface','threedhighlight',
194 'threedlightshadow','threedshadow','top','ultra-condensed',
195 'ultra-expanded','underline','unfurl','up','upper-alpha',
196 'upper-latin','upper-roman','uppercase','vertical','visible',
197 'visual','w-resize','wait','wave','wider','window','windowframe',
198 'windowtext','x-large','x-small','xx-large','xx-small'
199 ),
200 // function xxx()
201 3 => array(
202 'attr','calc','contrast','cross-fade','cubic-bezier','cycle',
203 'device-cmyk','drop-shadow','element','ellipse','hsl','hsla','hwb',
204 'image','matrix','matrix3d','minmax','gray','grayscale',
205 'perspective','polygon','radial-gradient','translate','translatex',
206 'translatey','translatez','translate3d','skew','skewx','skewy',
207 'saturate','sepia','scale','scalex','scaley','scalez','scale3d',
208 'steps','rect','repeating-linear-gradient',
209 'repeating-radial-gradient','repeat','rgb','rgba','rotate','rotatex',
210 'rotatey','rotatez','rotate3d','url','var'
211 ),
212 // colors
213 4 => array(
214 'aliceblue','antiquewhite','aqua','aquamarine','azure','beige',
215 'bisque','black','blanchedalmond','blue','blueviolet','brown',
216 'burlywood','cadetblue','chartreuse','chocolate','coral',
217 'cornflowerblue','cornsilk','crimson','cyan','darkblue','darkcyan',
218 'darkgoldenrod','darkgray','darkgreen','darkgrey','darkkhaki',
219 'darkmagenta','darkolivegreen','darkorange','darkorchid','darkred',
220 'darksalmon','darkseagreen','darkslateblue','darkslategray',
221 'darkslategrey','darkturquoise','darkviolet','deeppink',
222 'deepskyblue','dimgray','dimgrey','dodgerblue','firebrick',
223 'floralwhite','forestgreen','fuchsia','gainsboro','ghostwhite',
224 'gold','goldenrod','gray','green','greenyellow','grey','honeydew',
225 'hotpink','indianred','indigo','ivory','khaki','lavender',
226 'lavenderblush','lawngreen','lemonchiffon','lightblue','lightcoral',
227 'lightcyan','lightgoldenrodyellow','lightgray','lightgreen',
228 'lightgrey','lightpink','lightsalmon','lightseagreen','lightskyblue',
229 'lightslategray','lightslategrey','lightsteelblue','lightyellow',
230 'lime','limegreen','linen','magenta','maroon','mediumaquamarine',
231 'mediumblue','mediumorchid','mediumpurple','mediumseagreen',
232 'mediumslateblue','mediumspringgreen','mediumturquoise',
233 'mediumvioletred','midnightblue','mintcream','mistyrose','moccasin',
234 'navajowhite','navy','oldlace','olive','olivedrab','orange',
235 'orangered','orchid','palegoldenrod','palegreen','paleturquoise',
236 'palevioletred','papayawhip','peachpuff','peru','pink','plum',
237 'powderblue','purple','rebeccapurple','red','rosybrown','royalblue',
238 'saddlebrown','salmon','sandybrown','seagreen','seashell','sienna',
239 'silver','skyblue','slateblue','slategray','slategrey','snow',
240 'springgreen','steelblue','tan','teal','thistle','transparent',
241 'tomato','turquoise','violet','wheat','white','whitesmoke','yellow',
242 'yellowgreen'
243 ),
244 // pseudo class
245 5 => array(
246 'active','after','before','checked','choices','default','dir',
247 'disabled','empty','enabled','first','first-child','first-letter',
248 'first-line','first-of-type','focus','fullscreen','hover',
249 'indeterminate','in-range','invalid','lang','last-child',
250 'last-of-type','left','link','not','nth-child','nth-last-child',
251 'nth-last-of-type','nth-of-type','only-child','only-of-type',
252 'optional','out-of-range','read-only','read-write','repeat-index',
253 'repeat-item','required','right','root','scope','selection','target',
254 'valid','value','visited'
255 )
256 ),
257 'SYMBOLS' => array(
258 '(', ')', '{', '}', ':', ';',
259 '>', '+', '*', ',', '^', '='
260 ),
261 'CASE_SENSITIVE' => array(
262 GESHI_COMMENTS => false,
263 1 => true,
264 2 => true,
265 3 => true,
266 4 => true,
267 5 => true
268 ),
269 'STYLES' => array(
270 'KEYWORDS' => array(
271 1 => 'color: #000000; font-weight: bold;',
272 2 => 'color: #993333;',
273 3 => 'color: #9932cc;',
274 4 => 'color: #dc143c;',
275 5 => 'color: #F5758F;',
276 ),
277 'COMMENTS' => array(
278 1 => 'color: #a1a100;',
279 2 => 'color: #ff0000; font-style: italic;',
280 'MULTI' => 'color: #808080; font-style: italic;'
281 ),
282 'ESCAPE_CHAR' => array(
283 0 => 'color: #000099; font-weight: bold;',
284 //1 => 'color: #000099; font-weight: bold;',
285 2 => 'color: #000099; font-weight: bold;'
286 //3 => 'color: #000099; font-weight: bold;'
287 ),
288 'BRACKETS' => array(
289 0 => 'color: #00AA00;'
290 ),
291 'STRINGS' => array(
292 0 => 'color: #ff0000;'
293 ),
294 'NUMBERS' => array(
295 0 => 'color: #cc66cc;'
296 ),
297 'METHODS' => array(
298 ),
299 'SYMBOLS' => array(
300 0 => 'color: #00AA00;'
301 ),
302 'SCRIPT' => array(
303 ),
304 'REGEXPS' => array(
305 0 => 'color: #cc00cc;',
306 1 => 'color: #6666ff;',
307 2 => 'color: #3F84D9; font-weight: bold;',
308 3 => 'color: #933;',
309 4 => 'color: #444;'
310 )
311 ),
312 'URLS' => array(
313 1 => '',
314 2 => '',
315 3 => '',
316 4 => '',
317 5 => ''
318 ),
319 'OOLANG' => false,
320 'OBJECT_SPLITTERS' => array(
321 ),
322 'REGEXPS' => array(
323 //DOM Node ID
324 0 => '\#[a-zA-Z0-9\-_]+(?:\\\\:[a-zA-Z0-9\-_]+)*',
325 //CSS classname
326 1 => '\.(?!\d)[a-zA-Z0-9\-_]+(?:\\\\:[a-zA-Z0-9\-_]+)*\b(?=[\{\.#\s,:].|<\|)',
327 //CSS rules
328 2 => '\@(?!\d)[a-zA-Z0-9\-_]+(?:\\\\:[a-zA-Z0-9\-_]+)*\b(?=[\{\.#\s,:].|<\|)',
329 //Measurements
330 3 => '[+\-]?(\d+|(\d*\.\d+))(em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx|%)',
331 //var
332 4 => '(--[a-zA-Z0-9\-]*)'
333 ),
334 'STRICT_MODE_APPLIES' => GESHI_NEVER,
335 'SCRIPT_DELIMITERS' => array(
336 ),
337 'HIGHLIGHT_STRICT_BLOCK' => array(
338 ),
339 'TAB_WIDTH' => 4,
340 'PARSER_CONTROL' => array(
341 'KEYWORDS' => array(
342 'DISALLOWED_AFTER' => '(?![\-a-zA-Z0-9_\|%\\-&\.])',
343 'DISALLOWED_BEFORE' => '(?<![\-a-zA-Z0-9_\|%\\~&\.])',
344 1 => array(
345 'DISALLOWED_AFTER' => '(?![\-a-zA-Z0-9_\|%\\-&\.])(?=\s*:)'
346 )
347 )
348 )
349);
An exception for terminatinating execution or to throw for unit testing.
$language_data
Definition: css.php:56
const GESHI_CAPS_NO_CHANGE
Lowercase keywords found.
Definition: geshi.php:95
const GESHI_COMMENTS
Used in language files to mark comments.
Definition: geshi.php:150
const GESHI_NEVER
#+ @access private
Definition: geshi.php:124