mastalk 0.5.9 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +91 -1
- data/lib/mastalk/extensions.rb +1 -0
- data/lib/mastalk/snippets/bright_video.html.erb +2 -1
- data/lib/mastalk/snippets/vimeo_video.html.erb +2 -1
- data/lib/mastalk/snippets/youtube_video.html.erb +9 -0
- data/lib/mastalk/snippets/{video.html.erb → youtube_video_legacy.html.erb} +0 -0
- data/mastalk.gemspec +1 -1
- data/spec/mastalk_spec.rb +80 -9
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 142542ba7114af62f17ff07bce33fed666fb13f4
|
4
|
+
data.tar.gz: 65302ae5e6b40ab47424c74952c3150819e492ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a3daed5e8da337a5aeea8d3a685031ea6917c0dac163b1a4ac81567a0c1bf5fac2728a2c1bf004d3b44e550bf12fdedf3116ee41c89ed086696ac20d498834b
|
7
|
+
data.tar.gz: 36b9ccec884afa53fa692e6d8c3c87b6f30dd88ca900e28a77c51d35b2c72d00c28025d7f6b70b16c1a7d8defe03ad2b3e0d4e455d92b6e492cf3ce1caeda0fb
|
data/README.md
CHANGED
@@ -138,9 +138,52 @@ Outputs:
|
|
138
138
|
|
139
139
|
`.video-wrapper`
|
140
140
|
|
141
|
+
Embedding a YouTube video:
|
142
|
+
|
141
143
|
```
|
142
|
-
|
144
|
+
$~youtube_video
|
145
|
+
5n1nixLSrQI
|
146
|
+
~$
|
143
147
|
|
148
|
+
```
|
149
|
+
Outputs:
|
150
|
+
|
151
|
+
```
|
152
|
+
<iframe
|
153
|
+
frameborder="0"
|
154
|
+
height="413"
|
155
|
+
width="680"
|
156
|
+
src= "https://www.youtube.com/embed/5n1nixLSrQI"
|
157
|
+
title="Video">
|
158
|
+
</iframe>
|
159
|
+
```
|
160
|
+
|
161
|
+
Or with a custom title:
|
162
|
+
|
163
|
+
```
|
164
|
+
$~youtube_video
|
165
|
+
5n1nixLSrQI
|
166
|
+
The title of this video
|
167
|
+
~$
|
168
|
+
|
169
|
+
```
|
170
|
+
Outputs:
|
171
|
+
|
172
|
+
```
|
173
|
+
<iframe
|
174
|
+
frameborder="0"
|
175
|
+
height="413"
|
176
|
+
width="680"
|
177
|
+
src= "https://www.youtube.com/embed/5n1nixLSrQI"
|
178
|
+
title="The title of this video">
|
179
|
+
</iframe>
|
180
|
+
```
|
181
|
+
|
182
|
+
Alternatively there is also this legacy format (just here for backward
|
183
|
+
compatibility):
|
184
|
+
|
185
|
+
```
|
186
|
+
({5n1nixLSrQI})
|
144
187
|
```
|
145
188
|
|
146
189
|
Outputs:
|
@@ -155,17 +198,41 @@ Outputs:
|
|
155
198
|
</iframe>
|
156
199
|
```
|
157
200
|
|
201
|
+
Embedding a Brightcove video:
|
202
|
+
|
158
203
|
```
|
159
204
|
$~brightcove_video
|
160
205
|
3739688349001
|
161
206
|
~$
|
207
|
+
```
|
208
|
+
|
209
|
+
Outputs:
|
162
210
|
|
211
|
+
```
|
212
|
+
<iframe src='//players.brightcove.net/3608769895001/b15c0e6a-51da-4bb1-b717-bccae778670d_default/index.html?videoId=3739688349001'
|
213
|
+
frameBorder="0"
|
214
|
+
allowfullscreen=""
|
215
|
+
webkitallowfullscreen=""
|
216
|
+
mozallowfullscreen=""
|
217
|
+
height="413"
|
218
|
+
width="680" >
|
219
|
+
</iframe>
|
220
|
+
```
|
221
|
+
|
222
|
+
Or with a custom title:
|
223
|
+
|
224
|
+
```
|
225
|
+
$~brightcove_video
|
226
|
+
3739688349001
|
227
|
+
The title of this video
|
228
|
+
~$
|
163
229
|
```
|
164
230
|
|
165
231
|
Outputs:
|
166
232
|
|
167
233
|
```
|
168
234
|
<iframe src='//players.brightcove.net/3608769895001/b15c0e6a-51da-4bb1-b717-bccae778670d_default/index.html?videoId=3739688349001'
|
235
|
+
title="The title of this video"
|
169
236
|
frameBorder="0"
|
170
237
|
allowfullscreen=""
|
171
238
|
webkitallowfullscreen=""
|
@@ -175,9 +242,31 @@ Outputs:
|
|
175
242
|
</iframe>
|
176
243
|
```
|
177
244
|
|
245
|
+
Embedding a Vimeo video:
|
246
|
+
|
247
|
+
```
|
248
|
+
$~vimeo_video
|
249
|
+
146226360
|
250
|
+
~$
|
251
|
+
```
|
252
|
+
|
253
|
+
Outputs:
|
254
|
+
|
255
|
+
```
|
256
|
+
<iframe src="https://player.vimeo.com/video/146226360?portrait=0&title=0&byline=0"
|
257
|
+
frameborder="0"
|
258
|
+
webkitallowfullscreen
|
259
|
+
mozallowfullscreen
|
260
|
+
allowfullscreen>
|
261
|
+
</iframe>
|
262
|
+
```
|
263
|
+
|
264
|
+
Or with a custom title:
|
265
|
+
|
178
266
|
```
|
179
267
|
$~vimeo_video
|
180
268
|
146226360
|
269
|
+
The title of this video
|
181
270
|
~$
|
182
271
|
|
183
272
|
```
|
@@ -185,6 +274,7 @@ Outputs:
|
|
185
274
|
|
186
275
|
```
|
187
276
|
<iframe src="https://player.vimeo.com/video/146226360?portrait=0&title=0&byline=0"
|
277
|
+
title="The title of this video"
|
188
278
|
frameborder="0"
|
189
279
|
webkitallowfullscreen
|
190
280
|
mozallowfullscreen
|
data/lib/mastalk/extensions.rb
CHANGED
@@ -27,6 +27,7 @@ module Mastalk
|
|
27
27
|
content = File.read(File.join(SNIPPETS_FOLDER, file))
|
28
28
|
start, stop = args(content)
|
29
29
|
extension(start, stop) do |body|
|
30
|
+
body_lines = body.strip.gsub(/(\n|\r)+/, "\n").split(/\n/)
|
30
31
|
ERB.new(remove_syntax_from(content)).result(binding)
|
31
32
|
end
|
32
33
|
end
|
@@ -1,7 +1,8 @@
|
|
1
1
|
# $~brightcove_video, ~$
|
2
2
|
|
3
3
|
<div class="video-wrapper">
|
4
|
-
<iframe src='//players.brightcove.net/3608769895001/b15c0e6a-51da-4bb1-b717-bccae778670d_default/index.html?videoId=<%=
|
4
|
+
<iframe src='//players.brightcove.net/3608769895001/b15c0e6a-51da-4bb1-b717-bccae778670d_default/index.html?videoId=<%= body_lines[0].strip %>'
|
5
|
+
title="<%= (body_lines[1] || 'Video').strip %>"
|
5
6
|
frameBorder="0"
|
6
7
|
allowfullscreen=""
|
7
8
|
webkitallowfullscreen=""
|
@@ -1,7 +1,8 @@
|
|
1
1
|
# $~vimeo_video, ~$
|
2
2
|
|
3
3
|
<div class="video-wrapper">
|
4
|
-
<iframe src="https://player.vimeo.com/video/<%=
|
4
|
+
<iframe src="https://player.vimeo.com/video/<%= body_lines[0].strip %>?portrait=0&title=0&byline=0"
|
5
|
+
title="<%= (body_lines[1] || 'Video').strip %>"
|
5
6
|
frameborder="0"
|
6
7
|
webkitallowfullscreen
|
7
8
|
mozallowfullscreen
|
File without changes
|
data/mastalk.gemspec
CHANGED
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = 'mastalk'
|
6
|
-
s.version = '0.
|
6
|
+
s.version = '0.6.0'
|
7
7
|
s.summary = 'mastalk'
|
8
8
|
s.description = 'Mastalk markdown extension language'
|
9
9
|
s.authors = ['Douglas Roper', 'Justin Perry']
|
data/spec/mastalk_spec.rb
CHANGED
@@ -142,11 +142,32 @@ describe Mastalk::Document do
|
|
142
142
|
end
|
143
143
|
end
|
144
144
|
|
145
|
-
context '
|
146
|
-
let(:
|
145
|
+
context 'when brightcove video' do
|
146
|
+
let(:video_id) { '3739688349001' }
|
147
147
|
|
148
|
-
|
149
|
-
|
148
|
+
context 'without a title' do
|
149
|
+
let(:source) { "$~brightcove_video#{video_id}~$" }
|
150
|
+
|
151
|
+
it 'outputs the brightcove embed video' do
|
152
|
+
expect(subject.to_html).to include("src=\"//players.brightcove.net/3608769895001/b15c0e6a-51da-4bb1-b717-bccae778670d_default/index.html?videoId=#{video_id}\"")
|
153
|
+
end
|
154
|
+
|
155
|
+
it 'outputs sets a default title on the iframe' do
|
156
|
+
expect(subject.to_html).to include('title="Video"')
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
context 'without a custom title' do
|
161
|
+
let(:title) { 'a custom video title'}
|
162
|
+
let(:source) { "$~brightcove_video#{video_id}\n#{title}~$" }
|
163
|
+
|
164
|
+
it 'outputs the brightcove embed video' do
|
165
|
+
expect(subject.to_html).to include("src=\"//players.brightcove.net/3608769895001/b15c0e6a-51da-4bb1-b717-bccae778670d_default/index.html?videoId=#{video_id}\"")
|
166
|
+
end
|
167
|
+
|
168
|
+
it 'outputs sets a default title on the iframe' do
|
169
|
+
expect(subject.to_html).to include("title=\"#{title}\"")
|
170
|
+
end
|
150
171
|
end
|
151
172
|
end
|
152
173
|
|
@@ -158,7 +179,7 @@ describe Mastalk::Document do
|
|
158
179
|
end
|
159
180
|
end
|
160
181
|
|
161
|
-
context 'when youtube video' do
|
182
|
+
context 'when youtube video (legacy format)' do
|
162
183
|
let(:source) { '({oZ0_U108aZw})' }
|
163
184
|
|
164
185
|
it 'outputs the youtube embed video' do
|
@@ -166,11 +187,61 @@ describe Mastalk::Document do
|
|
166
187
|
end
|
167
188
|
end
|
168
189
|
|
169
|
-
context '
|
170
|
-
let(:
|
190
|
+
context 'when youtube video (new format)' do
|
191
|
+
let(:video_id) { 'oZ0_U108aZw' }
|
171
192
|
|
172
|
-
|
173
|
-
|
193
|
+
context 'without a title' do
|
194
|
+
let(:source) { "$~youtube_video#{video_id}~$" }
|
195
|
+
|
196
|
+
it 'outputs the youtube embed video' do
|
197
|
+
expect(subject.to_html).to include("src=\"https://www.youtube.com/embed/#{video_id}?rel=0\"")
|
198
|
+
end
|
199
|
+
|
200
|
+
it 'outputs sets a default title on the iframe' do
|
201
|
+
expect(subject.to_html).to include('title="Video"')
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
205
|
+
context 'without a custom title' do
|
206
|
+
let(:title) { 'a custom video title' }
|
207
|
+
let(:source) { "$~youtube_video#{video_id}\n#{title}~$" }
|
208
|
+
|
209
|
+
it 'outputs the youtube embed video' do
|
210
|
+
expect(subject.to_html).to include("src=\"https://www.youtube.com/embed/#{video_id}?rel=0\"")
|
211
|
+
end
|
212
|
+
|
213
|
+
it 'outputs sets a default title on the iframe' do
|
214
|
+
expect(subject.to_html).to include("title=\"#{title}\"")
|
215
|
+
end
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
context 'when vimeo video' do
|
220
|
+
let(:video_id) { '145743834' }
|
221
|
+
|
222
|
+
context 'without a title' do
|
223
|
+
let(:source) { "$~vimeo_video#{video_id}~$" }
|
224
|
+
|
225
|
+
it 'outputs the vimeo embed video' do
|
226
|
+
expect(subject.to_html).to include("src=\"https://player.vimeo.com/video/#{video_id}?portrait=0&title=0&byline=0\"")
|
227
|
+
end
|
228
|
+
|
229
|
+
it 'outputs sets a default title on the iframe' do
|
230
|
+
expect(subject.to_html).to include('title="Video"')
|
231
|
+
end
|
232
|
+
end
|
233
|
+
|
234
|
+
context 'without a custom title' do
|
235
|
+
let(:title) { 'a custom video title' }
|
236
|
+
let(:source) { "$~vimeo_video#{video_id}\n#{title}~$" }
|
237
|
+
|
238
|
+
it 'outputs the vimeo embed video' do
|
239
|
+
expect(subject.to_html).to include("src=\"https://player.vimeo.com/video/#{video_id}?portrait=0&title=0&byline=0\"")
|
240
|
+
end
|
241
|
+
|
242
|
+
it 'outputs sets a default title on the iframe' do
|
243
|
+
expect(subject.to_html).to include("title=\"#{title}\"")
|
244
|
+
end
|
174
245
|
end
|
175
246
|
end
|
176
247
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mastalk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Douglas Roper
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-03
|
12
|
+
date: 2016-08-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: kramdown
|
@@ -123,10 +123,11 @@ files:
|
|
123
123
|
- lib/mastalk/snippets/points.html.erb
|
124
124
|
- lib/mastalk/snippets/ticks.html.erb
|
125
125
|
- lib/mastalk/snippets/tool.html.erb
|
126
|
-
- lib/mastalk/snippets/video.html.erb
|
127
126
|
- lib/mastalk/snippets/vimeo_video.html.erb
|
128
127
|
- lib/mastalk/snippets/why.html.erb
|
129
128
|
- lib/mastalk/snippets/yes.html.erb
|
129
|
+
- lib/mastalk/snippets/youtube_video.html.erb
|
130
|
+
- lib/mastalk/snippets/youtube_video_legacy.html.erb
|
130
131
|
- mastalk.gemspec
|
131
132
|
- spec/mastalk_spec.rb
|
132
133
|
- spec/spec_helper.rb
|