reveal-ck 3.5.1 → 3.6.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
  SHA1:
3
- metadata.gz: 672a77ecbcabbec2df42ba7cfbba21b46a4a4123
4
- data.tar.gz: 5daf328bdd2e713373469133d2ab9c566a36dd67
3
+ metadata.gz: 35dca89fefa9a67e27ae9e895b8825ba195fe905
4
+ data.tar.gz: 774ce2424ecda5c7c2b3b5c3b4daccb93fa14752
5
5
  SHA512:
6
- metadata.gz: 65d42838ba9a956611bd92dc4a45d62780849ce8b03d1cc897654bbae1327e621861a86ffc387a8c4bb7897829bed5fad8dc9d8d4de925e5e9967e6d5673ed27
7
- data.tar.gz: fd19909cb7ef6bb81e77de54c5e63774a881068fa5bae128dec01ca629d124d4c20c8d36fd442ed3b9f58771315d17113f8e9d0dd8faf6556fb2563321bd8f1f
6
+ metadata.gz: 75700135fe17408154e56ddeeda673904e1ebc62c26db3d30044537dc56bc4bfe46db17c14c26033a3fd56ca3a6dccdc46b90cc41ecd74d10e785d073e8be19a
7
+ data.tar.gz: 26a79e3851769b63e5ba2260a29ddf459137ff9480507e17f56ad7f70b5400dc2433c51e9be54dbd682a4fae8597159577b4351ce513c218f4a92c021b9c8a8e
data/Rakefile CHANGED
@@ -13,4 +13,4 @@ end
13
13
 
14
14
  task default: :ci
15
15
 
16
- task test: [:spec, :cucumber]
16
+ task test: %i[spec cucumber]
data/bin/reveal-ck CHANGED
@@ -14,10 +14,10 @@ class RevealCKExecutable
14
14
  command :generate do |c|
15
15
  default_file = FileList['slides.*'].first
16
16
  c.desc 'The file containing your slide content'
17
- c.flag [:f, :file], default_value: default_file
17
+ c.flag %i[f file], default_value: default_file
18
18
 
19
19
  c.desc 'The directory for generated slides. Default based on slide file.'
20
- c.flag [:d, :dir]
20
+ c.flag %i[d dir]
21
21
 
22
22
  c.action do |_, options, _|
23
23
  slides_file = options[:file]
@@ -51,16 +51,16 @@ class RevealCKExecutable
51
51
  command :serve, :server do |c|
52
52
  default_file = FileList['slides.*'].first
53
53
  c.desc 'The file containing your slide content'
54
- c.flag [:f, :file], default_value: default_file
54
+ c.flag %i[f file], default_value: default_file
55
55
 
56
56
  c.desc 'The directory to serve up. Default is based on slide file.'
57
- c.flag [:d, :dir]
57
+ c.flag %i[d dir]
58
58
 
59
59
  c.desc 'The port to serve on'
60
- c.flag [:p, :port], default_value: 10_000
60
+ c.flag %i[p port], default_value: 10_000
61
61
 
62
62
  c.desc 'The host to serve on'
63
- c.flag [:h, :host], default_value: 'localhost'
63
+ c.flag %i[h host], default_value: 'localhost'
64
64
 
65
65
  c.desc 'Exit after starting + n seconds (for testing only)'
66
66
  c.flag ['test-quit-after-starting'], type: Integer
@@ -1,5 +1,5 @@
1
1
  notification :off
2
2
 
3
3
  guard 'livereload' do
4
- watch(/^slides\/index.html$/)
4
+ watch(%r{^slides/index.html$})
5
5
  end
@@ -6,6 +6,14 @@
6
6
  <meta name="author" content="<%= config.author %>">
7
7
  <meta name="generator" content="reveal-ck <%= RevealCK::VERSION %>">
8
8
 
9
+ <% config.meta_properties.each do |property, content| %>
10
+ <meta property="<%= property %>" content="<%= content %>" />
11
+ <% end %>
12
+
13
+ <% config.meta_names.each do |name, content| %>
14
+ <meta name="<%= name %>" content="<%= content %>" />
15
+ <% end %>
16
+
9
17
  <meta name="apple-mobile-web-app-capable" content="yes" />
