html-pipeline-youtube 0.1.2 → 0.1.3
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.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/lib/html/pipeline/youtube/version.rb +1 -1
- data/lib/html/pipeline/youtube/youtube_filter.rb +4 -3
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ec1da87cb376287956f8e42a3608a874ab260dff
|
|
4
|
+
data.tar.gz: 09ea8fb4878d8948952aeff14b20d8dcfe1b8f40
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 47d1ec39c7fa80f8fbe19431a7aca3ff99e57b3a772a59376590ba04a4bfcad78b8539534755e988f53ccee9780cb8ac85484649cb40b1022a6104ab70447ca3
|
|
7
|
+
data.tar.gz: 7799c1614cf57d3366ccb1d26a8e2428a70ab2be4e7d182e09f3a7be45467e3128f8ea1f8ae6d0912a0d3b2117febecac4314529d3c2a601c2033a6a59d16314
|
data/.gitignore
CHANGED
|
@@ -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
|
|
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 = $
|
|
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.
|
|
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:
|
|
11
|
+
date: 2016-06-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: html-pipeline
|