linky 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/linky/linky.rb +1 -0
  2. data/spec/linky_spec.rb +6 -0
  3. metadata +3 -3
data/lib/linky/linky.rb CHANGED
@@ -17,6 +17,7 @@ class Linky
17
17
  block = proc {|keyword| %{<a href="#{target}" #{options}>#{keyword}</a>}}
18
18
  html_fragment = Nokogiri::HTML::DocumentFragment.parse html
19
19
  real_link keyword.to_s, html_fragment, &block
20
+ raise "We lost some content in attempting to link it. Please report a bug" unless html_fragment.text == Nokogiri::HTML::DocumentFragment.parse(html).text
20
21
  html_fragment.to_xhtml
21
22
  end
22
23
 
data/spec/linky_spec.rb CHANGED
@@ -30,4 +30,10 @@ describe Linky, "#link" do
30
30
  new_html = Linky.link "California", "topics/california", html
31
31
  new_html.should == "<p><a href=\"topics/california\">California</a> <a href=\"topics/cabernet-sauvignon\">Cabernet Sauvignon</a></p>"
32
32
  end
33
+
34
+ it "should preserve entities" do
35
+ html = "<p>California <a href=\"topics/cabernet-sauvignon\">Cabernet Sauvignon</a>&#151;an awesome wine</p>"
36
+ new_html = Linky.link "California", "topics/california", html
37
+ new_html.should == "<p><a href=\"topics/california\">California</a> <a href=\"topics/cabernet-sauvignon\">Cabernet Sauvignon</a>&#x97;an awesome wine</p>"
38
+ end
33
39
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: linky
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 4
10
- version: 0.0.4
9
+ - 5
10
+ version: 0.0.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Matt Parker