reveal-ck 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +13 -0
- data/bin/reveal-ck +23 -8
- data/lib/reveal-ck.rb +6 -0
- data/lib/reveal-ck/build_task.rb +14 -0
- data/lib/reveal-ck/builder.rb +21 -0
- data/lib/reveal-ck/config.rb +43 -0
- data/lib/reveal-ck/file_slicer.rb +19 -17
- data/lib/reveal-ck/file_splicer.rb +30 -28
- data/lib/reveal-ck/file_string_replacer.rb +17 -0
- data/lib/reveal-ck/haml_processor.rb +17 -15
- data/lib/reveal-ck/presentation_builder.rb +69 -0
- data/lib/reveal-ck/slide_builder.rb +66 -0
- data/lib/reveal-ck/version.rb +1 -1
- data/rakelib/cucumber.rake +14 -1
- data/reveal.js/Gruntfile.js +132 -0
- data/reveal.js/LICENSE +1 -1
- data/reveal.js/README.md +362 -50
- data/reveal.js/css/print/paper.css +14 -14
- data/reveal.js/css/print/pdf.css +60 -30
- data/reveal.js/css/reveal.css +444 -149
- data/reveal.js/css/reveal.min.css +2 -2
- data/reveal.js/css/theme/README.md +8 -10
- data/reveal.js/css/theme/beige.css +24 -45
- data/reveal.js/css/theme/default.css +24 -45
- data/reveal.js/css/theme/moon.css +142 -0
- data/reveal.js/css/theme/night.css +24 -44
- data/reveal.js/css/theme/serif.css +27 -45
- data/reveal.js/css/theme/simple.css +25 -45
- data/reveal.js/css/theme/sky.css +26 -43
- data/reveal.js/css/theme/solarized.css +142 -0
- data/reveal.js/css/theme/source/beige.scss +2 -2
- data/reveal.js/css/theme/source/default.scss +2 -2
- data/reveal.js/css/theme/source/moon.scss +68 -0
- data/reveal.js/css/theme/source/night.scss +4 -4
- data/reveal.js/css/theme/source/serif.scss +8 -6
- data/reveal.js/css/theme/source/simple.scss +5 -5
- data/reveal.js/css/theme/source/sky.scss +9 -4
- data/reveal.js/css/theme/source/solarized.scss +74 -0
- data/reveal.js/css/theme/template/settings.scss +2 -2
- data/reveal.js/examples/assets/image1.png +0 -0
- data/reveal.js/examples/assets/image2.png +0 -0
- data/reveal.js/examples/barebones.html +42 -0
- data/reveal.js/examples/embedded-media.html +49 -0
- data/reveal.js/examples/slide-backgrounds.html +101 -0
- data/reveal.js/index.html +63 -56
- data/reveal.js/js/reveal.js +997 -216
- data/reveal.js/js/reveal.min.js +3 -3
- data/reveal.js/package.json +43 -29
- data/reveal.js/plugin/highlight/highlight.js +28 -6
- data/reveal.js/plugin/markdown/example.html +97 -0
- data/reveal.js/plugin/markdown/example.md +29 -0
- data/reveal.js/plugin/markdown/markdown.js +164 -11
- data/reveal.js/plugin/markdown/marked.js +37 -0
- data/reveal.js/plugin/multiplex/client.js +13 -0
- data/reveal.js/plugin/multiplex/index.js +56 -0
- data/reveal.js/plugin/multiplex/master.js +50 -0
- data/reveal.js/plugin/notes-server/index.js +1 -0
- data/reveal.js/plugin/notes-server/notes.html +8 -5
- data/reveal.js/plugin/notes/notes.html +133 -44
- data/reveal.js/plugin/notes/notes.js +3 -1
- data/reveal.js/plugin/print-pdf/print-pdf.js +8 -3
- data/reveal.js/plugin/remotes/remotes.js +13 -4
- data/reveal.js/plugin/search/search.js +196 -0
- data/reveal.js/plugin/zoom-js/zoom.js +26 -21
- data/spec/data/config/config.toml +6 -0
- data/spec/data/string_replacer/after_replace +4 -0
- data/spec/data/string_replacer/before_replace +4 -0
- data/spec/lib/reveal-ck/config_spec.rb +50 -0
- data/spec/lib/reveal-ck/file_slicer_spec.rb +29 -27
- data/spec/lib/reveal-ck/file_splicer_spec.rb +28 -26
- data/spec/lib/reveal-ck/file_string_replacer_spec.rb +32 -0
- data/spec/lib/reveal-ck/haml_processor_spec.rb +28 -26
- metadata +82 -27
- data/rakelib/presentation.rake +0 -41
- data/rakelib/reveal.rake +0 -15
- data/reveal.js/css/shaders/tile-flip.fs +0 -64
- data/reveal.js/css/shaders/tile-flip.vs +0 -141
- data/reveal.js/grunt.js +0 -84
- data/reveal.js/plugin/markdown/showdown.js +0 -62
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MWI3OTAwYjcxYTZlODc0NTI3NWQxNzU3OGJhMzlhMTdmZmZjYmVkYQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZDdhNDAyYWM1ODk2OWU5OTU3MWUyNDU1MjU3N2ZiYTQyOTI1M2I0Ng==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZGZkOGUxZTM3MTg4M2M5MWM5MTk2NDJmZmJkNThiZTVhNGEyODBkMTRmZDUw
|
10
|
+
ZjY1YzVkNTUwMGUyOTM5NGQzNTM4MWI1ZGNkNzVmZjYzYjVlYjM0ZDU5YTNi
|
11
|
+
NDUyYWU0NWQyMWJmYjhmZWNjNDA2NjYwMmY5OGVkODYxNmMyY2E=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
M2ZkOTIwM2UxNGNkMjBlNmUyYTFiOWVmYTM1NWI2NTUyMmU3ZDIzNWVkZDA2
|
14
|
+
NGIyOWQ0YWRjZWNiOTM0ZGQ1ZTU0MDQxNzgwZDA0OGI5NzgyZmI1YmZkOTE3
|
15
|
+
MDQ2N2RmYWRjYTBkYTBjNGZkMTRmMjI5OWRjZWIwMjUzMjBlMWE=
|
data/README.md
CHANGED
@@ -151,3 +151,16 @@ features, and `rake` runs both `spec` and `cucumber`.
|
|
151
151
|
|
152
152
|
This project is setup within Travis. Here is the
|
153
153
|
[project page](https://travis-ci.org/jedcn/reveal-ck).
|
154
|
+
|
155
|
+
### Updating the embedded reveal.js
|
156
|
+
|
157
|
+
If you've got things checked out, and submodules inited, then you can
|
158
|
+
updated the embedded reveal.js as follows:
|
159
|
+
|
160
|
+
* cd into reveal.js
|
161
|
+
* Run a `git fetch` and then merge/rebase/reset as is appropriate
|
162
|
+
* Run tests
|
163
|
+
* If the tests don't pass, you likely need to update how the
|
164
|
+
FileSplicer is invoked in the SliderBuilder. It's got hard-coded
|
165
|
+
begin/end line numbers for where the default reveal.js slides are
|
166
|
+
found. This commit is a good example of such a change: b29b050.
|
data/bin/reveal-ck
CHANGED
@@ -2,12 +2,6 @@
|
|
2
2
|
require 'gli'
|
3
3
|
require 'reveal-ck'
|
4
4
|
|
5
|
-
# Setup rake and load needed parts of rakelib so that rake tasks can be
|
6
|
-
# invoked programmatically
|
7
|
-
require 'rake'
|
8
|
-
rakelib = File.expand_path(File.join(File.dirname(__FILE__), '..', 'rakelib'))
|
9
|
-
load File.join(rakelib, 'presentation.rake')
|
10
|
-
|
11
5
|
include GLI::App
|
12
6
|
|
13
7
|
program_desc 'A reveal.js construction kit'
|
@@ -15,10 +9,31 @@ program_desc 'A reveal.js construction kit'
|
|
15
9
|
version RevealCK::VERSION
|
16
10
|
|
17
11
|
desc 'Generate reveal.js slides'
|
18
|
-
arg_name 'Tranforms your slides.haml into a presentation'
|
19
12
|
command :generate do |c|
|
20
13
|
c.action do |global_options,options,args|
|
21
|
-
|
14
|
+
|
15
|
+
require 'rake' # for FileList
|
16
|
+
|
17
|
+
revealjs_root = File.expand_path(File.join(File.dirname(__FILE__), '..', 'reveal.js'))
|
18
|
+
revealjs_files = FileList["#{revealjs_root}/**/*"]
|
19
|
+
|
20
|
+
image_files = FileList["images/**/*"]
|
21
|
+
|
22
|
+
output_dir = 'slides'
|
23
|
+
|
24
|
+
slides_haml = 'slides.haml'
|
25
|
+
|
26
|
+
config = RevealCK::Config.new config_file: 'config.toml'
|
27
|
+
|
28
|
+
builder = RevealCK::PresentationBuilder.new({
|
29
|
+
revealjs_files: revealjs_files,
|
30
|
+
image_files: image_files,
|
31
|
+
output_dir: output_dir,
|
32
|
+
slides_haml: slides_haml,
|
33
|
+
config: config
|
34
|
+
})
|
35
|
+
builder.build!
|
36
|
+
|
22
37
|
end
|
23
38
|
end
|
24
39
|
|
data/lib/reveal-ck.rb
CHANGED
@@ -1,4 +1,10 @@
|
|
1
1
|
require_relative 'reveal-ck/version'
|
2
|
+
require_relative 'reveal-ck/config'
|
3
|
+
require_relative 'reveal-ck/file_string_replacer'
|
2
4
|
require_relative 'reveal-ck/file_slicer'
|
3
5
|
require_relative 'reveal-ck/file_splicer'
|
4
6
|
require_relative 'reveal-ck/haml_processor'
|
7
|
+
require_relative 'reveal-ck/build_task'
|
8
|
+
require_relative 'reveal-ck/builder'
|
9
|
+
require_relative 'reveal-ck/slide_builder'
|
10
|
+
require_relative 'reveal-ck/presentation_builder'
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module RevealCK
|
2
|
+
class Builder
|
3
|
+
|
4
|
+
def register_tasks
|
5
|
+
raise "Subclasses must implement register_tasks"
|
6
|
+
end
|
7
|
+
|
8
|
+
def add_task(description, action)
|
9
|
+
@tasks << BuildTask.new({
|
10
|
+
description: description,
|
11
|
+
action: action
|
12
|
+
})
|
13
|
+
end
|
14
|
+
|
15
|
+
def build!
|
16
|
+
register_tasks unless @tasks
|
17
|
+
@tasks.each {|task| task.go!}
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'toml'
|
2
|
+
|
3
|
+
module RevealCK
|
4
|
+
class Config
|
5
|
+
|
6
|
+
def initialize(args={})
|
7
|
+
config_file = args[:config_file]
|
8
|
+
@config = load_config config_file
|
9
|
+
end
|
10
|
+
|
11
|
+
def title
|
12
|
+
@config["title"]
|
13
|
+
end
|
14
|
+
|
15
|
+
def author
|
16
|
+
@config["author"]
|
17
|
+
end
|
18
|
+
|
19
|
+
def theme
|
20
|
+
@config["presentation"]["theme"]
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
DEFAULTS = {
|
26
|
+
"title" => "Slides",
|
27
|
+
"author" => "Hakim El Hattab",
|
28
|
+
"presentation" => {
|
29
|
+
"theme" => "default"
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
def load_config(config_file)
|
34
|
+
config = DEFAULTS.dup
|
35
|
+
if config_file && File.exists?(config_file)
|
36
|
+
file_config = TOML.load_file config_file
|
37
|
+
config.merge! file_config
|
38
|
+
end
|
39
|
+
config
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
@@ -1,23 +1,25 @@
|
|
1
|
-
|
1
|
+
module RevealCK
|
2
|
+
class FileSlicer
|
2
3
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
def self.remove!(path, range)
|
5
|
+
slice_file = if File.exists? path
|
6
|
+
path
|
7
|
+
else
|
8
|
+
File.expand_path(File.join(Dir.pwd, path))
|
9
|
+
end
|
10
|
+
lines = File.open(slice_file).readlines
|
11
|
+
slicer = FileSlicer.new lines
|
12
|
+
sliced_lines = slicer.remove range
|
13
|
+
File.open(slice_file, 'w') { |f| f << sliced_lines.join }
|
8
14
|
end
|
9
|
-
lines = File.open(slice_file).readlines
|
10
|
-
slicer = FileSlicer.new lines
|
11
|
-
sliced_lines = slicer.remove range
|
12
|
-
File.open(slice_file, 'w') { |f| f << sliced_lines.join }
|
13
|
-
end
|
14
15
|
|
15
|
-
|
16
|
-
|
17
|
-
|
16
|
+
def initialize(lines)
|
17
|
+
@lines = lines
|
18
|
+
end
|
18
19
|
|
19
|
-
|
20
|
-
|
21
|
-
|
20
|
+
def remove(range)
|
21
|
+
@lines.select.with_index { |line, index| ! range.cover? index }
|
22
|
+
end
|
22
23
|
|
24
|
+
end
|
23
25
|
end
|
@@ -1,39 +1,41 @@
|
|
1
|
-
|
1
|
+
module RevealCK
|
2
|
+
class FileSplicer
|
2
3
|
|
3
|
-
|
4
|
-
|
5
|
-
|
4
|
+
def initialize(lines)
|
5
|
+
@lines = lines
|
6
|
+
end
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
8
|
+
def insert(new_lines, opts)
|
9
|
+
index = @lines.each.with_index do |line, i|
|
10
|
+
break i + 1 if line.include? opts[:after]
|
11
|
+
end
|
12
|
+
@lines.insert(index, new_lines).flatten
|
10
13
|
end
|
11
|
-
@lines.insert(index, new_lines).flatten
|
12
|
-
end
|
13
14
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
def self.insert!(to_insert, opts)
|
16
|
+
to_insert_lines = readlines to_insert
|
17
|
+
insert_into_file = find_file opts[:into]
|
18
|
+
insert_into_lines = readlines insert_into_file
|
18
19
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
splicer = FileSplicer.new insert_into_lines
|
21
|
+
spliced_lines = splicer.insert to_insert_lines, after: opts[:after]
|
22
|
+
File.open(insert_into_file, 'w') { |f| f << spliced_lines.join }
|
23
|
+
end
|
23
24
|
|
24
|
-
|
25
|
+
private
|
25
26
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
27
|
+
def self.find_file(path)
|
28
|
+
if File.exists? path
|
29
|
+
path
|
30
|
+
else
|
31
|
+
File.expand_original(File.join(Dir.pwd, to_insert))
|
32
|
+
end
|
31
33
|
end
|
32
|
-
end
|
33
34
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
35
|
+
def self.readlines(path)
|
36
|
+
file = find_file path
|
37
|
+
File.open(file).readlines
|
38
|
+
end
|
38
39
|
|
40
|
+
end
|
39
41
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module RevealCK
|
2
|
+
class FileStringReplacer
|
3
|
+
|
4
|
+
def self.replace!(path, args)
|
5
|
+
old, new = args[:old], args[:new]
|
6
|
+
file = if File.exists? path
|
7
|
+
path
|
8
|
+
else
|
9
|
+
File.expand_path(File.join(Dir.pwd, path))
|
10
|
+
end
|
11
|
+
lines = File.open(file).read
|
12
|
+
lines = lines.sub old, new
|
13
|
+
File.open(file, 'w') { |f| f << lines }
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -1,24 +1,26 @@
|
|
1
1
|
require 'haml'
|
2
2
|
require 'ostruct'
|
3
3
|
|
4
|
-
|
4
|
+
module RevealCK
|
5
|
+
class HamlProcessor
|
5
6
|
|
6
|
-
|
7
|
+
attr_reader :html
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
def initialize(haml)
|
10
|
+
render_context = ::OpenStruct.new({})
|
11
|
+
engine = ::Haml::Engine.new haml
|
12
|
+
@html = engine.render render_context
|
13
|
+
end
|
13
14
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
def self.open(path)
|
16
|
+
haml_file = if File.exists? path
|
17
|
+
path
|
18
|
+
else
|
19
|
+
File.expand_path(File.join(Dir.pwd, path))
|
20
|
+
end
|
21
|
+
haml = File.open(haml_file).read
|
22
|
+
HamlProcessor.new haml
|
19
23
|
end
|
20
|
-
haml = File.open(haml_file).read
|
21
|
-
HamlProcessor.new haml
|
22
|
-
end
|
23
24
|
|
25
|
+
end
|
24
26
|
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
3
|
+
module RevealCK
|
4
|
+
#
|
5
|
+
# Public: A PresentationBuilder knows how to bundle together all of
|
6
|
+
# the various files that makeup a reveal.js presentation
|
7
|
+
#
|
8
|
+
class PresentationBuilder < Builder
|
9
|
+
|
10
|
+
attr_reader :revealjs_files, :image_files, :slides_haml, :config
|
11
|
+
attr_reader :tasks
|
12
|
+
|
13
|
+
def initialize(args)
|
14
|
+
@revealjs_files, @image_files = args[:revealjs_files], args[:image_files]
|
15
|
+
@slides_haml = args[:slides_haml]
|
16
|
+
@output_dir = args[:output_dir]
|
17
|
+
@config = args[:config]
|
18
|
+
end
|
19
|
+
|
20
|
+
def output_dir(child=nil)
|
21
|
+
if child
|
22
|
+
File.join(@output_dir, child)
|
23
|
+
else
|
24
|
+
@output_dir
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def register_tasks
|
31
|
+
|
32
|
+
@tasks = []
|
33
|
+
|
34
|
+
add_task "Ensuring #{output_dir}/ exists",
|
35
|
+
lambda {
|
36
|
+
FileUtils.mkdir_p output_dir, verbose: false
|
37
|
+
}
|
38
|
+
|
39
|
+
add_task "Transforming #{slides_haml} into #{output_dir('slides_html')}'}",
|
40
|
+
lambda {
|
41
|
+
processor = HamlProcessor.open slides_haml
|
42
|
+
File.open(output_dir('slides.html'), 'w') { |f| f << processor.html }
|
43
|
+
}
|
44
|
+
|
45
|
+
add_task "Bundling up the revealjs stuff into #{output_dir}/",
|
46
|
+
lambda {
|
47
|
+
FileUtils.cp_r revealjs_files, output_dir, verbose: false
|
48
|
+
}
|
49
|
+
|
50
|
+
add_task "Copying in images into #{output_dir('images')}",
|
51
|
+
lambda {
|
52
|
+
FileUtils.mkdir_p output_dir('images'), verbose: false
|
53
|
+
FileUtils.cp_r image_files, output_dir('images'), verbose: false
|
54
|
+
}
|
55
|
+
|
56
|
+
add_task "Creating slides/index.html",
|
57
|
+
lambda {
|
58
|
+
slide_builder = SlideBuilder.new({
|
59
|
+
user_slides: output_dir('slides.html'),
|
60
|
+
reveal_slides: output_dir('index.html'),
|
61
|
+
config: config
|
62
|
+
})
|
63
|
+
slide_builder.build!
|
64
|
+
}
|
65
|
+
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
module RevealCK
|
2
|
+
#
|
3
|
+
# Public: A SlideBuilder knows how to build the index.html file (the
|
4
|
+
# core slides) within a reveal.js presentation.
|
5
|
+
#
|
6
|
+
class SlideBuilder < Builder
|
7
|
+
|
8
|
+
attr_reader :user_slides, :reveal_slides
|
9
|
+
|
10
|
+
attr_reader :tasks
|
11
|
+
|
12
|
+
attr_reader :config
|
13
|
+
|
14
|
+
def initialize(args)
|
15
|
+
@user_slides = args[:user_slides]
|
16
|
+
@reveal_slides = args[:reveal_slides]
|
17
|
+
@config = args[:config]
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def register_tasks
|
23
|
+
|
24
|
+
@tasks = []
|
25
|
+
|
26
|
+
add_task "Slicing out reveal.js default slides",
|
27
|
+
lambda {
|
28
|
+
line_nums = {
|
29
|
+
default_slides: {
|
30
|
+
first: 38, # Line where I see <div class="slides">
|
31
|
+
last: 346 # Closing <div>
|
32
|
+
}
|
33
|
+
}
|
34
|
+
default_slides = line_nums[:default_slides][:first]..line_nums[:default_slides][:last]
|
35
|
+
FileSlicer.remove! reveal_slides, default_slides
|
36
|
+
}
|
37
|
+
|
38
|
+
add_task "Splicing in slides from #{user_slides}",
|
39
|
+
lambda {
|
40
|
+
FileSplicer.insert! user_slides, into: reveal_slides, after: '<div class="slides">'
|
41
|
+
}
|
42
|
+
|
43
|
+
old_title = 'reveal.js - The HTML Presentation Framework'
|
44
|
+
new_title = config.title
|
45
|
+
add_task "Replacing the <title>",
|
46
|
+
lambda {
|
47
|
+
FileStringReplacer.replace! reveal_slides, old: old_title, new: config.title
|
48
|
+
}
|
49
|
+
|
50
|
+
old_author = 'name="author" content="Hakim El Hattab"'
|
51
|
+
new_author = 'name="author" content="' + config.author + '"'
|
52
|
+
add_task "Replacing the <meta name='author'>",
|
53
|
+
lambda {
|
54
|
+
FileStringReplacer.replace! reveal_slides, old: old_author, new: new_author
|
55
|
+
}
|
56
|
+
|
57
|
+
old_theme = 'href="css/theme/default.css" id="theme"'
|
58
|
+
new_theme = 'href="css/theme/' + config.theme + '.css" id="theme"'
|
59
|
+
add_task 'Replacing the core theme',
|
60
|
+
lambda {
|
61
|
+
FileStringReplacer.replace! reveal_slides, old: old_theme, new: new_theme
|
62
|
+
}
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
end
|