ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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.9.0
8 * Date Started: 2004/06/18
9 *
10 * CSS language file for GeSHi.
11 *
12 * CHANGES
13 * -------
14 * 2014/07/14 (1.0.8.13)
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',
78 'align-items',
79 'align-self',
80 'all',
81 'animation',
82 'animation-delay',
83 'animation-direction',
84 'animation-duration',
85 'animation-fill-mode',
86 'animation-iteration-count',
87 'animation-name',
88 'animation-play-state',
89 'animation-timing-function',
90 'backface-visibility',
91 'background',
92 'background-attachment',
93 'background-blend-mode',
94 'background-clip',
95 'background-color',
96 'background-image',
97 'background-origin',
98 'background-position',
99 'background-repeat',
100 'background-size',
101 'border',
102 'border-bottom',
103 'border-bottom-color',
104 'border-bottom-left-radius',
105 'border-bottom-right-radius',
106 'border-bottom-style',
107 'border-bottom-width',
108 'border-collapse',
109 'border-color',
110 'border-image',
111 'border-image-outset',
112 'border-image-repeat',
113 'border-image-slice',
114 'border-image-source',
115 'border-image-width',
116 'border-left',
117 'border-left-color',
118 'border-left-style',
119 'border-left-width',
120 'border-radius',
121 'border-right',
122 'border-right-color',
123 'border-right-style',
124 'border-right-width',
125 'border-spacing',
126 'border-style',
127 'border-top',
128 'border-top-color',
129 'border-top-left-radius',
130 'border-top-right-radius',
131 'border-top-style',
132 'border-top-width',
133 'border-width',
134 'bottom',
135 'box-decoration-break',
136 'box-shadow',
137 'box-sizing',
138 'break-after',
139 'break-before',
140 'break-inside',
141 'caption-side',
142 'clear',
143 'clip',
144 'clip-path',
145 'color',
146 'columns',
147 'column-count',
148 'column-fill',
149 'column-gap',
150 'column-rule',
151 'column-rule-color',
152 'column-rule-style',
153 'column-rule-width',
154 'column-span',
155 'column-width',
156 'content',
157 'counter-increment',
158 'counter-reset',
159 'cursor',
160 'direction',
161 'display',
162 'empty-cells',
163 'fill',
164 'fill-rule',
165 'fill-opacity',
166 'filter',
167 'flex',
168 'flex-basis',
169 'flex-direction',
170 'flex-flow',
171 'flex-grow',
172 'flex-shrink',
173 'flex-wrap',
174 'float',
175 'font',
176 'font-family',
177 'font-feature-settings',
178 'font-kerning',
179 'font-language-override',
180 'font-size',
181 'font-size-adjust',
182 'font-stretch',
183 'font-style',
184 'font-synthesis',
185 'font-variant',
186 'font-variant-alternates',
187 'font-variant-caps',
188 'font-variant-east-asian',
189 'font-variant-ligatures',
190 'font-variant-numeric',
191 'font-variant-position',
192 'font-weight',
193 'grid',
194 'grid-area',
195 'grid-auto-columns',
196 'grid-auto-flow',
197 'grid-auto-position',
198 'grid-auto-rows',
199 'grid-column',
200 'grid-column-start',
201 'grid-column-end',
202 'grid-row',
203 'grid-row-start',
204 'grid-row-end',
205 'grid-template',
206 'grid-template-areas',
207 'grid-template-rows',
208 'grid-template-columns',
209 'height',
210 'hyphens',
211 'icon',
212 'image-rendering',
213 'image-resolution',
214 'image-orientation',
215 'ime-mode',
216 'justify-content',
217 'left',
218 'letter-spacing',
219 'line-break',
220 'line-height',
221 'list-style',
222 'list-style-image',
223 'list-style-position',
224 'list-style-type',
225 'margin',
226 'margin-bottom',
227 'margin-left',
228 'margin-right',
229 'margin-top',
230 'marks',
231 'mask',
232 'mask-type',
233 'max-height',
234 'max-width',
235 'min-height',
236 'min-width',
237 'mix-blend-mode',
238 'nav-down',
239 'nav-index',
240 'nav-left',
241 'nav-right',
242 'nav-up',
243 'object-fit',
244 'object-position',
245 'opacity',
246 'order',
247 'orphans',
248 'outline',
249 'outline-color',
250 'outline-offset',
251 'outline-style',
252 'outline-width',
253 'overflow',
254 'overflow-wrap',
255 'overflow-x',
256 'overflow-y',
257 'overflow-clip-box',
258 'padding',
259 'padding-bottom',
260 'padding-left',
261 'padding-right',
262 'padding-top',
263 'page-break-after',
264 'page-break-before',
265 'page-break-inside',
266 'perspective',
267 'perspective-origin',
268 'pointer-events',
269 'position',
270 'quotes',
271 'resize',
272 'right',
273 'shape-image-threshold',
274 'shape-margin',
275 'shape-outside',
276 'stroke',
277 'stroke-width',
278 'stroke-linecap',
279 'stroke-linejoin',
280 'stroke-miterlimit',
281 'stroke-dasharray',
282 'stroke-dashoffset',
283 'table-layout',
284 'tab-size',
285 'text-align',
286 'text-align-last',
287 'text-combine-horizontal',
288 'text-decoration',
289 'text-decoration-color',
290 'text-decoration-line',
291 'text-decoration-style',
292 'text-indent',
293 'text-orientation',
294 'text-overflow',
295 'text-rendering',
296 'text-shadow',
297 'text-transform',
298 'text-underline-position',
299 'top',
300 'touch-action',
301 'transform',
302 'transform-origin',
303 'transform-style',
304 'transition',
305 'transition-delay',
306 'transition-duration',
307 'transition-property',
308 'transition-timing-function',
309 'unicode-bidi',
310 'unicode-range',
311 'vertical-align',
312 'visibility',
313 'white-space',
314 'widows',
315 'width',
316 'will-change',
317 'word-break',
318 'word-spacing',
319 'word-wrap',
320 'writing-mode',
321 'z-index'
322 ),
323 // value
324 2 => array(
325 'absolute',
326 'activeborder',
327 'activecaption',
328 'after-white-space',
329 'ahead',
330 'alternate',
331 'always',
332 'appworkspace',
333 'armenian',
334 'auto',
335 'avoid',
336 'background',
337 'backwards',
338 'baseline',
339 'below',
340 'bevel',
341 'bidi-override',
342 'blink',
343 'block',
344 'block clear',
345 'block width',
346 'block-axis',
347 'bold',
348 'bolder',
349 'border',
350 'border-box',
351 'both',
352 'bottom',
353 'break-word',
354 'butt',
355 'button',
356 'button-bevel',
357 'buttonface',
358 'buttonhighlight',
359 'buttonshadow',
360 'buttontext',
361 'capitalize',
362 'caption',
363 'captiontext',
364 'caret',
365 'center',
366 'checkbox',
367 'circle',
368 'cjk-ideographic',
369 'clip',
370 'close-quote',
371 'collapse',
372 'compact',
373 'condensed',
374 'content',
375 'content-box',
376 'continuous',
377 'crop',
378 'cross',
379 'crosshair',
380 'currentColor',
381 'cursive',
382 'dashed',
383 'decimal',
384 'decimal-leading-zero',
385 'default',
386 'disc',
387 'discard',
388 'dot-dash',
389 'dot-dot-dash',
390 'dotted',
391 'double',
392 'down',
393 'e-resize',
394 'element',
395 'ellipsis',
396 'embed',
397 'end',
398 'evenodd',
399 'expanded',
400 'extra-condensed',
401 'extra-expanded',
402 'fantasy',
403 'fast',
404 'fixed',
405 'forwards',
406 'georgian',
407 'graytext',
408 'groove',
409 'hand',
410 'hebrew',
411 'help',
412 'hidden',
413 'hide',
414 'higher',
415 'highlight',
416 'highlighttext',
417 'hiragana',
418 'hiragana-iroha',
419 'horizontal',
420 'icon',
421 'ignore',
422 'inactiveborder',
423 'inactivecaption',
424 'inactivecaptiontext',
425 'infinite',
426 'infobackground',
427 'infotext',
428 'inherit',
429 'initial',
430 'inline',
431 'inline-axis',
432 'inline-block',
433 'inline-table',
434 'inset',
435 'inside',
436 'intrinsic',
437 'invert',
438 'italic',
439 'justify',
440 'katakana',
441 'katakana-iroha',
442 'landscape',
443 'large',
444 'larger',
445 'left',
446 'level',
447 'lighter',
448 'line-through',
449 'list-item',
450 'listbox',
451 'listitem',
452 'logical',
453 'loud',
454 'lower',
455 'lower-alpha',
456 'lower-greek',
457 'lower-latin',
458 'lower-roman',
459 'lowercase',
460 'ltr',
461 'marker',
462 'match',
463 'medium',
464 'menu',
465 'menulist',
466 'menulist-button',
467 'menulist-text',
468 'menulist-textfield',
469 'menutext',
470 'message-box',
471 'middle',
472 'min-intrinsic',
473 'miter',
474 'mix',
475 'monospace',
476 'move',
477 'multiple',
478 'n-resize',
479 'narrower',
480 'ne-resize',
481 'no-close',
482 'no-close-quote',
483 'no-open-quote',
484 'no-repeat',
485 'none',
486 'nonzero',
487 'normal',
488 'nowrap',
489 'nw-resize',
490 'oblique',
491 'once',
492 'open-quote',
493 'outset',
494 'outside',
495 'overline',
496 'padding',
497 'pointer',
498 'portrait',
499 'pre',
500 'pre-line',
501 'pre-wrap',
502 'push-button',
503 'radio',
504 'read-only',
505 'read-write',
506 'read-write-plaintext-only',
507 'relative',
508 'repeat',
509 'repeat-x',
510 'repeat-y',
511 'reverse',
512 'ridge',
513 'right',
514 'round',
515 'rtl',
516 'run-in',
517 's-resize',
518 'sans-serif',
519 'scroll',
520 'scrollbar',
521 'scrollbarbutton-down',
522 'scrollbarbutton-left',
523 'scrollbarbutton-right',
524 'scrollbarbutton-up',
525 'scrollbargripper-horizontal',
526 'scrollbargripper-vertical',
527 'scrollbarthumb-horizontal',
528 'scrollbarthumb-vertical',
529 'scrollbartrack-horizontal',
530 'scrollbartrack-vertical',
531 'se-resize',
532 'searchfield',
533 'searchfield-close',
534 'searchfield-results',
535 'semi-condensed',
536 'semi-expanded',
537 'separate',
538 'serif',
539 'show',
540 'single',
541 'skip-white-space',
542 'slide',
543 'slider-horizontal',
544 'slider-vertical',
545 'sliderthumb-horizontal',
546 'sliderthumb-vertical',
547 'slow',
548 'small',
549 'small-caps',
550 'small-caption',
551 'smaller',
552 'solid',
553 'space',
554 'square',
555 'square-button',
556 'start',
557 'static',
558 'status-bar',
559 'stretch',
560 'sub',
561 'super',
562 'sw-resize',
563 'table',
564 'table-caption',
565 'table-cell',
566 'table-column',
567 'table-column-group',
568 'table-footer-group',
569 'table-header-group',
570 'table-row',
571 'table-row-group',
572 'text',
573 'text-bottom',
574 'text-top',
575 'textfield',
576 'thick',
577 'thin',
578 'threeddarkshadow',
579 'threedface',
580 'threedhighlight',
581 'threedlightshadow',
582 'threedshadow',
583 'top',
584 'ultra-condensed',
585 'ultra-expanded',
586 'underline',
587 'unfurl',
588 'up',
589 'upper-alpha',
590 'upper-latin',
591 'upper-roman',
592 'uppercase',
593 'vertical',
594 'visible',
595 'visual',
596 'w-resize',
597 'wait',
598 'wave',
599 'wider',
600 'window',
601 'windowframe',
602 'windowtext',
603 'x-large',
604 'x-small',
605 'xx-large',
606 'xx-small'
607 ),
608 // function xxx()
609 3 => array(
610 'attr',
611 'calc',
612 'contrast',
613 'cross-fade',
614 'cubic-bezier',
615 'cycle',
616 'device-cmyk',
617 'drop-shadow',
618 'ellipse',
619 'hsl',
620 'hsla',
621 'hwb',
622 'image',
623 'matrix',
624 'matrix3d',
625 'minmax',
626 'grayscale',
627 'perspective',
628 'polygon',
629 'radial-gradient',
630 'translate',
631 'translatex',
632 'translatey',
633 'translatez',
634 'translate3d',
635 'skew',
636 'skewx',
637 'skewy',
638 'saturate',
639 'sepia',
640 'scale',
641 'scalex',
642 'scaley',
643 'scalez',
644 'scale3d',
645 'steps',
646 'rect',
647 'repeating-linear-gradient',
648 'repeating-radial-gradient',
649 'rgb',
650 'rgba',
651 'rotate',
652 'rotatex',
653 'rotatey',
654 'rotatez',
655 'rotate3d',
656 'url',
657 'var'
658 ),
659 // colors
660 4 => array(
661 'aliceblue',
662 'antiquewhite',
663 'aqua',
664 'aquamarine',
665 'azure',
666 'beige',
667 'bisque',
668 'black',
669 'blanchedalmond',
670 'blue',
671 'blueviolet',
672 'brown',
673 'burlywood',
674 'cadetblue',
675 'chartreuse',
676 'chocolate',
677 'coral',
678 'cornflowerblue',
679 'cornsilk',
680 'crimson',
681 'cyan',
682 'darkblue',
683 'darkcyan',
684 'darkgoldenrod',
685 'darkgray',
686 'darkgreen',
687 'darkgrey',
688 'darkkhaki',
689 'darkmagenta',
690 'darkolivegreen',
691 'darkorange',
692 'darkorchid',
693 'darkred',
694 'darksalmon',
695 'darkseagreen',
696 'darkslateblue',
697 'darkslategray',
698 'darkslategrey',
699 'darkturquoise',
700 'darkviolet',
701 'deeppink',
702 'deepskyblue',
703 'dimgray',
704 'dimgrey',
705 'dodgerblue',
706 'firebrick',
707 'floralwhite',
708 'forestgreen',
709 'fuchsia',
710 'gainsboro',
711 'ghostwhite',
712 'gold',
713 'goldenrod',
714 'gray',
715 'green',
716 'greenyellow',
717 'grey',
718 'honeydew',
719 'hotpink',
720 'indianred',
721 'indigo',
722 'ivory',
723 'khaki',
724 'lavender',
725 'lavenderblush',
726 'lawngreen',
727 'lemonchiffon',
728 'lightblue',
729 'lightcoral',
730 'lightcyan',
731 'lightgoldenrodyellow',
732 'lightgray',
733 'lightgreen',
734 'lightgrey',
735 'lightpink',
736 'lightsalmon',
737 'lightseagreen',
738 'lightskyblue',
739 'lightslategray',
740 'lightslategrey',
741 'lightsteelblue',
742 'lightyellow',
743 'lime',
744 'limegreen',
745 'linen',
746 'magenta',
747 'maroon',
748 'mediumaquamarine',
749 'mediumblue',
750 'mediumorchid',
751 'mediumpurple',
752 'mediumseagreen',
753 'mediumslateblue',
754 'mediumspringgreen',
755 'mediumturquoise',
756 'mediumvioletred',
757 'midnightblue',
758 'mintcream',
759 'mistyrose',
760 'moccasin',
761 'navajowhite',
762 'navy',
763 'oldlace',
764 'olive',
765 'olivedrab',
766 'orange',
767 'orangered',
768 'orchid',
769 'palegoldenrod',
770 'palegreen',
771 'paleturquoise',
772 'palevioletred',
773 'papayawhip',
774 'peachpuff',
775 'peru',
776 'pink',
777 'plum',
778 'powderblue',
779 'purple',
780 'rebeccapurple',
781 'red',
782 'rosybrown',
783 'royalblue',
784 'saddlebrown',
785 'salmon',
786 'sandybrown',
787 'seagreen',
788 'seashell',
789 'sienna',
790 'silver',
791 'skyblue',
792 'slateblue',
793 'slategray',
794 'slategrey',
795 'snow',
796 'springgreen',
797 'steelblue',
798 'tan',
799 'teal',
800 'thistle',
801 'transparent',
802 'tomato',
803 'turquoise',
804 'violet',
805 'wheat',
806 'white',
807 'whitesmoke',
808 'yellow',
809 'yellowgreen'
810 ),
811 // pseudo class
812 5 => array(
813 'active',
814 'after',
815 'before',
816 'checked',
817 'choices',
818 'dir',
819 'disabled',
820 'empty',
821 'enabled',
822 'first',
823 'first-child',
824 'first-letter',
825 'first-line',
826 'first-of-type',
827 'focus',
828 'fullscreen',
829 'hover',
830 'indeterminate',
831 'in-range',
832 'invalid',
833 'lang',
834 'last-child',
835 'last-of-type',
836 'link',
837 'not',
838 'nth-child',
839 'nth-last-child',
840 'nth-last-of-type',
841 'nth-of-type',
842 'only-child',
843 'only-of-type',
844 'optional',
845 'out-of-range',
846 'repeat-index',
847 'repeat-item',
848 'required',
849 'root',
850 'scope',
851 'selection',
852 'target',
853 'valid',
854 'value',
855 'visited'
856 )
857 ),
858 'SYMBOLS' => array(
859 '(', ')', '{', '}', ':', ';',
860 '>', '+', '*', ',', '^', '='
861 ),
862 'CASE_SENSITIVE' => array(
863 GESHI_COMMENTS => false,
864 1 => true,
865 2 => true,
866 3 => true,
867 4 => true,
868 5 => true
869 ),
870 'STYLES' => array(
871 'KEYWORDS' => array(
872 1 => 'color: #000000; font-weight: bold;',
873 2 => 'color: #993333;',
874 3 => 'color: #9932cc;',
875 4 => 'color: #dc143c;',
876 5 => 'color: #F5758F;',
877 ),
878 'COMMENTS' => array(
879 2 => 'color: #ff0000; font-style: italic;',
880 'MULTI' => 'color: #808080; font-style: italic;'
881 ),
882 'ESCAPE_CHAR' => array(
883 0 => 'color: #000099; font-weight: bold;',
884 //1 => 'color: #000099; font-weight: bold;',
885 2 => 'color: #000099; font-weight: bold;'
886 //3 => 'color: #000099; font-weight: bold;'
887 ),
888 'BRACKETS' => array(
889 0 => 'color: #00AA00;'
890 ),
891 'STRINGS' => array(
892 0 => 'color: #ff0000;'
893 ),
894 'NUMBERS' => array(
895 0 => 'color: #cc66cc;'
896 ),
897 'METHODS' => array(),
898 'SYMBOLS' => array(
899 0 => 'color: #00AA00;'
900 ),
901 'SCRIPT' => array(),
902 'REGEXPS' => array(
903 0 => 'color: #cc00cc;',
904 1 => 'color: #6666ff;',
905 2 => 'color: #3F84D9; font-weight: bold;',
906 3 => 'color: #933;',
907 4 => 'color: #444;'
908 )
909 ),
910 'URLS' => array(
911 1 => '',
912 2 => '',
913 3 => '',
914 4 => '',
915 5 => ''
916 ),
917 'OOLANG' => false,
918 'OBJECT_SPLITTERS' => array(),
919 'REGEXPS' => array(
920 //DOM Node ID
921 0 => '\#[a-zA-Z0-9\-_]+(?:\\\\:[a-zA-Z0-9\-_]+)*',
922 //CSS classname
923 1 => '\.(?!\d)[a-zA-Z0-9\-_]+(?:\\\\:[a-zA-Z0-9\-_]+)*\b(?=[\{\.#\s,:].|<\|)',
924 //CSS rules
925 2 => '\@(?!\d)[a-zA-Z0-9\-_]+(?:\\\\:[a-zA-Z0-9\-_]+)*\b(?=[\{\.#\s,:].|<\|)',
926 //Measurements
927 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|%)',
928 //var
929 4 => '(--[a-zA-Z0-9\-]*)'
930 ),
931 'STRICT_MODE_APPLIES' => GESHI_NEVER,
932 'SCRIPT_DELIMITERS' => array(),
933 'HIGHLIGHT_STRICT_BLOCK' => array(),
934 'TAB_WIDTH' => 4,
935 'PARSER_CONTROL' => array(
936 'KEYWORDS' => array(
937 'DISALLOWED_AFTER' => '(?![\-a-zA-Z0-9_\|%\\-&\.])',
938 'DISALLOWED_BEFORE' => '(?<![\-a-zA-Z0-9_\|%\\~&\.])',
939 1 => array(
940 'DISALLOWED_AFTER' => '(?![\-a-zA-Z0-9_\|%\\-&\.])(?=\s*:)'
941 )
942 )
943 )
944);
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:94
const GESHI_COMMENTS
Used in language files to mark comments.
Definition: geshi.php:149
const GESHI_NEVER
#+ @access private
Definition: geshi.php:123