showoff 0.12.0 → 0.12.1

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.
@@ -1,3 +1,3 @@
1
1
  # No namespace here since ShowOff is a class and I'd have to inherit from
2
2
  # Sinatra::Application (which we don't want to load here)
3
- SHOWOFF_VERSION = '0.12.0'
3
+ SHOWOFF_VERSION = '0.12.1'
data/lib/showoff_utils.rb CHANGED
@@ -32,7 +32,7 @@ class ShowOffUtils
32
32
  end
33
33
 
34
34
  def self.create(dirname,create_samples,dir='one')
35
- Dir.mkdir(dirname) if !File.exists?(dirname)
35
+ Dir.mkdir(dirname) if !File.exist?(dirname)
36
36
  Dir.chdir(dirname) do
37
37
  if create_samples
38
38
  # create section
@@ -52,6 +52,28 @@ class ShowOffUtils
52
52
  end
53
53
  end
54
54
 
55
+ def self.skeleton(config)
56
+ if config
57
+ FileUtils.cp(config, '.')
58
+ ShowOffUtils.presentation_config_file = File.basename(config)
59
+ end
60
+
61
+ self.showoff_sections('.').each do |filename|
62
+ next if File.exist? filename
63
+
64
+ puts "Creating: #{filename}"
65
+ if filename.downcase.end_with? '.md'
66
+ FileUtils.mkdir_p File.dirname(filename)
67
+
68
+ File.open(filename, 'w+') do |f|
69
+ f.puts make_slide("#{filename.sub(/\.md$/, '')}")
70
+ end
71
+ else
72
+ FileUtils.mkdir_p filename
73
+ end
74
+ end
75
+ end
76
+
55
77
  HEROKU_GEMS_FILE = '.gems'
56
78
  HEROKU_BUNDLER_GEMS_FILE = 'Gemfile'
57
79
  HEROKU_CONFIG_FILE = 'config.ru'
@@ -99,6 +121,7 @@ class ShowOffUtils
99
121
  # generate a static version of the site into the gh-pages branch
100
122
  def self.github
101
123
  ShowOff.do_static(nil)
124
+ FileUtils.touch 'static/.nojekyll'
102
125
  `git add -f static`
103
126
  sha = `git write-tree`.chomp
104
127
  tree_sha = `git rev-parse #{sha}:static`.chomp
@@ -152,7 +175,7 @@ class ShowOffUtils
152
175
  # [:type] - the type of slide to create
153
176
  def self.add_slide(options)
154
177
 
155
- add_new_dir(options[:dir]) if options[:dir] && !File.exists?(options[:dir])
178
+ add_new_dir(options[:dir]) if options[:dir] && !File.exist?(options[:dir])
156
179
 
157
180
  options[:type] = 'code' if options[:code]
158
181
 
@@ -273,10 +296,15 @@ class ShowOffUtils
273
296
  [code,lines,width]
274
297
  end
275
298
 
276
- def self.showoff_sections(dir,logger)
299
+ def self.showoff_sections(dir, logger = nil)
300
+ unless logger
301
+ logger = Logger.new(STDOUT)
302
+ logger.level = Logger::WARN
303
+ end
304
+
277
305
  index = File.join(dir, ShowOffUtils.presentation_config_file)
278
306
  sections = nil
279
- if File.exists?(index)
307
+ if File.exist?(index)
280
308
  data = JSON.parse(File.read(index))
281
309
  logger.debug data
282
310
  if data.is_a?(Hash)
@@ -330,7 +358,7 @@ class ShowOffUtils
330
358
 
331
359
  def self.get_config_option(dir, option, default = nil)
332
360
  index = File.join(dir, ShowOffUtils.presentation_config_file)
333
- if File.exists?(index)
361
+ if File.exist?(index)
334
362
  data = JSON.parse(File.read(index))
335
363
  if data.is_a?(Hash)
336
364
  if default.is_a?(Hash)
