slide-em-up 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -5,13 +5,14 @@ Slide'em up is a presentation tool. You write some slides in markdown, choose
5
5
  a style and it displays it in HTML5. With a browser in full-screen, you can
6
6
  make amazing presentations!
7
7
 
8
+
8
9
  TODO
9
10
  ----
10
11
 
11
- * Add specs :p
12
- * https://github.com/rubygems/rubygems-test/blob/master/README.txt
13
12
  * Explain how to install and use it in README
13
+ * Same command line stuff than showoff
14
14
  * Many more things
15
+ * Add more themes
15
16
 
16
17
 
17
18
  Issues or Suggestions
@@ -7,9 +7,5 @@ require "goliath/runner"
7
7
  presentation = SlideEmUp::Presentation.new(Dir.pwd)
8
8
 
9
9
  runner = Goliath::Runner.new(ARGV, nil)
10
- runner.app = Rack::Builder.new do
11
- use Rack::CommonLogger
12
- map '/slides' do run SlideEmUp::SlidesAPI.new(presentation) end
13
- map '/' do run SlideEmUp::AssetsAPI.new(presentation) end
14
- end
10
+ runner.app = SlideEmUp::SlidesAPI.new(presentation)
15
11
  runner.run
@@ -1,5 +1,4 @@
1
1
  module SlideEmUp
2
- autoload :AssetsAPI, "slide-em-up/assets_api"
3
2
  autoload :Presentation, "slide-em-up/presentation"
4
3
  autoload :SlidesAPI, "slide-em-up/slides_api"
5
4
  autoload :VERSION, "slide-em-up/version"
@@ -1,5 +1,5 @@
1
1
  require "albino"
2
- require "nolate"
2
+ require "erubis"
3
3
  require "redcarpet"
4
4
  require "yajl"
5
5
 
@@ -11,25 +11,27 @@ module SlideEmUp
11
11
  Section = Struct.new(:number, :title, :slides)
12
12
  Slide = Struct.new(:number, :classes, :markdown, :html)
13
13
 
14
- attr_accessor :meta, :theme
14
+ attr_accessor :meta, :theme, :common, :titles
15
15
 
16
16
  def initialize(dir)
17
17
  infos = extract_normal_infos(dir) || extract_infos_from_showoff(dir) || {}
18
18
  infos = { "title" => "No title", "theme" => "default" }.merge(infos)
19
19
  @meta = build_meta(infos["title"], dir)
20
20
  @theme = build_theme(infos["theme"])
21
+ @common = build_theme("common")
21
22
  @titles = infos["sections"]
22
23
  end
23
24
 
24
25
  def html
25
- str = File.read("#{theme.dir}/index.nlt")
26
- nolate str, :meta => meta, :theme => theme, :sections => sections
26
+ str = File.read("#{theme.dir}/index.erb")
27
+ Erubis::Eruby.new(str).result(:meta => meta, :theme => theme, :sections => sections)
27
28
  end
28
29
 
29
30
  def path_for_asset(asset)
30
- try = "#{theme.dir}/#{asset}"
31
- return try if File.exists? try
32
- Dir["#{meta.dir}/**/#{asset}"].first
31
+ Dir[ "#{meta.dir}#{asset}"].first ||
32
+ Dir[ "#{theme.dir}#{asset}"].first ||
33
+ Dir[ "#{common.dir}#{asset}"].first ||
34
+ Dir["#{meta.dir}/**#{asset}"].first
33
35
  end
34
36
 
35
37
  protected
@@ -78,7 +80,8 @@ module SlideEmUp
78
80
  slides = parts.map.with_index do |slide,j|
79
81
  @codemap = {}
80
82
  classes, md = slide.split("\n", 2)
81
- html = Redcarpet.new(extract_code md).to_html
83
+ tmp = extract_code(md)
84
+ html = Redcarpet.new(tmp).to_html
82
85
  html = process_code(html)
83
86
  Slide.new(j, classes, md, html)
84
87
  end
@@ -1,21 +1,59 @@
1
+ require "time"
1
2
  require "rack/utils"
3
+ require "rack/mime"
2
4
  require "goliath/api"
3
5
 
4
6
 
5
7
  module SlideEmUp
