markdown_media 1.3 → 1.4

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
- SHA1:
3
- metadata.gz: 7c783195b2805f1968847903953f28c369539484
4
- data.tar.gz: 9faf2d6ee457d0c93693cc4446c7cda2688fcfca
2
+ SHA256:
3
+ metadata.gz: 3d22a4a1b8de635e7282c224074cb15791846b14f47cc520094c8f25403b303c
4
+ data.tar.gz: 83e1124968bd7191315f41c877ffdc90668ca99029e35a644c2f1ea06bdc45ac
5
5
  SHA512:
6
- metadata.gz: 73d5056d1e39114551b9b50af7098428c9dc0d88e27915b2bbce98484a62d5bde01f47301cc61730c06ef10c3ff59f5216d5c419aca657bcd8ac30c83867bd97
7
- data.tar.gz: 9521dfa197f1955358fe12a434044cc2982d0d48d354b093982643d75ef96bf17c52b14f62d5cd0191594146fb10c3a5ff50ee7b4477ceab2e30d1b358cff550
6
+ metadata.gz: 9780c13fa7738fb34be102056e3c0a78ac202f1e5911f9bdd857e78aa4907cd21c891cd08c7fb0431031a25bfee64fa0a4cb9a3f9ec57993d527ccb944c50936
7
+ data.tar.gz: e416e2dd0363a7b22a116b9be2c3e4f858dad78a428dcf7d5a46f5ec25685ef8748679a43d3f143ed86d3f245af33734cb86dbbe6f96e74301d388155c7d51a5
data/README.md CHANGED
@@ -2,30 +2,30 @@
2
2
 
