slide_hero 0.0.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.
Files changed (111) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +17 -0
  3. data/.travis.yml +3 -0
  4. data/Gemfile +4 -0
  5. data/Guardfile +28 -0
  6. data/LICENSE.txt +22 -0
  7. data/README.md +161 -0
  8. data/Rakefile +9 -0
  9. data/bin/slidehero +37 -0
  10. data/config.ru +14 -0
  11. data/lib/slide_hero/code.rb +16 -0
  12. data/lib/slide_hero/dsl.rb +10 -0
  13. data/lib/slide_hero/grouped_slides.rb +21 -0
  14. data/lib/slide_hero/list.rb +29 -0
  15. data/lib/slide_hero/list_point.rb +26 -0
  16. data/lib/slide_hero/point.rb +27 -0
  17. data/lib/slide_hero/presentation.rb +36 -0
  18. data/lib/slide_hero/slide.rb +47 -0
  19. data/lib/slide_hero/version.rb +3 -0
  20. data/lib/slide_hero/views/_footer.html.erb +0 -0
  21. data/lib/slide_hero/views/_header.html.erb +0 -0
  22. data/lib/slide_hero/views/code.html.erb +3 -0
  23. data/lib/slide_hero/views/empty.html +12 -0
  24. data/lib/slide_hero/views/grouped_slides.html.erb +5 -0
  25. data/lib/slide_hero/views/layout.html.erb +54 -0
  26. data/lib/slide_hero/views/ordered_list.html.erb +5 -0
  27. data/lib/slide_hero/views/slide.html.erb +6 -0
  28. data/lib/slide_hero/views/unordered_list.html.erb +5 -0
  29. data/lib/slide_hero.rb +15 -0
  30. data/slide_hero.gemspec +29 -0
  31. data/templates/new_presentation.tt +11 -0
  32. data/test/fixtures/testclass.rb +5 -0
  33. data/test/minitest_helper.rb +18 -0
  34. data/test/slide_hero/code_spec.rb +29 -0
  35. data/test/slide_hero/dsl_spec.rb +27 -0
  36. data/test/slide_hero/grouped_slides_spec.rb +29 -0
  37. data/test/slide_hero/list_point_spec.rb +34 -0
  38. data/test/slide_hero/list_spec.rb +49 -0
  39. data/test/slide_hero/point_spec.rb +25 -0
  40. data/test/slide_hero/presentation_spec.rb +56 -0
  41. data/test/slide_hero/slide_spec.rb +147 -0
  42. data/test/slide_hero_spec.rb +15 -0
  43. data/vendor/reveal.js/.gitignore +6 -0
  44. data/vendor/reveal.js/.travis.yml +5 -0
  45. data/vendor/reveal.js/Gruntfile.js +132 -0
  46. data/vendor/reveal.js/LICENSE +19 -0
  47. data/vendor/reveal.js/README.md +798 -0
  48. data/vendor/reveal.js/css/print/paper.css +176 -0
  49. data/vendor/reveal.js/css/print/pdf.css +190 -0
  50. data/vendor/reveal.js/css/reveal.css +1649 -0
  51. data/vendor/reveal.js/css/reveal.min.css +7 -0
  52. data/vendor/reveal.js/css/theme/README.md +23 -0
  53. data/vendor/reveal.js/css/theme/beige.css +142 -0
  54. data/vendor/reveal.js/css/theme/default.css +142 -0
  55. data/vendor/reveal.js/css/theme/moon.css +142 -0
  56. data/vendor/reveal.js/css/theme/night.css +130 -0
  57. data/vendor/reveal.js/css/theme/serif.css +132 -0
  58. data/vendor/reveal.js/css/theme/simple.css +132 -0
  59. data/vendor/reveal.js/css/theme/sky.css +139 -0
  60. data/vendor/reveal.js/css/theme/solarized.css +142 -0
  61. data/vendor/reveal.js/css/theme/source/beige.scss +50 -0
  62. data/vendor/reveal.js/css/theme/source/default.scss +42 -0
  63. data/vendor/reveal.js/css/theme/source/moon.scss +68 -0
  64. data/vendor/reveal.js/css/theme/source/night.scss +35 -0
  65. data/vendor/reveal.js/css/theme/source/serif.scss +35 -0
  66. data/vendor/reveal.js/css/theme/source/simple.scss +38 -0
  67. data/vendor/reveal.js/css/theme/source/sky.scss +46 -0
  68. data/vendor/reveal.js/css/theme/source/solarized.scss +74 -0
  69. data/vendor/reveal.js/css/theme/template/mixins.scss +29 -0
  70. data/vendor/reveal.js/css/theme/template/settings.scss +34 -0
  71. data/vendor/reveal.js/css/theme/template/theme.scss +163 -0
  72. data/vendor/reveal.js/examples/assets/image1.png +0 -0
  73. data/vendor/reveal.js/examples/assets/image2.png +0 -0
  74. data/vendor/reveal.js/examples/barebones.html +42 -0
  75. data/vendor/reveal.js/examples/embedded-media.html +49 -0
  76. data/vendor/reveal.js/examples/math.html +185 -0
  77. data/vendor/reveal.js/examples/slide-backgrounds.html +101 -0
  78. data/vendor/reveal.js/js/reveal.js +2788 -0
  79. data/vendor/reveal.js/js/reveal.min.js +8 -0
  80. data/vendor/reveal.js/lib/css/zenburn.css +115 -0
  81. data/vendor/reveal.js/lib/font/league_gothic-webfont.eot +0 -0
  82. data/vendor/reveal.js/lib/font/league_gothic-webfont.svg +230 -0
  83. data/vendor/reveal.js/lib/font/league_gothic-webfont.ttf +0 -0
  84. data/vendor/reveal.js/lib/font/league_gothic-webfont.woff +0 -0
  85. data/vendor/reveal.js/lib/font/league_gothic_license +2 -0
  86. data/vendor/reveal.js/lib/js/classList.js +2 -0
  87. data/vendor/reveal.js/lib/js/head.min.js +8 -0
  88. data/vendor/reveal.js/lib/js/html5shiv.js +7 -0
  89. data/vendor/reveal.js/package.json +45 -0
  90. data/vendor/reveal.js/plugin/highlight/highlight.js +31 -0
  91. data/vendor/reveal.js/plugin/leap/leap.js +157 -0
  92. data/vendor/reveal.js/plugin/markdown/example.html +98 -0
  93. data/vendor/reveal.js/plugin/markdown/example.md +31 -0
  94. data/vendor/reveal.js/plugin/markdown/markdown.js +220 -0
  95. data/vendor/reveal.js/plugin/markdown/marked.js +37 -0
  96. data/vendor/reveal.js/plugin/math/math.js +64 -0
  97. data/vendor/reveal.js/plugin/multiplex/client.js +13 -0
  98. data/vendor/reveal.js/plugin/multiplex/index.js +56 -0
  99. data/vendor/reveal.js/plugin/multiplex/master.js +50 -0
  100. data/vendor/reveal.js/plugin/notes/notes.html +259 -0
  101. data/vendor/reveal.js/plugin/notes/notes.js +78 -0
  102. data/vendor/reveal.js/plugin/notes-server/client.js +57 -0
  103. data/vendor/reveal.js/plugin/notes-server/index.js +59 -0
  104. data/vendor/reveal.js/plugin/notes-server/notes.html +142 -0
  105. data/vendor/reveal.js/plugin/postmessage/example.html +39 -0
  106. data/vendor/reveal.js/plugin/postmessage/postmessage.js +42 -0
  107. data/vendor/reveal.js/plugin/print-pdf/print-pdf.js +44 -0
  108. data/vendor/reveal.js/plugin/remotes/remotes.js +39 -0
  109. data/vendor/reveal.js/plugin/search/search.js +196 -0
  110. data/vendor/reveal.js/plugin/zoom-js/zoom.js +256 -0
  111. metadata +277 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5ba41a9d72122a93c31a9aacb8b410f940ee8455