6
8
  class SlidesAPI < Goliath::API
7
- use ::Rack::ContentLength
8
-
9
9
  def initialize(presentation)
10
10
  @presentation = presentation
11
11
  end
12
12
 
13
13
  def response(env)
14
+ path_info = Rack::Utils.unescape(env["PATH_INFO"])
15
+ if path_info == "/"
16
+ serve_slides
17
+ elsif path_info.include? ".."
18
+ unauthorized_access
19
+ else
20
+ serve_asset(path_info)
21
+ end
22
+ end
23
+
24
+ protected
25
+
26
+ def serve_slides
14
27
  body = @presentation.html
15
28
  [200, {
16
29
  "Content-Type" => "text/html; charset=utf-8",
17
30
  "Content-Length" => Rack::Utils.bytesize(body).to_s
18
31
  }, [body] ]
19
32
  end
33
+
34
+ def serve_asset(path_info)
35
+ path = @presentation.path_for_asset(path_info)
36
+ return page_not_found(path_info) unless path && File.readable?(path)
37
+ body = File.read(path)
38
+ [200, {
39
+ "Last-Modified" => File.mtime(path).httpdate,
40
+ "Content-Length" => Rack::Utils.bytesize(body).to_s,
41
+ "Content-Type" => Rack::Mime.mime_type(File.extname(path), 'text/plain'),
42
+ }, [body] ]
43
+ end
44
+
45
+ def page_not_found(path_info)
46
+ [404, {
47
+ "Content-Type" => "text/plain",
48
+ "Content-Length" => "0"
49
+ }, ["File not found: #{path_info}\n"] ]
50
+ end
51
+
52
+ def unauthorized_access
53
+ [403, {
54
+ "Content-Type" => "text/plain",
55
+ "Content-Length" => "0"
56
+ }, ["Forbidden\n"] ]
57
+ end
20
58
  end
21
59
  end
@@ -1,3 +1,3 @@
1
1
  module SlideEmUp
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
@@ -9,11 +9,29 @@
9
9
 
10
10
  @font-face {
11
11
  font-family: 'League Gothic';
12
- src: url('/fonts/league_gothic-webfont.ttf') format('truetype');
12
+ src: url('../fonts/league_gothic-webfont.ttf') format('truetype');
13
13
  font-weight: normal;
14
14
  font-style: normal;
15
15
  }
16
16
 
17
+ @font-face {
18
+ font-family: 'Crimson Text';
19
+ font-style: normal;
20
+ font-weight: 600;
21
+ src: local('Crimson Text Semibold'), local('CrimsonText-Semibold'), url('../fonts/crimson_text_semibold.ttf') format('truetype');
22
+ }
23
+ @font-face {
24
+ font-family: 'Crimson Text';
25
+ font-style: normal;
26
+ font-weight: normal;
27
+ src: local('Crimson Text'), local('CrimsonText-Roman'), url('../fonts/crimson_text.ttf') format('truetype');
28
+ }
29
+ @font-face {
30
+ font-family: 'Crimson Text';
31
+ font-style: normal;
32
+ font-weight: 700;
33
+ src: local('Crimson Text Bold'), local('CrimsonText-Bold'), url('../fonts/crimson_text_bold.ttf') format('truetype');
34
+ }
17
35
 
