1 # Various CSS Data for CSSTidy
3 # This file is part of CSSTidy.
5 # CSSTidy is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # CSSTidy is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with CSSTidy; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 # @license http://opensource.org/licenses/gpl-license.php GNU Public License
21 # @author Florian Schmitz (floele at gmail dot com) 2005
32 # All whitespace allowed in CSS
34 # @global array whitespace
36 whitespace = frozenset([' ',"\n","\t","\r","\x0B"])
38 # All CSS tokens used by csstidy
40 # @global string tokens
42 tokens = '/@}{;:=\'"(,\\!$%&)#+.<>?[]^`|~'
44 # All CSS units (CSS 3 units included)
46 # @see compress_numbers()
49 units = frozenset(['in','cm','mm','pt','pc','px','rem','em','%','ex','gd','vw','vh','vm','deg','grad','rad','ms','s','khz','hz'])
53 # @global array at_rules
55 at_rules = {'page':'is', 'font-face':'is', 'charset':'iv', 'import':'iv', 'namespace':'iv', 'media':'at'}
57 # Properties that need a value with unit
59 # @todo CSS3 properties
60 # @see compress_numbers()
61 # @global array unit_values
63 unit_values = frozenset(['background', 'background-position', 'border', 'border-top', 'border-right', 'border-bottom',
64 'border-left', 'border-width', 'border-top-width', 'border-right-width', 'border-left-width',
65 'border-bottom-width', 'bottom', 'border-spacing', 'font-size','height', 'left', 'margin', 'margin-top',
66 'margin-right', 'margin-bottom', 'margin-left', 'max-height', 'max-width', 'min-height', 'min-width',
67 'outline-width', 'padding', 'padding-top', 'padding-right', 'padding-bottom', 'padding-left','position',
68 'right', 'top', 'text-indent', 'letter-spacing', 'word-spacing', 'width'
72 # Properties that allow <color> as value
74 # @todo CSS3 properties
75 # @see compress_numbers()
76 # @global array color_values
78 color_values = frozenset(['background-color', 'border-color', 'border-top-color', 'border-right-color',
79 'border-bottom-color', 'border-left-color', 'color', 'outline-color'])
82 # Default values for the background properties
84 # @todo Possibly property names will change during CSS3 development
85 # @global array background_prop_default
86 # @see dissolve_short_bg()
89 background_prop_default = {}
90 background_prop_default['background-image'] = 'none'
91 background_prop_default['background-size'] = 'auto'
92 background_prop_default['background-repeat'] = 'repeat'
93 background_prop_default['background-position'] = '0 0'
94 background_prop_default['background-attachment'] = 'scroll'
95 background_prop_default['background-clip'] = 'border'
96 background_prop_default['background-origin'] = 'padding'
97 background_prop_default['background-color'] = 'transparent'
99 # A list of non-W3C color names which get replaced by their hex-codes
101 # @global array replace_colors
105 replace_colors['aliceblue'] = '#F0F8FF'
106 replace_colors['antiquewhite'] = '#FAEBD7'
107 replace_colors['aquamarine'] = '#7FFFD4'
108 replace_colors['azure'] = '#F0FFFF'
109 replace_colors['beige'] = '#F5F5DC'
110 replace_colors['bisque'] = '#FFE4C4'
111 replace_colors['blanchedalmond'] = '#FFEBCD'
112 replace_colors['blueviolet'] = '#8A2BE2'
113 replace_colors['brown'] = '#A52A2A'
114 replace_colors['burlywood'] = '#DEB887'
115 replace_colors['cadetblue'] = '#5F9EA0'
116 replace_colors['chartreuse'] = '#7FFF00'
117 replace_colors['chocolate'] = '#D2691E'
118 replace_colors['coral'] = '#FF7F50'
119 replace_colors['cornflowerblue'] = '#6495ED'
120 replace_colors['cornsilk'] = '#FFF8DC'
121 replace_colors['crimson'] = '#DC143C'
122 replace_colors['cyan'] = '#00FFFF'
123 replace_colors['darkblue'] = '#00008B'
124 replace_colors['darkcyan'] = '#008B8B'
125 replace_colors['darkgoldenrod'] = '#B8860B'
126 replace_colors['darkgray'] = '#A9A9A9'
127 replace_colors['darkgreen'] = '#006400'
128 replace_colors['darkkhaki'] = '#BDB76B'
129 replace_colors['darkmagenta'] = '#8B008B'
130 replace_colors['darkolivegreen'] = '#556B2F'
131 replace_colors['darkorange'] = '#FF8C00'
132 replace_colors['darkorchid'] = '#9932CC'
133 replace_colors['darkred'] = '#8B0000'
134 replace_colors['darksalmon'] = '#E9967A'
135 replace_colors['darkseagreen'] = '#8FBC8F'
136 replace_colors['darkslateblue'] = '#483D8B'
137 replace_colors['darkslategray'] = '#2F4F4F'
138 replace_colors['darkturquoise'] = '#00CED1'
139 replace_colors['darkviolet'] = '#9400D3'
140 replace_colors['deeppink'] = '#FF1493'
141 replace_colors['deepskyblue'] = '#00BFFF'
142 replace_colors['dimgray'] = '#696969'
143 replace_colors['dodgerblue'] = '#1E90FF'
144 replace_colors['feldspar'] = '#D19275'
145 replace_colors['firebrick'] = '#B22222'
146 replace_colors['floralwhite'] = '#FFFAF0'
147 replace_colors['forestgreen'] = '#228B22'
148 replace_colors['gainsboro'] = '#DCDCDC'
149 replace_colors['ghostwhite'] = '#F8F8FF'
150 replace_colors['gold'] = '#FFD700'
151 replace_colors['goldenrod'] = '#DAA520'
152 replace_colors['greenyellow'] = '#ADFF2F'
153 replace_colors['honeydew'] = '#F0FFF0'
154 replace_colors['hotpink'] = '#FF69B4'
155 replace_colors['indianred'] = '#CD5C5C'
156 replace_colors['indigo'] = '#4B0082'
157 replace_colors['ivory'] = '#FFFFF0'
158 replace_colors['khaki'] = '#F0E68C'
159 replace_colors['lavender'] = '#E6E6FA'
160 replace_colors['lavenderblush'] = '#FFF0F5'
161 replace_colors['lawngreen'] = '#7CFC00'
162 replace_colors['lemonchiffon'] = '#FFFACD'
163 replace_colors['lightblue'] = '#ADD8E6'
164 replace_colors['lightcoral'] = '#F08080'
165 replace_colors['lightcyan'] = '#E0FFFF'
166 replace_colors['lightgoldenrodyellow'] = '#FAFAD2'
167 replace_colors['lightgrey'] = '#D3D3D3'
168 replace_colors['lightgreen'] = '#90EE90'
169 replace_colors['lightpink'] = '#FFB6C1'
170 replace_colors['lightsalmon'] = '#FFA07A'
171 replace_colors['lightseagreen'] = '#20B2AA'
172 replace_colors['lightskyblue'] = '#87CEFA'
173 replace_colors['lightslateblue'] = '#8470FF'
174 replace_colors['lightslategray'] = '#778899'
175 replace_colors['lightsteelblue'] = '#B0C4DE'
176 replace_colors['lightyellow'] = '#FFFFE0'
177 replace_colors['limegreen'] = '#32CD32'
178 replace_colors['linen'] = '#FAF0E6'
179 replace_colors['magenta'] = '#FF00FF'
180 replace_colors['mediumaquamarine'] = '#66CDAA'
181 replace_colors['mediumblue'] = '#0000CD'
182 replace_colors['mediumorchid'] = '#BA55D3'
183 replace_colors['mediumpurple'] = '#9370D8'
184 replace_colors['mediumseagreen'] = '#3CB371'
185 replace_colors['mediumslateblue'] = '#7B68EE'
186 replace_colors['mediumspringgreen'] = '#00FA9A'
187 replace_colors['mediumturquoise'] = '#48D1CC'
188 replace_colors['mediumvioletred'] = '#C71585'
189 replace_colors['midnightblue'] = '#191970'
190 replace_colors['mintcream'] = '#F5FFFA'
191 replace_colors['mistyrose'] = '#FFE4E1'
192 replace_colors['moccasin'] = '#FFE4B5'
193 replace_colors['navajowhite'] = '#FFDEAD'
194 replace_colors['oldlace'] = '#FDF5E6'
195 replace_colors['olivedrab'] = '#6B8E23'
196 replace_colors['orangered'] = '#FF4500'
197 replace_colors['orchid'] = '#DA70D6'
198 replace_colors['palegoldenrod'] = '#EEE8AA'
199 replace_colors['palegreen'] = '#98FB98'
200 replace_colors['paleturquoise'] = '#AFEEEE'
201 replace_colors['palevioletred'] = '#D87093'
202 replace_colors['papayawhip'] = '#FFEFD5'
203 replace_colors['peachpuff'] = '#FFDAB9'
204 replace_colors['peru'] = '#CD853F'
205 replace_colors['pink'] = '#FFC0CB'
206 replace_colors['plum'] = '#DDA0DD'
207 replace_colors['powderblue'] = '#B0E0E6'
208 replace_colors['rosybrown'] = '#BC8F8F'
209 replace_colors['royalblue'] = '#4169E1'
210 replace_colors['saddlebrown'] = '#8B4513'
211 replace_colors['salmon'] = '#FA8072'
212 replace_colors['sandybrown'] = '#F4A460'
213 replace_colors['seagreen'] = '#2E8B57'
214 replace_colors['seashell'] = '#FFF5EE'
215 replace_colors['sienna'] = '#A0522D'
216 replace_colors['skyblue'] = '#87CEEB'
217 replace_colors['slateblue'] = '#6A5ACD'
218 replace_colors['slategray'] = '#708090'
219 replace_colors['snow'] = '#FFFAFA'
220 replace_colors['springgreen'] = '#00FF7F'
221 replace_colors['steelblue'] = '#4682B4'
222 replace_colors['tan'] = '#D2B48C'
223 replace_colors['thistle'] = '#D8BFD8'
224 replace_colors['tomato'] = '#FF6347'
225 replace_colors['turquoise'] = '#40E0D0'
226 replace_colors['violet'] = '#EE82EE'
227 replace_colors['violetred'] = '#D02090'
228 replace_colors['wheat'] = '#F5DEB3'
229 replace_colors['whitesmoke'] = '#F5F5F5'
230 replace_colors['yellowgreen'] = '#9ACD32'
232 #A list of optimized colors
234 optimize_colors['black'] = '#000'
235 optimize_colors['fuchsia'] = '#F0F'
236 optimize_colors['white'] = '#FFF'
237 optimize_colors['yellow'] = '#FF0'
238 optimize_colors['cyan'] = '#0FF'
239 optimize_colors['magenta'] = '#F0F'
240 optimize_colors['lightslategray'] = '#789'
242 optimize_colors['#800000'] = 'maroon'
243 optimize_colors['#FFA500'] = 'orange'
244 optimize_colors['#808000'] = 'olive'
245 optimize_colors['#800080'] = 'purple'
246 optimize_colors['#008000'] = 'green'
247 optimize_colors['#000080'] = 'navy'
248 optimize_colors['#008080'] = 'teal'
249 optimize_colors['#C0C0C0'] = 'silver'
250 optimize_colors['#808080'] = 'gray'
251 optimize_colors['#4B0082'] = 'indigo'
252 optimize_colors['#FFD700'] = 'gold'
253 optimize_colors['#A52A2A'] = 'brown'
254 optimize_colors['#00FFFF'] = 'cyan'
255 optimize_colors['#EE82EE'] = 'violet'
256 optimize_colors['#DA70D6'] = 'orchid'
257 optimize_colors['#FFE4C4'] = 'bisque'
258 optimize_colors['#F0E68C'] = 'khaki'
259 optimize_colors['#F5DEB3'] = 'wheat'
260 optimize_colors['#FF7F50'] = 'coral'
261 optimize_colors['#F5F5DC'] = 'beige'
262 optimize_colors['#F0FFFF'] = 'azure'
263 optimize_colors['#A0522D'] = 'sienna'
264 optimize_colors['#CD853F'] = 'peru'
265 optimize_colors['#FFFFF0'] = 'ivory'
266 optimize_colors['#DDA0DD'] = 'plum'
267 optimize_colors['#D2B48C'] = 'tan'
268 optimize_colors['#FFC0CB'] = 'pink'
269 optimize_colors['#FFFAFA'] = 'snow'
270 optimize_colors['#FA8072'] = 'salmon'
271 optimize_colors['#FF6347'] = 'tomato'
272 optimize_colors['#FAF0E6'] = 'linen'
273 optimize_colors['#F00'] = 'red'
276 # A list of all shorthand properties that are devided into four properties and/or have four subvalues
278 # @global array shorthands
279 # @todo Are there new ones in CSS3?
280 # @see dissolve_4value_shorthands()
281 # @see merge_4value_shorthands()
284 shorthands['border-color'] = ['border-top-color','border-right-color','border-bottom-color','border-left-color']
285 shorthands['border-style'] = ['border-top-style','border-right-style','border-bottom-style','border-left-style']
286 shorthands['border-width'] = ['border-top-width','border-right-width','border-bottom-width','border-left-width']
287 shorthands['margin'] = ['margin-top','margin-right','margin-bottom','margin-left']
288 shorthands['padding'] = ['padding-top','padding-right','padding-bottom','padding-left']
289 shorthands['-moz-border-radius'] = 0
291 # All CSS Properties. Needed for csstidy::property_is_next()
293 # @global array all_properties
294 # @todo Add CSS3 properties
296 # @see csstidy::property_is_next()
298 all_properties['background'] = 'CSS1.0,CSS2.0,CSS2.1'
299 all_properties['background-color'] = 'CSS1.0,CSS2.0,CSS2.1'
300 all_properties['background-image'] = 'CSS1.0,CSS2.0,CSS2.1'
301 all_properties['background-repeat'] = 'CSS1.0,CSS2.0,CSS2.1'
302 all_properties['background-attachment'] = 'CSS1.0,CSS2.0,CSS2.1'
303 all_properties['background-position'] = 'CSS1.0,CSS2.0,CSS2.1'
304 all_properties['border'] = 'CSS1.0,CSS2.0,CSS2.1'
305 all_properties['border-top'] = 'CSS1.0,CSS2.0,CSS2.1'
306 all_properties['border-right'] = 'CSS1.0,CSS2.0,CSS2.1'
307 all_properties['border-bottom'] = 'CSS1.0,CSS2.0,CSS2.1'
308 all_properties['border-left'] = 'CSS1.0,CSS2.0,CSS2.1'
309 all_properties['border-color'] = 'CSS1.0,CSS2.0,CSS2.1'
310 all_properties['border-top-color'] = 'CSS2.0,CSS2.1'
311 all_properties['border-bottom-color'] = 'CSS2.0,CSS2.1'
312 all_properties['border-left-color'] = 'CSS2.0,CSS2.1'
313 all_properties['border-right-color'] = 'CSS2.0,CSS2.1'
314 all_properties['border-style'] = 'CSS1.0,CSS2.0,CSS2.1'
315 all_properties['border-top-style'] = 'CSS2.0,CSS2.1'
316 all_properties['border-right-style'] = 'CSS2.0,CSS2.1'
317 all_properties['border-left-style'] = 'CSS2.0,CSS2.1'
318 all_properties['border-bottom-style'] = 'CSS2.0,CSS2.1'
319 all_properties['border-width'] = 'CSS1.0,CSS2.0,CSS2.1'
320 all_properties['border-top-width'] = 'CSS1.0,CSS2.0,CSS2.1'
321 all_properties['border-right-width'] = 'CSS1.0,CSS2.0,CSS2.1'
322 all_properties['border-left-width'] = 'CSS1.0,CSS2.0,CSS2.1'
323 all_properties['border-bottom-width'] = 'CSS1.0,CSS2.0,CSS2.1'
324 all_properties['border-collapse'] = 'CSS2.0,CSS2.1'
325 all_properties['border-spacing'] = 'CSS2.0,CSS2.1'
326 all_properties['bottom'] = 'CSS2.0,CSS2.1'
327 all_properties['caption-side'] = 'CSS2.0,CSS2.1'
328 all_properties['content'] = 'CSS2.0,CSS2.1'
329 all_properties['clear'] = 'CSS1.0,CSS2.0,CSS2.1'
330 all_properties['clip'] = 'CSS1.0,CSS2.0,CSS2.1'
331 all_properties['color'] = 'CSS1.0,CSS2.0,CSS2.1'
332 all_properties['counter-reset'] = 'CSS2.0,CSS2.1'
333 all_properties['counter-increment'] = 'CSS2.0,CSS2.1'
334 all_properties['cursor'] = 'CSS2.0,CSS2.1'
335 all_properties['empty-cells'] = 'CSS2.0,CSS2.1'
336 all_properties['display'] = 'CSS1.0,CSS2.0,CSS2.1'
337 all_properties['direction'] = 'CSS2.0,CSS2.1'
338 all_properties['float'] = 'CSS1.0,CSS2.0,CSS2.1'
339 all_properties['font'] = 'CSS1.0,CSS2.0,CSS2.1'
340 all_properties['font-family'] = 'CSS1.0,CSS2.0,CSS2.1'
341 all_properties['font-style'] = 'CSS1.0,CSS2.0,CSS2.1'
342 all_properties['font-variant'] = 'CSS1.0,CSS2.0,CSS2.1'
343 all_properties['font-weight'] = 'CSS1.0,CSS2.0,CSS2.1'
344 all_properties['font-stretch'] = 'CSS2.0'
345 all_properties['font-size-adjust'] = 'CSS2.0'
346 all_properties['font-size'] = 'CSS1.0,CSS2.0,CSS2.1'
347 all_properties['height'] = 'CSS1.0,CSS2.0,CSS2.1'
348 all_properties['left'] = 'CSS1.0,CSS2.0,CSS2.1'
349 all_properties['line-height'] = 'CSS1.0,CSS2.0,CSS2.1'
350 all_properties['list-style'] = 'CSS1.0,CSS2.0,CSS2.1'
351 all_properties['list-style-type'] = 'CSS1.0,CSS2.0,CSS2.1'
352 all_properties['list-style-image'] = 'CSS1.0,CSS2.0,CSS2.1'
353 all_properties['list-style-position'] = 'CSS1.0,CSS2.0,CSS2.1'
354 all_properties['margin'] = 'CSS1.0,CSS2.0,CSS2.1'
355 all_properties['margin-top'] = 'CSS1.0,CSS2.0,CSS2.1'
356 all_properties['margin-right'] = 'CSS1.0,CSS2.0,CSS2.1'
357 all_properties['margin-bottom'] = 'CSS1.0,CSS2.0,CSS2.1'
358 all_properties['margin-left'] = 'CSS1.0,CSS2.0,CSS2.1'
359 all_properties['marks'] = 'CSS1.0,CSS2.0'
360 all_properties['marker-offset'] = 'CSS2.0'
361 all_properties['max-height'] = 'CSS2.0,CSS2.1'
362 all_properties['max-width'] = 'CSS2.0,CSS2.1'
363 all_properties['min-height'] = 'CSS2.0,CSS2.1'
364 all_properties['min-width'] = 'CSS2.0,CSS2.1'
365 all_properties['overflow'] = 'CSS1.0,CSS2.0,CSS2.1'
366 all_properties['orphans'] = 'CSS2.0,CSS2.1'
367 all_properties['outline'] = 'CSS2.0,CSS2.1'
368 all_properties['outline-width'] = 'CSS2.0,CSS2.1'
369 all_properties['outline-style'] = 'CSS2.0,CSS2.1'
370 all_properties['outline-color'] = 'CSS2.0,CSS2.1'
371 all_properties['padding'] = 'CSS1.0,CSS2.0,CSS2.1'
372 all_properties['padding-top'] = 'CSS1.0,CSS2.0,CSS2.1'
373 all_properties['padding-right'] = 'CSS1.0,CSS2.0,CSS2.1'
374 all_properties['padding-bottom'] = 'CSS1.0,CSS2.0,CSS2.1'
375 all_properties['padding-left'] = 'CSS1.0,CSS2.0,CSS2.1'
376 all_properties['page-break-before'] = 'CSS1.0,CSS2.0,CSS2.1'
377 all_properties['page-break-after'] = 'CSS1.0,CSS2.0,CSS2.1'
378 all_properties['page-break-inside'] = 'CSS2.0,CSS2.1'
379 all_properties['page'] = 'CSS2.0'
380 all_properties['position'] = 'CSS1.0,CSS2.0,CSS2.1'
381 all_properties['quotes'] = 'CSS2.0,CSS2.1'
382 all_properties['right'] = 'CSS2.0,CSS2.1'
383 all_properties['size'] = 'CSS1.0,CSS2.0'
384 all_properties['speak-header'] = 'CSS2.0,CSS2.1'
385 all_properties['table-layout'] = 'CSS2.0,CSS2.1'
386 all_properties['top'] = 'CSS1.0,CSS2.0,CSS2.1'
387 all_properties['text-indent'] = 'CSS1.0,CSS2.0,CSS2.1'
388 all_properties['text-align'] = 'CSS1.0,CSS2.0,CSS2.1'
389 all_properties['text-decoration'] = 'CSS1.0,CSS2.0,CSS2.1'
390 all_properties['text-shadow'] = 'CSS2.0'
391 all_properties['letter-spacing'] = 'CSS1.0,CSS2.0,CSS2.1'
392 all_properties['word-spacing'] = 'CSS1.0,CSS2.0,CSS2.1'
393 all_properties['text-transform'] = 'CSS1.0,CSS2.0,CSS2.1'
394 all_properties['white-space'] = 'CSS1.0,CSS2.0,CSS2.1'
395 all_properties['unicode-bidi'] = 'CSS2.0,CSS2.1'
396 all_properties['vertical-align'] = 'CSS1.0,CSS2.0,CSS2.1'
397 all_properties['visibility'] = 'CSS1.0,CSS2.0,CSS2.1'
398 all_properties['width'] = 'CSS1.0,CSS2.0,CSS2.1'
399 all_properties['widows'] = 'CSS2.0,CSS2.1'
400 all_properties['z-index'] = 'CSS1.0,CSS2.0,CSS2.1'
403 all_properties['volume'] = 'CSS2.0,CSS2.1'
404 all_properties['speak'] = 'CSS2.0,CSS2.1'
405 all_properties['pause'] = 'CSS2.0,CSS2.1'
406 all_properties['pause-before'] = 'CSS2.0,CSS2.1'
407 all_properties['pause-after'] = 'CSS2.0,CSS2.1'
408 all_properties['cue'] = 'CSS2.0,CSS2.1'
409 all_properties['cue-before'] = 'CSS2.0,CSS2.1'
410 all_properties['cue-after'] = 'CSS2.0,CSS2.1'
411 all_properties['play-during'] = 'CSS2.0,CSS2.1'
412 all_properties['azimuth'] = 'CSS2.0,CSS2.1'
413 all_properties['elevation'] = 'CSS2.0,CSS2.1'
414 all_properties['speech-rate'] = 'CSS2.0,CSS2.1'
415 all_properties['voice-family'] = 'CSS2.0,CSS2.1'
416 all_properties['pitch'] = 'CSS2.0,CSS2.1'
417 all_properties['pitch-range'] = 'CSS2.0,CSS2.1'
418 all_properties['stress'] = 'CSS2.0,CSS2.1'
419 all_properties['richness'] = 'CSS2.0,CSS2.1'
420 all_properties['speak-punctuation'] = 'CSS2.0,CSS2.1'
421 all_properties['speak-numeral'] = 'CSS2.0,CSS2.1'