keydown 0.7.1 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/.travis.yml +3 -0
- data/LICENSE +1 -1
- data/README.md +16 -15
- data/VERSION +1 -1
- data/keydown.gemspec +9 -6
- data/lib/keydown.rb +9 -22
- data/lib/keydown/html_helpers.rb +12 -0
- data/lib/keydown/{lib/slide.rb → slide.rb} +16 -19
- data/lib/keydown/{lib/slidedeck.rb → slidedeck.rb} +20 -5
- data/lib/keydown/tasks.rb +5 -0
- data/lib/keydown/tasks/base.rb +15 -0
- data/lib/keydown/tasks/generate.rb +5 -1
- data/lib/keydown/tasks/slides.rb +1 -1
- data/lib/version.rb +1 -1
- data/spec/lib/html_helpers_spec.rb +26 -0
- data/spec/lib/slide_spec.rb +29 -17
- data/spec/lib/slidedeck_spec.rb +41 -13
- data/spec/spec_helper.rb +2 -6
- data/spec/tasks/generate_spec.rb +41 -20
- data/spec/tasks/slides_spec.rb +83 -44
- data/templates/deck.js/code.html.haml +1 -0
- data/templates/deck.js/index.html.haml +54 -0
- data/templates/deck.js/slide.html.haml +6 -0
- data/templates/generate/css/%presentation_name%.css +12 -1
- data/templates/generate/deck.js/core/deck.core.css +394 -0
- data/templates/generate/deck.js/core/deck.core.js +461 -0
- data/templates/generate/deck.js/core/deck.core.scss +432 -0
- data/templates/generate/deck.js/extensions/codemirror/CONTRIBUTORS.txt +2 -0
- data/templates/generate/deck.js/extensions/codemirror/MIT-LICENSE.txt +21 -0
- data/templates/generate/deck.js/extensions/codemirror/README.md +120 -0
- data/templates/generate/deck.js/extensions/codemirror/VERSION.txt +1 -0
- data/templates/generate/deck.js/extensions/codemirror/codemirror.js +21 -0
- data/templates/generate/deck.js/extensions/codemirror/deck.codemirror.css +89 -0
- data/templates/generate/deck.js/extensions/codemirror/deck.codemirror.js +213 -0
- data/templates/generate/deck.js/extensions/codemirror/deck.codemirror.scss +107 -0
- data/templates/generate/deck.js/extensions/codemirror/mode/clike/clike.js +247 -0
- data/templates/generate/deck.js/extensions/codemirror/mode/clike/index.html +102 -0
- data/templates/generate/deck.js/extensions/codemirror/mode/clojure/clojure.js +207 -0
- data/templates/generate/deck.js/extensions/codemirror/mode/clojure/index.html +85 -0
- data/templates/generate/deck.js/extensions/codemirror/mode/coffeescript/LICENSE +22 -0
- data/templates/generate/deck.js/extensions/codemirror/mode/coffeescript/coffeescript.js +325 -0
- data/templates/generate/deck.js/extensions/codemirror/mode/coffeescript/index.html +722 -0
- data/templates/generate/deck.js/extensions/codemirror/mode/css/css.js +124 -0
- data/templates/generate/deck.js/extensions/codemirror/mode/css/index.html +56 -0
- data/templates/generate/deck.js/extensions/codemirror/mode/diff/diff.css +3 -0
- data/templates/generate/deck.js/extensions/codemirror/mode/diff/diff.js +13 -0
- data/templates/generate/deck.js/extensions/codemirror/mode/diff/index.html +99 -0
- data/templates/generate/deck.js/extensions/codemirror/mode/haskell/haskell.js +242 -0
- data/templates/generate/deck.js/extensions/codemirror/mode/haskell/index.html +60 -0
- data/templates/generate/deck.js/extensions/codemirror/mode/htmlmixed/htmlmixed.js +79 -0
- data/templates/generate/deck.js/extensions/codemirror/mode/htmlmixed/index.html +52 -0
- data/templates/generate/deck.js/extensions/codemirror/mode/javascript/index.html +78 -0
- data/templates/generate/deck.js/extensions/codemirror/mode/javascript/javascript.js +348 -0
- data/templates/generate/deck.js/extensions/codemirror/mode/lua/index.html +72 -0
- data/templates/generate/deck.js/extensions/codemirror/mode/lua/lua.js +138 -0
- data/templates/generate/deck.js/extensions/codemirror/mode/php/index.html +49 -0
- data/templates/generate/deck.js/extensions/codemirror/mode/php/php.js +115 -0
- data/templates/generate/deck.js/extensions/codemirror/mode/plsql/index.html +63 -0
- data/templates/generate/deck.js/extensions/codemirror/mode/plsql/plsql.js +217 -0
- data/templates/generate/deck.js/extensions/codemirror/mode/python/LICENSE.txt +21 -0
- data/templates/generate/deck.js/extensions/codemirror/mode/python/index.html +123 -0
- data/templates/generate/deck.js/extensions/codemirror/mode/python/python.js +321 -0
- data/templates/generate/deck.js/extensions/codemirror/mode/r/LICENSE +24 -0
- data/templates/generate/deck.js/extensions/codemirror/mode/r/index.html +74 -0
- data/templates/generate/deck.js/extensions/codemirror/mode/r/r.js +141 -0
- data/templates/generate/deck.js/extensions/codemirror/mode/rst/index.html +526 -0
- data/templates/generate/deck.js/extensions/codemirror/mode/rst/rst.css +75 -0
- data/templates/generate/deck.js/extensions/codemirror/mode/rst/rst.js +333 -0
- data/templates/generate/deck.js/extensions/codemirror/mode/ruby/LICENSE +24 -0
- data/templates/generate/deck.js/extensions/codemirror/mode/ruby/index.html +172 -0
- data/templates/generate/deck.js/extensions/codemirror/mode/ruby/ruby.js +195 -0
- data/templates/generate/deck.js/extensions/codemirror/mode/scheme/index.html +65 -0
- data/templates/generate/deck.js/extensions/codemirror/mode/scheme/scheme.js +202 -0
- data/templates/generate/deck.js/extensions/codemirror/mode/smalltalk/index.html +56 -0
- data/templates/generate/deck.js/extensions/codemirror/mode/smalltalk/smalltalk.js +122 -0
- data/templates/generate/deck.js/extensions/codemirror/mode/sparql/index.html +41 -0
- data/templates/generate/deck.js/extensions/codemirror/mode/sparql/sparql.js +143 -0
- data/templates/generate/deck.js/extensions/codemirror/mode/stex/index.html +96 -0
- data/templates/generate/deck.js/extensions/codemirror/mode/stex/stex.js +167 -0
- data/templates/generate/deck.js/extensions/codemirror/mode/velocity/index.html +103 -0
- data/templates/generate/deck.js/extensions/codemirror/mode/velocity/velocity.js +146 -0
- data/templates/generate/deck.js/extensions/codemirror/mode/xml/index.html +42 -0
- data/templates/generate/deck.js/extensions/codemirror/mode/xml/xml.js +231 -0
- data/templates/generate/deck.js/extensions/codemirror/mode/xmlpure/index.html +60 -0
- data/templates/generate/deck.js/extensions/codemirror/mode/xmlpure/xmlpure.js +481 -0
- data/templates/generate/deck.js/extensions/codemirror/mode/yaml/index.html +68 -0
- data/templates/generate/deck.js/extensions/codemirror/mode/yaml/yaml.js +95 -0
- data/templates/generate/deck.js/extensions/codemirror/themes/cobalt.css +17 -0
- data/templates/generate/deck.js/extensions/codemirror/themes/default.css +19 -0
- data/templates/generate/deck.js/extensions/codemirror/themes/elegant.css +9 -0
- data/templates/generate/deck.js/extensions/codemirror/themes/neat.css +8 -0
- data/templates/generate/deck.js/extensions/codemirror/themes/night.css +20 -0
- data/templates/generate/deck.js/extensions/goto/deck.goto.css +41 -0
- data/templates/generate/deck.js/extensions/goto/deck.goto.html +6 -0
- data/templates/generate/deck.js/extensions/goto/deck.goto.js +118 -0
- data/templates/generate/deck.js/extensions/goto/deck.goto.scss +46 -0
- data/templates/generate/deck.js/extensions/hash/deck.hash.css +13 -0
- data/templates/generate/deck.js/extensions/hash/deck.hash.html +2 -0
- data/templates/generate/deck.js/extensions/hash/deck.hash.js +125 -0
- data/templates/generate/deck.js/extensions/hash/deck.hash.scss +15 -0
- data/templates/generate/deck.js/extensions/menu/deck.menu.css +24 -0
- data/templates/generate/deck.js/extensions/menu/deck.menu.js +127 -0
- data/templates/generate/deck.js/extensions/menu/deck.menu.scss +29 -0
- data/templates/generate/deck.js/extensions/navigation/deck.navigation.css +43 -0
- data/templates/generate/deck.js/extensions/navigation/deck.navigation.html +3 -0
- data/templates/generate/deck.js/extensions/navigation/deck.navigation.js +83 -0
- data/templates/generate/deck.js/extensions/navigation/deck.navigation.scss +56 -0
- data/templates/generate/deck.js/extensions/scale/deck.scale.css +16 -0
- data/templates/generate/deck.js/extensions/scale/deck.scale.js +155 -0
- data/templates/generate/deck.js/extensions/scale/deck.scale.scss +17 -0
- data/templates/generate/deck.js/extensions/status/deck.status.css +14 -0
- data/templates/generate/deck.js/extensions/status/deck.status.html +6 -0
- data/templates/generate/deck.js/extensions/status/deck.status.js +42 -0
- data/templates/generate/deck.js/extensions/status/deck.status.scss +16 -0
- data/templates/generate/deck.js/support/jquery.1.6.4.min.js +4 -0
- data/templates/generate/deck.js/support/modernizr.custom.js +4 -0
- data/templates/generate/deck.js/themes/style/neon.css +114 -0
- data/templates/generate/deck.js/themes/style/neon.scss +139 -0
- data/templates/generate/deck.js/themes/style/swiss.css +75 -0
- data/templates/generate/deck.js/themes/style/swiss.scss +91 -0
- data/templates/generate/deck.js/themes/style/web-2.0.css +187 -0
- data/templates/generate/deck.js/themes/style/web-2.0.scss +214 -0
- data/templates/generate/deck.js/themes/transition/fade.css +44 -0
- data/templates/generate/deck.js/themes/transition/fade.scss +70 -0
- data/templates/generate/deck.js/themes/transition/horizontal-slide.css +79 -0
- data/templates/generate/deck.js/themes/transition/horizontal-slide.scss +94 -0
- data/templates/generate/deck.js/themes/transition/vertical-slide.css +97 -0
- data/templates/generate/deck.js/themes/transition/vertical-slide.scss +116 -0
- data/templates/keydown.css.erb +27 -23
- metadata +171 -32
- data/Gemfile.lock +0 -41
- data/templates/generate/css/rocks.css +0 -392
- data/templates/generate/css/syntax_highlighting.css +0 -135
- data/templates/generate/js/rocks.js +0 -419
- data/templates/rocks/index.rhtml +0 -132
- data/templates/rocks/slide.rhtml +0 -10
data/spec/lib/slidedeck_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Keydown::SlideDeck do
|
4
4
|
|
@@ -15,12 +15,11 @@ describe Keydown::SlideDeck do
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
|
19
18
|
before :each do
|
20
19
|
module Keydown
|
21
20
|
class Tasks
|
22
21
|
def self.template_dir
|
23
|
-
File.join(Keydown::Tasks.source_root, 'templates', '
|
22
|
+
File.join(Keydown::Tasks.source_root, 'templates', 'deck.js')
|
24
23
|
end
|
25
24
|
end
|
26
25
|
end
|
@@ -69,16 +68,20 @@ and this
|
|
69
68
|
end
|
70
69
|
|
71
70
|
it "should generate the correct number of slides" do
|
72
|
-
@doc.css('
|
71
|
+
@doc.css('section.slide').length.should == 3
|
73
72
|
end
|
74
73
|
|
75
74
|
it "should set the CSS classnames of each slide" do
|
76
|
-
|
75
|
+
slides_content = @doc.css('section.slide div')
|
76
|
+
|
77
|
+
first_slide = slides_content[0]
|
78
|
+
first_slide['class'].should be_nil
|
79
|
+
|
80
|
+
second_slide = slides_content[1]
|
81
|
+
second_slide['class'].should == 'foo'
|
77
82
|
|
78
|
-
|
79
|
-
|
80
|
-
slides[2]['class'].should == 'foo'
|
81
|
-
slides[3]['class'].should == 'foo bar'
|
83
|
+
third_slide = slides_content[2]
|
84
|
+
third_slide['class'].should == 'foo bar'
|
82
85
|
end
|
83
86
|
end
|
84
87
|
end
|
@@ -98,6 +101,8 @@ and this
|
|
98
101
|
|
99
102
|
# Is Brought to You By
|
100
103
|
|
104
|
+
}}} images/ping.png::cprsize
|
105
|
+
|
101
106
|
!NOTE
|
102
107
|
|
103
108
|
and this
|
@@ -105,6 +110,9 @@ and this
|
|
105
110
|
!SLIDE foo bar
|
106
111
|
|
107
112
|
# The Letter Q
|
113
|
+
|
114
|
+
}}} images/poke.png::cprsize::flickr::http://flickr.com/1234
|
115
|
+
|
108
116
|
SLIDES
|
109
117
|
|
110
118
|
@deck = Keydown::SlideDeck.new(@slides_text)
|
@@ -116,18 +124,38 @@ and this
|
|
116
124
|
before(:each) do
|
117
125
|
@html = @deck.to_html
|
118
126
|
@doc = Nokogiri(@html)
|
119
|
-
@
|
127
|
+
@first_slide = @doc.css('section.slide')[0]
|
128
|
+
@second_slide = @doc.css('section.slide')[1]
|
129
|
+
@third_slide = @doc.css('section.slide')[2]
|
120
130
|
end
|
121
131
|
|
122
132
|
it "should add the full-bleed background CSS classname to any slide that specifies a background" do
|
123
|
-
@
|
133
|
+
@first_slide['class'].split(' ').should include('full-background')
|
134
|
+
@second_slide['class'].split(' ').should include('full-background')
|
135
|
+
@third_slide['class'].split(' ').should include('full-background')
|
124
136
|
end
|
125
137
|
|
126
138
|
it "should add a custom classname to a slide that specifies a background" do
|
127
|
-
@
|
139
|
+
@first_slide['class'].split(' ').should include('my_background')
|
140
|
+
@second_slide['class'].split(' ').should include('ping')
|
141
|
+
@third_slide['class'].split(' ').should include('poke')
|
142
|
+
end
|
143
|
+
|
144
|
+
it "should add an attribution element only to slides that requested it" do
|
145
|
+
@first_slide.css('.attribution').length.should == 0
|
146
|
+
@second_slide.css('.attribution').length.should == 1
|
147
|
+
@third_slide.css('.attribution').length.should == 1
|
128
148
|
end
|
129
|
-
end
|
130
149
|
|
150
|
+
it "should add attribution content to slides that requested it" do
|
151
|
+
@second_slide.css('a')[0].text.should match('cprsize')
|
152
|
+
@third_slide.css('a')[0].text.should match('cprsize')
|
153
|
+
end
|
131
154
|
|
155
|
+
it "should add an attribution link if provided" do
|
156
|
+
@second_slide.css('a')[0]['href'].should be_nil
|
157
|
+
@third_slide.css('a')[0]['href'].should match(/^http:/)
|
158
|
+
end
|
159
|
+
end
|
132
160
|
end
|
133
161
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,12 +1,8 @@
|
|
1
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
3
|
-
require 'rubygems'
|
4
1
|
require 'keydown'
|
5
|
-
require 'rspec'
|
6
|
-
require 'pp'
|
7
|
-
|
8
2
|
require 'nokogiri'
|
3
|
+
|
9
4
|
require 'tmpdir'
|
5
|
+
require 'pp'
|
10
6
|
|
11
7
|
def capture_output
|
12
8
|
output = StringIO.new
|
data/spec/tasks/generate_spec.rb
CHANGED
@@ -1,10 +1,18 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Keydown do
|
4
|
+
|
5
|
+
let :tmp_dir do
|
6
|
+
"#{Dir.tmpdir}/keydown"
|
7
|
+
end
|
8
|
+
|
9
|
+
let :project_dir do
|
10
|
+
"#{tmp_dir}/sample"
|
11
|
+
end
|
12
|
+
|
4
13
|
before :each do
|
5
|
-
|
6
|
-
FileUtils.
|
7
|
-
FileUtils.mkdir_p @tmp_dir
|
14
|
+
FileUtils.rm_r tmp_dir if File.exists?(tmp_dir)
|
15
|
+
FileUtils.mkdir_p tmp_dir
|
8
16
|
|
9
17
|
@thor = Thor.new
|
10
18
|
end
|
@@ -12,38 +20,51 @@ describe Keydown do
|
|
12
20
|
describe "generate command" do
|
13
21
|
before :each do
|
14
22
|
capture_output do
|
15
|
-
Dir.chdir
|
23
|
+
Dir.chdir tmp_dir do
|
16
24
|
@thor.invoke Keydown::Tasks, ["generate", "sample"]
|
17
25
|
end
|
18
26
|
end
|
19
27
|
end
|
20
28
|
|
21
29
|
it "should generate a directory for the presentation" do
|
22
|
-
|
23
|
-
File.directory?('sample').should be_true
|
24
|
-
end
|
30
|
+
File.directory?(project_dir).should be_true
|
25
31
|
end
|
26
32
|
|
27
33
|
it "should generate a sample Markdown file" do
|
28
|
-
|
29
|
-
File.exist?("slides.md").should be_true
|
30
|
-
end
|
34
|
+
File.exist?("#{project_dir}/slides.md").should be_true
|
31
35
|
end
|
32
36
|
|
33
37
|
it "should create the support directories for the presentation" do
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
38
|
+
File.directory?("#{project_dir}/css").should be_true
|
39
|
+
File.directory?("#{project_dir}/images").should be_true
|
40
|
+
File.directory?("#{project_dir}/js").should be_true
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should copy the deck.js core files" do
|
44
|
+
File.exist?("#{project_dir}/deck.js/core/deck.core.css").should be_true
|
45
|
+
File.exist?("#{project_dir}/deck.js/core/deck.core.js").should be_true
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should copy deck.js's support files" do
|
49
|
+
File.exist?("#{project_dir}/deck.js/support/jquery.1.6.4.min.js").should be_true
|
50
|
+
File.exist?("#{project_dir}/deck.js/support/modernizr.custom.js").should be_true
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should copy the deck.js extensions" do
|
54
|
+
File.directory?("#{project_dir}/deck.js/extensions").should be_true
|
55
|
+
|
56
|
+
extensions = Dir.glob("#{project_dir}/deck.js/extensions/*")
|
57
|
+
extensions.length.should > 1
|
58
|
+
extensions.should include("#{project_dir}/deck.js/extensions/codemirror")
|
39
59
|
end
|
40
60
|
|
41
|
-
it "should copy
|
42
|
-
File.exist?("#{
|
61
|
+
it "should copy default theme files for deck.js" do
|
62
|
+
File.exist?("#{project_dir}/css/horizontal-slide.css").should be_true
|
63
|
+
File.exist?("#{project_dir}/css/swiss.css").should be_true
|
43
64
|
end
|
44
65
|
|
45
|
-
it "should copy
|
46
|
-
File.exist?("#{
|
66
|
+
it "should copy default them files for codemirror.js" do
|
67
|
+
File.exist?("#{project_dir}/css/default.css").should be_true
|
47
68
|
end
|
48
69
|
|
49
70
|
end
|
data/spec/tasks/slides_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Keydown, "`slides`" do
|
4
4
|
|
@@ -13,30 +13,35 @@ describe Keydown, "`slides`" do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
it "should generate the correct number of slides" do
|
16
|
-
@doc.css('
|
16
|
+
@doc.css('section.slide').length.should == 3
|
17
17
|
end
|
18
18
|
|
19
|
-
|
20
|
-
@doc.css('link[@href="css/rocks.css"]').length.should == 1
|
21
|
-
end
|
19
|
+
end
|
22
20
|
|
23
|
-
|
24
|
-
|
25
|
-
|
21
|
+
let :tmp_dir do
|
22
|
+
"#{Dir.tmpdir}/keydown_test"
|
23
|
+
end
|
26
24
|
|
25
|
+
let :project_dir do
|
26
|
+
"#{tmp_dir}/test"
|
27
27
|
end
|
28
28
|
|
29
29
|
before :each do
|
30
|
-
|
31
|
-
FileUtils.
|
32
|
-
FileUtils.mkdir_p @tmp_dir
|
30
|
+
FileUtils.rm_r tmp_dir if File.exists?(tmp_dir)
|
31
|
+
FileUtils.mkdir_p tmp_dir
|
33
32
|
|
34
33
|
@thor = Thor.new
|
34
|
+
|
35
|
+
Dir.chdir tmp_dir do
|
36
|
+
capture_output do
|
37
|
+
@thor.invoke Keydown::Tasks, ["generate", "test"]
|
38
|
+
end
|
39
|
+
end
|
35
40
|
end
|
36
41
|
|
37
42
|
describe "when file cannot be found" do
|
38
43
|
before(:each) do
|
39
|
-
Dir.chdir
|
44
|
+
Dir.chdir project_dir do
|
40
45
|
@std_out = capture_output do
|
41
46
|
@thor.invoke Keydown::Tasks, ["slides", "with_title.md"]
|
42
47
|
end
|
@@ -48,7 +53,7 @@ describe Keydown, "`slides`" do
|
|
48
53
|
end
|
49
54
|
|
50
55
|
it "should not write out a file" do
|
51
|
-
Dir.glob("#{
|
56
|
+
Dir.glob("#{tmp_dir}/*.html").should be_empty
|
52
57
|
end
|
53
58
|
|
54
59
|
end
|
@@ -56,13 +61,13 @@ describe Keydown, "`slides`" do
|
|
56
61
|
describe "with defaults" do
|
57
62
|
|
58
63
|
before :each do
|
59
|
-
system "cp -r spec/fixtures/with_title.md #{
|
64
|
+
system "cp -r spec/fixtures/with_title.md #{project_dir}"
|
60
65
|
end
|
61
66
|
|
62
67
|
describe "should generate an html file that" do
|
63
68
|
before(:each) do
|
64
69
|
capture_output do
|
65
|
-
Dir.chdir
|
70
|
+
Dir.chdir project_dir do
|
66
71
|
@thor.invoke Keydown::Tasks, ["slides", "with_title.md"]
|
67
72
|
@file = File.new('with_title.html')
|
68
73
|
@doc = Nokogiri(@file)
|
@@ -74,24 +79,64 @@ describe Keydown, "`slides`" do
|
|
74
79
|
|
75
80
|
describe "should have one slide that" do
|
76
81
|
before :each do
|
77
|
-
@
|
82
|
+
@third_slide = @doc.css('section')[2].css('div')[0]
|
78
83
|
end
|
79
84
|
|
80
85
|
it "should have the correct css class(es)" do
|
81
|
-
@
|
82
|
-
@
|
86
|
+
@third_slide['class'].should match /foo/
|
87
|
+
@third_slide['class'].should match /bar/
|
83
88
|
end
|
84
89
|
|
85
90
|
it "should have the correct content" do
|
86
|
-
@
|
91
|
+
@third_slide.css('h1').text.should match /The Letter Q/
|
92
|
+
end
|
93
|
+
|
94
|
+
it "should have the deck.js files" do
|
95
|
+
scripts = @doc.css('script').collect { |tag| tag['src'] }
|
96
|
+
scripts.should include('deck.js/support/modernizr.custom.js')
|
97
|
+
scripts.should include('deck.js/support/jquery.1.6.4.min.js')
|
98
|
+
scripts.should include('deck.js/core/deck.core.js')
|
87
99
|
end
|
100
|
+
|
101
|
+
it "should have all of the extension js files" do
|
102
|
+
scripts = @doc.css('script').collect { |tag| tag['src'] }
|
103
|
+
|
104
|
+
scripts.should include('deck.js/extensions/codemirror/codemirror.js')
|
105
|
+
scripts.should include('deck.js/extensions/codemirror/deck.codemirror.js')
|
106
|
+
scripts.should include('deck.js/extensions/codemirror/mode/ruby/ruby.js') # assuming one means all, really
|
107
|
+
scripts.should include('deck.js/extensions/goto/deck.goto.js')
|
108
|
+
scripts.should include('deck.js/extensions/hash/deck.hash.js')
|
109
|
+
scripts.should include('deck.js/extensions/menu/deck.menu.js')
|
110
|
+
scripts.should include('deck.js/extensions/navigation/deck.navigation.js')
|
111
|
+
scripts.should include('deck.js/extensions/scale/deck.scale.js')
|
112
|
+
scripts.should include('deck.js/extensions/status/deck.status.js')
|
113
|
+
end
|
114
|
+
|
115
|
+
it "should have all of the extension top-level css files" do
|
116
|
+
stylesheets = @doc.css('link').collect {|tag| tag['href']}
|
117
|
+
|
118
|
+
stylesheets.should include('deck.js/extensions/codemirror/deck.codemirror.css')
|
119
|
+
stylesheets.should include('deck.js/extensions/goto/deck.goto.css')
|
120
|
+
stylesheets.should include('deck.js/extensions/hash/deck.hash.css')
|
121
|
+
stylesheets.should include('deck.js/extensions/menu/deck.menu.css')
|
122
|
+
stylesheets.should include('deck.js/extensions/navigation/deck.navigation.css')
|
123
|
+
stylesheets.should include('deck.js/extensions/scale/deck.scale.css')
|
124
|
+
stylesheets.should include('deck.js/extensions/status/deck.status.css')
|
125
|
+
end
|
126
|
+
|
127
|
+
it "should not include any of the extension sub-directory css files" do
|
128
|
+
stylesheets = @doc.css('link').collect {|tag| tag['href']}
|
129
|
+
|
130
|
+
stylesheets.should_not include('deck.js/extensions/codemirror/themes/cobalt.css')
|
131
|
+
end
|
132
|
+
|
88
133
|
end
|
89
134
|
end
|
90
135
|
|
91
136
|
describe "should add an .md extention if one isn't specified" do
|
92
137
|
before(:each) do
|
93
138
|
capture_output do
|
94
|
-
Dir.chdir
|
139
|
+
Dir.chdir project_dir do
|
95
140
|
@thor.invoke Keydown::Tasks, ["slides", "with_title"]
|
96
141
|
@file = File.new('with_title.html')
|
97
142
|
@doc = Nokogiri(@file)
|
@@ -108,13 +153,10 @@ describe Keydown, "`slides`" do
|
|
108
153
|
before(:each) do
|
109
154
|
capture_output do
|
110
155
|
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
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"
|
156
|
+
Dir.chdir project_dir do
|
157
|
+
system "cp #{Keydown::Tasks.source_root}/spec/fixtures/with_title.md #{project_dir}/with_title.md"
|
158
|
+
system "cp #{Keydown::Tasks.source_root}/spec/fixtures/custom.css #{project_dir}/css/custom.css"
|
159
|
+
system "cp #{Keydown::Tasks.source_root}/spec/fixtures/custom.js #{project_dir}/js/custom.js"
|
118
160
|
|
119
161
|
@thor.invoke Keydown::Tasks, ["slides", "with_title.md"]
|
120
162
|
|
@@ -122,37 +164,35 @@ describe Keydown, "`slides`" do
|
|
122
164
|
@doc = Nokogiri(@file)
|
123
165
|
end
|
124
166
|
end
|
125
|
-
end
|
126
167
|
end
|
127
168
|
|
128
169
|
it_should_behave_like "generating a presentation file"
|
129
170
|
|
130
171
|
it "should include any custom CSS file from the css directory" do
|
131
|
-
@doc.css('link
|
132
|
-
|
172
|
+
stylesheets = @doc.css('link').collect {|tag| tag['href']}
|
173
|
+
|
174
|
+
stylesheets.should include('css/test.css')
|
175
|
+
stylesheets.should include('css/custom.css')
|
133
176
|
end
|
134
177
|
|
135
178
|
it "should include any custom JavaScript files from the js directory" do
|
136
|
-
@doc.css('script
|
137
|
-
|
179
|
+
scripts = @doc.css('script').collect { |tag| tag['src'] }
|
180
|
+
|
181
|
+
scripts.should include('js/test.js')
|
182
|
+
scripts.should include('js/custom.js')
|
138
183
|
end
|
139
184
|
end
|
140
185
|
|
141
186
|
describe "for a presentation that has background images" do
|
142
187
|
before(:each) do
|
143
188
|
capture_output do
|
189
|
+
Dir.chdir project_dir do
|
190
|
+
system "cp #{Keydown::Tasks.source_root}/spec/fixtures/with_backgrounds.md #{tmp_dir}/test/with_backgrounds.md"
|
144
191
|
|
145
|
-
|
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"
|
192
|
+
@thor.invoke Keydown::Tasks, ["slides", "with_backgrounds.md"]
|
150
193
|
|
151
|
-
|
152
|
-
|
153
|
-
@file = File.new('with_backgrounds.html')
|
154
|
-
@doc = Nokogiri(@file)
|
155
|
-
end
|
194
|
+
@file = File.new('with_backgrounds.html')
|
195
|
+
@doc = Nokogiri(@file)
|
156
196
|
end
|
157
197
|
end
|
158
198
|
end
|
@@ -160,12 +200,11 @@ describe Keydown, "`slides`" do
|
|
160
200
|
it_should_behave_like "generating a presentation file"
|
161
201
|
|
162
202
|
it "should add the keydown.css file (which has the backgrounds) to the css directory" do
|
163
|
-
File.exist?("#{
|
203
|
+
File.exist?("#{tmp_dir}/test/css/keydown.css").should be_true
|
164
204
|
end
|
165
205
|
|
166
206
|
it "should add the keydown.css file to the HTML file" do
|
167
207
|
@doc.css('link[@href="css/keydown.css"]').length.should == 1
|
168
208
|
end
|
169
|
-
|
170
209
|
end
|
171
210
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
%textarea{ :class => "code", :mode => language, :display => "none" }= code
|
@@ -0,0 +1,54 @@
|
|
1
|
+
!!! 5
|
2
|
+
%html
|
3
|
+
%head
|
4
|
+
%title= title
|
5
|
+
%meta{ :charset => "utf-8" }
|
6
|
+
%meta{ :name => "viewport", :content => "width=1024, user-scalable=no" }
|
7
|
+
|
8
|
+
/ deck.js's core css
|
9
|
+
= stylesheet "deck.js/core/deck.core.css"
|
10
|
+
|
11
|
+
/ deck.js extension CSS files
|
12
|
+
- extensions_css_files.each do |css_file|
|
13
|
+
= stylesheet css_file
|
14
|
+
|
15
|
+
/ all css in the css dir: Keydown CSS, your custom CSS, and themes from deck.js
|
16
|
+
- css_files.each do |css_file|
|
17
|
+
= stylesheet css_file
|
18
|
+
|
19
|
+
/ Modernizr (provided for legacy browsers)
|
20
|
+
= script "deck.js/support/modernizr.custom.js"
|
21
|
+
|
22
|
+
%body{ :class => 'keydown' }
|
23
|
+
%article.deck-container
|
24
|
+
- slides.each do |slide|
|
25
|
+
= slide.to_html
|
26
|
+
|
27
|
+
/ deck.js navigation extension
|
28
|
+
%a{ :href => '#', :class => 'deck-prev-link', :title => 'Previous' } ←
|
29
|
+
%a{ :href => '#', :class => 'deck-next-link', :title => 'Next' } →
|
30
|
+
|
31
|
+
/ deck.js hash extension
|
32
|
+
%a{ :href => '.', :class => 'deck-permalink', :title => 'Permalink to this slide' } #
|
33
|
+
|
34
|
+
/ deck.js status extension
|
35
|
+
%p.deck-status
|
36
|
+
%span.deck-status-current
|
37
|
+
\/
|
38
|
+
%span.deck-status-total
|
39
|
+
|
40
|
+
/ jQuery & deck.js
|
41
|
+
= script "deck.js/support/jquery.1.6.4.min.js"
|
42
|
+
= script "deck.js/core/deck.core.js"
|
43
|
+
|
44
|
+
/ deck.js extension JS files
|
45
|
+
- extensions_js_files.each do |js_file|
|
46
|
+
= script js_file
|
47
|
+
|
48
|
+
/ your custom JS here, including call to initialize deck.js-codemirror
|
49
|
+
- js_files.each do |js_file|
|
50
|
+
= script js_file
|
51
|
+
|
52
|
+
/ Initialize the deck.
|
53
|
+
%script{:type => "text/javascript"}
|
54
|
+
$(function() { $.deck('.slide'); });
|