link_url 0.0.3 → 0.0.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.
- data/lib/link_url.rb +5 -20
- metadata +8 -5
- checksums.yaml +0 -15
data/lib/link_url.rb
CHANGED
|
@@ -10,26 +10,11 @@ class LinkUrl
|
|
|
10
10
|
# content: (String)
|
|
11
11
|
|
|
12
12
|
def self.convert(content)
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
if !content.gsub( %r{https://[^\s<]+} ).nil?
|
|
19
|
-
content.gsub( %r{https://[^\s<]+} ) do |url|
|
|
20
|
-
content = content.gsub(url,"<a href='"+url+"'>"+url+"</a>")
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
if !content.gsub( %r{ www.[^\s<]+} ).nil?
|
|
24
|
-
content.gsub( %r{ www.[^\s<]+} ) do |url|
|
|
25
|
-
content = content.gsub(url," <a href='http://"+url.gsub(" ","")+"'>"+url.gsub(" ","")+"</a>")
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
if !content.gsub( %r{^\www.[^\s<]+} ).nil?
|
|
29
|
-
content.gsub( %r{^\www.[^\s<]+} ) do |url|
|
|
30
|
-
content = content.gsub(url,"<a href='http://"+url+"'>"+url+"</a>")
|
|
31
|
-
end
|
|
13
|
+
if(content)
|
|
14
|
+
exp =/\b((?:mailto:\S+|(?:https?|ftp|file):\/\/|www.)[^\s<]+)\b/
|
|
15
|
+
content = content.gsub(exp) { |url| "<a href='"+url+"'>"+url+"</a>" }
|
|
16
|
+
content = content.gsub("<a href='www.","<a href='http://www.");
|
|
17
|
+
return content
|
|
32
18
|
end
|
|
33
|
-
return content
|
|
34
19
|
end
|
|
35
20
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: link_url
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.4
|
|
5
|
+
prerelease:
|
|
5
6
|
platform: ruby
|
|
6
7
|
authors:
|
|
7
8
|
- Ashish Prajapati
|
|
8
9
|
autorequire:
|
|
9
10
|
bindir: bin
|
|
10
11
|
cert_chain: []
|
|
11
|
-
date: 2013-12-
|
|
12
|
+
date: 2013-12-31 00:00:00.000000000 Z
|
|
12
13
|
dependencies: []
|
|
13
14
|
description: Convert all the url from the string or text into the links as <a href="...">...</a>
|
|
14
15
|
Need to install this gem and use LinkUrl.convert("Guys come at www.ashishprajapati.com
|
|
@@ -21,25 +22,27 @@ files:
|
|
|
21
22
|
- lib/link_url.rb
|
|
22
23
|
homepage: http://rubygems.org/gems/link_url
|
|
23
24
|
licenses: []
|
|
24
|
-
metadata: {}
|
|
25
25
|
post_install_message:
|
|
26
26
|
rdoc_options: []
|
|
27
27
|
require_paths:
|
|
28
28
|
- lib
|
|
29
29
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
30
|
+
none: false
|
|
30
31
|
requirements:
|
|
31
32
|
- - ! '>='
|
|
32
33
|
- !ruby/object:Gem::Version
|
|
33
34
|
version: '0'
|
|
34
35
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
36
|
+
none: false
|
|
35
37
|
requirements:
|
|
36
38
|
- - ! '>='
|
|
37
39
|
- !ruby/object:Gem::Version
|
|
38
40
|
version: '0'
|
|
39
41
|
requirements: []
|
|
40
42
|
rubyforge_project:
|
|
41
|
-
rubygems_version:
|
|
43
|
+
rubygems_version: 1.8.25
|
|
42
44
|
signing_key:
|
|
43
|
-
specification_version:
|
|
45
|
+
specification_version: 3
|
|
44
46
|
summary: Convert all url into link
|
|
45
47
|
test_files: []
|
|
48
|
+
has_rdoc:
|
checksums.yaml
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
!binary "U0hBMQ==":
|
|
3
|
-
metadata.gz: !binary |-
|
|
4
|
-
Zjg3ZmE0M2Q1ZTIyODk3MDY5YjY2Zjc2NTQ5NWJmMjNhZTJjMTQ3MA==
|
|
5
|
-
data.tar.gz: !binary |-
|
|
6
|
-
ZGVjNjBjZGY1MDgwODM0NDNjNjI3NTAzZjhhOWNiOGY4Zjg4ZTA5YQ==
|
|
7
|
-
!binary "U0hBNTEy":
|
|
8
|
-
metadata.gz: !binary |-
|
|
9
|
-
ZmM4OGMxYzlmYzg5ZjRjZGE0MzdmYjMzYzFhYWFjNTc0ZWM2NmY2YjExOTA5
|
|
10
|
-
MTcxM2I5MmRiM2ExZWM0NzM4OTI0MDJhMmY5MjM2ZmNiZGIwYTQ2YjAzYWI3
|
|
11
|
-
MTQwNTU3ZDI2MGI5MTFjODNiMmUzZjM0NWU3M2FkODRkN2MxNzc=
|
|
12
|
-
data.tar.gz: !binary |-
|
|
13
|
-
OTU0NjJiYjk2NDA4YjQ3YjA1NjUyZTEyM2Y4YjljYjJmNGUzYWRiMjVkOTE3
|
|
14
|
-
NWMyNzUwOWJkYzJmMGQzMTg3NTZkNTg3ZjRmMWU5MDNlY2FhZTk1NmFiNzQ1
|
|
15
|
-
YmY0NjcxYTMyNjQ5YWZkZGM3OWEwN2E4YTdiZmQ1NmQzYmE2NTE=
|