@@ -393,7 +421,7 @@ class ShowOffUtils
393
421
  #
394
422
  # Returns true if the file was created
395
423
  def self.create_file_if_needed(filename,force)
396
- if !File.exists?(filename) || force
424
+ if !File.exist?(filename) || force
397
425
  File.open(filename, 'w+') do |f|
398
426
  yield f
399
427
  end
@@ -409,44 +437,53 @@ end
409
437
  # file
410
438
  module MarkdownConfig
411
439
  def self.setup(dir_name)
412
- # Load markdown configuration
413
- case ShowOffUtils.showoff_markdown(dir_name)
440
+ require 'tilt'
441
+ require 'tilt/erb'
442
+
443
+ renderer = ShowOffUtils.showoff_markdown(dir_name)
444
+ begin
445
+ # Load markdown configuration
446
+ case renderer
447
+ when 'rdiscount'
448
+ Tilt.prefer Tilt::RDiscountTemplate, "markdown"
449
+
450
+ when 'maruku'
451
+ Tilt.prefer Tilt::MarukuTemplate, "markdown"
452
+ # Now check if we can go for latex mode
453
+ require 'maruku'
454
+ require 'maruku/ext/math'
455
+
456
+ # Load maruku options
457
+ opts = ShowOffUtils.showoff_renderer_options(dir_name,
458
+ { :use_tex => false,
459
+ :png_dir => 'images',
460
+ :html_png_url => '/file/images/'})
461
+
462
+ if opts[:use_tex]
463
+ MaRuKu::Globals[:html_math_output_mathml] = false
464
+ MaRuKu::Globals[:html_math_output_png] = true
465
+ MaRuKu::Globals[:html_math_engine] = 'none'
466
+ MaRuKu::Globals[:html_png_engine] = 'blahtex'
467
+ MaRuKu::Globals[:html_png_dir] = opts[:png_dir]
468
+ MaRuKu::Globals[:html_png_url] = opts[:html_png_url]
469
+ end
414
470
 
415
- when 'rdiscount'
416
- Tilt.prefer Tilt::RDiscountTemplate, "markdown"
471
+ when 'bluecloth'
472
+ Tilt.prefer Tilt::BlueClothTemplate, "markdown"
417
473
 
418
- when 'maruku'
419
- Tilt.prefer Tilt::MarukuTemplate, "markdown"
420
- # Now check if we can go for latex mode
421
- require 'maruku'
422
- require 'maruku/ext/math'
423
-
424
- # Load maruku options
425
- opts = ShowOffUtils.showoff_renderer_options(dir_name,
426
- { :use_tex => false,
427
- :png_dir => 'images',
428
- :html_png_url => '/file/images/'})
429
-
430
- if opts[:use_tex]
431
- MaRuKu::Globals[:html_math_output_mathml] = false
432
- MaRuKu::Globals[:html_math_engine] = 'none'
433
- MaRuKu::Globals[:html_math_output_png] = true
434
- MaRuKu::Globals[:html_png_engine] = 'blahtex'
435
- MaRuKu::Globals[:html_png_dir] = opts[:png_dir]
436
- MaRuKu::Globals[:html_png_url] = opts[:html_png_url]
437
- end
474
+ when 'kramdown'
475
+ Tilt.prefer Tilt::KramdownTemplate, "markdown"
438
476
 
439
- when 'bluecloth'
440
- Tilt.prefer Tilt::BlueClothTemplate, "markdown"
477
+ when 'commonmarker'
478
+ Tilt.prefer Tilt::CommonMarkerTemplate, "markdown"
441
479
 
442
- when 'kramdown'
443
- Tilt.prefer Tilt::KramdownTemplate, "markdown"
444
-
445
- else
446
- Tilt.prefer Tilt::RedcarpetTemplate, "markdown"
447
- require 'tilt'
448
- require 'tilt/erb'
480
+ else
481
+ Tilt.prefer Tilt::RedcarpetTemplate, "markdown"
449
482
 