10
18
  <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
11
19
 
@@ -1,6 +1,6 @@
1
1
  <!doctype html>
2
2
  <html lang="en">
3
- <head>
3
+ <head prefix="<%= head_prefix %>">
4
4
  <%= head %>
5
5
  </head>
6
6
 
@@ -21,6 +21,7 @@ module RevealCK
21
21
  index_html_file = "#{output_dir}/index.html"
22
22
  task(index_html_file => slides_html) do
23
23
  content = IndexHtml.new(slides_html: slides_html,
24
+ head_prefix: config.head_prefix,
24
25
  template: template,
25
26
  config: config).render
26
27
  File.open(index_html_file, 'w') do |index_html|
@@ -9,11 +9,12 @@ module RevealCK
9
9
  class IndexHtml
10
10
  include Retrieve
11
11
 
12
- attr_reader :template, :slides_html, :config
12
+ attr_reader :template, :slides_html, :head_prefix, :config
13
13
 
14
14
  def initialize(args)
15
15
  @template = retrieve(:template, args)
16
16
  @slides_html = retrieve(:slides_html, args)
17
+ @head_prefix = retrieve(:head_prefix, args)
17
18
  @config = retrieve(:config, args)
18
19
  end
19
20
 
@@ -21,7 +22,8 @@ module RevealCK
21
22
  scope = RevealCK::Render::Scope.new(dir: Dir.pwd, config: config)
22
23
  tilt_template = Tilt.new(template)
23
24
  locals = {
24
- slides_html: slides_html
25
+ slides_html: slides_html,
26
+ head_prefix: head_prefix
25
27
  }
26
28
  tilt_template.render(scope, locals)
27
29
  end
@@ -20,16 +20,22 @@ module RevealCK
20
20
  filter_defaults].reduce({}) { |acc, elem| acc.merge(elem) }
21
21
  end
22
22
 
23
+ OPEN_GRAPH_PREFIX =
24
+ 'og: http://ogp.me/ns# ' \
25
+ 'fb: http://ogp.me/ns/fb# ' \
26
+ 'article: http://ogp.me/ns/article#'.freeze
27
+
23
28
  def core_defaults
24
29
  {
25
- 'title' => 'Slides',
26
- 'description' => '',
27
- 'author' => '',
28
- 'theme' => 'black',
29
- 'transition' => 'default',
30
- 'data' => {
31
-
32
- }
30
+ 'title' => 'Slides',
31
+ 'description' => '',
32
+ 'author' => '',
33
+ 'theme' => 'black',
34
+ 'transition' => 'default',
35
+ 'data' => {},
36
+ 'meta_properties' => {},
37
+ 'meta_names' => {},
38
+ 'head_prefix' => OPEN_GRAPH_PREFIX
33
39
  }
34
40
  end
35
41
 
@@ -8,7 +8,7 @@ module RevealCK
8
8
  class Presentation
9
9
  include Retrieve
10
10
  extend Forwardable
11
- [:author, :title, :transition, :theme].each do |name|
11
+ %i[author title transition theme].each do |name|
12
12
  def_delegators :@config, name, "#{name}=".to_sym
13
13
  end
14
14
 
@@ -1,4 +1,4 @@
1
1
  # RevealCK::VERSION is the current version of reveal-ck
2
2
  module RevealCK
3
- VERSION = '3.5.1'.freeze
3
+ VERSION = '3.6.0'.freeze
4
4
  end
data/rakelib/ci.rake CHANGED
@@ -1,2 +1,2 @@
1
1
  desc 'Run Continuous Integration'
2
- task ci: [:spec, :rubocop, :cucumber]
2
+ task ci: %i[spec rubocop cucumber]
@@ -64,7 +64,7 @@ module RevealCK
64
64
  end
65
65
 
66
66
  config = Config.new
67
- config.requires = %w(json time)
67
+ config.requires = %w[json time]
68
68
  application = Rake::Application.new
69
69
  slides_html =
