css_parser 1.2.4 → 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/css_parser.rb +5 -3
- data/test/test_merging.rb +6 -0
- metadata +28 -48
data/lib/css_parser.rb
CHANGED
@@ -8,7 +8,7 @@ require 'stringio'
|
|
8
8
|
require 'iconv'
|
9
9
|
|
10
10
|
module CssParser
|
11
|
-
VERSION = '1.2.
|
11
|
+
VERSION = '1.2.5'
|
12
12
|
|
13
13
|
# Merge multiple CSS RuleSets by cascading according to the CSS 2.1 cascading rules
|
14
14
|
# (http://www.w3.org/TR/REC-CSS2/cascade.html#cascading-order).
|
@@ -78,8 +78,10 @@ module CssParser
|
|
78
78
|
# Add the property to the list to be folded per http://www.w3.org/TR/CSS21/cascade.html#cascading-order
|
79
79
|
if not properties.has_key?(property)
|
80
80
|
properties[property] = {:value => value, :specificity => specificity, :is_important => is_important}
|
81
|
-
elsif is_important
|
82
|
-
properties[property]
|
81
|
+
elsif is_important
|
82
|
+
if not properties[property][:is_important] or properties[property][:specificity] <= specificity
|
83
|
+
properties[property] = {:value => value, :specificity => specificity, :is_important => is_important}
|
84
|
+
end
|
83
85
|
elsif properties[property][:specificity] < specificity or properties[property][:specificity] == specificity
|
84
86
|
unless properties[property][:is_important]
|
85
87
|
properties[property] = {:value => value, :specificity => specificity, :is_important => is_important}
|
data/test/test_merging.rb
CHANGED
@@ -98,6 +98,12 @@ class MergingTests < Test::Unit::TestCase
|
|
98
98
|
rs2 = RuleSet.new(nil, 'color: red !important;', 1)
|
99
99
|
merged = CssParser.merge(rs1, rs2)
|
100
100
|
assert_equal 'black !important;', merged['color']
|
101
|
+
|
102
|
+
rs3 = RuleSet.new(nil, 'color: blue !important;', 1000)
|
103
|
+
merged = CssParser.merge(rs1, rs2, rs3)
|
104
|
+
assert_equal 'blue !important;', merged['color']
|
105
|
+
|
106
|
+
|
101
107
|
end
|
102
108
|
|
103
109
|
def test_merging_shorthand_important
|
metadata
CHANGED
@@ -1,45 +1,33 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: css_parser
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.2.5
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 2
|
9
|
-
- 4
|
10
|
-
version: 1.2.4
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Alex Dunae
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-09-07 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: addressable
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &2153617080 !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
26
|
-
- -
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
segments:
|
30
|
-
- 0
|
31
|
-
version: "0"
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
32
22
|
type: :runtime
|
33
|
-
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *2153617080
|
34
25
|
description: A set of classes for parsing CSS in Ruby.
|
35
26
|
email: code@dunae.ca
|
36
27
|
executables: []
|
37
|
-
|
38
28
|
extensions: []
|
39
|
-
|
40
29
|
extra_rdoc_files: []
|
41
|
-
|
42
|
-
files:
|
30
|
+
files:
|
43
31
|
- lib/css_parser.rb
|
44
32
|
- lib/css_parser/parser.rb
|
45
33
|
- lib/css_parser/regexps.rb
|
@@ -61,42 +49,34 @@ files:
|
|
61
49
|
- test/test_rule_set_expanding_shorthand.rb
|
62
50
|
homepage: https://github.com/alexdunae/css_parser
|
63
51
|
licenses: []
|
64
|
-
|
65
52
|
post_install_message:
|
66
|
-
rdoc_options:
|
53
|
+
rdoc_options:
|
67
54
|
- --all
|
68
55
|
- --inline-source
|
69
56
|
- --line-numbers
|
70
57
|
- --charset
|
71
58
|
- utf-8
|
72
|
-
require_paths:
|
59
|
+
require_paths:
|
73
60
|
- lib
|
74
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
61
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
75
62
|
none: false
|
76
|
-
requirements:
|
77
|
-
- -
|
78
|
-
- !ruby/object:Gem::Version
|
79
|
-
|
80
|
-
|
81
|
-
- 0
|
82
|
-
version: "0"
|
83
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ! '>='
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
67
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
68
|
none: false
|
85
|
-
requirements:
|
86
|
-
- -
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
|
89
|
-
segments:
|
90
|
-
- 0
|
91
|
-
version: "0"
|
69
|
+
requirements:
|
70
|
+
- - ! '>='
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
92
73
|
requirements: []
|
93
|
-
|
94
74
|
rubyforge_project:
|
95
75
|
rubygems_version: 1.8.10
|
96
76
|
signing_key:
|
97
77
|
specification_version: 3
|
98
78
|
summary: Ruby CSS parser.
|
99
|
-
test_files:
|
79
|
+
test_files:
|
100
80
|
- test/test_css_parser_basic.rb
|
101
81
|
- test/test_css_parser_loading.rb
|
102
82
|
- test/test_css_parser_media_types.rb
|