483
+ end
484
+ rescue LoadError
485
+ puts "ERROR: The #{renderer} markdown rendering engine does not appear to be installed correctly."
486
+ exit! 1
450
487
  end
451
488
  end
452
489
 
@@ -0,0 +1,42 @@
1
+ /**
2
+ * This element is created inside your target element
3
+ * It is used so that your own element will not need to be altered
4
+ **/
5
+ .time_circles {
6
+ position: relative;
7
+ width: 100%;
8
+ height: 100%;
9
+ }
10
+
11
+ /**
12
+ * This is all the elements used to house all text used
13
+ * in time circles
14
+ **/
15
+ .time_circles > div {
16
+ position: absolute;
17
+ text-align: center;
18
+ }
19
+
20
+ /**
21
+ * Titles (Days, Hours, etc)
22
+ **/
23
+ .time_circles > div > h4 {
24
+ margin: 0px;
25
+ padding: 0px;
26
+ text-align: center;
27
+ text-transform: uppercase;
28
+ font-family: 'Century Gothic', Arial;
29
+ }
30
+
31
+ /**
32
+ * Time numbers, ie: 12
33
+ **/
34
+ .time_circles > div > span {
35
+ display: block;
36
+ width: 100%;
37
+ text-align: center;
38
+ font-family: 'Century Gothic', Arial;
39
+ font-size: 300%;
40
+ margin-top: 0.4em;
41
+ font-weight: bold;
42
+ }
@@ -17,30 +17,46 @@
17
17
  }
18
18
 
19
19
  #topbar {
20
+ display: flex;
21
+ flex-flow: row;
20
22
  line-height: 24px;
23
+ height: 24px;
21
24
  background: #222222;
22
25
  font-size: .55em;
23
26
  color: #fff;
24
- padding: 0 1em;
25
27
  }
26
28
 
27
29
  #topbar a {
28
30
  text-decoration: none;
29
31
  color: #fff;
30
- padding: .35em;
31
32
  }
32
33
 
33
34
  #topbar a:hover{
34
35
  background-color: #555;
35
36
  }
36
37
 
38
+ #topbar .fa {
39
+ color: #8affeb;
40
+ }
41
+
42
+ #slideSource {
43
+ display: flex;
44
+ flex-shrink: 1;
45
+ white-space: nowrap;
46
+ overflow: hidden;
47
+ margin: 0 0.5em;
48
+ }
49
+
37
50
  #links {
38
- float: right;
51
+ display: flex;
52
+ flex-shrink: 0;
53
+ margin: 0 0 0 auto;
39
54
  }
40
55
 
41
56
  #links a {
42
57
  border: 1px solid #ccc;
43
58
  border-radius: 0.5em;
59
+ padding: .35em;
44
60
  }
45
61
 
46
62
  #links a.enabled {
@@ -52,13 +68,29 @@
52
68
  }
53
69
 
54
70
  .desktop span {
55
- margin: 0 1em;
71
+ margin: 0 0.5em;
56
72
  }
57
73
 
58
74
  #presenterPopup {
59
- font-size: 0.5em;
75
+ display: none;
76
+ position: absolute;
77
+ z-index: 2147483647;
78
+ top: 24px;
79
+ left: 25%;
80
+ max-height: 80%;
81
+ width: 50%;
82
+ border-radius: 0 0 .5em .5em;
83
+ border-bottom: 8px solid #222222;
84
+ background-color: #222222;
85
+ color: #ffffff;
86
+ font-size: .8em;
87
+ overflow: auto;
60
88
  }
61
89
 
90
+ #presenterPopup a {
91
+ color: #ffffff;
92
+ }
93
+
62
94
  #center {
63
95
  display: -webkit-flex;
64
96
  display: flex;
@@ -86,25 +118,58 @@
86
118
  }
87
119
  #timerSection {
88
120
  margin-bottom: 0.25em;
