reveal.rb 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +18 -0
- data/lib/reveal/cli.rb +32 -6
- data/lib/reveal/templates/reveal.yml +2 -0
- data/lib/reveal/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 198dbe4ca1f44f2451805ae003e8d3b28a226e7a
|
4
|
+
data.tar.gz: 5e975881ed302587d4865ed8c39ad842b1861dd1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f2b54d533b7057c14b94738649be8b1fe4c6e51a469a979969a2458729d935a4f9a2fe53bf8aa7ee8fea9cac40543627347395fa271f74ae5ef12282aae5d05
|
7
|
+
data.tar.gz: 0d3a46938807a1c055ea9a78687753ca1518c632e74bece5837676dd11d15218ebb4108857c95938767f9191cab102d5d35c6e8b9fa1a397faf0862d2ac3e1a5
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -23,3 +23,21 @@ Simply install the gem:
|
|
23
23
|
reveal generate
|
24
24
|
|
25
25
|
That's it! Now open `output/index.html` to watch your presentation.
|
26
|
+
|
27
|
+
## Configuration
|
28
|
+
|
29
|
+
All currently supported configurations are made through `reveal.yml` file.
|
30
|
+
|
31
|
+
### Slides order
|
32
|
+
|
33
|
+
There are two ways to order your slides:
|
34
|
+
|
35
|
+
* **Manual order**: set `order` parameter to `manual` and list your slide names in `slides` parameter. This is the default configuration, and it's automatically done for you with `reveal add-slide` command;
|
36
|
+
* **Alphabetical order**: if you omit `order` parameter (or set it to anything other than `manual`), slides will be orderer alphabetically.
|
37
|
+
|
38
|
+
### reveal.js configurations
|
39
|
+
|
40
|
+
`reveal create` command adds a `template.html` file to your
|
41
|
+
presentation, with reveal.js default configurations. If you want to
|
42
|
+
change some configuration, just edit this file before running `reveal
|
43
|
+
generate`.
|
data/lib/reveal/cli.rb
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
require 'fileutils'
|
2
|
+
require 'yaml'
|
2
3
|
|
3
4
|
module Reveal
|
4
5
|
SOURCE_DIR = "source"
|
5
6
|
OUTPUT_DIR = "output"
|
6
7
|
TEMPLATE_FILENAME = "template.html"
|
8
|
+
CONFIG_FILENAME = "reveal.yml"
|
7
9
|
SLIDES_TAG = "<slides>"
|
8
10
|
|
9
11
|
module Cli
|
@@ -16,7 +18,7 @@ module Reveal
|
|
16
18
|
def create args
|
17
19
|
name = args.first
|
18
20
|
|
19
|
-
if
|
21
|
+
if File.exists?(name)
|
20
22
|
puts "#{name} already exists."
|
21
23
|
exit 1
|
22
24
|
end
|
@@ -24,19 +26,25 @@ module Reveal
|
|
24
26
|
FileUtils.mkdir_p(File.join(name, SOURCE_DIR))
|
25
27
|
FileUtils.mkdir_p(File.join(name, OUTPUT_DIR))
|
26
28
|
FileUtils.cp(File.join(templates_path, TEMPLATE_FILENAME), name)
|
29
|
+
FileUtils.cp(File.join(templates_path, CONFIG_FILENAME), name)
|
27
30
|
FileUtils.cp_r(File.join(templates_path, "revealjs", "."), File.join(name, OUTPUT_DIR))
|
28
31
|
|
29
|
-
puts "#{name}
|
32
|
+
puts "Presentation '#{name}' created."
|
30
33
|
end
|
31
34
|
|
32
35
|
def add_slide args
|
33
36
|
check_if_presentation_exists
|
34
37
|
|
38
|
+
config["slides"] ||= []
|
39
|
+
|
35
40
|
args.each do |slide_name|
|
36
41
|
filepath = File.join(SOURCE_DIR, "#{slide_name}.md")
|
37
42
|
FileUtils.touch(filepath)
|
38
|
-
|
43
|
+
config["slides"] << slide_name
|
44
|
+
puts "Slide '#{filepath}' created."
|
39
45
|
end
|
46
|
+
|
47
|
+
write_config
|
40
48
|
end
|
41
49
|
|
42
50
|
def generate args
|
@@ -44,7 +52,7 @@ module Reveal
|
|
44
52
|
|
45
53
|
source_content = ""
|
46
54
|
|
47
|
-
|
55
|
+
ordered_slide_names.each do |filename|
|
48
56
|
source_content << <<-SLIDE
|
49
57
|
<section data-markdown>
|
50
58
|
<script type="text/template">
|
@@ -52,7 +60,7 @@ module Reveal
|
|
52
60
|
</script>
|
53
61
|
</section>
|
54
62
|
|
55
|
-
|
63
|
+
SLIDE
|
56
64
|
end
|
57
65
|
|
58
66
|
template = File.read(TEMPLATE_FILENAME)
|
@@ -61,7 +69,7 @@ module Reveal
|
|
61
69
|
file.write(template.gsub(SLIDES_TAG, source_content))
|
62
70
|
end
|
63
71
|
|
64
|
-
puts "#{compiled_filename} presentation generated."
|
72
|
+
puts "#{compiled_filename} presentation file generated."
|
65
73
|
end
|
66
74
|
|
67
75
|
private
|
@@ -81,5 +89,23 @@ module Reveal
|
|
81
89
|
].select { |item| File.readable?(item) }.first
|
82
90
|
end
|
83
91
|
end
|
92
|
+
|
93
|
+
def ordered_slide_names
|
94
|
+
if config && config["order"] == "manual" && config["slides"]
|
95
|
+
config["slides"].
|
96
|
+
map { |slide_name| File.join(SOURCE_DIR, "#{slide_name}.md") }.
|
97
|
+
select { |filepath| File.readable?(filepath) }
|
98
|
+
else
|
99
|
+
Dir.glob(File.join(SOURCE_DIR, "*.md"))
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
def config
|
104
|
+
@config ||= YAML.load(File.read(CONFIG_FILENAME))
|
105
|
+
end
|
106
|
+
|
107
|
+
def write_config
|
108
|
+
File.write(CONFIG_FILENAME, config.to_yaml)
|
109
|
+
end
|
84
110
|
end
|
85
111
|
end
|
data/lib/reveal/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reveal.rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Guilherme Garnier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-26 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Generates presentations using reveal.js
|
14
14
|
email:
|
@@ -27,6 +27,7 @@ files:
|
|
27
27
|
- bin/reveal
|
28
28
|
- lib/reveal.rb
|
29
29
|
- lib/reveal/cli.rb
|
30
|
+
- lib/reveal/templates/reveal.yml
|
30
31
|
- lib/reveal/templates/revealjs/css/print/pdf.css
|
31
32
|
- lib/reveal/templates/revealjs/css/reveal.min.css
|
32
33
|
- lib/reveal/templates/revealjs/css/theme/default.css
|