3
3
  [![Build Status](https://travis-ci.org/veganstraightedge/markdown_media.svg?branch=master)](https://travis-ci.org/veganstraightedge/markdown_media)
4
4
  [![Code Climate](https://codeclimate.com/github/veganstraightedge/markdown_media/badges/gpa.svg)](https://codeclimate.com/github/veganstraightedge/markdown_media)
5
- ![Version 1.0.0](https://img.shields.io/badge/VERSION-1.2.1-green.svg)
5
+ ![Version 1.2.1](https://img.shields.io/badge/VERSION-1.2.1-green.svg)
6
6
 
7
7
  This syntax uses doubles square brackets on each side of a URL and optional options.
8
- It expands into the current preferred embed code for that site's media or raw media.
8
+ It expands into the current preferred embed code for that sites media or raw media.
9
9
  Supported media types: YouTube, Vimeo, Instagram, Twitter, Daily Motion, images, videos, audios.
10
10
 
11
11
 
12
12
  ## Installation
13
13
 
14
- Add this line to your application's Gemfile:
14
+ Add this line to your applications Gemfile:
15
15
 
16
16
  ```ruby
17
- gem "markdown_media"
17
+ gem 'markdown_media'
18
18
  ```
19
19
 
20
20
  And then execute:
21
21
 
22
- ```
22
+ ```sh
23
23
  bundle
24
24
  ```
25
25
 
26
26
  Or install it yourself as:
27
27
 
28
- ```
28
+ ```sh
29
29
  gem install markdown_media
30
30
  ```
31
31
 
@@ -34,11 +34,11 @@ gem install markdown_media
34
34
 
35
35
  ### As a Writer
36
36
 
37
- This a syntax that can sit on top of Markdown (or any templating format, except MediaWiki which already uses the double square bracket syntax). The purpose is to simplify adding images (with or without caption and optionally linked), videos, tweets, audio, etc for writers in a CMS. The HTML that we want for a video is different from an image. But as a writer, it's conceptually the same, "here's a piece of media and its caption, stick it in the page right here".
37
+ This a syntax that can sit on top of Markdown (or any templating format, except MediaWiki which already uses the double square bracket syntax). The purpose is to simplify adding images (with or without caption and optionally linked), videos, tweets, audio, etc for writers in a CMS. The HTML that we want for a video is different from an image. But as a writer, its conceptually the same, heres a piece of media and its caption, stick it in the page right here”.
38
38
 
39
- So, the media embed syntax makes it so you don't have to think about the differences between YouTube, Vimeo, Twitter and an image. Here's how it works.
39
+ So, the media embed syntax makes it so you dont have to think about the differences between YouTube, Vimeo, Twitter and an image. Heres how it works.
40
40
 
41
- There are six pieces. Some are required. Some are optional. It must always be on one line. But for explanation here, I'll put them on separate lines, then tie it all together.
41
+ There are six pieces. Some are required. Some are optional. It must always be on one line. But for explanation here, Ill put them on separate lines, then tie it all together.
42
42
 
43
43
  ```
44
44
  [[
@@ -51,7 +51,7 @@ type (used for Twitter video)
51
51
  ]]
52
52
  ```
53
53
 
54
- Here's what they all mean.
54
+ Heres what they all mean.
55
55
 
56
56
  - **Required**. Always put a blank line above the media embed
57
57
  - **Required**. Always start the media embed with two left square brackets (no space between them).
@@ -64,14 +64,14 @@ Here's what they all mean.
64
64
 
65
65
  ### As a Developer
66
66
 
67
- ```
68
- MarkdownMedia.parse("[[https://example.com/photo.png]]")
67
+ ```ruby
68
+ MarkdownMedia.parse('[[https://example.com/photo.png]]')
69
69
  ```
70
70
 
71
71
  In Rails, you might also need to add `.html_safe` to avoid escaping.
72
72
 
73
- ```
74
- MarkdownMedia.parse("[[https://example.com/photo.png]]").html_safe
73
+ ```ruby
74
+ MarkdownMedia.parse('[[https://example.com/photo.png]]').html_safe
75
75
  ```
76
76
 
77
77
  ### Examples
@@ -87,13 +87,13 @@ A simple image.
87
87
  An image with a caption.
88
88
 
89
89
  ```
90
- [[https://example.com/image.png Look at me, I'm a caption!]]
90
+ [[https://example.com/image.png Look at me, Im a caption!]]
91
91
  ```
92
92
 
93
93
  An image with Markdown in the caption.
94
94
 
95
95
  ```
96
- [[https://example.com/image.png _Look at me_, I'm a **caption**!]]
96
+ [[https://example.com/image.png _Look at me_, Im a **caption**!]]
97
97
  ```
98
98
 
99
99
  An image linked to a URL (requires a caption present).
@@ -146,7 +146,7 @@ A video from YouTube with caption.
146
146
  [[https://www.youtube.com/watch?v=YX40hbAHx3s P vs. NP and the Computational Complexity Zoo]]
147
147
  ```
148
148
 
149
- YouTube's short URL format also works.
149
+ YouTubes short URL format also works.
150
150
 
151
151
  ```
152
152
  [[https://youtu.be/YX40hbAHx3s]]
@@ -164,6 +164,18 @@ A video from Twitter.
164
164
  [[https://twitter.com/Breaking911/status/900211169734131713 type:video]]
165
165
  ```
166
166
 
167
+ A video/gif from Giphy.
168
+
169
+ ```
170
+ [[https://giphy.com/gifs/cat-funny-OrNbkY7oQOrh6]]
171
+ ```
172
+
173
+ A video/gif from Giphy with caption.
174
+
175
+ ```
176
+ [[https://giphy.com/gifs/cat-funny-OrNbkY7oQOrh6 Dogs and cats are buddies.]]
177
+ ```
178
+
167
179
  #### Audio
168
180
 
169
181
  A simple audio.
@@ -183,10 +195,16 @@ A simple audio with caption.
183
195
  Any URL in a [[]] block that is unrecognized, just gets rendered into a linked URL.
184
196
 
185
197
  ```
186
- [[https://veganstraightedge.com/cancer]] gets turned into <a href="https://veganstraightedge.com/cancer">https://veganstraightedge.com/cancer</a>.
198
+ [[https://veganstraightedge.com/cancer]]
199
+ ```
200
+
201
+ That gets turned into this.
202
+
203
+ ```html
204
+ <a href='https://veganstraightedge.com/cancer'>https://veganstraightedge.com/cancer</a>.
187
205
  ```
188
206
 
189
- If you try to embed some piece of media and it renders to a URL that means that that kind of URL isn't supported yet. But don't distress, new sites are pretty easy to add. So, raise a flag in Slack or GitHub Issues.
207
+ If you try to embed some piece of media and it renders to a URL that means that that kind of URL isnt supported yet. But dont distress, new sites are pretty easy to add. So, raise a flag in Slack or GitHub Issues.
190
208
 
191
209
  ### Supported Media URLs
192
210
 
@@ -207,6 +225,7 @@ Here are the currently supported URLs and media types.
207
225
  - https://youtu.be/video-id
208
226
  - http://www.dailymotion.com/video/video-id_video-slug
209
227
  - https://twitter.com/Breaking911/status/900211169734131713
228
+ - https://giphy.com/gifs/cat-funny-OrNbkY7oQOrh6
210
229
 
211
230
  #### Audios
212
231
 
@@ -250,6 +269,6 @@ Your heart is as free as the air you breathe. <br>
250
269
  The ground you stand on is liberated territory.
251
270
 
252
271
  In legal text, *Markdown Media* is dedicated to the public domain
253
- using Creative Commons -- CC0 1.0 Universal.
272
+ using Creative Commons CC0 1.0 Universal.
254
273
 
255
- [http://creativecommons.org/publicdomain/zero/1.0](http://creativecommons.org/publicdomain/zero/1.0 "Creative Commons &mdash; CC0 1.0 Universal")
274
+ [http://creativecommons.org/publicdomain/zero/1.0](http://creativecommons.org/publicdomain/zero/1.0 "Creative Commons CC0 1.0 Universal")
@@ -1,3 +1,3 @@
1
1
  module MarkdownMedia
2
- VERSION = "1.3"
2
+ VERSION = "1.4"
3
3
  end
@@ -109,6 +109,10 @@ module MarkdownMedia
109
109
  when /instagram/
110
110
  slug = "instagram"
111
111
 
112
+ when "giphy.com"
113
+ slug = "giphy"
114
+ embed_id = url.path.split("/").last.split('-').last
115
+
112
116
  else
113
117
  slug = case url.path
114
118
 
@@ -0,0 +1,11 @@
1
+ <figure class="video-container <%= klass %>" id="<%= id %>">
2
+ <div style="width:100%;height:0;padding-bottom:56%;position:relative;">
3
+ <iframe src="https://giphy.com/embed/<%= embed_id %>" width="100%" height="100%" style="position:absolute" frameborder="0" class="giphy-embed" webkitallowfullscreen mozallowfullscreen allowFullScreen></iframe>
4
+ </div>
5
+
6
+ <% unless caption.to_s.empty? %>
7
+ <figcaption class="caption video-caption video-caption-giphy">
8
+ <%= MarkdownMedia.render_markdown caption %>
9
+ </figcaption>
10
+ <% end %>
11
+ </figure>
@@ -28,9 +28,9 @@ Gem::Specification.new do |spec|
28
28
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
29
29
  spec.require_paths = ["lib"]
30
30
 
31
- spec.add_development_dependency "bundler", "~> 1.14"
32
- spec.add_development_dependency "rake", "~> 10.0"
33
- spec.add_development_dependency "rspec", "~> 3.7"
31
+ spec.add_development_dependency "bundler"
32
+ spec.add_development_dependency "rake"
33
+ spec.add_development_dependency "rspec"
34
34
 
35
35
  spec.add_runtime_dependency "kramdown"
36
36
  end
metadata CHANGED
@@ -1,57 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: markdown_media
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.3'
4
+ version: '1.4'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shane Becker
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-12-19 00:00:00.000000000 Z
11
+ date: 2018-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.14'
19
+ version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.14'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '3.7'
47
+ version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '3.7'
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: kramdown
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -90,6 +90,7 @@ files:
90
90
  - lib/markdown_media/version.rb
91
91
  - lib/templates/audio.erb
92
92
  - lib/templates/dailymotion.erb
93
+ - lib/templates/giphy.erb
93
94
  - lib/templates/image.erb
94
95
  - lib/templates/instagram.erb
95
96
  - lib/templates/link.erb
@@ -118,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
119
  version: '0'
119
120
  requirements: []
120
121
  rubyforge_project:
121
- rubygems_version: 2.6.13
122
+ rubygems_version: 2.7.6
122
123
  signing_key:
123
124
  specification_version: 4
124
125
  summary: A [[ URL ]] syntax to embed media into views.