home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2010 November / maximum-cd-2010-11.iso / DiscContents / calibre-0.7.13.msi / file_1593 (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2010-08-06  |  21.1 KB  |  434 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. __all__ = [
  5.     'Profiles']
  6. __docformat__ = 'restructuredtext'
  7. __version__ = '$Id: cssproperties.py 1116 2008-03-05 13:52:23Z cthedot $'
  8. import re
  9.  
  10. class NoSuchProfileException(Exception):
  11.     pass
  12.  
  13.  
  14. class Profiles(object):
  15.     CSS_LEVEL_2 = 'CSS Level 2.1'
  16.     CSS3_BOX = CSS_BOX_LEVEL_3 = 'CSS Box Module Level 3'
  17.     CSS3_COLOR = CSS_COLOR_LEVEL_3 = 'CSS Color Module Level 3'
  18.     CSS3_FONTS = 'CSS Fonts Module Level 3'
  19.     CSS3_FONT_FACE = 'CSS Fonts Module Level 3 @font-face properties'
  20.     CSS3_PAGED_MEDIA = 'CSS3 Paged Media Module'
  21.     _TOKEN_MACROS = {
  22.         'ident': '[-]?{nmstart}{nmchar}*',
  23.         'name': '{nmchar}+',
  24.         'nmstart': '[_a-z]|{nonascii}|{escape}',
  25.         'nonascii': '[^\\0-\\177]',
  26.         'unicode': '\\\\[0-9a-f]{1,6}(\\r\\n|[ \\n\\r\\t\\f])?',
  27.         'escape': '{unicode}|\\\\[ -~\\200-\\777]',
  28.         'int': '[-]?\\d+',
  29.         'nmchar': '[\\w-]|{nonascii}|{escape}',
  30.         'num': '[-]?\\d+|[-]?\\d*\\.\\d+',
  31.         'positivenum': '\\d+|\\d*\\.\\d+',
  32.         'number': '{num}',
  33.         'string': '{string1}|{string2}',
  34.         'string1': '"(\\\\\\"|[^\\"])*"',
  35.         'uri': 'url\\({w}({string}|(\\\\\\)|[^\\)])+){w}\\)',
  36.         'string2': "'(\\\\\\'|[^\\'])*'",
  37.         'nl': '\\n|\\r\\n|\\r|\\f',
  38.         'w': '\\s*' }
  39.     _MACROS = {
  40.         'hexcolor': '#[0-9a-f]{3}|#[0-9a-f]{6}',
  41.         'rgbcolor': 'rgb\\({w}{int}{w},{w}{int}{w},{w}{int}{w}\\)|rgb\\({w}{num}%{w},{w}{num}%{w},{w}{num}%{w}\\)',
  42.         'namedcolor': '(transparent|orange|maroon|red|orange|yellow|olive|purple|fuchsia|white|lime|green|navy|blue|aqua|teal|black|silver|gray)',
  43.         'uicolor': '(ActiveBorder|ActiveCaption|AppWorkspace|Background|ButtonFace|ButtonHighlight|ButtonShadow|ButtonText|CaptionText|GrayText|Highlight|HighlightText|InactiveBorder|InactiveCaption|InactiveCaptionText|InfoBackground|InfoText|Menu|MenuText|Scrollbar|ThreeDDarkShadow|ThreeDFace|ThreeDHighlight|ThreeDLightShadow|ThreeDShadow|Window|WindowFrame|WindowText)',
  44.         'color': '{namedcolor}|{hexcolor}|{rgbcolor}|{uicolor}',
  45.         'integer': '{int}',
  46.         'length': '0|{num}(em|ex|px|in|cm|mm|pt|pc)',
  47.         'positivelength': '0|{positivenum}(em|ex|px|in|cm|mm|pt|pc)',
  48.         'angle': '0|{num}(deg|grad|rad)',
  49.         'time': '0|{num}m?s',
  50.         'frequency': '0|{num}k?Hz',
  51.         'percentage': '{num}%' }
  52.     
  53.     def __init__(self, log = None):
  54.         self._log = log
  55.         self._profileNames = []
  56.         self._profiles = { }
  57.         self._defaultProfiles = None
  58.         self.addProfile(self.CSS_LEVEL_2, properties[self.CSS_LEVEL_2], macros[self.CSS_LEVEL_2])
  59.         self.addProfile(self.CSS3_BOX, properties[self.CSS3_BOX], macros[self.CSS3_BOX])
  60.         self.addProfile(self.CSS3_COLOR, properties[self.CSS3_COLOR], macros[self.CSS3_COLOR])
  61.         self.addProfile(self.CSS3_FONTS, properties[self.CSS3_FONTS], macros[self.CSS3_FONTS])
  62.         self.addProfile(self.CSS3_FONT_FACE, properties[self.CSS3_FONT_FACE], macros[self.CSS3_FONTS])
  63.         self.addProfile(self.CSS3_PAGED_MEDIA, properties[self.CSS3_PAGED_MEDIA], macros[self.CSS3_PAGED_MEDIA])
  64.         self._Profiles__update_knownNames()
  65.  
  66.     
  67.     def _expand_macros(self, dictionary, macros):
  68.         
  69.         def macro_value(m):
  70.             return '(?:%s)' % macros[m.groupdict()['macro']]
  71.  
  72.         for key, value in dictionary.items():
  73.             dictionary[key] = value
  74.         
  75.         return dictionary
  76.  
  77.     
  78.     def _compile_regexes(self, dictionary):
  79.         for key, value in dictionary.items():
  80.             if not hasattr(value, '__call__'):
  81.                 value = re.compile('^(?:%s)$' % value, re.I).match
  82.             
  83.             dictionary[key] = value
  84.         
  85.         return dictionary
  86.  
  87.     
  88.     def __update_knownNames(self):
  89.         self._knownNames = []
  90.         for properties in self._profiles.values():
  91.             self._knownNames.extend(properties.keys())
  92.         
  93.  
  94.     
  95.     def _getDefaultProfiles(self):
  96.         if not self._defaultProfiles:
  97.             return self.profiles
  98.         return self._defaultProfiles
  99.  
  100.     
  101.     def _setDefaultProfiles(self, profiles):
  102.         if isinstance(profiles, basestring):
  103.             self._defaultProfiles = (profiles,)
  104.         else:
  105.             self._defaultProfiles = profiles
  106.  
  107.     defaultProfiles = property(_getDefaultProfiles, _setDefaultProfiles, doc = u'Names of profiles to use for validation.To use e.g. the CSS2 profile set ``cssutils.profile.defaultProfiles = cssutils.profile.CSS_LEVEL_2``')
  108.     profiles = property((lambda self: self._profileNames), doc = u'Names of all profiles in order as defined.')
  109.     knownNames = property((lambda self: self._knownNames), doc = 'All known property names of all profiles.')
  110.     
  111.     def addProfile(self, profile, properties, macros = None):
  112.         if not macros:
  113.             macros = { }
  114.         
  115.         m = Profiles._TOKEN_MACROS.copy()
  116.         m.update(Profiles._MACROS)
  117.         m.update(macros)
  118.         properties = self._expand_macros(properties, m)
  119.         self._profileNames.append(profile)
  120.         self._profiles[profile] = self._compile_regexes(properties)
  121.         self._Profiles__update_knownNames()
  122.  
  123.     
  124.     def removeProfile(self, profile = None, all = False):
  125.         if all:
  126.             self._profiles.clear()
  127.             del self._profileNames[:]
  128.         else:
  129.             
  130.             try:
  131.                 del self._profiles[profile]
  132.                 del self._profileNames[self._profileNames.index(profile)]
  133.             except KeyError:
  134.                 raise NoSuchProfileException(u'No profile %r.' % profile)
  135.  
  136.         self._Profiles__update_knownNames()
  137.  
  138.     
  139.     def propertiesByProfile(self, profiles = None):
  140.         if not profiles:
  141.             profiles = self.profiles
  142.         elif isinstance(profiles, basestring):
  143.             profiles = (profiles,)
  144.         
  145.         
  146.         try:
  147.             for profile in sorted(profiles):
  148.                 for name in sorted(self._profiles[profile].keys()):
  149.                     yield name
  150.                 
  151.         except KeyError:
  152.             e = None
  153.             raise NoSuchProfileException(e)
  154.  
  155.  
  156.     
  157.     def validate(self, name, value):
  158.         for profile in self.profiles:
  159.             if name in self._profiles[profile]:
  160.                 
  161.                 try:
  162.                     r = bool(self._profiles[profile][name](value))
  163.                 except Exception:
  164.                     e = None
  165.                     self._log.error(e, error = Exception)
  166.                     return False
  167.  
  168.                 if r:
  169.                     return r
  170.                 continue
  171.             r
  172.         
  173.         return False
  174.  
  175.     
  176.     def validateWithProfile(self, name, value, profiles = None):
  177.         if name not in self.knownNames:
  178.             return (False, False, [])
  179.         if not profiles:
  180.             profiles = self.defaultProfiles
  181.         elif isinstance(profiles, basestring):
  182.             profiles = (profiles,)
  183.         
  184.         for profilename in profiles:
  185.             if name in self._profiles[profilename]:
  186.                 validate = self._profiles[profilename][name]
  187.                 
  188.                 try:
  189.                     if validate(value):
  190.                         return (True, True, [
  191.                             profilename])
  192.                 except Exception:
  193.                     e = None
  194.                     self._log.error(e, error = Exception)
  195.                 except:
  196.                     None<EXCEPTION MATCH>Exception
  197.                 
  198.  
  199.             None<EXCEPTION MATCH>Exception
  200.         
  201.         for profilename in (lambda .0: for p in .0:
  202. if p not in profiles:
  203. pcontinue)(self._profileNames):
  204.             if name in self._profiles[profilename]:
  205.                 validate = self._profiles[profilename][name]
  206.                 
  207.                 try:
  208.                     if validate(value):
  209.                         return (True, False, [
  210.                             profilename])
  211.                 except Exception:
  212.                     (None,)
  213.                     e = (None,)
  214.                     self._log.error(e, error = Exception)
  215.                 except:
  216.                     (None,)<EXCEPTION MATCH>Exception
  217.                 
  218.  
  219.             (None,)<EXCEPTION MATCH>Exception
  220.         
  221.         names = []
  222.         for profilename, properties in self._profiles.items():
  223.             if name in properties.keys():
  224.                 names.append(profilename)
  225.                 continue
  226.             (None,)
  227.         
  228.         names.sort()
  229.         return (False, False, names)
  230.  
  231.  
  232. properties = { }
  233. macros = { }
  234. macros[Profiles.CSS_LEVEL_2] = {
  235.     'border-style': 'none|hidden|dotted|dashed|solid|double|groove|ridge|inset|outset',
  236.     'border-color': '{color}',
  237.     'border-width': '{length}|thin|medium|thick',
  238.     'background-color': '{color}|transparent|inherit',
  239.     'background-image': '{uri}|none|inherit',
  240.     'background-position': '({percentage}|{length}|left|center|right)(\\s*({percentage}|{length}|top|center|bottom))?|((top|center|bottom)\\s*(left|center|right)?)|((left|center|right)\\s*(top|center|bottom)?)|inherit',
  241.     'background-repeat': 'repeat|repeat-x|repeat-y|no-repeat|inherit',
  242.     'background-attachment': 'scroll|fixed|inherit',
  243.     'shape': 'rect\\(({w}({length}|auto}){w},){3}{w}({length}|auto){w}\\)',
  244.     'counter': 'counter\\({w}{identifier}{w}(?:,{w}{list-style-type}{w})?\\)',
  245.     'identifier': '{ident}',
  246.     'family-name': '{string}|{identifier}({w}{identifier})*',
  247.     'generic-family': 'serif|sans-serif|cursive|fantasy|monospace',
  248.     'absolute-size': '(x?x-)?(small|large)|medium',
  249.     'relative-size': 'smaller|larger',
  250.     'font-family': '(({family-name}|{generic-family}){w},{w})*({family-name}|{generic-family})|inherit',
  251.     'font-size': '{absolute-size}|{relative-size}|{positivelength}|{percentage}|inherit',
  252.     'font-style': 'normal|italic|oblique|inherit',
  253.     'font-variant': 'normal|small-caps|inherit',
  254.     'font-weight': 'normal|bold|bolder|lighter|[1-9]00|inherit',
  255.     'line-height': 'normal|{number}|{length}|{percentage}|inherit',
  256.     'list-style-image': '{uri}|none|inherit',
  257.     'list-style-position': 'inside|outside|inherit',
  258.     'list-style-type': 'disc|circle|square|decimal|decimal-leading-zero|lower-roman|upper-roman|lower-greek|lower-(latin|alpha)|upper-(latin|alpha)|armenian|georgian|none|inherit',
  259.     'margin-width': '{length}|{percentage}|auto',
  260.     'outline-color': '{color}|invert|inherit',
  261.     'outline-style': '{border-style}|inherit',
  262.     'outline-width': '{border-width}|inherit',
  263.     'padding-width': '{length}|{percentage}',
  264.     'specific-voice': '{identifier}',
  265.     'generic-voice': 'male|female|child',
  266.     'content': '{string}|{uri}|{counter}|attr\\({w}{identifier}{w}\\)|open-quote|close-quote|no-open-quote|no-close-quote',
  267.     'border-attrs': '{border-width}|{border-style}|{border-color}',
  268.     'background-attrs': '{background-color}|{background-image}|{background-repeat}|{background-attachment}|{background-position}',
  269.     'list-attrs': '{list-style-type}|{list-style-position}|{list-style-image}',
  270.     'font-attrs': '{font-style}|{font-variant}|{font-weight}',
  271.     'outline-attrs': '{outline-color}|{outline-style}|{outline-width}',
  272.     'text-attrs': 'underline|overline|line-through|blink',
  273.     'overflow': 'visible|hidden|scroll|auto|inherit' }
  274. properties[Profiles.CSS_LEVEL_2] = {
  275.     'azimuth': '{angle}|(behind\\s+)?(left-side|far-left|left|center-left|center|center-right|right|far-right|right-side)(\\s+behind)?|behind|leftwards|rightwards|inherit',
  276.     'background-attachment': '{background-attachment}',
  277.     'background-color': '{background-color}',
  278.     'background-image': '{background-image}',
  279.     'background-position': '{background-position}',
  280.     'background-repeat': '{background-repeat}',
  281.     'background': '{background-attrs}(\\s+{background-attrs})*|inherit',
  282.     'border-collapse': 'collapse|separate|inherit',
  283.     'border-color': '({border-color}|transparent)(\\s+({border-color}|transparent)){0,3}|inherit',
  284.     'border-spacing': '{length}(\\s+{length})?|inherit',
  285.     'border-style': '{border-style}(\\s+{border-style}){0,3}|inherit',
  286.     'border-top': '{border-attrs}(\\s+{border-attrs})*|inherit',
  287.     'border-right': '{border-attrs}(\\s+{border-attrs})*|inherit',
  288.     'border-bottom': '{border-attrs}(\\s+{border-attrs})*|inherit',
  289.     'border-left': '{border-attrs}(\\s+{border-attrs})*|inherit',
  290.     'border-top-color': '{border-color}|transparent|inherit',
  291.     'border-right-color': '{border-color}|transparent|inherit',
  292.     'border-bottom-color': '{border-color}|transparent|inherit',
  293.     'border-left-color': '{border-color}|transparent|inherit',
  294.     'border-top-style': '{border-style}|inherit',
  295.     'border-right-style': '{border-style}|inherit',
  296.     'border-bottom-style': '{border-style}|inherit',
  297.     'border-left-style': '{border-style}|inherit',
  298.     'border-top-width': '{border-width}|inherit',
  299.     'border-right-width': '{border-width}|inherit',
  300.     'border-bottom-width': '{border-width}|inherit',
  301.     'border-left-width': '{border-width}|inherit',
  302.     'border-width': '{border-width}(\\s+{border-width}){0,3}|inherit',
  303.     'border': '{border-attrs}(\\s+{border-attrs})*|inherit',
  304.     'bottom': '{length}|{percentage}|auto|inherit',
  305.     'caption-side': 'top|bottom|inherit',
  306.     'clear': 'none|left|right|both|inherit',
  307.     'clip': '{shape}|auto|inherit',
  308.     'color': '{color}|inherit',
  309.     'content': 'none|normal|{content}(\\s+{content})*|inherit',
  310.     'counter-increment': '({identifier}(\\s+{integer})?)(\\s+({identifier}(\\s+{integer})))*|none|inherit',
  311.     'counter-reset': '({identifier}(\\s+{integer})?)(\\s+({identifier}(\\s+{integer})))*|none|inherit',
  312.     'cue-after': '{uri}|none|inherit',
  313.     'cue-before': '{uri}|none|inherit',
  314.     'cue': '({uri}|none|inherit){1,2}|inherit',
  315.     'cursor': '((({uri}{w},{w})*)?(auto|crosshair|default|pointer|move|(e|ne|nw|n|se|sw|s|w)-resize|text|wait|help|progress))|inherit',
  316.     'direction': 'ltr|rtl|inherit',
  317.     'display': 'inline|block|list-item|run-in|inline-block|table|inline-table|table-row-group|table-header-group|table-footer-group|table-row|table-column-group|table-column|table-cell|table-caption|none|inherit',
  318.     'elevation': '{angle}|below|level|above|higher|lower|inherit',
  319.     'empty-cells': 'show|hide|inherit',
  320.     'float': 'left|right|none|inherit',
  321.     'font-family': '{font-family}',
  322.     'font-size': '{font-size}',
  323.     'font-style': '{font-style}',
  324.     'font-variant': '{font-variant}',
  325.     'font-weight': '{font-weight}',
  326.     'font': '({font-attrs}\\s+)*{font-size}({w}/{w}{line-height})?\\s+{font-family}|caption|icon|menu|message-box|small-caption|status-bar|inherit',
  327.     'height': '{length}|{percentage}|auto|inherit',
  328.     'left': '{length}|{percentage}|auto|inherit',
  329.     'letter-spacing': 'normal|{length}|inherit',
  330.     'line-height': '{line-height}',
  331.     'list-style-image': '{list-style-image}',
  332.     'list-style-position': '{list-style-position}',
  333.     'list-style-type': '{list-style-type}',
  334.     'list-style': '{list-attrs}(\\s+{list-attrs})*|inherit',
  335.     'margin-right': '{margin-width}|inherit',
  336.     'margin-left': '{margin-width}|inherit',
  337.     'margin-top': '{margin-width}|inherit',
  338.     'margin-bottom': '{margin-width}|inherit',
  339.     'margin': '{margin-width}(\\s+{margin-width}){0,3}|inherit',
  340.     'max-height': '{length}|{percentage}|none|inherit',
  341.     'max-width': '{length}|{percentage}|none|inherit',
  342.     'min-height': '{length}|{percentage}|none|inherit',
  343.     'min-width': '{length}|{percentage}|none|inherit',
  344.     'orphans': '{integer}|inherit',
  345.     'outline-color': '{outline-color}',
  346.     'outline-style': '{outline-style}',
  347.     'outline-width': '{outline-width}',
  348.     'outline': '{outline-attrs}(\\s+{outline-attrs})*|inherit',
  349.     'overflow': '{overflow}',
  350.     'padding-top': '{padding-width}|inherit',
  351.     'padding-right': '{padding-width}|inherit',
  352.     'padding-bottom': '{padding-width}|inherit',
  353.     'padding-left': '{padding-width}|inherit',
  354.     'padding': '{padding-width}(\\s+{padding-width}){0,3}|inherit',
  355.     'page-break-after': 'auto|always|avoid|left|right|inherit',
  356.     'page-break-before': 'auto|always|avoid|left|right|inherit',
  357.     'page-break-inside': 'avoid|auto|inherit',
  358.     'pause-after': '{time}|{percentage}|inherit',
  359.     'pause-before': '{time}|{percentage}|inherit',
  360.     'pause': '({time}|{percentage}){1,2}|inherit',
  361.     'pitch-range': '{number}|inherit',
  362.     'pitch': '{frequency}|x-low|low|medium|high|x-high|inherit',
  363.     'play-during': '{uri}(\\s+(mix|repeat))*|auto|none|inherit',
  364.     'position': 'static|relative|absolute|fixed|inherit',
  365.     'quotes': '({string}\\s+{string})(\\s+{string}\\s+{string})*|none|inherit',
  366.     'richness': '{number}|inherit',
  367.     'right': '{length}|{percentage}|auto|inherit',
  368.     'speak-header': 'once|always|inherit',
  369.     'speak-numeral': 'digits|continuous|inherit',
  370.     'speak-punctuation': 'code|none|inherit',
  371.     'speak': 'normal|none|spell-out|inherit',
  372.     'speech-rate': '{number}|x-slow|slow|medium|fast|x-fast|faster|slower|inherit',
  373.     'stress': '{number}|inherit',
  374.     'table-layout': 'auto|fixed|inherit',
  375.     'text-align': 'left|right|center|justify|inherit',
  376.     'text-decoration': 'none|{text-attrs}(\\s+{text-attrs})*|inherit',
  377.     'text-indent': '{length}|{percentage}|inherit',
  378.     'text-transform': 'capitalize|uppercase|lowercase|none|inherit',
  379.     'top': '{length}|{percentage}|auto|inherit',
  380.     'unicode-bidi': 'normal|embed|bidi-override|inherit',
  381.     'vertical-align': 'baseline|sub|super|top|text-top|middle|bottom|text-bottom|{percentage}|{length}|inherit',
  382.     'visibility': 'visible|hidden|collapse|inherit',
  383.     'voice-family': '({specific-voice}|{generic-voice}{w},{w})*({specific-voice}|{generic-voice})|inherit',
  384.     'volume': '{number}|{percentage}|silent|x-soft|soft|medium|loud|x-loud|inherit',
  385.     'white-space': 'normal|pre|nowrap|pre-wrap|pre-line|inherit',
  386.     'widows': '{integer}|inherit',
  387.     'width': '{length}|{percentage}|auto|inherit',
  388.     'word-spacing': 'normal|{length}|inherit',
  389.     'z-index': 'auto|{integer}|inherit' }
  390. macros[Profiles.CSS3_BOX] = {
  391.     'overflow': macros[Profiles.CSS_LEVEL_2]['overflow'] }
  392. properties[Profiles.CSS3_BOX] = {
  393.     'overflow': '{overflow}{w}{overflow}?|inherit',
  394.     'overflow-x': '{overflow}|inherit',
  395.     'overflow-y': '{overflow}|inherit' }
  396. macros[Profiles.CSS3_COLOR] = {
  397.     'namedcolor': '(currentcolor|transparent|aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow)',
  398.     'rgbacolor': 'rgba\\({w}{int}{w},{w}{int}{w},{w}{int}{w},{w}{int}{w}\\)|rgba\\({w}{num}%{w},{w}{num}%{w},{w}{num}%{w},{w}{num}{w}\\)',
  399.     'hslcolor': 'hsl\\({w}{int}{w},{w}{num}%{w},{w}{num}%{w}\\)|hsla\\({w}{int}{w},{w}{num}%{w},{w}{num}%{w},{w}{num}{w}\\)',
  400.     'x11color': 'aliceblue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blue|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkgrey|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkslategrey|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dimgrey|dodgerblue|firebrick|floralwhite|forestgreen|fuchsia|gainsboro|ghostwhite|gold|goldenrod|gray|green|greenyellow|grey|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgray|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightslategrey|lightsteelblue|lightyellow|lime|limegreen|linen|magenta|maroon|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orange|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|purple|red|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|silver|skyblue|slateblue|slategray|slategrey|snow|springgreen|steelblue|tan|teal|thistle|tomato|turquoise|violet|wheat|white|whitesmoke|yellow|yellowgreen',
  401.     'uicolor': '(ActiveBorder|ActiveCaption|AppWorkspace|Background|ButtonFace|ButtonHighlight|ButtonShadow|ButtonText|CaptionText|GrayText|Highlight|HighlightText|InactiveBorder|InactiveCaption|InactiveCaptionText|InfoBackground|InfoText|Menu|MenuText|Scrollbar|ThreeDDarkShadow|ThreeDFace|ThreeDHighlight|ThreeDLightShadow|ThreeDShadow|Window|WindowFrame|WindowText)' }
  402. properties[Profiles.CSS3_COLOR] = {
  403.     'color': '{namedcolor}|{hexcolor}|{rgbcolor}|{rgbacolor}|{hslcolor}|inherit',
  404.     'opacity': '{num}|inherit' }
  405. macros[Profiles.CSS3_FONTS] = {
  406.     'family-name': '{string}|{ident}',
  407.     'font-face-name': 'local\\({w}{ident}{w}\\)',
  408.     'font-stretch-names': '(ultra-condensed|extra-condensed|condensed|semi-condensed|semi-expanded|expanded|extra-expanded|ultra-expanded)',
  409.     'unicode-range': '[uU]\\+[0-9A-Fa-f?]{1,6}(\\-[0-9A-Fa-f]{1,6})?' }
  410. properties[Profiles.CSS3_FONTS] = {
  411.     'font-size-adjust': '{number}|none|inherit',
  412.     'font-stretch': 'normal|wider|narrower|{font-stretch-names}|inherit' }
  413. properties[Profiles.CSS3_FONT_FACE] = {
  414.     'font-family': '{family-name}',
  415.     'font-stretch': '{font-stretch-names}',
  416.     'font-style': 'normal|italic|oblique',
  417.     'font-weight': 'normal|bold|[1-9]00',
  418.     'src': '({uri}{w}(format\\({w}{string}{w}(\\,{w}{string}{w})*\\))?|{font-face-name})({w},{w}({uri}{w}(format\\({w}{string}{w}(\\,{w}{string}{w})*\\))?|{font-face-name}))*',
  419.     'unicode-range': '{unicode-range}({w},{w}{unicode-range})*' }
  420. macros[Profiles.CSS3_PAGED_MEDIA] = {
  421.     'pagesize': 'a5|a4|a3|b5|b4|letter|legal|ledger',
  422.     'pagebreak': 'auto|always|avoid|left|right' }
  423. properties[Profiles.CSS3_PAGED_MEDIA] = {
  424.     'fit': 'fill|hidden|meet|slice',
  425.     'fit-position': 'auto|(({percentage}|{length})(\\s*({percentage}|{length}))?|((top|center|bottom)\\s*(left|center|right)?)|((left|center|right)\\s*(top|center|bottom)?))',
  426.     'image-orientation': 'auto|{angle}',
  427.     'orphans': '{integer}|inherit',
  428.     'page': 'auto|{ident}',
  429.     'page-break-before': '{pagebreak}|inherit',
  430.     'page-break-after': '{pagebreak}|inherit',
  431.     'page-break-inside': 'auto|avoid|inherit',
  432.     'size': '({length}{w}){1,2}|auto|{pagesize}{w}(?:portrait|landscape)',
  433.     'widows': '{integer}|inherit' }
  434.