lib/beautiful-css/rule_parser.rb in beautiful-css-0.0.10 vs lib/beautiful-css/rule_parser.rb in beautiful-css-0.1.01

- old
+ new

@@ -3,28 +3,29 @@ module BeautifulCss class RuleParser def initialize(str) @body = str - @body = @body.gsub( /url\( *data:/ , '__url_data__') @body = @body.gsub( /;base64,/ , '__base64__') end def selectors @body.match(/[^{]*/).to_s.split(/,/).map{|s| s.strip}.select{|s| !s.empty? } end def props begin p = @body.match(/\{([^}]*)/)[1].split(';').select{|s| !s.strip.empty? } - p.map{|s| s.strip.split(':') } + p.map do |s| + first, *rest = s.strip.split(':') + rest.class == Array ? [first, rest.join(':') ] : [first, rest ] + end rescue [] end end def restore_special_strings str - str = str.gsub( /__url_data__/, 'url(data:') str = str.gsub( /__base64__/, ';base64,') str end def to_rules