89
- padding-left: 0.5em;
90
121
  height: 2.15em;
91
122
  min-height: 2.15em;
92
123
  line-height: 2.15em;
93
124
  vertical-align: middle;
94
125
  }
126
+ #timerSection.open {
127
+ height: 100px;
128
+ min-height: 100px;
129
+ }
130
+
131
+ #timerDisplay {
132
+ height: 100px;
133
+ width: 100px;
134
+ }
95
135
 
96
- #timerInfo {
97
- margin-left: 25px;
136
+ #timerDisplay.paused {
137
+ -webkit-filter: grayscale(100%);
138
+ filter: grayscale(100%);
139
+ opacity: 0.25;
98
140
  }
99
141
 
100
142
  #timerSection input[type='button'] {
143
+ margin: 2px 0px;
144
+ }
145
+
146
+ #timerSection #pauseTimer {
147
+ float: left;
148
+ display: none;
149
+ }
150
+ #timerSection #stopTimer {
101
151
  float: right;
152
+ display: none;
153
+ }
154
+ #timerSection #timerDisplay {
155
+ display: none;
156
+ margin: 0 auto;
102
157
  }
103
158
 
104
- .tBlue { background: #79d; }
105
- .tGreen { background: #9d9; }
106
- .tRed { background: #d99; }
107
- .tYellow { background: #dd9; }
159
+ .intervalHalf,
160
+ .intervalQuarter,
161
+ .intervalWarning,
162
+ .intervalCritical {
163
+ -webkit-transition: background-color 1000ms linear;
164
+ -moz-transition: background-color 1000ms linear;
165
+ -o-transition: background-color 1000ms linear;
166
+ -ms-transition: background-color 1000ms linear;
167
+ transition: background-color 1000ms linear;
168
+ }
169
+ .intervalHalf { background: #99ff99; }
170
+ .intervalQuarter { background: #ffff66; }
171
+ .intervalWarning { background: #ffcc66; }
172
+ .intervalCritical { background: #ffcccc; }
108
173
 
109
174
  #feedbackPace {
110
175
  height: 40px;
@@ -218,7 +283,7 @@
218
283
  display: flex;
219
284
  -webkit-flex-flow: row;
220
285
  flex-flow: row;
221
- height: 150px;
286
+ height: 180px;
222
287
  background: #F5ED9B;
223
288
  border-top: 1px solid #ccc;
224
289
  }
@@ -234,17 +299,26 @@
234
299
  height: 100%;
235
300
  }
236
301
 
237
- #questions ul {
238
- margin-left: 1.5em;
239
- margin-right: 0.25em;
302
+ #questions #answered li {
303
+ text-decoration: line-through;
304
+ color: #ccc;
305
+ }
306
+
307
+ #questions #unanswered li:hover {
308
+ background-color: #dedede;
309
+ }
310
+ #questions #unanswered li:hover:after {
311
+ font-family: FontAwesome;
312
+ font-style: normal;
313
+ font-weight: normal;
314
+ text-decoration: inherit;
315
+ padding: 0 8px;
316
+ float: right;
317
+ content: "\f058"; /* fa-check-circle */
240
318
  }
241
319
 
242
- #questions li:hover {
243
- background: #dedede url(close.png) no-repeat top right;
244
- -moz-border-radius: 0.25em;
245
- -webkit-border-radius: 0.25em;
246
- -khtml-border-radius: 0.25em;
247
- border-radius: 0.25em;
320
+ #questions li {
321
+ cursor: default;
248
322
  }
249
323
 
250
324
  #notes {
@@ -254,33 +328,46 @@
254
328
  order: 1;
255
329
  overflow: auto;
256
330
  height: 100%;
331
+ padding: 0 1em;
332
+ display: block;
333
+ }
334
+
335
+ #notes > :first-child:before {
336
+ display: none;
257
337
  }
