friendlyfashion-rails_autolink 1.0.12 → 1.0.13

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.
@@ -71,7 +71,7 @@ module RailsAutolink
71
71
  private
72
72
 
73
73
  AUTO_LINK_RE = %r{
74
- (?: ((?:ed2k|ftp|http|https|irc|mailto|news|gopher|nntp|telnet|webcal|xmpp|callto|feed|svn|urn|aim|rsync|tag|ssh|sftp|rtsp|afs):)// | www\. )
74
+ (?: ((?:ed2k|ftp|http|https|irc|mailto|news|gopher|nntp|telnet|webcal|xmpp|callto|feed|svn|urn|aim|rsync|tag|ssh|sftp|rtsp|afs|file|z39.50r|chrome|view-source:http):)// | www\. )
75
75
  [^\s<]+
76
76
  }x
77
77
 
@@ -141,6 +141,10 @@ module RailsAutolink
141
141
  else
142
142
  display_text = (block_given?) ? yield(text) : text
143
143
 
144
+ if display_text.is_a?(Hash)
145
+ display_text = display_text[:text]
146
+ end
147
+
144
148
  unless options[:sanitize] == false
145
149
  text = sanitize(text)
146
150
  display_text = sanitize(display_text) unless text == display_text
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'friendlyfashion-rails_autolink'
3
- s.version = '1.0.12'
3
+ s.version = '1.0.13'
4
4
  s.authors = ["Laurynas Butkus", "Tomas Didziokas", "Justas Janauskas", "Edvinas Bartkus", "Andrius Janauskas"]
5
5
  s.email = ["laurynas.butkus@gmail.com", "tomas.did@gmail.com", "jjanauskas@gmail.com", "edvinas.bartkus@gmail.com", "andrius.janauskas@gmail.com"]
6
6
  s.summary = 'This is an extraction of the `auto_link` method from rails. The `auto_link` method was removed from Rails in version Rails 3.1. This gem is meant to bridge the gap for people migrating.'
@@ -58,6 +58,15 @@ class TestRailsAutolink < MiniTest::Unit::TestCase
58
58
  assert_equal '<a href="http://www.facebook.com">www.facebook.com</a>', result
59
59
  end
60
60
 
61
+ def test_auto_link_with_block_with_returns_hash_with_email
62
+ url = 'jeffry@google.com'
63
+ result = auto_link(url) do |it|
64
+ { text: "jeffry email" }
65
+ end
66
+
67
+ assert_equal "<a href=\"mailto:jeffry@google.com\">jeffry email</a>", result
68
+ end
69
+
61
70
  def test_auto_link_with_block_which_returns_hash_with_html_options
62
71
  url = 'http://www.google.com/'
63
72
  result = auto_link(url) do |it|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: friendlyfashion-rails_autolink
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.12
4
+ version: 1.0.13
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2013-03-22 00:00:00.000000000 Z
16
+ date: 2013-04-04 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: rails
@@ -43,6 +43,7 @@ extensions: []
43
43
  extra_rdoc_files: []
44
44
  files:
45
45
  - ./CHANGELOG.rdoc
46
+ - ./friendlyfashion-rails_autolink-1.0.12.gem
46
47
  - ./Gemfile
47
48
  - ./Gemfile.lock
48
49
  - ./lib/rails_autolink/helpers.rb