4
+ data.tar.gz: c878af46810347583ab517442e9e6d60bba35705
5
+ SHA512:
6
+ metadata.gz: 826eb9577377c8b9a9e9030db14c4a662e1071c3b9a66da06785a5d7ff3e3866db33a220a98ed023bf9ead67b57a62d4463c8384eb0875e5341b8cc5e7469231
7
+ data.tar.gz: dcde6333cd24cfb2db0647fcd47f838b2bbed118bf5b287202140a56e1eeab5c99716c26c4fb4903be1adebb2a878f2815facc831b274a442409432d8f9f086c
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in slide_hero.gemspec
4
+ gemspec
data/Guardfile ADDED
@@ -0,0 +1,28 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ guard :minitest do
5
+ # with Minitest::Unit
6
+ watch(%r{^test/(.*)\/?test_(.*)\.rb})
7
+ watch(%r{^lib/(.*/)?([^/]+)\.rb}) { |m| "test/#{m[1]}test_#{m[2]}.rb" }
8
+ watch(%r{^test/test_helper\.rb}) { 'test' }
9
+
10
+ # with Minitest::Spec
11
+ # watch(%r{^spec/(.*)_spec\.rb})
12
+ # watch(%r{^lib/(.+)\.rb}) { |m| "spec/#{m[1]}_spec.rb" }
13
+ # watch(%r{^spec/spec_helper\.rb}) { 'spec' }
14
+
15
+ # Rails 4
16
+ # watch(%r{^app/(.+)\.rb}) { |m| "test/#{m[1]}_test.rb" }
17
+ # watch(%r{^app/controllers/application_controller\.rb}) { 'test/controllers' }
18
+ # watch(%r{^app/controllers/(.+)_controller\.rb}) { |m| "test/integration/#{m[1]}_test.rb" }
19
+ # watch(%r{^app/views/(.+)_mailer/.+}) { |m| "test/mailers/#{m[1]}_mailer_test.rb" }
20
+ # watch(%r{^lib/(.+)\.rb}) { |m| "test/lib/#{m[1]}_test.rb" }
21
+ # watch(%r{^test/.+_test\.rb})
22
+ # watch(%r{^test/test_helper\.rb}) { 'test' }
23
+
24
+ # Rails < 4
25
+ # watch(%r{^app/controllers/(.*)\.rb}) { |m| "test/functional/#{m[1]}_test.rb" }
26
+ # watch(%r{^app/helpers/(.*)\.rb}) { |m| "test/helpers/#{m[1]}_test.rb" }
27
+ # watch(%r{^app/models/(.*)\.rb}) { |m| "test/unit/#{m[1]}_test.rb" }
28
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Steven Nunez
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,161 @@
1
+ # SlideHero
2
+
3
+ SlideHero is a gem for creating presentations backed by reveal.js through a
4
+ Ruby DSL.
5
+
6
+ ## Installation
7
+
8
+ Requires Ruby 2.0.0
9
+
10
+ Add this line to your application's Gemfile:
11
+
12
+ gem 'slide_hero'
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install slide_hero
21
+
22
+ ## Usage
23
+ All features are accessible through the `slidehero` command.
24
+
25
+ ### Generator
26
+
27
+ slidehero new presentation_name
28
+
29
+ This creates a new folder named `presentation_name` in the current directory. Inside, there is a sample file called `presentation.rb`.
30
+
31
+ ### Server
32
+
33
+ slidehero serve
34
+
35
+ Call this in the same folder as your presentation to serve your files on port 9292. You can optionally pass in an alternate location for the presentation.rb file.
36
+
37
+ slidehero serve ../other/folder/presentation.rb
38
+
39
+ ### Compilation
40
+
41
+ slidehero compile
42
+
43
+ Use this if you just want a folder with the markup files. A new `presentation` folder is created.
44
+
45
+ ### DSL
46
+
47
+ The DSL for SlideHero was created to add expressibility to creating slides.
48
+
49
+ **presentation**
50
+
51
+
52
+ presentation "My Presentation" do
53
+
54
+ end
55
+
56
+ `#presentation` indicates the beginning of a presentation. You can have one of these per file. The String passed is used as the title for the presentation.
57
+
58
+ **slide**
59
+
60
+ presentation "My Presentation" do
61
+ slide "A slide" do
62
+ #…
63
+ end
64
+ end
65
+
66
+ `#slide` is used to create a new slide. The string is the headline of the slide. `#slide` can take an optional argument of `headline_size:`. Valid options are :small, :medium, :large. These create h3, h2, and h1 elements respectively.
67
+
68
+ presentation "My Presentation" do
69
+ slide "A slide", headline_size: :small do
70
+ #…
71
+ end
72
+ end
73
+
74
+ `#slide` can have transitions applied as well. Valid transitions are: :cube, :page, :concave, :zoom, :linear, :fade, :none, and :default
75
+
76
+ presentation "My Presentation" do
77
+ slide "A slide", transition: :slide do
78
+ #…
79
+ end
80
+ end
81
+
82
+ **points**
83
+
84
+ presentation "My Presentation" do
85
+ slide "A slide" do
86
+ point "An interesting Point"
87
+ end
88
+ end
89
+
90
+ `#point` adds p tag wrapped text to your presentation
91
+
92
+ **grouped_slides**
93
+
94
+ presentation "My Presentation" do
95
+ grouped_slides do
96
+ slide "Slide 1" do
97
+ end
98
+ slide "Slide 2" do
99
+ end
100
+ end
101
+ end
102
+
103
+ `#grouped_slides` lets you nest slides. In reveal, this translates into vertical slides.
104
+
105
+ **lists**
106
+
107
+
108
+ presentation "My Presentation" do
109
+
110
+ slide "Slide 1" do
111
+ list do
112
+ point "An interesting point about monkeys"
113
+ point "An even more interesting point about nargles"
114
+ end
115
+ end
116
+ slide "Slide 2" do
117
+ list(:ordered) do
118
+ point "I should go first"
119
+ point "I'm ok going second"
120
+ end
121
+ end
122
+ end
123
+
124
+ `#list` must be nested in a slide. It takes an optional argument of :ordered to
125
+ create an ordered list. List items are added by the `#point` method.
126
+
127
+ **code**
128
+
129
+ presentation "My Presentation" do
130
+ slide "A slide" do
131
+ code(:ruby) do
132
+ "working_code.rb"
133
+ end
134
+ end
135
+ end
136
+
137
+ `#code` must be nested in a slide. It loads any code file in the same directory as the file.
138
+
139
+ #### Animation
140
+
141
+ Animation for points are supported.
142
+
143
+ #…
144
+ slide do
145
+ point "My point", animation: "grow"
146
+ list do
147
+ point "My", animation: "step"
148
+ point "Staggered", animation: "step"
149
+ point "List", animation: "step"
150
+ end
151
+ end
152
+
153
+ Supported animations are: step, grow, shrink, roll-in, fade-out, highlight-red, highlight-green, and highlight-blue
154
+
155
+ ## Contributing
156
+
157
+ 1. Fork it
158
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
159
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
160
+ 4. Push to the branch (`git push origin my-new-feature`)
161
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,9 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.test_files = FileList['test/*_spec.rb']
7
+ end
8
+
9
+ task :default => :test
data/bin/slidehero ADDED
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'slide_hero'
4
+ require 'thor'
5
+ require 'fileutils'
6
+
7
+ class PresentationGenerator < Thor
8
+ include Thor::Actions
9
+ desc "new NAME", "Create a new presentation"
10
+ def new(name)
11
+ @name = name
12
+ template 'templates/new_presentation.tt', "#{name}/presentation.rb"
13
+ end
14
+
15
+ desc "compile PRESENTATION_NAME (defaults to presentation.rb", "Compile presentation"
16
+ def compile(name = 'presentation.rb')
17
+ directory 'vendor/reveal.js', 'presentation'
18
+ File.open('presentation/index.html', 'w+') do |f|
19
+ f.puts eval(File.read(name), SlideHero.get_binding)
20
+ end
21
+ end
22
+
23
+ desc "serve FILENAME", "starts a server running your presentation on port 9292"
24
+ def serve(name = 'presentation.rb')
25
+ directory 'vendor/reveal.js', '.tmp'
26
+ File.open('.tmp/index.html', 'w+') do |f|
27
+ f.puts eval(File.read(name), SlideHero.get_binding)
28
+ end
29
+ puts "Go checkout your awesome presentation at http://localhost:9292!"
30
+ system("rackup #{Gem.loaded_specs['slide_hero'].full_gem_path}/config.ru")
31
+ rescue Interrupt
32
+ remove_dir '.tmp'
33
+ end
34
+ end
35
+
36
+ PresentationGenerator.source_root(Gem.loaded_specs['slide_hero'].full_gem_path)
37
+ PresentationGenerator.start ARGV
data/config.ru ADDED
@@ -0,0 +1,14 @@
1
+ use Rack::Static,
2
+ :urls => ["/images", "/js", "/css", "/lib", "/plugin"],
3
+ :root => ".tmp"
4
+
5
+ run lambda { |env|
6
+ [
7
+ 200,
8
+ {
9
+ 'Content-Type' => 'text/html',
10
+ 'Cache-Control' => 'public, max-age=86400'
11
+ },
12
+ File.open('.tmp/index.html', File::RDONLY)
13
+ ]
14
+ }
@@ -0,0 +1,16 @@
1
+ module SlideHero
2
+ class Code
3
+ def initialize(language, &code_file)
4
+ @language = language
5
+ @source = File.read("#{Dir.pwd}/#{code_file.call}")
6
+ rescue Errno::ENOENT
7
+ abort "#{Dir.pwd}/#{code_file.call} not found"
8
+ end
9
+
10
+ def compile
11
+ Tilt::ERBTemplate.
12
+ new(File.join(Gem.loaded_specs['slide_hero'].full_gem_path,
13
+ 'lib/slide_hero/views/code.html.erb')).render(self)
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,10 @@
1
+ module SlideHero
2
+ module DSL
3
+ def presentation(title, &slide_block)
4
+ SlideHero::Presentation.new(title, &slide_block).compile
5
+ end
6
+ end
7
+ end
8
+
9
+ extend SlideHero::DSL
10
+ Module.send(:include, SlideHero::DSL)
@@ -0,0 +1,21 @@
1
+ module SlideHero
2
+ class GroupedSlides
3
+ def initialize(&block)
4
+ instance_eval(&block)
5
+ end
6
+
7
+ def compile
8
+ Tilt::ERBTemplate.
9
+ new(File.join(Gem.loaded_specs['slide_hero'].full_gem_path,
10
+ 'lib/slide_hero/views/grouped_slides.html.erb')).render(self)
11
+ end
12
+
13
+ def slide(headline, &block)
14
+ slides << Slide.new(headline, &block).compile
15
+ end
16
+
17
+ def slides
18
+ @slides ||= []
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,29 @@
1
+ module SlideHero
2
+ class List
3
+ attr_reader :style
4
+
5
+ def initialize(style=:unordered, &block)
6
+ @style = style
7
+ instance_eval(&block)
8
+ end
9
+
10
+ def compile
11
+ gem_path = Gem.loaded_specs['slide_hero'].full_gem_path
12
+ if style == :unordered
13
+ Tilt::ERBTemplate.new(File.join(gem_path,
14
+ 'lib/slide_hero/views/unordered_list.html.erb')).render(self)
15
+ else
16
+ Tilt::ERBTemplate.new(File.join(gem_path,
17
+ 'lib/slide_hero/views/ordered_list.html.erb')).render(self)
18
+ end
19
+ end
20
+
21
+ def point(text, animation: nil)
22
+ points << ListPoint.new(text, { animation: animation })
23
+ end
24
+
25
+ def points
26
+ @points ||= []
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,26 @@
1
+ module SlideHero
2
+ class ListPoint
3
+ attr_reader :animation, :text
4
+ SUPPORTED_ANIMATIONS = %w{grow shrink roll-in fade-out
5
+ highlight-red highlight-green highlight-blue}
6
+
7
+ def initialize(text, options={})
8
+ @text = text
9
+ @animation = options[:animation]
10
+ end
11
+
12
+ def to_s
13
+ text
14
+ end
15
+
16
+ def animation_class
17
+ if animation
18
+ animation_markup = ' class="fragment '
19
+ if SUPPORTED_ANIMATIONS.include? animation
20
+ animation_markup << animation
21
+ end
22
+ animation_markup + "\""
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,27 @@
1
+ module SlideHero
2
+ class Point
3
+ attr_reader :text
4
+ SUPPORTED_ANIMATIONS = %w{grow shrink roll-in fade-out
5
+ highlight-red highlight-green highlight-blue}
6
+
7
+ def initialize(text, animation: nil)
8
+ @text = text
9
+ @animation = animation
10
+ end
11
+
12
+ def compile
13
+ "<p#{animation}>#{text}</p>"
14
+ end
15
+
16
+ private
17
+ def animation
18
+ if @animation
19
+ animation_markup = ' class="fragment '
20
+ if SUPPORTED_ANIMATIONS.include? @animation
21
+ animation_markup << @animation
22
+ end
23
+ animation_markup + "\""
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,36 @@
1
+ module SlideHero
2
+ require 'erb'
3
+ require 'tilt'
4
+ class Presentation
5
+ attr_reader :title
6
+ def initialize(title, &block)
7
+ @title = title
8
+ instance_eval(&block)
9
+ end
10
+
11
+ def compile
12
+ gem_path = Gem.loaded_specs['slide_hero'].full_gem_path
13
+ Tilt::ERBTemplate.new(File.join(gem_path,
14
+ 'lib/slide_hero/views/layout.html.erb')).
15
+ render(self) do
16
+ collected_slides
17
+ end
18
+ end
19
+
20
+ def slide(title, **kwargs, &slide_block)
21
+ slides << Slide.new(title, **kwargs, &slide_block).compile
22
+ end
23
+
24
+ def grouped_slides(&block)
25
+ slides << GroupedSlides.new(&block).compile
26
+ end
27
+
28
+ def collected_slides
29
+ slides.join
30
+ end
31
+
32
+ def slides
33
+ @slides ||= []
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,47 @@
1
+ module SlideHero
2
+ class Slide
3
+ attr_reader :headline, :headline_size, :transition
4
+ def initialize(headline, headline_size: :large, transition: :default, &point_block)
5
+ @headline = headline
6
+ @headline_size = headline_size
7
+ @transition = transition
8
+ instance_eval(&point_block) if block_given?
9
+ end
10
+
11
+ def compile
12
+ gem_path = Gem.loaded_specs['slide_hero'].full_gem_path
13
+ Tilt::ERBTemplate.new(File.join(gem_path,
14
+ 'lib/slide_hero/views/slide.html.erb')).
15
+ render(self)
16
+ end
17
+
18
+ def point(text, animation: nil)
19
+ points << Point.new(text, animation: nil).compile
20
+ end
21
+
22
+ def list(style=:unordered, &block)
23
+ points << List.new(style, &block).compile
24
+ end
25
+
26
+ def code(language, &code)
27
+ points << Code.new(language, &code).compile
28
+ end
29
+
30
+ def points
31
+ @points ||= []
32
+ end
33
+
34
+ private
35
+ def size_to_markup
36
+ {
37
+ large: :h1,
38
+ medium: :h2,
39
+ small: :h3
40
+ }[headline_size]
41
+ end
42
+
43
+ def data_attributes
44
+ "data-transition=\"#{transition}\""
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,3 @@
1
+ module SlideHero
2
+ VERSION = "0.0.2"
3
+ end
File without changes
File without changes
@@ -0,0 +1,3 @@
1
+ <pre><code data-trim>
2
+ <%= @source %>
3
+ </code></pre>
@@ -0,0 +1,12 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <%= partial 'header', locals: title: title %>
4
+ <body>
5
+ <div class="reveal">
6
+ <div class="slides">
7
+ <%= yield %>
8
+ </div>
9
+ </div>
10
+ <%= partial 'footer' %>
11
+ </body>
12
+ </html>
@@ -0,0 +1,5 @@
1
+ <section>
2
+ <% slides.each do |slide| %>
3
+ <%= slide %>
4
+ <% end %>
5
+ </section>
@@ -0,0 +1,54 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title><%= @title %></title>
6
+ <meta name="apple-mobile-web-app-capable" content="yes" />
7
+ <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
8
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
9
+ <link rel="stylesheet" href="css/reveal.min.css">
10
+ <link rel="stylesheet" href="css/theme/solarized.css" id="theme">
11
+ <link rel="stylesheet" href="lib/css/zenburn.css">
12
+ <script>
13
+ document.write( '<link rel="stylesheet" href="css/print/' + ( window.location.search.match( /print-pdf/gi ) ? 'pdf' : 'paper' ) + '.css" type="text/css" media="print">' );
14
+ </script>
15
+ <!--[if lt IE 9]>
16
+ <script src="lib/js/html5shiv.js"></script>
17
+ <![endif]-->
18
+ </head>
19
+ <body>
20
+ <div class="reveal">
21
+ <div class="slides">
22
+ <%= yield %>
23
+ </div>
24
+ </div>
25
+ <script src="lib/js/head.min.js"></script>
26
+ <script src="js/reveal.min.js"></script>
27
+
28
+ <script>
29
+
30
+ // Full list of configuration options available here:
31
+ // https://github.com/hakimel/reveal.js#configuration
32
+ Reveal.initialize({
33
+ controls: true,
34
+ progress: true,
35
+ history: true,
36
+ center: true,
37
+
38
+ theme: Reveal.getQueryHash().theme, // available themes are in /css/theme
39
+ transition: Reveal.getQueryHash().transition || 'default', // default/cube/page/concave/zoom/linear/fade/none
40
+
41
+ // Optional libraries used to extend on reveal.js
42
+ dependencies: [
43
+ { src: 'lib/js/classList.js', condition: function() { return !document.body.classList; } },
44
+ { src: 'plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
45
+ { src: 'plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
46
+ { src: 'plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
47
+ { src: 'plugin/zoom-js/zoom.js', async: true, condition: function() { return !!document.body.classList; } },
48
+ { src: 'plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } }
49
+ ]
50
+ });
51
+
52
+ </script>
53
+ </body>
54
+ </html>
@@ -0,0 +1,5 @@
1
+ <ol>
2
+ <% points.each do |point| %>
3
+ <li<%= point.animation_class %>><%= point %></li>
4
+ <% end %>
5
+ </ol>
@@ -0,0 +1,6 @@
1
+ <section <%= data_attributes %>>
2
+ <<%= size_to_markup %>><%= headline %></<%= size_to_markup %>>
3
+ <% points.each do |point| %>
4
+ <%= point %>
5
+ <% end %>
6
+ </section>
@@ -0,0 +1,5 @@
1
+ <ul>
2
+ <% points.each do |point| %>
3
+ <li<%= point.animation_class %>><%= point %></li>
4
+ <% end %>
5
+ </ul>
data/lib/slide_hero.rb ADDED
@@ -0,0 +1,15 @@
1
+ require_relative "slide_hero/version"
2
+ require_relative "slide_hero/slide"
3
+ require_relative "slide_hero/point"
4
+ require_relative "slide_hero/list"
5
+ require_relative "slide_hero/list_point"
6
+ require_relative "slide_hero/grouped_slides"
7
+ require_relative "slide_hero/code"
8
+ require_relative "slide_hero/presentation"
9
+ require_relative "slide_hero/dsl"
10
+
11
+ module SlideHero
12
+ def self.get_binding
13
+ binding
14
+ end
15
+ end