class CodeRay::Encoders::HTML::CSS

def parse stylesheet

def parse stylesheet
  stylesheet.scan CSS_CLASS_PATTERN do |selectors, style, error|
    raise "CSS parse error: '#{error.inspect}' not recognized" if error
    for selector in selectors.split(',')
      classes = selector.scan(/[-\w]+/)
      cl = classes.pop
      @styles[cl] ||= Hash.new
      @styles[cl][classes] = style.to_s.strip.delete(' ').chomp(';')
    end
  end
end