slide-em-up 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +7 -0
- data/bin/slide-em-up2pdf +67 -0
- data/lib/slide-em-up/presentation.rb +7 -0
- data/lib/slide-em-up/version.rb +1 -1
- data/themes/3d_slideshow/index.erb +1 -1
- data/themes/3d_slideshow/js/slideshow.js +3 -1
- data/themes/CSSS/js/slideshow.js +3 -1
- data/themes/html5rocks/js/slides.js +3 -1
- data/themes/memories/js/slideshow.js +3 -1
- data/themes/shower/js/script.js +3 -1
- metadata +15 -13
data/README.md
CHANGED
@@ -120,6 +120,13 @@ setting the `APIKEY` environment variable:
|
|
120
120
|
APIKEY=foobar slide-em-up
|
121
121
|
|
122
122
|
|
123
|
+
Export to PDF
|
124
|
+
-------------
|
125
|
+
|
126
|
+
You can export your presentation to PDF by installing
|
127
|
+
[phantomjs](http://phantomjs.org/) and then run `slide-em-up2pdf`.
|
128
|
+
|
129
|
+
|
123
130
|
Examples
|
124
131
|
--------
|
125
132
|
|
data/bin/slide-em-up2pdf
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'tmpdir'
|
4
|
+
require "slide-em-up"
|
5
|
+
require "goliath/runner"
|
6
|
+
|
7
|
+
|
8
|
+
puts "Export to pdf..."
|
9
|
+
|
10
|
+
# Config
|
11
|
+
output = ARGV.first || "slides.pdf"
|
12
|
+
delay = 500
|
13
|
+
url = "http://localhost:9000/"
|
14
|
+
viewport = { width: 1024, height: 768 }
|
15
|
+
presentation = SlideEmUp::Presentation.new(Dir.pwd)
|
16
|
+
|
17
|
+
# Run a slide-em-up instance in background
|
18
|
+
pid = Process.fork do
|
19
|
+
runner = Goliath::Runner.new([], nil)
|
20
|
+
runner.app = SlideEmUp::Routes.run(presentation)
|
21
|
+
runner.run
|
22
|
+
end
|
23
|
+
|
24
|
+
# Count the number of slides
|
25
|
+
nb_slides = presentation.nb_slides
|
26
|
+
|
27
|
+
# The phantomjs script
|
28
|
+
js = <<-EOS
|
29
|
+
var dir = phantom.args[0];
|
30
|
+
var page = require('webpage').create();
|
31
|
+
page.viewportSize = { width: #{viewport[:width]}, height: #{viewport[:height]} };
|
32
|
+
page.paperSize = { format: 'A4', orientation: 'landscape' };
|
33
|
+
|
34
|
+
function exportSlides() {
|
35
|
+
var i = 0;
|
36
|
+
setInterval(function() {
|
37
|
+
console.log('Render slide ' + i);
|
38
|
+
page.render(dir + '/slide' + i + '.pdf');
|
39
|
+
page.sendEvent('keypress', ' ');
|
40
|
+
if (++i == #{nb_slides}) { phantom.exit(); }
|
41
|
+
}, #{delay});
|
42
|
+
}
|
43
|
+
|
44
|
+
console.log('Load #{url}');
|
45
|
+
page.open("#{url}", function (status) {
|
46
|
+
if (status !== 'success') {
|
47
|
+
console.log('Unable to load the given URL');
|
48
|
+
phantom.exit(-1);
|
49
|
+
} else {
|
50
|
+
// wait to be sure the page is loaded correctly
|
51
|
+
setTimeout(exportSlides, #{delay} * 5);
|
52
|
+
}
|
53
|
+
});
|
54
|
+
EOS
|
55
|
+
|
56
|
+
Dir.mktmpdir do |dir|
|
57
|
+
sleep 2
|
58
|
+
script = "#{dir}/script.js"
|
59
|
+
File.write script, js
|
60
|
+
system "phantomjs #{script} #{dir}"
|
61
|
+
files = (0...nb_slides).map {|i| "#{dir}/slide#{i}.pdf" }.join ' '
|
62
|
+
system "pdftk #{files} cat output #{output}"
|
63
|
+
File.delete script
|
64
|
+
end
|
65
|
+
|
66
|
+
Process.kill "QUIT", pid
|
67
|
+
Process.wait pid
|
@@ -40,6 +40,13 @@ module SlideEmUp
|
|
40
40
|
Dir["#{meta.dir}/**#{asset}"].first
|
41
41
|
end
|
42
42
|
|
43
|
+
def nb_slides
|
44
|
+
@parts.inject(0) do |nb,(dir,title)|
|
45
|
+
raw = Dir["#{meta.dir}/#{dir}/**/*.md"].map { |f| File.read(f) }.join("\n\n")
|
46
|
+
nb += raw.split(/!SLIDE */).length
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
43
50
|
protected
|
44
51
|
|
45
52
|
def extract_normal_infos(dir)
|
data/lib/slide-em-up/version.rb
CHANGED
@@ -43,7 +43,9 @@ var Slideshow = (function(){
|
|
43
43
|
document.addEventListener('touchstart', onDocumentTouchStart, false);
|
44
44
|
window.addEventListener('hashchange', onWindowHashChange, false);
|
45
45
|
|
46
|
-
|
46
|
+
window.setTimeout(function() {
|
47
|
+
startEventSourceHandler('/remote/sub/events');
|
48
|
+
}, 100);
|
47
49
|
|
48
50
|
// Read the initial state of the URL (hash)
|
49
51
|
readURL();
|
data/themes/CSSS/js/slideshow.js
CHANGED
@@ -157,7 +157,9 @@ var self = window.SlideShow = function(slide) {
|
|
157
157
|
document.addEventListener('touchend', this, false);
|
158
158
|
document.addEventListener('touchcancel', this, false);
|
159
159
|
|
160
|
-
|
160
|
+
window.setTimeout(function() {
|
161
|
+
this.startEventSourceHandler('/remote/sub/events');
|
162
|
+
}, 100);
|
161
163
|
|
162
164
|
// Process iframe slides
|
163
165
|
$$('.slide[data-src]:empty').forEach(function(slide) {
|
@@ -304,7 +304,9 @@
|
|
304
304
|
function(e) { if (e.state) { _t.go(e.state); } }, false);
|
305
305
|
query('#left-init-key').addEventListener('click',
|
306
306
|
function() { _t.next(); }, false);
|
307
|
-
|
307
|
+
window.setTimeout(function() {
|
308
|
+
this._startEventSource('/remote/sub/events');
|
309
|
+
}, 100);
|
308
310
|
this._update();
|
309
311
|
};
|
310
312
|
|
@@ -119,7 +119,9 @@ var self = window.SlideShow = function(slide) {
|
|
119
119
|
document.addEventListener('keyup', this, false);
|
120
120
|
document.addEventListener('keydown', this, false);
|
121
121
|
|
122
|
-
|
122
|
+
window.setTimeout(function() {
|
123
|
+
this.startEventSourceHandler('/remote/sub/events');
|
124
|
+
}, 100);
|
123
125
|
|
124
126
|
// Process iframe slides
|
125
127
|
$$('.slide[data-src]:empty').forEach(function(slide) {
|
data/themes/shower/js/script.js
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slide-em-up
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-10-06 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: goliath
|
16
|
-
requirement: &
|
16
|
+
requirement: &75213700 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '1.0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *75213700
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: redcarpet
|
27
|
-
requirement: &
|
27
|
+
requirement: &75213370 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '2.1'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *75213370
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: erubis
|
38
|
-
requirement: &
|
38
|
+
requirement: &75212860 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '2.7'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *75212860
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: yajl-ruby
|
49
|
-
requirement: &
|
49
|
+
requirement: &75212540 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '1.1'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *75212540
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: albino
|
60
|
-
requirement: &
|
60
|
+
requirement: &75212210 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '1.3'
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *75212210
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: minitest
|
71
|
-
requirement: &
|
71
|
+
requirement: &75211700 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ~>
|
@@ -76,11 +76,12 @@ dependencies:
|
|
76
76
|
version: '2.3'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *75211700
|
80
80
|
description: Slide'em up is a presentation tool that displays markdown-formatted slides
|
81
81
|
email: bruno.michel@af83.com
|
82
82
|
executables:
|
83
83
|
- slide-em-up
|
84
|
+
- slide-em-up2pdf
|
84
85
|
extensions: []
|
85
86
|
extra_rdoc_files:
|
86
87
|
- README.md
|
@@ -88,6 +89,7 @@ files:
|
|
88
89
|
- MIT-LICENSE
|
89
90
|
- README.md
|
90
91
|
- Gemfile
|
92
|
+
- bin/slide-em-up2pdf
|
91
93
|
- bin/slide-em-up
|
92
94
|
- lib/slide-em-up.rb
|
93
95
|
- lib/slide-em-up/markdown.rb
|