18
36
  /*********************************************
19
37
  * GLOBAL STYLES
@@ -2,11 +2,10 @@
2
2
  <html>
3
3
  <head>
4
4
  <meta charset="utf-8">
5
- <title><%= meta.title %></title>
6
- <link href='http://fonts.googleapis.com/css?family=Crimson+Text:regular,600,bold' rel='stylesheet' type='text/css'>
7
- <link rel="stylesheet" href="/css/reset.css">
8
- <link rel="stylesheet" href="/css/main.css">
9
- <link rel="stylesheet" href="/css/colorful.css">
5
+ <title><%= meta.title %></title>
6
+ <link rel="stylesheet" href="css/reset.css">
7
+ <link rel="stylesheet" href="css/main.css">
8
+ <link rel="stylesheet" href="css/pygments/colorful.css">
10
9
  </head>
11
10
  <body>
12
11
  <div id="main">
@@ -20,6 +19,6 @@
20
19
  </section>
21
20
  <% end %>
22
21
  </div>
23
- <script src="/js/slideshow.js"></script>
22
+ <script src="js/slideshow.js"></script>
24
23
  </body>
25
24
  </html>
@@ -0,0 +1,2 @@
1
+ Slides from Google (slides.html5rocks.com) cleaned up for new presentations
2
+ https://github.com/paulgreg/blankhtml5slides
@@ -0,0 +1,501 @@
1
+ body {
2
+ font: 16px "Lucida Grande", "Trebuchet MS", Verdana, sans-serif;
3
+ padding: 0;
4
+ margin: 0;
5
+ width: 100%;
6
+ height: 100%;
7
+ position: absolute;
8
+ left: 0px; top: 0px;
9
+ }
10
+
11
+ .presentation {
12
+ position: absolute;
13
+ height: 100%;
14
+ width: 100%;
15
+ left: 0px;
16
+ top: 0px;
17
+ display: block;
18
+ overflow: hidden;
19
+ background: #778;
20
+ }
21
+
22
+ .slides {
23
+ width: 100%;
24
+ height: 100%;
25
+ left: 0;
26
+ top: 0;
27
+ position: absolute;
28
+ display: none;
29
+ -webkit-transition: -webkit-transform 1s ease-in-out;
30
+ -moz-transition: -moz-transform 1s ease-in-out;
31
+ -o-transition: -o-transform 1s ease-in-out;
32
+ transition: transform 1s ease-in-out;
33
+ }
34
+
35
+ .slide {
36
+ display: none;
37
+ position: absolute;
38
+ overflow: hidden;
39
+ width: 900px;
40
+ height: 700px;
41
+ left: 50%;
42
+ top: 50%;
43
+ margin-top: -350px;
44
+ background-color: #eee;
45
+ background: -webkit-gradient(linear, left bottom, left top, from(#bbd), to(#fff));
46
+ background: -moz-linear-gradient(bottom, #bbd, #fff);
47
+ background: linear-gradient(bottom, #bbd, #fff);
48
+ -webkit-transition: margin 0.25s ease-in-out;
49
+ -moz-transition: margin 0.25s ease-in-out;
50
+ -o-transition: margin-left 0.25s ease-in-out;
51
+ transition: margin 0.25s ease-in-out;
52
+ }
53
+
54
+ .slide:nth-child(even) {
55
+ -moz-border-radius: 20px 0;
56
+ -khtml-border-radius: 20px 0;
57
+ border-radius: 20px 0; /* includes Opera 10.5+ */
58
+ -webkit-border-top-left-radius: 20px;
59
+ -webkit-border-bottom-right-radius: 20px;
60
+ }
61
+
62
+ .slide:nth-child(odd) {
63
+ -moz-border-radius: 0 20px;
64
+ -khtml-border-radius: 0 20px;
65
+ border-radius: 0 20px;
66
+ -webkit-border-top-right-radius: 20px;
67
+ -webkit-border-bottom-left-radius: 20px;
68
+ }
69
+
70
+ .slide p, .slide textarea {
71
+ font-size: 20px;
72
+ }
73
+
74
+ .slide .counter {
75
+ color: #999999;
76
+ position: absolute;
77
+ left: 20px;
78
+ bottom: 20px;
79
+ display: block;
80
+ font-size: 12px;
81
+ width: 100%;
82
+ }
83
+
84
+ .slide:not(.transitionSlide) .counter:after {
85
+ content: '';
86
+ width: 32px;
87
+ height: 32px;
88
+ background-repeat: no-repeat;
89
+ background-position: right bottom;
90
+ position: absolute;
91
+ bottom: 0;
92
+ right: 45px;
93
+ opacity: 0.25;
94
+ }
95
+
96
+ .slide.title > .counter,
97
+ .slide.segue > .counter,
98
+ .slide.mainTitle > .counter {
99
+ display: none;
100
+ }
101
+
102
+ .slide.transitionSlide h2 {
103
+ font-size: 40px;
104
+ margin: 0;
105
+ line-height: 10px;
106
+ }
107
+ .slide.transitionSlide p {
108
+ margin: 0;
109
+ }
110
+
111
+ .slide.transitionSlide img {
112
+ opacity: 0.25;
113
+ width: 64px;
114
+ height: 64px;
115
+ }
116
+
117
+ .vbox {
118
+ display: -webkit-box;
119
+ -webkit-box-orient: vertical;
120
+ -webkit-box-align: stretch;
121
+
122
+ display: -moz-box;
123
+ -moz-box-orient: vertical;
124
+ -moz-box-align: stretch;
125
+
126
+ display: box;
127
+ box-orient: vertical;
128
+ box-align: stretch;
129
+ }
130
+
131
+ .hbox {
132
+ display: -webkit-box;
133
+ -webkit-box-orient: horizontal;
134
+ -webkit-box-align: stretch;
135
+
136
+ display: -moz-box;
137
+ -moz-box-orient: horizontal;
138
+ -moz-box-align: stretch;
139
+
140
+ display: box;
141
+ box-orient: horizontal;
142
+ box-align: stretch;
143
+ }
144
+
145
+ .flex {
146
+ -webkit-box-flex: 1;
147
+ -moz-box-flex: 1;
148
+ box-flex: 1;
149
+ }
150
+
151
+ .noflex {
152
+ -webkit-box-flex: 0;
153
+ -moz-box-flex: 0;
154
+ box-flex: 0;
155
+ }
156
+
157
+ .boxcenter {
158
+ -webkit-box-pack: center;
159
+ -moz-box-pack: center;
160
+ box-pack: center;
161
+ }
162
+
163
+ .slide.far-past {
164
+ display: block;
165
+ margin-left: -2400px;
166
+ }
167
+
168
+ .slide.past {
169
+ visibility: visible;
170
+ display: block;
171
+ margin-left: -1400px;
172
+ }
173
+
174
+ .slide.current {
175
+ visibility: visible;
176
+ display: block;
177
+ margin-left: -450px;
178
+ }
179
+
180
+ .slide.future {
181
+ visibility: visible;
182
+ display: block;
183
+ margin-left: 500px;
184
+ }
185
+
186
+ .slide.far-future {
187
+ display: block;
188
+ margin-left: 1500px;
189
+ }
190
+
191
+ body.three-d div.presentation {
192
+ /*background: -webkit-gradient(radial, 50% 50%, 10, 50% 50%, 1000, from(#333), to(#000)); */
193
+ }
194
+
195
+ body.three-d div.slides {
196
+ -webkit-transform: translateX(50px) scale(0.8) rotateY(10deg);
197
+ -moz-transform: translateX(50px) scale(0.8) rotateY(10deg);
198
+ -o-transform: translateX(50px) scale(0.8) rotateY(10deg);
199
+ transform: translateX(50px) scale(0.8) rotateY(10deg);
200
+ }
201
+
202
+ /* Content */
203
+ /*
204
+ Font sizes:
205
+ header h1 - 50px
206
+ h2, p - 20px
207
+ default, pre, input - 16px
208
+ */
209
+
210
+ @font-face {
211
+ font-family: 'JunctionRegular';
212
+ src: url('/src/fonts/junction02/junction02-webfont.eot');
213
+ src: local('☺'), url('/src/fonts/junction02/junction02-webfont.woff') format('woff'), url('/src/fonts/junction02/junction02-webfont.ttf') format('truetype'), url('/src/fonts/junction02/junction02-webfont.svg#webfontwzJOjWvv') format('svg');
214
+ font-weight: normal;
215
+ font-style: normal;
216
+ }
217
+ @font-face {
218
+ font-family: 'LeagueGothicRegular';
219
+ src: url('/src/fonts/leaguegothic/leaguegothic-webfont.eot');
220
+ src: local('☺'), url('/src/fonts/leaguegothic/leaguegothic-webfont.woff') format('woff'), url('/src/fonts/leaguegothic/leaguegothic-webfont.ttf') format('truetype'), url('/src/fonts/leaguegothic/leaguegothic-webfont.svg#webfontWgfhmMGx') format('svg');
221
+ font-weight: normal;
222
+ font-style: normal;
223
+ }
224
+
225
+ header {
226
+ font-family: 'Droid Sans';
227
+ font-weight: normal;
228
+ letter-spacing: -.05em;
229
+ color: black;
230
+ text-shadow: rgba(0, 0, 0, 0.2) 0 2px 5px;
231
+ position: absolute;
232
+ left: 30px;
233
+ top: 25px;
234
+ margin: 0;
235
+ padding: 0;
236
+ font-size: 50px;
237
+ }
238
+
239
+ h1 {
240
+ font-size: 100%;
241
+ display: inline;
242
+ font-weight: normal;
243
+ padding: 0;
244
+ margin: 0;
245
+ }
246
+
247
+ h2 {
248
+ font-family: 'Droid Sans';
249
+ color: black;
250
+ font-size: 20px;
251
+ padding: 0;
252
+ margin: 15px 0 5px 0;
253
+ }
254
+
255
+ h2:first-child {
256
+ margin-top: 0;
257
+ }
258
+
259
+ section, footer {
260
+ font-family: 'Droid Sans';
261
+ color: #3f3f3f;
262
+ text-shadow: rgba(0, 0, 0, 0.2) 0 2px 5px;
263
+ margin: 100px 30px 0;
264
+ display: block;
265
+ overflow: hidden;
266
+ }
267
+
268
+ footer {
269
+ font-size: 12px;
270
+ margin: 20px 0 0 30px;
271
+ }
272
+
273
+ a {
274
+ color: inherit;
275
+ display: inline-block;
276
+ text-decoration: none;
277
+ line-height: 110%;
278
+ border-bottom: 2px solid #3f3f3f;
279
+ }
280
+
281
+ .gmap a {
282
+ line-height: 100%;
283
+ border-bottom: none;
284
+ }
285
+
286
+ li {
287
+ list-style: none;
288
+ padding: 10px 0;
289
+ }
290
+
291
+ button {
292
+ font-size: 20px;
293
+ }
294
+
295
+ pre button {
296
+ margin: 2px;
297
+ }
298
+
299
+ .summary {
300
+ font-size: 30px;
301
+ }
302
+
303
+ .bullets {
304
+ font-size: 40px;
305
+ }
306
+
307
+ section.left {
308
+ float: left;
309
+ width: 390px;
310
+ }
311
+
312
+ section.small {
313
+ font-size: 24px;
314
+ }
315
+
316
+ section.small ul {
317
+ margin: 0 0 0 15px;
318
+ padding: 0;
319
+ }
320
+
321
+ section.small li {
322
+ padding-bottom: 0;
323
+ }
324
+
325
+ section.middle {
326
+ line-height: 68px;
327
+ text-align: center;
328
+ display: table-cell;
329
+ vertical-align: middle;
330
+ height: 700px;
331
+ width: 900px;
332
+ }
333
+
334
+ pre {
335
+ text-align: left;
336
+ font-family: 'Droid Sans Mono', Courier;
337
+ padding: 10px 20px;
338
+ background: rgba(255, 0, 0, 0.05);
339
+ -webkit-border-radius: 8px;
340
+ -khtml-border-radius: 8px;
341
+ -moz-border-radius: 8px;
342
+ border-radius: 8px;
343
+ border: 1px solid rgba(255, 0, 0, 0.2);
344
+ }
345
+
346
+ pre select {
347
+ font-family: Monaco, Courier;
348
+ border: 1px solid #c61800;
349
+ }
350
+
351
+ input {
352
+ font-size: 16px;
353
+ margin-right: 10px;
354
+ font-family: Helvetica;
355
+ padding: 3px 5px;
356
+ }
357
+ input[type="range"] {
358
+ width: 100%;
359
+ }
360
+
361
+ button {
362
+ font-family: Verdana;
363
+ }
364
+
365
+ button.large {
366
+ font-size: 32px;
367
+ }
368
+
369
+ pre b {
370
+ font-weight: normal;
371
+ color: #c61800;
372
+ text-shadow: #c61800 0 0 1px;
373
+ /*letter-spacing: -1px;*/
374
+ }
375
+ pre em {
376
+ font-weight: normal;
377
+ font-style: normal;
378
+ color: #18a600;
379
+ text-shadow: #18a600 0 0 1px;
380
+ }
381
+ pre input[type="range"] {
382
+ height: 6px;
383
+ cursor: pointer;
384
+ width: auto;
385
+ }
386
+
387
+ div.example {
388
+ display: block;
389
+ padding: 10px 20px;
390
+ color: black;
391
+ background: rgba(255, 255, 255, 0.4);
392
+ -webkit-border-radius: 8px;
393
+ -khtml-border-radius: 8px;
394
+ -moz-border-radius: 8px;
395
+ border-radius: 8px;
396
+ margin-bottom: 10px;
397
+ border: 1px solid rgba(0, 0, 0, 0.2);
398
+ }
399
+
400
+ video {
401
+ -moz-border-radius: 8px;
402
+ -khtml-border-radius: 8px;
403
+ -webkit-border-radius: 8px;
404
+ border-radius: 8px;
405
+ border: 1px solid rgba(0, 0, 0, 0.2);
406
+ }
407
+
408
+ .css,
409
+ .js,
410
+ .html,
411
+ .key {
412
+ font-family: 'Droid Sans';
413
+ color: black;
414
+ display: inline-block;
415
+ padding: 6px 10px 3px 10px;
416
+ font-size: 25px;
417
+ line-height: 30px;
418
+ text-shadow: none;
419
+ letter-spacing: 0;
420
+ bottom: 10px;
421
+ position: relative;
422
+ -moz-border-radius: 10px;
423
+ -khtml-border-radius: 10px;
424
+ -webkit-border-radius: 10px;
425
+ border-radius: 10px;
426
+ background: white;
427
+ box-shadow: rgba(0, 0, 0, 0.1) 0 2px 5px;
428
+ -webkit-box-shadow: rgba(0, 0, 0, 0.1) 0 2px 5px;
429
+ -moz-box-shadow: rgba(0, 0, 0, 0.1) 0 2px 5px;
430
+ -o-box-shadow: rgba(0, 0, 0, 0.1) 0 2px 5px;
431
+ }
432
+
433
+ .key { font-family: Arial; }
434
+
435
+ :not(header) > .css,
436
+ :not(header) > .js,
437
+ :not(header) > .html,
438
+ :not(header) > .key {
439
+ margin: 0 5px;
440
+ bottom: 4px;
441
+ }
442
+
443
+ .css {
444
+ background: -webkit-gradient(linear, left top, left bottom, from(#ff4), to(#ffa));
445
+ background-color: #ff4;
446
+ background: -moz-linear-gradient(left top, #ff4, #ffa);
447
+ }
448
+ .js {
449
+ background: -webkit-gradient(linear, left top, left bottom, from(#4f4), to(#afa));
450
+ background-color: #4f4;
451
+ background: -moz-linear-gradient(left top, #4f4, #afa);
452
+ }
453
+ .html {
454
+ background: -webkit-gradient(linear, left top, left bottom, from(#e88), to(#fee));
455
+ background-color: #e88;
456
+ background: -moz-linear-gradient(left top, #e88, #fee);
457
+ }
458
+
459
+ .two-column {
460
+ -webkit-column-count: 2;
461
+ -moz-column-count: 2;
462
+ column-count: 2;
463
+ }
464
+
465
+ .summary li::before, .bullets li::before {
466
+ content: '· ';
467
+ }
468
+
469
+ .stroke {
470
+ -webkit-text-stroke-color: red;
471
+ -webkit-text-stroke-width: 1px;
472
+ } /* currently webkit-only */
473
+
474
+ .center {
475
+ text-align: center;
476
+ }
477
+
478
+ .formula {
479
+ font-size: 50px;
480
+ }
481
+
482
+ #presentation-counter {
483
+ color: #ccc;
484
+ font-size: 100px;
485
+ letter-spacing: 1px;
486
+ position: absolute;
487
+ top: 40%;
488
+ left: 0;
489
+ width: 100%;
490
+ text-align: center;
491
+ }
492
+
493
+ [data-build] > * {
494
+ -webkit-transition: opacity 0.5s ease-in-out 0.2s;
495
+ -moz-transition: opacity 0.5s ease-in-out 0.2s;
496
+ -o-transition: opacity 0.5s ease-in-out 0.2s;
497
+ }
498
+
499
+ [data-build] > *.to-build {
500
+ opacity: 0;
501
+ }