r2 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/lib/r2.rb +3 -2
- data/lib/r2/version.rb +1 -1
- data/spec/r2_spec.rb +15 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c4f4e266f69646ea465956984aae4e9f23714888
|
4
|
+
data.tar.gz: 4bc745ee1417f388979ffd6b090b3b0ce7cf012b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b504c3c059252910fb1ab6dbcfbf41cf2c8383d181d28b861c133b99459ed7d2bff733fa51bddacc58b8583f0c27116fb5ebcdf3d6e62a9b06d25fc8509a61a
|
7
|
+
data.tar.gz: e2f4ecebe8b886e6478ad1e3b99cfecee536df7f587d676f26757e5264a5d822504c5e7153a6fda23352bfb7d7f7b2300fd5725d3784606027ac8175567811ee
|
data/README.md
CHANGED
@@ -23,6 +23,8 @@ Report bugs in the github project at http://github.com/mzsanford/r2rb
|
|
23
23
|
|
24
24
|
## Change Log
|
25
25
|
|
26
|
+
* v0.2.4 - Handle `url()` properties better
|
27
|
+
* [BUG] - Handle `url()` without embedded semi-colons and with trailing parameters
|
26
28
|
* v0.2.3 - Handle `url()` properties better
|
27
29
|
* [BUG] - Handle `url()` with embedded semi-colons (like escaped SVG)
|
28
30
|
* [CHANGE] - Remove Travis tests for Ruby 1.8 because Travis adds a `celluloid` dependency that does not work before Ruby 1.9.3
|
data/lib/r2.rb
CHANGED
@@ -85,11 +85,12 @@ module R2
|
|
85
85
|
# a state machine is constructed.
|
86
86
|
url_rule = nil
|
87
87
|
rule.split(/;/).each do |part|
|
88
|
-
|
88
|
+
# A rule body that contains a "url(" and a ";" before the closing ")"
|
89
|
+
if part.match(/url\([^\)]+$/)
|
89
90
|
url_rule = part
|
90
91
|
elsif url_rule != nil
|
91
92
|
url_rule << ";" + part
|
92
|
-
if part.match(/\)
|
93
|
+
if part.match(/\)( |$)/)
|
93
94
|
rule_str << declaration_swap(url_rule)
|
94
95
|
url_rule = nil
|
95
96
|
end
|
data/lib/r2/version.rb
CHANGED
data/spec/r2_spec.rb
CHANGED
@@ -40,6 +40,21 @@ describe R2::Swapper do
|
|
40
40
|
flipped_css.should == expected_result
|
41
41
|
end
|
42
42
|
|
43
|
+
it "handles background-image declarations" do
|
44
|
+
css = <<-EOS
|
45
|
+
.flag {
|
46
|
+
background: url('flags/flag16.png') no-repeat;
|
47
|
+
text-align: left;
|
48
|
+
}
|
49
|
+
EOS
|
50
|
+
|
51
|
+
expected_result = ".flag{background:url('flags/flag16.png') no-repeat;text-align:right;}"
|
52
|
+
|
53
|
+
flipped_css = r2.r2(css)
|
54
|
+
|
55
|
+
flipped_css.should == expected_result
|
56
|
+
end
|
57
|
+
|
43
58
|
it "handles SVG background-image declarations" do
|
44
59
|
escaped_xml = "%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22iso-8859-1%22%3F%3E%3C!DOCTYPE%20svg%20PUBLIC%20%22-%2F%2FW3C%2F%2FDTD%20SVG%201.1%2F%2FEN%22%20%22http%3A%2F%2Fwww.w3.org%2FGraphics%2FSVG%2F1.1%2FDTD%2Fsvg11.dtd%22%3E%3Csvg%20version%3D%221.1%22%20id%3D%22Layer_1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20x%3D%220px%22%20y%3D%220px%22%20%20width%3D%2214px%22%20height%3D%2214px%22%20viewBox%3D%220%200%2014%2014%22%20style%3D%22enable-background%3Anew%200%200%2014%2014%3B%22%20xml%3Aspace%3D%22preserve%22%3E%3Cpath%20style%3D%22fill%3A%23FFFFFF%3B%22%20d%3D%22M9%2C5v3l5-4L9%2C0v3c0%2C0-5%2C0-5%2C7C6%2C5%2C9%2C5%2C9%2C5z%20M11%2C12H2V5h1l2-2H0v11h13V7l-2%2C2V12z%22%2F%3E%3C%2Fsvg%3E"
|
45
60
|
css = <<-EOS
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: r2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Sanford
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|