258
- #notes p,
259
- #notes h1,
260
- #notes h2,
261
- #notes h3,
262
- #notes h4,
263
- #notes ol,
264
- #notes ul {
265
- margin-right: 0.75em;
266
- padding-left: 0.25em;
338
+
339
+ #notes ul.section-selector {
340
+ padding: 0;
341
+ margin: 0 0 0 -1.25em; /* compensate for the border on #notes. 1/0.8 em */
342
+ text-align: center;
343
+ border-bottom: 1px solid #ccc;
344
+ font-size: 0.8em;
345
+ position: absolute;
346
+ background-color: #F5ED9B;
267
347
  }
268
- #notes p {
269
- padding: 0.25em;
270
- margin-bottom: 0.5em;
348
+ #notes ul.section-selector li {
349
+ display: none;
350
+ padding: 0 1em;
271
351
  }
272
- #notes ol, #notes ul {
273
- padding-left: 2em;
274
- padding-top: 0.25em;
275
- margin-bottom: 0.5em;
352
+ #notes ul.section-selector li:hover {
353
+ background-color: #b9b9b9;
354
+ transition-duration: 0.5s;
276
355
  }
277
- #notes ol {
278
- list-style-type: decimal;
356
+ #notes ul.section-selector li.selected {
357
+ display: inline;
358
+ background-color: #ccc;
279
359
  }
280
- #notes ul {
281
- list-style-type: disc;
360
+ #notes ul.section-selector:hover li {
361
+ display: inline;
282
362
  }
283
363
 
364
+ #notes ul.section-selector li a {
365
+ text-decoration: none;
366
+ }
367
+
368
+ #notes ol { list-style-type: decimal; }
369
+ #notes ul { list-style-type: disc; }
370
+
284
371
  #notes .element {
285
372
  display: inline-block;
286
373
  width: 90%;
@@ -288,9 +375,8 @@
288
375
 
289
376
  #notes .count {
290
377
  display: inline-block;
291
- background-color: #27ae60;
378
+ background-color: #2e2e2e;
292
379
  color: #ffffff;
293
- padding: 0 8px;
294
380
  font-size: 2.5em;
295
381
  vertical-align: top;
296
382
  border-radius: .2em;
@@ -302,7 +388,7 @@
302
388
  border-bottom: 4px solid #999;
303
389
  border-radius: 0 0 0 0.5em;
304
390
  padding: 0.1em 0 0.25em 0.25em;
305
- margin: 0 0 1em 1em;
391
+ margin: 0 -1em 1em 1em; /* compensate for the padding in the #notes section */
306
392
  background: #eee;
307
393
  max-width: 25%;
308
394
  }
@@ -313,6 +399,11 @@
313
399
  font-size: 1.5em;
314
400
  }
315
401
 
402
+ #notes .pagebreak {
403
+ display: none;
404
+ }
405
+
406
+
316
407
  a.controls {
317
408
  text-decoration: none;
318
409
  padding: 0 0.25em 0.1em 0.25em;
@@ -324,6 +415,25 @@ a.controls {
324
415
  border-radius: 0.5em;
325
416
  }
326
417
 
418
+ /* hide some elements when the screen is too small */
419
+ @media screen and (max-width: 1000px)
420
+ {
421
+ #slideSource label {
422
+ display: none;
423
+ }
424
+ }
425
+
426
+ @media screen and (max-width: 900px)
427
+ {
428
+ #topbar .fa {
429
+ display: none;
430
+ }
431
+ .desktop a {
432
+ margin-right: 0.25em;
433
+ }
434
+ }
435
+
436
+
327
437
  /* iPhone */
328
438
  /* Portrait */
329
439
  @media screen and (max-width: 480px)
@@ -438,3 +548,9 @@ a.controls {
438
548
  padding: 0;
439
549
  }
440
550
  }
551
+ @media screen and (pointer: coarse)
552
+ {
553
+ #buttonNav {
554
+ position: initial;
555
+ }
556
+ }