markdown_media 1.6.0 → 1.8.0

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
  SHA256:
3
- metadata.gz: f755e4e21059358def59c04d178f5e02100746bd4db9bd7741cb02154bdd9a60
4
- data.tar.gz: 76c8381cce9ab750f670f2e7f83da113d41f02216384464f7c2d504020f90458
3
+ metadata.gz: 9efdde1477ac05186f394efb42e867b31fe39cc3f605094d4ab0081e0df2e616
4
+ data.tar.gz: 2231240d060c40bec4082333e495ad780ee319ae1c6e595870eb25c4fb971966
5
5
  SHA512:
6
- metadata.gz: e4b9556ac6284ed82c8087ee39171c51cf51e4b747083bca902ec926296f63a809c6aba2217c5d538587faa1452f21e534ff6f7770c6922a082cba3216cf8148
7
- data.tar.gz: e6b9df447e0dbbd2dfb6ce9135e1b061a154df24c8b88dae1915f222fa8de360aff7fe0d1fbf89bdebac01c81443dcabc14919089ca4325d43e4136e1af574ed
6
+ metadata.gz: d57f9da1923537874eca7bd81fc0e5f20c61aa7f3ee9acc2cdf551ea05ad5ef96be02c829df8c7ca77dc56dbff20e3e4ae7cbd9f5c707e7a99033c99d3ecee59
7
+ data.tar.gz: e358eda3f2bc3f71cf779a454c345509e7ead78d941a4ac8087354dbd73dd42915aee6b7ecec5d5d506ff8a4dfc913408d0a51a0a19ef124b99111c6496b9472
@@ -0,0 +1,20 @@
1
+ on: [push]
2
+
3
+ name: specs
4
+
5
+ jobs:
6
+ run:
7
+ runs-on: ubuntu-latest
8
+
9
+ steps:
10
+ - name: Checkout repository
11
+ uses: actions/checkout@main
12
+
13
+ - name: Set up Ruby
14
+ uses: ruby/setup-ruby@master
15
+ with:
16
+ ruby-version: 3.3
17
+ bundler-cache: true
18
+
19
+ - name: Run RSpec
20
+ run: bundle exec rspec
data/README.md CHANGED
@@ -1,8 +1,7 @@
1
1
  # Markdown Media
2
2
 
