css_parser 1.3.2 → 1.3.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,12 +7,12 @@ require 'zlib'
7
7
  require 'stringio'
8
8
  require 'iconv' unless String.method_defined?(:encode)
9
9
 
10
+ require 'css_parser/version'
10
11
  require 'css_parser/rule_set'
11
12
  require 'css_parser/regexps'
12
13
  require 'css_parser/parser'
13
14
 
14
15
  module CssParser
15
- autoload :VERSION, "css_parser/version"
16
16
 
17
17
  # Merge multiple CSS RuleSets by cascading according to the CSS 2.1 cascading rules
18
18
  # (http://www.w3.org/TR/REC-CSS2/cascade.html#cascading-order).
@@ -22,10 +22,10 @@ module CssParser
22
22
  # Returns a RuleSet.
23
23
  #
24
24
  # ==== Cascading
25
- # If a RuleSet object has its +specificity+ defined, that specificity is
26
- # used in the cascade calculations.
25
+ # If a RuleSet object has its +specificity+ defined, that specificity is
26
+ # used in the cascade calculations.
27
27
  #
28
- # If no specificity is explicitly set and the RuleSet has *one* selector,
28
+ # If no specificity is explicitly set and the RuleSet has *one* selector,
29
29
  # the specificity is calculated using that selector.
30
30
  #
31
31
  # If no selectors the specificity is treated as 0.
@@ -57,7 +57,7 @@ module CssParser
57
57
 
58
58
  # in case called like CssParser.merge([rule_set, rule_set])
59
59
  rule_sets.flatten! if rule_sets[0].kind_of?(Array)
60
-
60
+
61
61
  unless rule_sets.all? {|rs| rs.kind_of?(CssParser::RuleSet)}
62
62
  raise ArgumentError, "all parameters must be CssParser::RuleSets."
63
63
  end
@@ -69,7 +69,7 @@ module CssParser
69
69
 
70
70
  rule_sets.each do |rule_set|
71
71
  rule_set.expand_shorthand!
72
-
72
+
73
73
  specificity = rule_set.specificity
74
74
  unless specificity
75
75
  if rule_set.selectors.length == 0
@@ -85,11 +85,11 @@ module CssParser
85
85
  properties[property] = {:value => value, :specificity => specificity, :is_important => is_important}
86
86
  elsif is_important
87
87
  if not properties[property][:is_important] or properties[property][:specificity] <= specificity
88
- properties[property] = {:value => value, :specificity => specificity, :is_important => is_important}
88
+ properties[property] = {:value => value, :specificity => specificity, :is_important => is_important}
89
89
  end
90
90
  elsif properties[property][:specificity] < specificity or properties[property][:specificity] == specificity
91
91
  unless properties[property][:is_important]
92
- properties[property] = {:value => value, :specificity => specificity, :is_important => is_important}
92
+ properties[property] = {:value => value, :specificity => specificity, :is_important => is_important}
93
93
  end
94
94
  end
95
95
  end
@@ -99,7 +99,7 @@ module CssParser
99
99
 
100
100
  properties.each do |property, details|
101
101
  if details[:is_important]
102
- merged[property.strip] = details[:value].strip.gsub(/\;\Z/, '') + '!important'
102
+ merged[property.strip] = details[:value].strip.gsub(/\;\Z/, '') + '!important'
103
103
  else
104
104
  merged[property.strip] = details[:value].strip
105
105
  end
@@ -141,7 +141,7 @@ module CssParser
141
141
  # Returns a string.
142
142
  #
143
143
  # ==== Example
144
- # CssParser.convert_uris("body { background: url('../style/yellow.png?abc=123') };",
144
+ # CssParser.convert_uris("body { background: url('../style/yellow.png?abc=123') };",
145
145
  # "http://example.org/style/basic.css").inspect
146
146
  # => "body { background: url('http://example.org/style/yellow.png?abc=123') };"
147
147
  def self.convert_uris(css, base_uri)
@@ -159,7 +159,7 @@ module CssParser
159
159
  "url('#{uri.to_s}')"
160
160
  end
161
161
  end
162
-
162
+
163
163
  def self.sanitize_media_query(raw)
164
164
  mq = raw.to_s.gsub(/[\s]+/, ' ').strip
165
165
  mq = 'all' if mq.empty?
@@ -1,3 +1,3 @@
1
1
  module CssParser
2
- VERSION = "1.3.2"
2
+ VERSION = "1.3.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: css_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
4
+ version: 1.3.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -53,7 +53,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
53
53
  version: '0'
54
54
  segments:
55
55
  - 0
56
- hash: -1308369005751003070
56
+ hash: -4240210053647962774
57
57
  required_rubygems_version: !ruby/object:Gem::Requirement
58
58
  none: false
59
59
  requirements:
@@ -62,10 +62,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
62
62
  version: '0'
63
63
  segments:
64
64
  - 0
65
- hash: -1308369005751003070
65
+ hash: -4240210053647962774
66
66
  requirements: []
67
67
  rubyforge_project:
68
- rubygems_version: 1.8.25
68
+ rubygems_version: 1.8.23
69
69
  signing_key:
70
70
  specification_version: 3
71
71
  summary: Ruby CSS parser.