keydown 0.5.0

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.
@@ -0,0 +1,171 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe Keydown, "`slides`" do
4
+
5
+ shared_examples_for "generating a presentation file" do
6
+
7
+ it "should have the correct file name" do
8
+ @file.should_not be_nil
9
+ end
10
+
11
+ it "should set the document's title" do
12
+ @doc.css('title').text.should == "Kermit the Frog Says..."
13
+ end
14
+
15
+ it "should generate the correct number of slides" do
16
+ @doc.css('div.slide').length.should == 4
17
+ end
18
+
19
+ it "should include the HTML5 Rocks CSS only once" do
20
+ @doc.css('link[@href="css/rocks.css"]').length.should == 1
21
+ end
22
+
23
+ it "should include the HTML5 Rocks JavaScript only once" do
24
+ @doc.css('script[@src="js/rocks.js"]').length.should == 1
25
+ end
26
+
27
+ end
28
+
29
+ before :each do
30
+ @tmp_dir = "#{Dir.tmpdir}/keydown_test"
31
+ FileUtils.rm_r @tmp_dir if File.exists?(@tmp_dir)
32
+ FileUtils.mkdir_p @tmp_dir
33
+
34
+ @thor = Thor.new
35
+ end
36
+
37
+ describe "when file cannot be found" do
38
+ before(:each) do
39
+ Dir.chdir @tmp_dir do
40
+ @std_out = capture_output do
41
+ @thor.invoke Keydown::Tasks, "slides", "with_title.md"
42
+ end
43
+ end
44
+ end
45
+
46
+ it "should warn the user" do
47
+ @std_out.should match(/not found\. Please call with a KeyDown Markdown file: keydown slides my_file\.md/)
48
+ end
49
+
50
+ it "should not write out a file" do
51
+ Dir.glob("#{@tmp_dir}/*.html").should be_empty
52
+ end
53
+
54
+ end
55
+
56
+ describe "with defaults" do
57
+
58
+ before :each do
59
+ system "cp -r spec/fixtures/with_title.md #{@tmp_dir}"
60
+ end
61
+
62
+ describe "should generate an html file that" do
63
+ before(:each) do
64
+ capture_output do
65
+ Dir.chdir @tmp_dir do
66
+ @thor.invoke Keydown::Tasks, "slides", "with_title.md"
67
+ @file = File.new('with_title.html')
68
+ @doc = Nokogiri(@file)
69
+ end
70
+ end
71
+ end
72
+
73
+ it_should_behave_like "generating a presentation file"
74
+
75
+ describe "should have one slide that" do
76
+ before :each do
77
+ @slide = @doc.css('section')[3]
78
+ end
79
+
80
+ it "should have the correct css class(es)" do
81
+ @slide['class'].should match /foo/
82
+ @slide['class'].should match /bar/
83
+ end
84
+
85
+ it "should have the correct content" do
86
+ @slide.css('h1').text.should match /The Letter Q/
87
+ end
88
+ end
89
+ end
90
+
91
+ describe "should add an .md extention if one isn't specified" do
92
+ before(:each) do
93
+ capture_output do
94
+ Dir.chdir @tmp_dir do
95
+ @thor.invoke Keydown::Tasks, "slides", "with_title"
96
+ @file = File.new('with_title.html')
97
+ @doc = Nokogiri(@file)
98
+ end
99
+ end
100
+ end
101
+
102
+ it_should_behave_like "generating a presentation file"
103
+
104
+ end
105
+ end
106
+
107
+ describe "with directory tree with custom CSS & JS" do
108
+ before(:each) do
109
+ capture_output do
110
+
111
+ Dir.chdir @tmp_dir do
112
+ @thor.invoke Keydown::Tasks, "generate", "test"
113
+
114
+ Dir.chdir "test" do
115
+ system "cp #{Keydown::Tasks.source_root}/spec/fixtures/with_title.md #{@tmp_dir}/test/with_title.md"
116
+ system "cp #{Keydown::Tasks.source_root}/spec/fixtures/custom.css #{@tmp_dir}/test/css/custom.css"
117
+ system "cp #{Keydown::Tasks.source_root}/spec/fixtures/custom.js #{@tmp_dir}/test/js/custom.js"
118
+
119
+ @thor.invoke Keydown::Tasks, "slides", "with_title.md"
120
+
121
+ @file = File.new('with_title.html')
122
+ @doc = Nokogiri(@file)
123
+ end
124
+ end
125
+ end
126
+ end
127
+
128
+ it_should_behave_like "generating a presentation file"
129
+
130
+ it "should include any custom CSS file from the css directory" do
131
+ @doc.css('link[@href="css/test.css"]').length.should == 1
132
+ @doc.css('link[@href="css/custom.css"]').length.should == 1
133
+ end
134
+
135
+ it "should include any custom JavaScript files from the js directory" do
136
+ @doc.css('script[@src="js/test.js"]').length.should == 1
137
+ @doc.css('script[@src="js/custom.js"]').length.should == 1
138
+ end
139
+ end
140
+
141
+ describe "for a presentation that has background images" do
142
+ before(:each) do
143
+ capture_output do
144
+
145
+ Dir.chdir @tmp_dir do
146
+ @thor.invoke Keydown::Tasks, "generate", "test"
147
+
148
+ Dir.chdir "test" do
149
+ system "cp #{Keydown::Tasks.source_root}/spec/fixtures/with_backgrounds.md #{@tmp_dir}/test/with_backgrounds.md"
150
+
151
+ @thor.invoke Keydown::Tasks, "slides", "with_backgrounds.md"
152
+
153
+ @file = File.new('with_backgrounds.html')
154
+ @doc = Nokogiri(@file)
155
+ end
156
+ end
157
+ end
158
+ end
159
+
160
+ it_should_behave_like "generating a presentation file"
161
+
162
+ it "should add the keydown.css file (which has the backgrounds) to the css directory" do
163
+ File.exist?("#{@tmp_dir}/test/css/keydown.css").should be_true
164
+ end
165
+
166
+ it "should add the keydown.css file to the HTML file" do
167
+ @doc.css('link[@href="css/keydown.css"]').length.should == 1
168
+ end
169
+
170
+ end
171
+ end
@@ -0,0 +1,27 @@
1
+ # <%= presentation_name %>
2
+
3
+ !SLIDE
4
+
5
+ # A Title Slide
6
+
7
+ ## me@example.com
8
+
9
+ !SLIDE
10
+
11
+ # Some sample code
12
+
13
+ ``` ruby
14
+ def method
15
+ puts "Hello, World"
16
+ end
17
+ ```
18
+
19
+ !NOTES
20
+
21
+ * a note
22
+
23
+ !SLIDE
24
+
25
+ # With a Background Image
26
+
27
+ }}} images/test.png
@@ -0,0 +1 @@
1
+ /* Custom CSS for your KeyDown presentation here */
@@ -0,0 +1,392 @@
1
+ body {
2
+ font: 20px "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: block;
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
+ /* so it's visible in the iframe. */
35
+ -webkit-transform: scale(0.8);
36
+ -moz-transform: scale(0.8);
37
+ -o-transform: scale(0.8);
38
+ transform: scale(0.8);
39
+
40
+ }
41
+
42
+ .slide {
43
+ display: none;
44
+ position: absolute;
45
+ overflow: hidden;
46
+ width: 900px;
47
+ height: 700px;
48
+ left: 50%;
49
+ top: 50%;
50
+ margin-top: -350px;
51
+ background-color: #eee;
52
+ background: -webkit-gradient(linear, left bottom, left top, from(#bbd), to(#fff));
53
+ background: -moz-linear-gradient(bottom, #bbd, #fff);
54
+ background: linear-gradient(bottom, #bbd, #fff);
55
+ -webkit-transition: all 0.25s ease-in-out;
56
+ -moz-transition: all 0.25s ease-in-out;
57
+ -o-transition: all 0.25s ease-in-out;
58
+ transition: all 0.25s ease-in-out;
59
+ -webkit-transform: scale(1);
60
+ -moz-transform: scale(1);
61
+ -o-transform: scale(1);
62
+ transform: scale(1);
63
+ }
64
+
65
+ .slide:nth-child(even) {
66
+ -moz-border-radius: 20px 0;
67
+ -khtml-border-radius: 20px 0;
68
+ border-radius: 20px 0; /* includes Opera 10.5+ */
69
+ -webkit-border-top-left-radius: 20px;
70
+ -webkit-border-bottom-right-radius: 20px;
71
+ }
72
+
73
+ .slide:nth-child(odd) {
74
+ -moz-border-radius: 0 20px;
75
+ -khtml-border-radius: 0 20px;
76
+ border-radius: 0 20px;
77
+ -webkit-border-top-right-radius: 20px;
78
+ -webkit-border-bottom-left-radius: 20px;
79
+ }
80
+
81
+ .slide p, .slide textarea {
82
+ font-size: 120%;
83
+ }
84
+
85
+ .slide .counter {
86
+ color: #999999;
87
+ position: absolute;
88
+ left: 20px;
89
+ bottom: 20px;
90
+ display: block;
91
+ font-size: 70%;
92
+ }
93
+
94
+ .slide.title > .counter,
95
+ .slide.segue > .counter,
96
+ .slide.mainTitle > .counter {
97
+ display: none;
98
+ }
99
+
100
+ .force-render {
101
+ display: block;
102
+ visibility: hidden;
103
+ }
104
+
105
+ .slide.far-past {
106
+ display: block;
107
+ margin-left: -2400px;
108
+ }
109
+
110
+ .slide.past {
111
+ visibility: visible;
112
+ display: block;
113
+ margin-left: -1400px;
114
+ }
115
+
116
+ .slide.current {
117
+ visibility: visible;
118
+ display: block;
119
+ margin-left: -450px;
120
+ }
121
+
122
+ .slide.future {
123
+ visibility: visible;
124
+ display: block;
125
+ margin-left: 500px;
126
+ }
127
+
128
+ .slide.far-future {
129
+ display: block;
130
+ margin-left: 1500px;
131
+ }
132
+
133
+ body.three-d div.slides {
134
+ -webkit-transform: translateX(50px) scale(0.8) rotateY(10deg);
135
+ -moz-transform: translateX(50px) scale(0.8) rotateY(10deg);
136
+ -o-transform: translateX(50px) scale(0.8) rotateY(10deg);
137
+ transform: translateX(50px) scale(0.8) rotateY(10deg);
138
+ }
139
+
140
+ /* Content */
141
+
142
+ @font-face { font-family: 'Junction'; src: url(src/Junction02.otf); }
143
+ @font-face { font-family: 'LeagueGothic'; src: url(src/LeagueGothic.otf); }
144
+
145
+ header {
146
+ font-family: 'Droid Sans';
147
+ font-weight: normal;
148
+ letter-spacing: -.05em;
149
+ text-shadow: rgba(0, 0, 0, 0.2) 0 2px 5px;
150
+ left: 30px;
151
+ top: 25px;
152
+ margin: 0;
153
+ padding: 0;
154
+ font-size: 140%;
155
+ }
156
+
157
+ h1 {
158
+ font-size: 140%;
159
+ display: inline;
160
+ font-weight: normal;
161
+ padding: 0;
162
+ margin: 0;
163
+ }
164
+
165
+ h2 {
166
+ font-family: 'Droid Sans';
167
+ color: black;
168
+ font-size: 120%;
169
+ padding: 0;
170
+ margin: 20px 0;
171
+ }
172
+
173
+ h2:first-child {
174
+ margin-top: 0;
175
+ }
176
+
177
+ section, footer {
178
+ font-family: 'Droid Sans';
179
+ color: #3f3f3f;
180
+ text-shadow: rgba(0, 0, 0, 0.2) 0 2px 5px;
181
+ margin: 100px 30px 0;
182
+ display: block;
183
+ overflow: hidden;
184
+ }
185
+
186
+ footer {
187
+ font-size: 100%;
188
+ margin: 20px 0 0 30px;
189
+ }
190
+
191
+ a {
192
+ color: inherit;
193
+ display: inline-block;
194
+ text-decoration: none;
195
+ line-height: 110%;
196
+ border-bottom: 2px solid #3f3f3f;
197
+ }
198
+
199
+ ul {
200
+ margin: 0;
201
+ padding: 0;
202
+ }
203
+
204
+ button {
205
+ font-size: 100%;
206
+ }
207
+
208
+ pre button {
209
+ margin: 2px;
210
+ }
211
+
212
+ section.left {
213
+ float: left;
214
+ width: 390px;
215
+ }
216
+
217
+ section.small {
218
+ font-size: 24px;
219
+ }
220
+
221
+ section.small ul {
222
+ margin: 0 0 0 15px;
223
+ padding: 0;
224
+ }
225
+
226
+ section.small li {
227
+ padding-bottom: 0;
228
+ }
229
+
230
+ section.middle {
231
+ line-height: 2em;
232
+ text-align: center;
233
+ display: table-cell;
234
+ vertical-align: middle;
235
+ height: 700px;
236
+ width: 900px;
237
+ }
238
+
239
+ pre {
240
+ text-align: left;
241
+ font-family: 'Droid Sans Mono', Courier;
242
+ font-size: 80%;
243
+ padding: 10px 20px;
244
+ background: rgba(255, 0, 0, 0.05);
245
+ -webkit-border-radius: 8px;
246
+ -khtml-border-radius: 8px;
247
+ -moz-border-radius: 8px;
248
+ border-radius: 8px;
249
+ border: 1px solid rgba(255, 0, 0, 0.2);
250
+ }
251
+
252
+ pre select {
253
+ font-family: Monaco, Courier;
254
+ border: 1px solid #c61800;
255
+ }
256
+
257
+ input {
258
+ font-size: 100%;
259
+ margin-right: 10px;
260
+ font-family: Helvetica;
261
+ padding: 3px;
262
+ }
263
+ input[type="range"] {
264
+ width: 100%;
265
+ }
266
+
267
+ button {
268
+ margin: 20px 10px 0 0;
269
+ font-family: Verdana;
270
+ }
271
+
272
+ button.large {
273
+ font-size: 32px;
274
+ }
275
+
276
+ pre b {
277
+ font-weight: normal;
278
+ color: #c61800;
279
+ text-shadow: #c61800 0 0 1px;
280
+ /*letter-spacing: -1px;*/
281
+ }
282
+ pre em {
283
+ font-weight: normal;
284
+ font-style: normal;
285
+ color: #18a600;
286
+ text-shadow: #18a600 0 0 1px;
287
+ }
288
+ pre input[type="range"] {
289
+ height: 6px;
290
+ cursor: pointer;
291
+ width: auto;
292
+ }
293
+
294
+ div.example {
295
+ display: block;
296
+ padding: 10px 20px;
297
+ color: black;
298
+ background: rgba(255, 255, 255, 0.4);
299
+ -webkit-border-radius: 8px;
300
+ -khtml-border-radius: 8px;
301
+ -moz-border-radius: 8px;
302
+ border-radius: 8px;
303
+ margin-bottom: 10px;
304
+ border: 1px solid rgba(0, 0, 0, 0.2);
305
+ }
306
+
307
+ video {
308
+ -moz-border-radius: 8px;
309
+ -khtml-border-radius: 8px;
310
+ -webkit-border-radius: 8px;
311
+ border-radius: 8px;
312
+ border: 1px solid rgba(0, 0, 0, 0.2);
313
+ }
314
+
315
+ .key {
316
+ font-family: 'Droid Sans';
317
+ color: black;
318
+ display: inline-block;
319
+ padding: 6px 10px 3px 10px;
320
+ font-size: 100%;
321
+ line-height: 30px;
322
+ text-shadow: none;
323
+ letter-spacing: 0;
324
+ bottom: 10px;
325
+ position: relative;
326
+ -moz-border-radius: 10px;
327
+ -khtml-border-radius: 10px;
328
+ -webkit-border-radius: 10px;
329
+ border-radius: 10px;
330
+ background: white;
331
+ box-shadow: rgba(0, 0, 0, 0.1) 0 2px 5px;
332
+ -webkit-box-shadow: rgba(0, 0, 0, 0.1) 0 2px 5px;
333
+ -moz-box-shadow: rgba(0, 0, 0, 0.1) 0 2px 5px;
334
+ -o-box-shadow: rgba(0, 0, 0, 0.1) 0 2px 5px;
335
+ }
336
+
337
+ .key { font-family: Arial; }
338
+
339
+ :not(header) > .key {
340
+ margin: 0 5px;
341
+ bottom: 4px;
342
+ }
343
+
344
+ .two-column {
345
+ -webkit-column-count: 2;
346
+ -moz-column-count: 2;
347
+ column-count: 2;
348
+ }
349
+
350
+ .stroke {
351
+ -webkit-text-stroke-color: red;
352
+ -webkit-text-stroke-width: 1px;
353
+ } /* currently webkit-only */
354
+
355
+ .center {
356
+ text-align: center;
357
+ }
358
+
359
+ #presentation-counter {
360
+ color: #ccc;
361
+ font-size: 70%;
362
+ letter-spacing: 1px;
363
+ position: absolute;
364
+ top: 40%;
365
+ left: 0;
366
+ width: 100%;
367
+ text-align: center;
368
+ }
369
+
370
+ div:not(.current).reduced {
371
+ -webkit-transform: scale(0.8);
372
+ -moz-transform: scale(0.8);
373
+ -o-transform: scale(0.8);
374
+ transform: scale(0.8);
375
+ }
376
+
377
+ .no-transitions {
378
+ -webkit-transition: none;
379
+ -moz-transition: none;
380
+ -o-transition: none;
381
+ transition: none;
382
+ }
383
+
384
+ .no-gradients {
385
+ background: none;
386
+ background-color: #fff;
387
+ }
388
+
389
+ ul.bulleted {
390
+ padding-left: 30px;
391
+ }
392
+
@@ -0,0 +1 @@
1
+ // Add your custom JavaScript for your KeyDown presentation here