3
- [![Build Status](https://travis-ci.org/veganstraightedge/markdown_media.svg?branch=master)](https://travis-ci.org/veganstraightedge/markdown_media)
4
3
  [![Code Climate](https://codeclimate.com/github/veganstraightedge/markdown_media/badges/gpa.svg)](https://codeclimate.com/github/veganstraightedge/markdown_media)
5
- ![Version 1.2.1](https://img.shields.io/badge/VERSION-1.2.1-green.svg)
4
+ ![Version 1.8.0](https://img.shields.io/badge/VERSION-1.8.0-green.svg)
6
5
 
7
6
  This syntax uses doubles square brackets on each side of a URL and optional options.
8
7
  It expands into the current preferred embed code for that site’s media or raw media.
@@ -152,6 +151,12 @@ YouTube’s short URL format also works.
152
151
  [[https://youtu.be/YX40hbAHx3s]]
153
152
  ```
154
153
 
154
+ YouTube’s embed URL format also works.
155
+
156
+ ```
157
+ [[https://www.youtube.com/embed/YX40hbAHx3s]]
158
+ ```
159
+
155
160
  A video from Daily Motion.
156
161
 
157
162
  ```
@@ -260,6 +265,13 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
260
265
 
261
266
  Bug reports and pull requests are welcome on GitHub at https://github.com/veganstraightedge/markdown_media. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
262
267
 
268
+ ### Contributors
269
+
270
+ * Shane Becker <veganstraightedge@gmail.com>
271
+ * Morgan Fogarty <mofo37@gmail.com>
272
+ * Matt Pruitt <guitsaru@gmail.com>
273
+ * Justin Lavoie <just1602@riseup.net>
274
+ * astronaut-wannabe <contact@astronaut-wannabe.com>
263
275
 
264
276
  ## License
265
277
 
@@ -1,3 +1,3 @@
1
1
  module MarkdownMedia
2
- VERSION = "1.6.0"
2
+ VERSION = "1.8.0"
3
3
  end
@@ -103,53 +103,63 @@ module MarkdownMedia
103
103
  def extract_options url:, include_media: true
104
104
  type = nil
105
105
 
106
- case url.host
107
- when /youtube.com/
106
+ if url.to_s =~ %r{youtube.com/embed}
108
107
  slug = "youtube"
109
- embed_id = nil
110
-
111
- url.query.split("&").each do |key_value_pair|
112
- argument, value = key_value_pair.split("=")
113
- if argument == "v"
114
- embed_id = value
115
- end
116
- end
117
-
118
- when "youtu.be"
119
- slug = "youtube"
120
- embed_id = url.path.split("/").map{ |path_piece| path_piece unless path_piece.to_s.empty? }.compact.first
121
-
122
- when /dailymotion.com/
123
- slug = "dailymotion"
124
- embed_id = url.path.split("/video/").map{ |path_piece| path_piece unless path_piece.to_s.empty? }.compact.first.split("_").first
125
-
126
- when "vimeo.com"
127
- slug = "vimeo"
128
- embed_id = url.path.split("/").map{ |path_piece| path_piece unless path_piece.to_s.empty? }.compact.first
129
-
130
- when "twitter.com"
131
- slug = "twitter"
132
- type ||= "tweet"
133
-
134
- when /instagram/
135
- slug = "instagram"
108
+ embed_id = url.path.split("/embed/")[1]
109
+ else
136
110
 
137
- when "giphy.com"
138
- slug = "giphy"
139
- embed_id = url.path.split("/").last.split('-').last
111
+ case url.host
112
+ when /youtube.com/
113
+ slug = "youtube"
114
+ embed_id = nil
140
115
 
141
- else
142
- slug =
143
- case url.path
144
- when /\.mp3|\.aac|\.wav|\.ogg|\.oga|\.m4a/
145
- "audio"
146
- when /\.mp4|\.avi|\.mov|\.ogv|\.webm|\.m4v|\.3gp|\.m3u8/
147
- "video"
148
- when /\.png|\.jpeg|\.jpg|\.gif|\.svg/
149
- "image"
150
- else
151
- "link"
116
+ url.query.split("&").each do |key_value_pair|
117
+ argument, value = key_value_pair.split("=")
118
+ if argument == "v"
119
+ embed_id = value
120
+ end
152
121
  end
122
+
123
+ when "youtu.be"
124
+ slug = "youtube"
125
+ embed_id = url.path.split("/").map{ |path_piece| path_piece unless path_piece.to_s.empty? }.compact.first
126
+
127
+ when /dailymotion.com/
128
+ slug = "dailymotion"
129
+ embed_id = url.path.split("/video/").map{ |path_piece| path_piece unless path_piece.to_s.empty? }.compact.first.split("_").first
130
+
131
+ when "vimeo.com"
132
+ slug = "vimeo"
133
+ embed_id = url.path.split("/").map{ |path_piece| path_piece unless path_piece.to_s.empty? }.compact.first
134
+
135
+ when "twitter.com"
136
+ slug = "twitter"
137
+ type ||= "tweet"
138
+
139
+ when /instagram/
140
+ slug = "instagram"
141
+
142
+ when "giphy.com"
143
+ slug = "giphy"
144
+ embed_id = url.path.split("/").last.split('-').last
145
+
146
+ when "kolektiva.media"
147
+ slug = "kolektiva"
148
+ embed_id = url.path.split("/").last
149
+
150
+ else
151
+ slug =
152
+ case url.path
153
+ when /\.mp3|\.aac|\.wav|\.ogg|\.oga|\.m4a/
154
+ "audio"
155
+ when /\.mp4|\.avi|\.mov|\.ogv|\.webm|\.m4v|\.3gp|\.m3u8/
156
+ "video"
157
+ when /\.png|\.jpeg|\.jpg|\.gif|\.svg/
158
+ "image"
159
+ else
160
+ "link"
161
+ end
162
+ end
153
163
  end
154
164
 
155
165
  slug = 'link' if include_media == false
@@ -2,7 +2,7 @@
2
2
  <iframe frameborder="0" src="//www.dailymotion.com/embed/video/<%= embed_id %>" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
3
3
 
4
4
  <% unless caption.to_s.empty? %>
5
- <figcaption class="caption video-caption video-caption-vimeo">
5
+ <figcaption class="caption video-caption video-caption-dailymotion">
6
6
  <%= MarkdownMedia.render_markdown caption %>
7
7
  </figcaption>
8
8
  <% end %>
@@ -0,0 +1,9 @@
1
+ <figure class="video-container <%= klass %>" id="<%= id %>">
2
+ <iframe src="https://kolektiva.media/videos/embed/<%= embed_id %>" frameborder="0" allowfullscreen sandbox="allow-same-origin allow-scripts allow-popups"></iframe>
3
+
4
+ <% unless caption.to_s.empty? %>
5
+ <figcaption class="caption video-caption video-caption-kolektiva">
6
+ <%= MarkdownMedia.render_markdown caption %>
7
+ </figcaption>
8
+ <% end %>
9
+ </figure>
@@ -1,5 +1,5 @@
1
1
  <figure class="video-container <%= klass %>" id="<%= id %>">
2
- <iframe src="https://www.youtube.com/embed/<%= embed_id %>" frameborder="0" gesture="media" allow="encrypted-media" allowfullscreen></iframe>
2
+ <iframe credentialless allowfullscreen referrerpolicy="no-referrer" sandbox="allow-scripts allow-same-origin" allow="accelerometer 'none'; ambient-light-sensor 'none'; autoplay 'none'; battery 'none'; bluetooth 'none'; browsing-topics 'none'; camera 'none'; ch-ua 'none'; display-capture 'none'; domain-agent 'none'; document-domain 'none'; encrypted-media 'none'; execution-while-not-rendered 'none'; execution-while-out-of-viewport 'none'; gamepad 'none'; geolocation 'none'; gyroscope 'none'; hid 'none'; identity-credentials-get 'none'; idle-detection 'none'; keyboard-map 'none'; local-fonts 'none'; magnetometer 'none'; microphone 'none'; midi 'none'; navigation-override 'none'; otp-credentials 'none'; payment 'none'; picture-in-picture 'none'; publickey-credentials-create 'none'; publickey-credentials-get 'none'; screen-wake-lock 'none'; serial 'none'; speaker-selection 'none'; sync-xhr 'none'; usb 'none'; web-share 'none'; window-management 'none'; xr-spatial-tracking 'none'" csp="sandbox allow-scripts allow-same-origin;" src="https://www.youtube-nocookie.com/embed/<%= embed_id %>" frameborder="0" loading="lazy" ></iframe>
3
3
 
4
4
  <% unless caption.to_s.empty? %>
5
5
  <figcaption class="caption video-caption video-caption-youtube">
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: markdown_media
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shane Becker
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-01-06 00:00:00.000000000 Z
11
+ date: 2024-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -76,9 +76,9 @@ executables: []
76
76
  extensions: []
77
77
  extra_rdoc_files: []
78
78
  files:
79
+ - ".github/workflows/tests.yml"
79
80
  - ".gitignore"
80
81
  - ".rspec"
81
- - ".travis.yml"
82
82
  - CODE_OF_CONDUCT.md
83
83
  - Gemfile
84
84
  - LICENSE.md
@@ -93,6 +93,7 @@ files:
93
93
  - lib/templates/giphy.erb
94
94
  - lib/templates/image.erb
95
95
  - lib/templates/instagram.erb
96
+ - lib/templates/kolektiva.erb
96
97
  - lib/templates/link.erb
97
98
  - lib/templates/twitter.erb
98
99
  - lib/templates/video.erb
@@ -103,7 +104,7 @@ homepage: https://github.com/veganstraightedge/markdown_media
103
104
  licenses:
104
105
  - CC0
105
106
  metadata: {}
106
- post_install_message:
107
+ post_install_message:
107
108
  rdoc_options: []
108
109
  require_paths:
109
110
  - lib
@@ -118,8 +119,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
119
  - !ruby/object:Gem::Version
119
120
  version: '0'
120
121
  requirements: []
121
- rubygems_version: 3.0.6
122
- signing_key:
122
+ rubygems_version: 3.5.9
123
+ signing_key:
123
124
  specification_version: 4
124
125
  summary: A [[ URL ]] syntax to embed media into views.
125
126
  test_files: []
data/.travis.yml DELETED
@@ -1,7 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.2.0
5
- - 2.3.0
6
- - 2.4.0
7
- before_install: gem install bundler -v 1.14.5