keydown 0.9.1 → 0.9.2

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.
File without changes
data/README.md CHANGED
@@ -7,6 +7,8 @@ It uses the excellent [deck.js](http://imakewebthings.github.com/deck.js) and it
7
7
 
8
8
  [![Build Status](https://secure.travis-ci.org/infews/keydown.png)](http://travis-ci.org/infews/keydown) at [Travis](http://travis-ci.org).
9
9
 
10
+ Our Github Pages is a [Sample Presentation](http://infews.github.com/keydown)
11
+
10
12
  ## Usage
11
13
  $ gem install keydown
12
14
 
@@ -16,6 +16,7 @@ Gem::Specification.new do |s|
16
16
  s.add_dependency 'tilt'
17
17
  s.add_dependency 'haml'
18
18
  s.add_dependency 'sass'
19
+ s.add_dependency 'compass'
19
20
  s.add_dependency 'rdiscount', '>= 1.6.8'
20
21
 
21
22
  s.add_development_dependency "rake"
@@ -4,6 +4,8 @@ require 'tilt'
4
4
 
5
5
  require 'version'
6
6
  require 'keydown/html_helpers'
7
+ require 'keydown/classnames'
7
8
  require 'keydown/slide'
9
+ require 'keydown/code_map'
8
10
  require 'keydown/slidedeck'
9
11
  require 'keydown/tasks'
@@ -0,0 +1,30 @@
1
+ module Keydown
2
+ class Classnames
3
+
4
+ def initialize(names = '')
5
+ @names = []
6
+ add(names)
7
+ end
8
+
9
+ def add(names)
10
+ @names += names.split(" ")
11
+ @names.uniq!
12
+ end
13
+
14
+ def remove(names)
15
+ @names -= names.split(' ')
16
+ end
17
+
18
+ def include?(name)
19
+ @names.include? name
20
+ end
21
+
22
+ def to_hash
23
+ @names.empty? ? {} : { :class => self.to_s }
24
+ end
25
+
26
+ def to_s
27
+ @names.sort.join(' ')
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,69 @@
1
+ module Keydown
2
+ class CodeMap
3
+
4
+ attr_reader :mapped_text
5
+
6
+ def initialize(text)
7
+ @text = text
8
+ @map = {}
9
+ end
10
+
11
+ def add(id, node)
12
+ @map[id] = node
13
+ end
14
+
15
+ def [](id)
16
+ @map[id]
17
+ end
18
+
19
+ def each(&blk)
20
+ @map.send(:each, &blk)
21
+ end
22
+
23
+ def length
24
+ @map.keys.length
25
+ end
26
+
27
+ def nodes
28
+ @map
29
+ end
30
+
31
+ def build
32
+ @mapped_text = @text.gsub(/^(```|@@@) ?(.+?)\r?\n(.+?)\r?\n(```|@@@)\r?$/m) do
33
+ language = $2
34
+ code = $3
35
+ id = Digest::SHA1.hexdigest(code)
36
+
37
+ add(id, highlight(code, language))
38
+ id
39
+ end
40
+ end
41
+
42
+ def put_code_in(html)
43
+ each do |id, code|
44
+ html.sub!(id, code)
45
+ end
46
+
47
+ html
48
+ end
49
+
50
+ def self.build_from(text)
51
+ map = CodeMap.new(text)
52
+ map.build
53
+ map
54
+ end
55
+
56
+ protected
57
+
58
+ def highlight(code, language)
59
+ if code.lines.all? { |line| line =~ /\A\r?\n\Z/ || line =~ /^( |\t)/ }
60
+ code.gsub!(/^( |\t)/m, '')
61
+ end
62
+
63
+ context = OpenStruct.new :language => language, :code => code
64
+ template = Tilt.new(File.join(Tasks.template_dir, 'code.html.haml'))
65
+
66
+ template.render(context)
67
+ end
68
+ end
69
+ end
@@ -4,40 +4,25 @@ module Keydown
4
4
  attr_reader :content
5
5
  attr_reader :notes
6
6
  attr_reader :background_image
7
+ attr_reader :classnames
7
8
 
8
9
  def initialize(text, classnames = '')
9
- @content = text
10
10
  @notes = ''
11
- @codemap = {}
12
11
  @background_image = {}
13
12
 
14
- @classnames = []
15
- classnames.split(' ').inject(@classnames) do |css_classnames, name|
16
- css_classnames << name
17
- css_classnames
18
- end
13
+ @codemap = CodeMap.build_from(text)
14
+ @content = @codemap.mapped_text
19
15
 
20
16
  extract_notes!
21
17
  extract_content!
22
- extract_code!
23
18
  extract_background_image!
24
- highlight_code!
25
- end
26
-
27
- def classnames
28
- @classnames.length > 0 ? { :class => @classnames.join(' ') } : {}
29
- end
30
19
 
31
- def container_classnames
32
- @names ||= begin
33
- names = ['slide']
20
+ @classnames = Classnames.new('slide')
21
+ @classnames.add(classnames)
34
22
 
35
- unless @background_image.empty?
36
- names << 'full-background'
37
- names << @background_image[:classname]
38
- end
39
-
40
- names.join(' ')
23
+ unless @background_image.empty?
24
+ @classnames.add('full-background')
25
+ @classnames.add(@background_image[:classname])
41
26
  end
42
27
  end
43
28
 
@@ -53,13 +38,14 @@ module Keydown
53
38
 
54
39
  markdown = RDiscount.new(@content)
55
40
  context = OpenStruct.new(:html_content => markdown.to_html,
56
- :container_classnames => container_classnames,
57
- :classnames => classnames,
41
+ :classnames => classnames.to_hash,
58
42
  :background_attribution_classnames => background_attribution_classnames,
59
43
  :background_image => background_image)
60
44
 
61
45
  slide = Tilt.new(File.join(Tasks.template_dir, 'slide.html.haml'))
62
- slide.render(context)
46
+ html = slide.render(context)
47
+
48
+ @codemap.put_code_in html
63
49
  end
64
50
 
65
51
  private
@@ -75,12 +61,7 @@ module Keydown
75
61
  @content.gsub!(/^!NOTE(S)?\s*(.*\n)$/m, '')
76
62
  end
77
63
 
78
- def extract_code!
79
- @content.gsub!(/^(```|@@@) ?(.+?)\r?\n(.+?)\r?\n(```|@@@)\r?$/m) do
80
- id = Digest::SHA1.hexdigest($3)
81
- @codemap[id] = {:lang => $2, :code => $3}
82
- id
83
- end
64
+ def extract_code(text)
84
65
  end
85
66
 
86
67
  def extract_background_image!
@@ -104,22 +85,5 @@ module Keydown
104
85
  :attribution_link => split_line[3]})
105
86
  end
106
87
  end
107
-
108
- require "coderay"
109
-
110
- def highlight_code!
111
- @codemap.each do |id, code_block|
112
- language = code_block[:lang]
113
- code = code_block[:code]
114
- if code.lines.all? { |line| line =~ /\A\r?\n\Z/ || line =~ /^( |\t)/ }
115
- code.gsub!(/^( |\t)/m, '')
116
- end
117
-
118
- context = OpenStruct.new :language => language, :code => code
119
- template = Tilt.new(File.join(Tasks.template_dir, 'code.html.haml'))
120
-
121
- @content.gsub!(id, template.render(context))
122
- end
123
- end
124
88
  end
125
89
  end
@@ -1,3 +1,6 @@
1
+ require 'sass'
2
+ require 'compass'
3
+
1
4
  module Keydown
2
5
  class Tasks < Thor
3
6
 
@@ -21,9 +24,14 @@ module Keydown
21
24
  slide.background_image unless slide.background_image.empty?
22
25
  end.compact
23
26
 
24
- css_template = File.new(File.join(Tasks.template_dir, '..', 'keydown.css.erb'))
27
+ context = OpenStruct.new({ :backgrounds => backgrounds })
28
+ scss_template = Tilt.new(File.join(Tasks.template_dir, '..', 'keydown.scss.erb'))
29
+ scss = scss_template.render(context)
30
+
31
+ compass_path = File.join(Gem.loaded_specs['compass'].full_gem_path, 'frameworks', 'compass', 'stylesheets')
32
+
25
33
  create_file 'css/keydown.css', :force => true do
26
- ERB.new(css_template.read).result(binding)
34
+ Sass::Engine.new(scss, :syntax => :scss, :load_paths => [compass_path]).render
27
35
  end
28
36
 
29
37
  presentation = file.gsub('md', 'html')
@@ -1,3 +1,3 @@
1
1
  module Keydown
2
- VERSION = "0.9.1"
2
+ VERSION = "0.9.2"
3
3
  end
@@ -0,0 +1,102 @@
1
+ require 'spec_helper'
2
+
3
+ describe Keydown::Classnames do
4
+
5
+ describe "#add" do
6
+ before do
7
+ @classnames = Keydown::Classnames.new
8
+ @classnames.add("foo")
9
+ @classnames.add("bar baz")
10
+ end
11
+
12
+ it "should return an empty hash" do
13
+ @classnames.to_hash.should == {:class => "bar baz foo"}
14
+ end
15
+
16
+ it "should not duplicate classnames" do
17
+ @classnames.add("foo")
18
+ @classnames.to_hash.should == {:class => "bar baz foo"}
19
+ end
20
+ end
21
+
22
+ describe "#remove" do
23
+ before do
24
+ @classnames = Keydown::Classnames.new
25
+ @classnames.add("foo")
26
+ @classnames.add("bar baz")
27
+ end
28
+
29
+ it "should remove a classname" do
30
+ @classnames.remove("foo")
31
+ @classnames.to_s.should_not match(/foo/)
32
+ @classnames.to_hash[:class].should_not match(/foo/)
33
+ end
34
+
35
+ it "should remove multiple classnames" do
36
+ @classnames.remove("bar baz")
37
+ @classnames.to_s.should_not match(/bar/)
38
+ @classnames.to_s.should_not match(/baz/)
39
+ @classnames.to_hash[:class].should_not match(/bar/)
40
+ @classnames.to_hash[:class].should_not match(/baz/)
41
+ end
42
+ end
43
+
44
+ describe "#include?" do
45
+ before do
46
+ @classnames = Keydown::Classnames.new
47
+ @classnames.add("foo")
48
+ end
49
+
50
+ it "should return true if the class is present" do
51
+ @classnames.include?('foo').should be_true
52
+ end
53
+
54
+ it "should return false if the class is not present" do
55
+ @classnames.include?('bar').should be_false
56
+ end
57
+ end
58
+
59
+ describe "#to_s" do
60
+ describe "with no classnames" do
61
+ before do
62
+ @classnames = Keydown::Classnames.new
63
+ end
64
+
65
+ it "should return an empty hash" do
66
+ @classnames.to_s.should == ''
67
+ end
68
+ end
69
+
70
+ describe "with classnames" do
71
+ before do
72
+ @classnames = Keydown::Classnames.new("foo bar baz")
73
+ end
74
+
75
+ it "should return a hash of classnames for use in HAML" do
76
+ @classnames.to_s.should == 'bar baz foo'
77
+ end
78
+ end
79
+ end
80
+
81
+ describe "#to_hash" do
82
+ describe "with no classnames" do
83
+ before do
84
+ @classnames = Keydown::Classnames.new
85
+ end
86
+
87
+ it "should return an empty hash" do
88
+ @classnames.to_hash.should == {}
89
+ end
90
+ end
91
+
92
+ describe "with classnames" do
93
+ before do
94
+ @classnames = Keydown::Classnames.new("foo bar baz")
95
+ end
96
+
97
+ it "should return a hash of classnames for use in HAML" do
98
+ @classnames.to_hash.should == {:class => "bar baz foo"}
99
+ end
100
+ end
101
+ end
102
+ end
@@ -0,0 +1,105 @@
1
+ require 'spec_helper'
2
+
3
+ describe Keydown::CodeMap do
4
+ before :each do
5
+ module Keydown
6
+ class Tasks
7
+ def self.template_dir
8
+ File.join(Keydown::Tasks.source_root, 'templates', 'deck.js')
9
+ end
10
+ end
11
+ end
12
+ end
13
+
14
+ let :ruby_block do
15
+ %{@@@ ruby
16
+ def a_method(options)
17
+ puts "I can has options " + options
18
+ end
19
+ @@@}
20
+ end
21
+
22
+ let :md_block do
23
+ %{``` Markdown
24
+ # I'm an H1
25
+
26
+ * list item 1
27
+ * list item 2
28
+ * list item 3
29
+ ```}
30
+ end
31
+
32
+ let :slide_text do
33
+ slide_text = <<-SLIDE
34
+ # A Slide
35
+ With some text
36
+
37
+ #{ruby_block}
38
+
39
+ #{md_block}
40
+
41
+ !NOTES
42
+ a simple note
43
+
44
+ SLIDE
45
+ end
46
+
47
+ before :each do
48
+ @map = Keydown::CodeMap.new(slide_text)
49
+ @map.build
50
+ @text = @map.mapped_text
51
+ end
52
+
53
+ it "should replace each code block with a marker" do
54
+ @text.should_not match(/ruby/)
55
+ @text.should_not match(/@@@/)
56
+ @text.should match(@map.nodes.keys[0])
57
+ @text.should_not match(/Markdown/)
58
+ @text.should_not match(/```/)
59
+ @text.should match(@map.nodes.keys[1])
60
+ end
61
+
62
+ it "should find all the code segments" do
63
+ @map.length.should == 2
64
+ end
65
+
66
+ it "should find and encode a code block in @@@" do
67
+ code_id = @map.nodes.keys[0]
68
+ @html = Nokogiri(@map[code_id])
69
+
70
+ @html.css('textarea.code').length.should == 1
71
+ @html.css('textarea').attr('mode').value.should == 'ruby'
72
+ @html.css('textarea').text.should match(/a_method/)
73
+ end
74
+
75
+ it "should find a code block in ```" do
76
+ code_id = @map.nodes.keys[1]
77
+ @html = Nokogiri(@map[code_id])
78
+
79
+ @html.css('textarea.code').length.should == 1
80
+ @html.css('textarea').attr('mode').value.should == 'Markdown'
81
+ @html.css('textarea').text.should match(/I'm an H1/)
82
+ end
83
+
84
+ describe ".build_form" do
85
+ before :each do
86
+ @map = Keydown::CodeMap.build_from(slide_text)
87
+ end
88
+
89
+ it "should return a built CodeMap" do
90
+ @map.length.should == 2
91
+ end
92
+ end
93
+
94
+ describe "#put_code_in" do
95
+
96
+ before :each do
97
+ converted = "<div>#{@map.put_code_in(@text)}</div>"
98
+ @doc = Nokogiri(converted)
99
+ end
100
+
101
+ it "should put the highligheted code back into the html" do
102
+ @doc.css('textarea.code').length.should == 2
103
+ end
104
+ end
105
+ end
@@ -14,7 +14,7 @@ describe Keydown::Slide do
14
14
  shared_examples_for 'extracting slide data' do
15
15
 
16
16
  it "should set the CSS classnames" do
17
- @slide.classnames.should == @classnames
17
+ @slide.classnames.to_s.should == @classnames
18
18
  end
19
19
 
20
20
  it "should extract the slide content" do
@@ -68,7 +68,7 @@ With some text
68
68
  a simple note
69
69
  SLIDE
70
70
 
71
- @classnames = {}
71
+ @classnames = 'slide'
72
72
  @slide = Keydown::Slide.new(@slide_text)
73
73
  end
74
74
 
@@ -96,7 +96,7 @@ With some text
96
96
  a simple note
97
97
  SLIDE
98
98
 
99
- @classnames = {:class => 'foo'}
99
+ @classnames = ['foo', 'slide'].sort.join(' ')
100
100
  @slide = Keydown::Slide.new(@slide_text, 'foo')
101
101
  end
102
102
 
@@ -106,7 +106,7 @@ a simple note
106
106
  before :each do
107
107
  @html = @slide.to_html
108
108
  @doc = Nokogiri(@html)
109
- @slide_selector = "section.#{@classnames[:class]}"
109
+ @slide_selector = "section.#{@classnames}"
110
110
  end
111
111
 
112
112
  it_should_behave_like "generating HTML"
@@ -124,7 +124,7 @@ With some text
124
124
  a simple note
125
125
  SLIDE
126
126
 
127
- @classnames = {:class => 'foo bar'}
127
+ @classnames = ['slide', 'foo', 'bar'].sort.join(' ')
128
128
  @slide = Keydown::Slide.new(@slide_text, 'foo bar')
129
129
 
130
130
  end
@@ -135,12 +135,46 @@ a simple note
135
135
  before :each do
136
136
  @html = @slide.to_html
137
137
  @doc = Nokogiri(@html)
138
- @slide_selector = "section.#{@classnames[:class]}"
138
+ @slide_selector = "section.#{@classnames}"
139
139
  end
140
140
  it_should_behave_like "generating HTML"
141
141
  end
142
142
  end
143
143
 
144
+ describe "with the classname of 'left'" do
145
+ before :each do
146
+ @slide_text = <<-SLIDE
147
+
148
+ # A Slide
149
+ With some text
150
+
151
+ !NOTES
152
+ a simple note
153
+ SLIDE
154
+
155
+ @classnames = ['slide', 'left', 'foo'].sort.join(' ')
156
+ @slide = Keydown::Slide.new(@slide_text, 'foo left')
157
+
158
+ end
159
+
160
+ it_should_behave_like "extracting slide data"
161
+
162
+ describe "generating HTML" do
163
+ before :each do
164
+ @html = @slide.to_html
165
+ @doc = Nokogiri(@html)
166
+ @slide_selector = "section.#{@classnames}"
167
+ end
168
+
169
+ it_should_behave_like "generating HTML"
170
+
171
+ it "should add the classname 'left' to the section (in order to justify the whole slide)" do
172
+ @doc.css('section')[0]['class'].should include('left')
173
+ end
174
+
175
+ end
176
+ end
177
+
144
178
  describe "without a note" do
145
179
  before :each do
146
180
  @slide_text = <<-SLIDE
@@ -149,12 +183,12 @@ a simple note
149
183
  With some text
150
184
  SLIDE
151
185
 
152
- @classnames = {}
186
+ @classnames = 'slide'
153
187
  @slide = Keydown::Slide.new(@slide_text)
154
188
  end
155
189
 
156
190
  it "should set the CSS classnames" do
157
- @slide.classnames.should == @classnames
191
+ @slide.classnames.to_s.should == @classnames
158
192
  end
159
193
 
160
194
  it "should extract the slide content" do
@@ -192,8 +226,8 @@ a simple note
192
226
 
193
227
  SLIDE
194
228
 
195
- @classnames = {}
196
- template_dir = File.join(Keydown::Tasks.source_root, 'templates', 'rocks')
229
+ @classnames = 'slide'
230
+ template_dir = File.join(Keydown::Tasks.source_root, 'templates', 'deck.js')
197
231
  @slide = Keydown::Slide.new(@slide_text)
198
232
  end
199
233
 
@@ -229,7 +263,7 @@ a simple note
229
263
 
230
264
  SLIDE
231
265
 
232
- @classnames = {}
266
+ @classnames = 'slide'
233
267
  @slide = Keydown::Slide.new(@slide_text)
234
268
  end
235
269
 
@@ -266,7 +300,7 @@ a simple note
266
300
 
267
301
  SLIDE
268
302
 
269
- @classnames = {}
303
+ @classnames = 'full-background my_background slide'
270
304
  @slide = Keydown::Slide.new(@slide_text.chomp)
271
305
  end
272
306
 
@@ -319,7 +353,7 @@ a simple note
319
353
 
320
354
  SLIDE
321
355
 
322
- @classnames = {}
356
+ @classnames = 'full-background my_background slide'
323
357
  @slide = Keydown::Slide.new(@slide_text.chomp)
324
358
  end
325
359
 
@@ -72,16 +72,16 @@ and this
72
72
  end
73
73
 
74
74
  it "should set the CSS classnames of each slide" do
75
- slides_content = @doc.css('section.slide div')
75
+ slides = @doc.css('.slide')
76
76
 
77
- first_slide = slides_content[0]
78
- first_slide['class'].should be_nil
77
+ first_slide = slides[0]
78
+ first_slide['class'].should == 'slide'
79
79
 
80
- second_slide = slides_content[1]
81
- second_slide['class'].should == 'foo'
80
+ second_slide = slides[1]
81
+ second_slide['class'].should == 'foo slide'
82
82
 
83
- third_slide = slides_content[2]
84
- third_slide['class'].should == 'foo bar'
83
+ third_slide = slides[2]
84
+ third_slide['class'].should == 'bar foo slide'
85
85
  end
86
86
  end
87
87
  end
@@ -79,7 +79,7 @@ describe Keydown, "`slides`" do
79
79
 
80
80
  describe "should have one slide that" do
81
81
  before :each do
82
- @third_slide = @doc.css('section')[2].css('div')[0]
82
+ @third_slide = @doc.css('.slide')[2]
83
83
  end
84
84
 
85
85
  it "should have the correct css class(es)" do
@@ -203,6 +203,12 @@ describe Keydown, "`slides`" do
203
203
  File.exist?("#{tmp_dir}/test/css/keydown.css").should be_true
204
204
  end
205
205
 
206
+ it "should build a CSS file with the custom background images definitions" do
207
+ css_contents = File.read("#{tmp_dir}/test/css/keydown.css")
208
+
209
+ css_contents.should match(/\.slide\.full-background\.one/)
210
+ end
211
+
206
212
  it "should add the keydown.css file to the HTML file" do
207
213
  @doc.css('link[@href="css/keydown.css"]').length.should == 1
208
214
  end
@@ -19,23 +19,22 @@
19
19
  / Modernizr (provided for legacy browsers)
20
20
  = script "deck.js/support/modernizr.custom.js"
21
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' } &#8592;
29
- %a{ :href => '#', :class => 'deck-next-link', :title => 'Next' } &#8594;
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
22
+ %body{ :class => "deck-container keydown" }
23
+ - slides.each do |slide|
24
+ = slide.to_html
25
+
26
+ / deck.js navigation extension
27
+ %a{ :href => '#', :class => 'deck-prev-link', :title => 'Previous' } &#8592;
28
+ %a{ :href => '#', :class => 'deck-next-link', :title => 'Next' } &#8594;
29
+
30
+ / deck.js hash extension
31
+ %a{ :href => '.', :class => 'deck-permalink', :title => 'Permalink to this slide' } #
32
+
33
+ / deck.js status extension
34
+ %p.deck-status
35
+ %span.deck-status-current
36
+ \/
37
+ %span.deck-status-total
39
38
 
40
39
  / jQuery & deck.js
41
40
  = script "deck.js/support/jquery.1.6.4.min.js"
@@ -1,6 +1,8 @@
1
- %section{:class => container_classnames}
2
- %div{classnames }
1
+ %section{classnames}
2
+ .spacer.top
3
+ .content
3
4
  = html_content
5
+ .spacer.bottom
4
6
  - if background_attribution_classnames.length > 2
5
7
  %div{:class => background_attribution_classnames}
6
- %a{:href => background_image[:attribution_link], :target => "_blank"}= background_image[:attribution_text]
8
+ %a{:href => background_image[:attribution_link], :target => "_blank"}= background_image[:attribution_text]
@@ -182,7 +182,7 @@ html {
182
182
  .deck-container h1 {
183
183
  font-size: 4.5em;
184
184
  font-weight: bold;
185
- text-align: center;
185
+ /*text-align: center;*/
186
186
  padding-top: 1em;
187
187
  }
188
188
  .csstransforms .deck-container h1 {
@@ -0,0 +1,208 @@
1
+ @import "compass/css3";
2
+
3
+ @import url(http://fonts.googleapis.com/css?family=Open+Sans:400,700,800);
4
+
5
+ /* Reset deck.core.css */
6
+ .keydown.deck-container h1 {
7
+ font-weight: normal;
8
+ text-align: left;
9
+ padding-top: 0;
10
+ }
11
+
12
+ /* Reset deck.core.css */
13
+ .csstransforms .deck-container .slide {
14
+
15
+ h1 {
16
+ padding: 0;
17
+ left: auto;
18
+ right: auto;
19
+ top: auto;
20
+ position: relative;
21
+
22
+ @include transform(none);
23
+ }
24
+
25
+ h2 {
26
+ border: none;
27
+ }
28
+ }
29
+
30
+ // Keydown Styles
31
+
32
+ @mixin box-vertical-center {
33
+ @include display-box;
34
+ @include box-orient(vertical);
35
+ @include box-align(center);
36
+ @include box-pack(center);
37
+ }
38
+
39
+ @mixin box-vertical-left {
40
+ @include display-box;
41
+ @include box-orient(vertical);
42
+ @include box-align(start);
43
+ @include box-pack(start);
44
+ }
45
+
46
+ html {
47
+ font-size: 20px; // allows all fonts to be in rems from here on down
48
+ }
49
+
50
+ // Presentation fills the window
51
+ body {
52
+ height: 100%;
53
+ margin: 0;
54
+ padding: 0;
55
+ background-color: #d7d7d7;
56
+ }
57
+
58
+ .keydown.deck-container {
59
+
60
+ @include box-vertical-center;
61
+
62
+ h1 {
63
+ font-family: "Open Sans", "Helvetica Neue", sans-serif;
64
+ font-size: 4.5rem;
65
+ font-weight: 800;
66
+ color: black;
67
+ text-align: none;
68
+ }
69
+
70
+ h2, h3, h4, h5, p, li {
71
+ font-family: "Open Sans", "Helvetica Neue", sans-serif;
72
+ font-weight: normal;
73
+ }
74
+
75
+ h2 {
76
+ font-size: 3.75rem;
77
+ }
78
+
79
+ h3 {
80
+ font-size: 3rem;
81
+ }
82
+
83
+ h4 {
84
+ font-size: 2.25rem;
85
+ }
86
+
87
+ p, li {
88
+ font-size: 2rem;
89
+ }
90
+
91
+ .deck-status {
92
+ font-size: .75rem;
93
+ }
94
+
95
+ .slide {
96
+
97
+ @include box-vertical-center;
98
+
99
+ background-color: white;
100
+
101
+ // for full-background images slides
102
+ &.full-background {
103
+ @include background-size(cover);
104
+ @include box-vertical-left;
105
+
106
+ <% backgrounds.each do |background| %>
107
+ &.<%= background[:classname] %> {
108
+ background-image: url(../<%= background[:path] %>);
109
+ }
110
+ <% end %>
111
+
112
+ h1 {
113
+ display: inline;
114
+ position: absolute;
115
+ background-color: rgba(0, 0, 0, 0.7);
116
+ font-weight: normal;
117
+ font-size: 3.5rem;
118
+ padding: 1rem;
119
+ color: #eee;
120
+ }
121
+
122
+ &.bottom-left {
123
+ h1 {
124
+ left: 0;
125
+ bottom: 20%;
126
+ }
127
+ }
128
+
129
+ &.top-left {
130
+ h1 {
131
+ left: 0;
132
+ top: 20%;
133
+ }
134
+ }
135
+
136
+ &.bottom-right {
137
+ h1 {
138
+ right: 0;
139
+ bottom: 20%;
140
+ }
141
+ }
142
+
143
+ &.top-right {
144
+ h1 {
145
+ right: 0;
146
+ top: 20%;
147
+ }
148
+ }
149
+ }
150
+
151
+ // left justified slides
152
+ &.left {
153
+ @include box-vertical-left;
154
+
155
+ .spacer {
156
+ &.top {
157
+ @include box-flex(1);
158
+ }
159
+ &.bottom {
160
+ @include box-flex(5);
161
+ }
162
+ }
163
+
164
+ .content {
165
+ @include box-vertical-left;
166
+
167
+ > * {
168
+ @include box-vertical-left;
169
+ }
170
+ }
171
+ }
172
+
173
+ // slide content - where the Markdown goes
174
+ .content {
175
+ @include box-vertical-center;
176
+
177
+ > * {
178
+ @include box-vertical-center;
179
+ }
180
+
181
+ .CodeMirror {
182
+ font-size: 1rem;
183
+ }
184
+ }
185
+
186
+ .attribution {
187
+ @include background-size(contain);
188
+ position: absolute;
189
+ bottom: 0;
190
+ font-size: 1.25rem;
191
+ font-family: "Open Sans", "Helvetica Neue", sans-serif;
192
+
193
+ &.flickr {
194
+ background: url(../images/flickr.png) left top no-repeat;
195
+ padding-left: 60px;
196
+ }
197
+
198
+ &.cc {
199
+ background: url(../images/cc.large.png) left top no-repeat;
200
+ padding-left: 36px;
201
+ }
202
+
203
+ a {
204
+ color: #c7c7c7;
205
+ }
206
+ }
207
+ }
208
+ }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: keydown
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-26 00:00:00.000000000Z
12
+ date: 2011-12-04 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
16
- requirement: &70128839150320 !ruby/object:Gem::Requirement
16
+ requirement: &70268241495180 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70128839150320
24
+ version_requirements: *70268241495180
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: tilt
27
- requirement: &70128839149900 !ruby/object:Gem::Requirement
27
+ requirement: &70268241494760 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70128839149900
35
+ version_requirements: *70268241494760
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: haml
38
- requirement: &70128839149480 !ruby/object:Gem::Requirement
38
+ requirement: &70268241494340 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70128839149480
46
+ version_requirements: *70268241494340
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: sass
49
- requirement: &70128839149060 !ruby/object:Gem::Requirement
49
+ requirement: &70268241493920 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,21 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70128839149060
57
+ version_requirements: *70268241493920
58
+ - !ruby/object:Gem::Dependency
59
+ name: compass
60
+ requirement: &70268241493500 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ type: :runtime
67
+ prerelease: false
68
+ version_requirements: *70268241493500
58
69
  - !ruby/object:Gem::Dependency
59
70
  name: rdiscount
60
- requirement: &70128839148560 !ruby/object:Gem::Requirement
71
+ requirement: &70268241493000 !ruby/object:Gem::Requirement
61
72
  none: false
62
73
  requirements:
63
74
  - - ! '>='
@@ -65,10 +76,10 @@ dependencies:
65
76
  version: 1.6.8
66
77
  type: :runtime
67
78
  prerelease: false
68
- version_requirements: *70128839148560
79
+ version_requirements: *70268241493000
69
80
  - !ruby/object:Gem::Dependency
70
81
  name: rake
71
- requirement: &70128839148140 !ruby/object:Gem::Requirement
82
+ requirement: &70268241492580 !ruby/object:Gem::Requirement
72
83
  none: false
73
84
  requirements:
74
85
  - - ! '>='
@@ -76,10 +87,10 @@ dependencies:
76
87
  version: '0'
77
88
  type: :development
78
89
  prerelease: false
79
- version_requirements: *70128839148140
90
+ version_requirements: *70268241492580
80
91
  - !ruby/object:Gem::Dependency
81
92
  name: rspec
82
- requirement: &70128839147680 !ruby/object:Gem::Requirement
93
+ requirement: &70268241492120 !ruby/object:Gem::Requirement
83
94
  none: false
84
95
  requirements:
85
96
  - - ! '>='
@@ -87,10 +98,10 @@ dependencies:
87
98
  version: '0'
88
99
  type: :development
89
100
  prerelease: false
90
- version_requirements: *70128839147680
101
+ version_requirements: *70268241492120
91
102
  - !ruby/object:Gem::Dependency
92
103
  name: fuubar
93
- requirement: &70128839147260 !ruby/object:Gem::Requirement
104
+ requirement: &70268241491700 !ruby/object:Gem::Requirement
94
105
  none: false
95
106
  requirements:
96
107
  - - ! '>='
@@ -98,10 +109,10 @@ dependencies:
98
109
  version: '0'
99
110
  type: :development
100
111
  prerelease: false
101
- version_requirements: *70128839147260
112
+ version_requirements: *70268241491700
102
113
  - !ruby/object:Gem::Dependency
103
114
  name: nokogiri
104
- requirement: &70128839146840 !ruby/object:Gem::Requirement
115
+ requirement: &70268241491280 !ruby/object:Gem::Requirement
105
116
  none: false
106
117
  requirements:
107
118
  - - ! '>='
@@ -109,10 +120,10 @@ dependencies:
109
120
  version: '0'
110
121
  type: :development
111
122
  prerelease: false
112
- version_requirements: *70128839146840
123
+ version_requirements: *70268241491280
113
124
  - !ruby/object:Gem::Dependency
114
125
  name: gem-release
115
- requirement: &70128839146420 !ruby/object:Gem::Requirement
126
+ requirement: &70268241490860 !ruby/object:Gem::Requirement
116
127
  none: false
117
128
  requirements:
118
129
  - - ! '>='
@@ -120,7 +131,7 @@ dependencies:
120
131
  version: '0'
121
132
  type: :development
122
133
  prerelease: false
123
- version_requirements: *70128839146420
134
+ version_requirements: *70268241490860
124
135
  description: Bastard child of Slidedown, deck.js and organic fair trade Bolivian coffee
125
136
  email:
126
137
  - dwfrank@infe.ws
@@ -134,13 +145,14 @@ files:
134
145
  - .rvmrc
135
146
  - .travis.yml
136
147
  - Gemfile
137
- - LICENSE
148
+ - LICENSE.md
138
149
  - README.md
139
150
  - Rakefile
140
- - VERSION
141
151
  - bin/keydown
142
152
  - keydown.gemspec
143
153
  - lib/keydown.rb
154
+ - lib/keydown/classnames.rb
155
+ - lib/keydown/code_map.rb
144
156
  - lib/keydown/html_helpers.rb
145
157
  - lib/keydown/slide.rb
146
158
  - lib/keydown/slidedeck.rb
@@ -155,6 +167,8 @@ files:
155
167
  - spec/fixtures/with_code.md
156
168
  - spec/fixtures/with_title.md
157
169
  - spec/fixtures/without_title.md
170
+ - spec/lib/classnames_spec.rb
171
+ - spec/lib/code_map_spec.rb
158
172
  - spec/lib/html_helpers_spec.rb
159
173
  - spec/lib/slide_spec.rb
160
174
  - spec/lib/slidedeck_spec.rb
@@ -274,7 +288,7 @@ files:
274
288
  - templates/generate/images/flickr.png
275
289
  - templates/generate/js/%presentation_name%.js
276
290
  - templates/generate/slides.md.tt
277
- - templates/keydown.css.erb
291
+ - templates/keydown.scss.erb
278
292
  homepage: http://rubygems.org/gems/keydown
279
293
  licenses: []
280
294
  post_install_message:
@@ -306,6 +320,8 @@ test_files:
306
320
  - spec/fixtures/with_code.md
307
321
  - spec/fixtures/with_title.md
308
322
  - spec/fixtures/without_title.md
323
+ - spec/lib/classnames_spec.rb
324
+ - spec/lib/code_map_spec.rb
309
325
  - spec/lib/html_helpers_spec.rb
310
326
  - spec/lib/slide_spec.rb
311
327
  - spec/lib/slidedeck_spec.rb
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.9.0
@@ -1,46 +0,0 @@
1
- body.keydown {
2
- height: 100%;
3
- margin: 0;
4
- padding: 0;
5
- }
6
-
7
- /* Full slide backgrounds */
8
- .slide.full-background {
9
- -webkit-background-size: cover;
10
- -moz-background-size: cover;
11
- background-size: cover;
12
- background-position: center;
13
- }
14
-
15
- <% backgrounds.each do |background| %>
16
- .slide.full-background.<%= background[:classname] %> {
17
- background-image: url(../<%= background[:path] %>);
18
- }
19
-
20
- <% end %>
21
-
22
- /* image attribution with service logos */
23
- .attribution {
24
- font-size: 24px;
25
- position: fixed;
26
- bottom: 8px;
27
- left: 40px;
28
- -webkit-background-size: contain;
29
- -moz-background-size: contain;
30
- background-size: contain;
31
- }
32
-
33
- .attribution.flickr {
34
- background: url(../images/flickr.png) left top no-repeat;
35
- padding-left: 60px;
36
- }
37
-
38
- .attribution.cc {
39
- background: url(../images/cc.large.png) left top no-repeat;
40
- padding-left: 36px;
41
- }
42
-
43
- /* Happy generic hiding class */
44
- .hidden {
45
- display: none;
46
- }