r2 0.2.3 → 0.2.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 993216b45cc4bad2255bc31184ca50bbd73dc8bf
4
- data.tar.gz: 8f13aebd5b0081c7f08e796654a67c54cb6ecb14
3
+ metadata.gz: c4f4e266f69646ea465956984aae4e9f23714888
4
+ data.tar.gz: 4bc745ee1417f388979ffd6b090b3b0ce7cf012b
5
5
  SHA512:
6
- metadata.gz: 553d29ee6461fb312f7e93cfee40a8707eefd96db4744041a4073e8d50be25781aea42c332313246c66ec1b23696ddf545965c9959ff88eb53d84a15b919ccaf
7
- data.tar.gz: 0638da0e1140f27b7b330575d038603007c15f865309b538d5543b8572e6bb610e2f747c7248fc058645c5c45e17255b4b6914920fb8a498733604911a39b643
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
- if part.match(/url\(/)
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
@@ -1,3 +1,3 @@
1
1
  module R2
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.4"
3
3
  end
@@ -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.3
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-04-30 00:00:00.000000000 Z
11
+ date: 2014-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake