html-pipeline-youtube 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cf95b59cad749b3c40a105c6d125099f7f9fab43
4
- data.tar.gz: 92ab4fedd9b6fadb9019633d6f7a1f9d002997ad
3
+ metadata.gz: ec1da87cb376287956f8e42a3608a874ab260dff
4
+ data.tar.gz: 09ea8fb4878d8948952aeff14b20d8dcfe1b8f40
5
5
  SHA512:
6
- metadata.gz: 6969d7e7294e3c30a7aee7c1d190f5e4799832ef05ef85d6522427fe694082fbe819b9421cebcaf27e2bb5404458acc198375766f0b8afe417dbd824fac71b38
7
- data.tar.gz: de710642756bb1894e1557196eab71313857fa4cf37c281cfbdbb7423b5517ea4db7f5c02a8ee3701a37ec63df1964e5e1f1360c0fcbcdcae1e42d71a5ce646d
6
+ metadata.gz: 47d1ec39c7fa80f8fbe19431a7aca3ff99e57b3a772a59376590ba04a4bfcad78b8539534755e988f53ccee9780cb8ac85484649cb40b1022a6104ab70447ca3
7
+ data.tar.gz: 7799c1614cf57d3366ccb1d26a8e2428a70ab2be4e7d182e09f3a7be45467e3128f8ea1f8ae6d0912a0d3b2117febecac4314529d3c2a601c2033a6a59d16314
data/.gitignore CHANGED
@@ -8,3 +8,4 @@
8
8
  /spec/reports/
9
9
  /tmp/
10
10
  **.gem
11
+ .ruby-version
@@ -1,7 +1,7 @@
1
1
  module HTML
2
2
  class Pipeline
3
3
  module Youtube
4
- VERSION = '0.1.2'
4
+ VERSION = '0.1.3'
5
5
  end
6
6
  end
7
7
  end
@@ -11,9 +11,10 @@ module HTML
11
11
  # :video_wmode - string, sets iframe's wmode option
12
12
  # :video_autoplay - boolean, whether video should autoplay
13
13
  # :video_hide_related - boolean, whether shows related videos
14
- regex = /(\s(https?:\/\/)|^(https?:\/\/))(www.)?(youtube\.com\/watch\?v=|youtu\.be\/|youtube\.com\/watch\?feature=player_embedded&v=)([A-Za-z0-9_-]*)(\&\S+)?(\?\S+)?/
14
+ regex = /(\s|^|<div>|<br>)(https?:\/\/)(www.)?(youtube\.com\/watch\?v=|youtu\.be\/|youtube\.com\/watch\?feature=player_embedded&v=)([A-Za-z0-9_-]*)(\&\S+)?(\?\S+)?/
15
15
  @text.gsub(regex) do
16
- youtube_id = $6
16
+ youtube_id = $5
17
+ close_tag = $1 if ["<br>", "<div>"].include? $1
17
18
  width = context[:video_width] || 420
18
19
  height = context[:video_height] || 315
19
20
  frameborder = context[:video_frameborder] || 0
@@ -27,7 +28,7 @@ module HTML
27
28
  params << "rel=0" if hide_related
28
29
  src += "?#{params.join '&'}" unless params.empty?
29
30
 
30
- %{<div class="video youtube"><iframe width="#{width}" height="#{height}" src="#{src}" frameborder="#{frameborder}" allowfullscreen></iframe></div>}
31
+ %{#{close_tag}<div class="video youtube"><iframe width="#{width}" height="#{height}" src="#{src}" frameborder="#{frameborder}" allowfullscreen></iframe></div>}
31
32
  end
32
33
  end
33
34
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: html-pipeline-youtube
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stan Luo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-11-23 00:00:00.000000000 Z
11
+ date: 2016-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: html-pipeline