70
70
  CreateSlidesHtml.new(slides_file: slides_file_initial,
@@ -55,7 +55,7 @@ module RevealCK
55
55
 
56
56
  it 'defines a task on the application' do
57
57
  args_expected_to_be_passed_to_rake = {
58
- 'creation_task_testing_class' => %w(foo bar)
58
+ 'creation_task_testing_class' => %w[foo bar]
59
59
  }
60
60
  application = double
61
61
  expect(application)
@@ -13,6 +13,10 @@ module RevealCK
13
13
  spec_data('builders', 'index_html', 'slides.html')
14
14
  end
15
15
 
16
+ let :head_prefix do
17
+ 'head_prefix'
18
+ end
19
+
16
20
  let :config do
17
21
  config = Config.new
18
22
  config.title = 'Sample Title'
@@ -26,6 +30,7 @@ module RevealCK
26
30
  let :index_html do
27
31
  IndexHtml.new(template: index_html_erb,
28
32
  slides_html: slides_html,
33
+ head_prefix: head_prefix,
29
34
  config: config)
30
35
  end
31
36
 
@@ -43,6 +48,11 @@ module RevealCK
43
48
  .to include('<html lang="en">')
44
49
  end
45
50
 
51
+ it 'can render a <head with a prefix' do
52
+ expect(rendered_content)
53
+ .to include('<head prefix="head_prefix">')
54
+ end
55
+
46
56
  it 'prints the program name and version in the generator tag' do
47
57
  expect(rendered_content)
48
58
  .to include(%(<meta name="generator" content="reveal-ck #{version}">))
@@ -57,6 +57,11 @@ module RevealCK
57
57
  .to eq 'https://assets-cdn.github.com/images/icons/'
58
58
  end
59
59
 
60
+ it 'supplies a default head_prefix' do
61
+ expect(config.head_prefix)
62
+ .to eq 'og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# article: http://ogp.me/ns/article#'
63
+ end
64
+
60
65
  it 'supplies a default list of filters' do
61
66
  expect(config.filters).to eq ['HTML::Pipeline::RevealCKEmojiFilter',
62
67
  'HTML::Pipeline::MentionFilter',
@@ -19,19 +19,19 @@ module RevealCK
19
19
 
20
20
  context 'handling notes' do
21
21
  let :transformed_notes do
22
- <<-eos
23
- <div>DIVIDER</div>
22
+ <<-EOS.strip_heredoc
23
+ <div>DIVIDER</div>
24
24
 
25
25
 
26
- <div>NOTES_OPEN</div>
26
+ <div>NOTES_OPEN</div>
27
27
 
28
- This is a note
28
+ This is a note
29
29
 
30
- <div>NOTES_CLOSE</div>
30
+ <div>NOTES_CLOSE</div>
31
31
 
32
32
 
33
- <div>DIVIDER</div>
34
- eos
33
+ <div>DIVIDER</div>
34
+ EOS
35
35
  end
36
36
 
37
37
  it 'translates <div>NOTES_OPEN</div> into <aside class="notes">' do
@@ -47,41 +47,41 @@ eos
47
47
 
48
48
  context 'without vertical slides' do
49
49
  let :three_slide_input do
50
- <<-eos
51
- <div>DIVIDER</div>
50
+ <<-EOS.strip_heredoc
51
+ <div>DIVIDER</div>
52
52
 
53
- <p>First</p>
53
+ <p>First</p>
54
54
 
55
- <div>DIVIDER</div>
55
+ <div>DIVIDER</div>
56
56
 
57
- <p>Second</p>
57
+ <p>Second</p>
58
58
 
59
- <div>DIVIDER</div>
59
+ <div>DIVIDER</div>
60
60
 
61
- <p>Third</p>
61
+ <p>Third</p>
62
62
 
63
- <div>DIVIDER</div>
64
- eos
63
+ <div>DIVIDER</div>
64
+ EOS
65
65
  end
66
66
 
67
67
  let :three_slides_output do
68
- <<-eos
69
- <section>
68
+ <<-EOS.strip_heredoc
69
+ <section>
70
70
 
71
- <p>First</p>
71
+ <p>First</p>
72
72
 
73
- </section>
74
- <section>
73
+ </section>
74
+ <section>
75
75
 
76
- <p>Second</p>
76
+ <p>Second</p>
77
77
 
78
- </section>
79
- <section>
78
+ </section>
79
+ <section>
80
80
 
81
- <p>Third</p>
81
+ <p>Third</p>
82
82
 
83
- </section>
84
- eos
83
+ </section>
84
+ EOS
85
85
  end
86
86
 
87
87
  it 'starts the output with a <section> and a newline' do
@@ -103,43 +103,43 @@ eos
103
103
  context 'with vertical slides' do
104
104
  context 'single vertical slide' do
105
105
  let :single_vertical_input do
106
- <<-eos
107
- <div>VERTICAL_START</div>
106
+ <<-EOS.strip_heredoc
107
+ <div>VERTICAL_START</div>
108
108
 
109
- First
109
+ First
110
110
 
111
- <div>DIVIDER</div>
111
+ <div>DIVIDER</div>
112
112
 
113
- Second
113
+ Second
114
114
 
115
- <div>DIVIDER</div>
115
+ <div>DIVIDER</div>
116
116
 
117
- Third
117
+ Third
118
118
 
119
- <div>VERTICAL_END</div>
120
- eos
119
+ <div>VERTICAL_END</div>
120
+ EOS
121
121
  end
122
122
 
123
123
  let :single_vertical_output do
124
- <<-eos
125
- <section>
126
- <section>
124
+ <<-EOS.strip_heredoc
125
+ <section>
126
+ <section>
127
127
 
128
- First
128
+ First
129
129
 
130
- </section>
131
- <section>
130
+ </section>
131
+ <section>
132
132
 
133
- Second
133
+ Second
134
134
 
135
- </section>
136
- <section>
135
+ </section>
136
+ <section>
137
137
 
138
- Third
138
+ Third
139
139
 
140
- </section>
141
- </section>
142
- eos
140
+ </section>
141
+ </section>
142
+ EOS
143
143
  end
144
144
 
145
145
  it 'starts the output with two <section>s' do
@@ -160,76 +160,76 @@ eos
160
160
 
161
161
  context 'back-to-back vertical slides' do
162
162
  let :double_vertical_input do
163
- <<-eos
164
- <div>VERTICAL_START</div>
163
+ <<-EOS.strip_heredoc
164
+ <div>VERTICAL_START</div>
165
165
 
166
- Vertical A1
166
+ Vertical A1
167
167
 
168
- <div>DIVIDER</div>
168
+ <div>DIVIDER</div>
169
169
 
170
- Vertical A2
170
+ Vertical A2
171
171
 
172
- <div>DIVIDER</div>
172
+ <div>DIVIDER</div>
173
173
 
174
- Vertical A3
174
+ Vertical A3
175
175
 
176
- <div>VERTICAL_END</div>
176
+ <div>VERTICAL_END</div>
177
177
 
178
178
 
179
- <div>VERTICAL_START</div>
179
+ <div>VERTICAL_START</div>
180
180
 
181
- Vertical B1
181
+ Vertical B1
182
182
 
183
- <div>DIVIDER</div>
183
+ <div>DIVIDER</div>
184
184
 
185
- Vertical B2
185
+ Vertical B2
186
186
 
187
- <div>DIVIDER</div>
187
+ <div>DIVIDER</div>
188
188
 
189
- Vertical B3
189
+ Vertical B3
190
190
 
191
- <div>VERTICAL_END</div>
192
- eos
191
+ <div>VERTICAL_END</div>
192
+ EOS
193
193
  end
194
194
 
195
195
  let :double_vertical_output do
196
- <<-eos
197
- <section>
198
- <section>
196
+ <<-EOS.strip_heredoc
197
+ <section>
198
+ <section>
199
199
 
200
- Vertical A1
200
+ Vertical A1
201
201
 
202
- </section>
203
- <section>
202
+ </section>
203
+ <section>
204
204
 
205
- Vertical A2
205
+ Vertical A2
206
206
 
207
- </section>
208
- <section>
207
+ </section>
208
+ <section>
209
209
 
210
- Vertical A3
210
+ Vertical A3
211
211
 
212
- </section>
213
- </section>
212
+ </section>
213
+ </section>
214
214
 
215
- <section>
216
- <section>
215
+ <section>
216
+ <section>
217
217
 
218
- Vertical B1
218
+ Vertical B1
219
219
 
220
- </section>
221
- <section>
220
+ </section>
221
+ <section>
222
222
 
223
- Vertical B2
223
+ Vertical B2
224
224
 
225
- </section>
226
- <section>
225
+ </section>
226
+ <section>
227
227
 
228
- Vertical B3
228
+ Vertical B3
229
229
 
230
- </section>
231
- </section>
232
- eos
230
+ </section>
231
+ </section>
232
+ EOS
233
233
  end
234
234
 
235
235
  it 'creates two columns of sections' do
@@ -240,99 +240,99 @@ eos
240
240
 
241
241
  context 'horizontal and vertical combinations' do
242
242
  let :verticals_surrounded_by_horizontals_input do
243
- <<-eos
244
- <div>DIVIDER</div>
243
+ <<-EOS.strip_heredoc
244
+ <div>DIVIDER</div>
245
245
 
246
- First
246
+ First
247
247
 
248
- <div>VERTICAL_START</div>
248
+ <div>VERTICAL_START</div>
249
249
 
250
- Vertical A1
250
+ Vertical A1
251
251
 
252
- <div>DIVIDER</div>
252
+ <div>DIVIDER</div>
253
253
 
254
- Vertical A2
254
+ Vertical A2
255
255
 
256
- <div>DIVIDER</div>
256
+ <div>DIVIDER</div>
257
257
 
258
- Vertical A3
258
+ Vertical A3
259
259
 
260
- <div>VERTICAL_END</div>
260
+ <div>VERTICAL_END</div>
261
261
 
262
- Middle
262
+ Middle
263
263
 
264
- <div>VERTICAL_START</div>
264
+ <div>VERTICAL_START</div>
265
265
 
266
- Vertical B1
266
+ Vertical B1
267
267
 
268
- <div>DIVIDER</div>
268
+ <div>DIVIDER</div>
269
269
 
270
- Vertical B2
270
+ Vertical B2
271
271
 
272
- <div>DIVIDER</div>
272
+ <div>DIVIDER</div>
273
273
 
274
- Vertical B3
274
+ Vertical B3
275
275
 
276
- <div>VERTICAL_END</div>
276
+ <div>VERTICAL_END</div>
277
277
 
278
- Last
278
+ Last
279
279
 
280
- <div>DIVIDER</div>
281
- eos
280
+ <div>DIVIDER</div>
281
+ EOS
282
282
  end
283
283
 
284
284
  let :verticals_surrounded_by_horizontals_output do
285
- <<-eos
286
- <section>
285
+ <<-EOS.strip_heredoc
286
+ <section>
287
287
 
288
- First
288
+ First
289
289
 
290
- </section>
291
- <section>
292
- <section>
290
+ </section>
291
+ <section>
292
+ <section>
293
293
 
294
- Vertical A1
294
+ Vertical A1
295
295
 
296
- </section>
297
- <section>
296
+ </section>
297
+ <section>
298
298
 
299
- Vertical A2
299
+ Vertical A2
300
300
 
301
- </section>
302
- <section>
301
+ </section>
302
+ <section>
303
303
 
304
- Vertical A3
304
+ Vertical A3
305
305
 
306
- </section>
307
- </section>
308
- <section>
306
+ </section>
307
+ </section>
308
+ <section>
309
309
 
310
- Middle
310
+ Middle
311
311
 
312
- </section>
313
- <section>
314
- <section>
312
+ </section>
313
+ <section>
314
+ <section>
315
315
 
316
- Vertical B1
316
+ Vertical B1
317
317
 
318
- </section>
319
- <section>
318
+ </section>
319
+ <section>
320
320
 
321
- Vertical B2
321
+ Vertical B2
322
322
 
323
- </section>
324
- <section>
323
+ </section>
324
+ <section>
325
325
 
326
- Vertical B3
326
+ Vertical B3
327
327
 
328
- </section>
329
- </section>
330
- <section>
328
+ </section>
329
+ </section>
330
+ <section>
331
331
 
332
- Last
332
+ Last
333
333
 
334
- </section>
335
- eos
334
+ </section>
335
+ EOS
336
336
  end
337
337
 
338
338
  it 'creates a slide, a column, a slide, a column, and a slide' do