url_to_media_tag 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Readme.md +8 -1
- data/VERSION +1 -1
- data/lib/url_to_media_tag.rb +2 -1
- data/spec/url_to_media_tag_spec.rb +6 -1
- data/url_to_media_tag.gemspec +7 -7
- metadata +20 -39
data/Readme.md
CHANGED
@@ -4,7 +4,9 @@ Supports:
|
|
4
4
|
|
5
5
|
- Youtube
|
6
6
|
- Vimeo
|
7
|
-
-
|
7
|
+
- *.jpg/png/gif
|
8
|
+
- easy to add more
|
9
|
+
- give size settings and restrict providers
|
8
10
|
|
9
11
|
Install
|
10
12
|
=======
|
@@ -56,6 +58,11 @@ TODO
|
|
56
58
|
|
57
59
|
Author
|
58
60
|
======
|
61
|
+
|
62
|
+
### [Contributors](http://github.com/grosser/url_to_media_tag/contributors)
|
63
|
+
- [Ozéias Sant'ana](https://github.com/ozeias)
|
64
|
+
|
65
|
+
|
59
66
|
Filter logic borrowed from Dejan Simic`s [auto_html](https://github.com/dejan/auto_html) MIT-LICENSE
|
60
67
|
|
61
68
|
[Michael Grosser](http://grosser.it)<br/>
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.4
|
data/lib/url_to_media_tag.rb
CHANGED
@@ -40,7 +40,8 @@ module UrlToMediaTag
|
|
40
40
|
when /http:\/\/(www.)?youtube\.com\/watch\?v=([A-Za-z0-9._%-]*)(\&\S+)?|http:\/\/(www.)?youtu\.be\/([A-Za-z0-9._%-]*)?/
|
41
41
|
options = merge_settings(:video, :vimeo, options)
|
42
42
|
youtube_id = $2 || $5
|
43
|
-
|
43
|
+
related_videos = "?rel=0" unless options.delete(:related_videos)
|
44
|
+
video_iframe "http://www.youtube.com/embed/#{youtube_id}#{related_videos}", options
|
44
45
|
|
45
46
|
# vimeo
|
46
47
|
when /http:\/\/(www.)?vimeo\.com\/([A-Za-z0-9._%-]*)((\?|#)\S+)?/
|
@@ -7,7 +7,7 @@ describe UrlToMediaTag do
|
|
7
7
|
|
8
8
|
describe 'convert' do
|
9
9
|
it "converts youtube" do
|
10
|
-
expected = "<iframe class=\"url-to-media-tag-video\" frameborder=\"0\" height=\"480\" src=\"http://www.youtube.com/embed/kW-dS4otEZU\" width=\"640\"></iframe>"
|
10
|
+
expected = "<iframe class=\"url-to-media-tag-video\" frameborder=\"0\" height=\"480\" src=\"http://www.youtube.com/embed/kW-dS4otEZU?rel=0\" width=\"640\"></iframe>"
|
11
11
|
UrlToMediaTag.convert('http://www.youtube.com/watch?v=kW-dS4otEZU').should == expected
|
12
12
|
end
|
13
13
|
|
@@ -66,6 +66,11 @@ describe UrlToMediaTag do
|
|
66
66
|
UrlToMediaTag.convert('http://vimeo.com/26881896').should include('title=0')
|
67
67
|
UrlToMediaTag.convert('http://vimeo.com/26881896', :settings => {:vimeo => {:show_title => true}}).should_not include('title=0')
|
68
68
|
end
|
69
|
+
|
70
|
+
it "can show suggested videos" do
|
71
|
+
UrlToMediaTag.convert('http://www.youtube.com/watch?v=kW-dS4otEZU').should include('rel=0')
|
72
|
+
UrlToMediaTag.convert('http://www.youtube.com/watch?v=kW-dS4otEZU', :related_videos => true).should_not include('rel=0')
|
73
|
+
end
|
69
74
|
end
|
70
75
|
end
|
71
76
|
end
|
data/url_to_media_tag.gemspec
CHANGED
@@ -4,13 +4,13 @@
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
|
-
s.name =
|
8
|
-
s.version = "0.1.
|
7
|
+
s.name = "url_to_media_tag"
|
8
|
+
s.version = "0.1.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Michael Grosser"]
|
12
|
-
s.date =
|
13
|
-
s.email =
|
12
|
+
s.date = "2011-10-17"
|
13
|
+
s.email = "michael@grosser.it"
|
14
14
|
s.files = [
|
15
15
|
"Gemfile",
|
16
16
|
"Gemfile.lock",
|
@@ -22,10 +22,10 @@ Gem::Specification.new do |s|
|
|
22
22
|
"spec/url_to_media_tag_spec.rb",
|
23
23
|
"url_to_media_tag.gemspec"
|
24
24
|
]
|
25
|
-
s.homepage =
|
25
|
+
s.homepage = "http://github.com/grosser/url_to_media_tag"
|
26
26
|
s.require_paths = ["lib"]
|
27
|
-
s.rubygems_version =
|
28
|
-
s.summary =
|
27
|
+
s.rubygems_version = "1.8.10"
|
28
|
+
s.summary = "Convert a Url to image or video embed"
|
29
29
|
|
30
30
|
if s.respond_to? :specification_version then
|
31
31
|
s.specification_version = 3
|
metadata
CHANGED
@@ -1,33 +1,22 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: url_to_media_tag
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.4
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 1
|
9
|
-
- 3
|
10
|
-
version: 0.1.3
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Michael Grosser
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
date: 2011-08-04 00:00:00 +02:00
|
19
|
-
default_executable:
|
12
|
+
date: 2011-10-17 00:00:00.000000000 Z
|
20
13
|
dependencies: []
|
21
|
-
|
22
14
|
description:
|
23
15
|
email: michael@grosser.it
|
24
16
|
executables: []
|
25
|
-
|
26
17
|
extensions: []
|
27
|
-
|
28
18
|
extra_rdoc_files: []
|
29
|
-
|
30
|
-
files:
|
19
|
+
files:
|
31
20
|
- Gemfile
|
32
21
|
- Gemfile.lock
|
33
22
|
- Rakefile
|
@@ -37,39 +26,31 @@ files:
|
|
37
26
|
- spec/spec_helper.rb
|
38
27
|
- spec/url_to_media_tag_spec.rb
|
39
28
|
- url_to_media_tag.gemspec
|
40
|
-
has_rdoc: true
|
41
29
|
homepage: http://github.com/grosser/url_to_media_tag
|
42
30
|
licenses: []
|
43
|
-
|
44
31
|
post_install_message:
|
45
32
|
rdoc_options: []
|
46
|
-
|
47
|
-
require_paths:
|
33
|
+
require_paths:
|
48
34
|
- lib
|
49
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
35
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
50
36
|
none: false
|
51
|
-
requirements:
|
52
|
-
- -
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
|
55
|
-
segments:
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
segments:
|
56
42
|
- 0
|
57
|
-
|
58
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
43
|
+
hash: 833680701
|
44
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
59
45
|
none: false
|
60
|
-
requirements:
|
61
|
-
- -
|
62
|
-
- !ruby/object:Gem::Version
|
63
|
-
|
64
|
-
segments:
|
65
|
-
- 0
|
66
|
-
version: "0"
|
46
|
+
requirements:
|
47
|
+
- - ! '>='
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
67
50
|
requirements: []
|
68
|
-
|
69
51
|
rubyforge_project:
|
70
|
-
rubygems_version: 1.
|
52
|
+
rubygems_version: 1.8.10
|
71
53
|
signing_key:
|
72
54
|
specification_version: 3
|
73
55
|
summary: Convert a Url to image or video embed
|
74
56
|
test_files: []
|
75
|
-
|