slide-em-up 0.1.0
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.
- data/Gemfile +3 -0
- data/MIT-LICENSE +20 -0
- data/README.md +34 -0
- data/lib/slide-em-up/assets_api.rb +41 -0
- data/lib/slide-em-up/presentation.rb +86 -0
- data/lib/slide-em-up/slides_api.rb +21 -0
- data/lib/slide-em-up/version.rb +3 -0
- data/lib/slide-em-up.rb +6 -0
- metadata +148 -0
data/Gemfile
ADDED
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 Bruno Michel <bruno.michel@af83.com>
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
Slide'em up
|
2
|
+
===========
|
3
|
+
|
4
|
+
Slide'em up is a presentation tool. You write some slides in markdown, choose
|
5
|
+
a style and it displays it in HTML5. With a browser in full-screen, you can
|
6
|
+
make amazing presentations!
|
7
|
+
|
8
|
+
TODO
|
9
|
+
----
|
10
|
+
|
11
|
+
* Add specs :p
|
12
|
+
* Explain how to install and use it in README
|
13
|
+
* Many more things
|
14
|
+
|
15
|
+
|
16
|
+
Issues or Suggestions
|
17
|
+
---------------------
|
18
|
+
|
19
|
+
Found an issue or have a suggestion? Please report it on
|
20
|
+
[Github's issue tracker](http://github.com/nono/slide-em-up/issues).
|
21
|
+
|
22
|
+
If you wants to make a pull request, please check the specs before:
|
23
|
+
|
24
|
+
./spec/slide-em-up_spec.rb
|
25
|
+
|
26
|
+
|
27
|
+
Credits
|
28
|
+
-------
|
29
|
+
|
30
|
+
Scott Chacon is the guy who made [ShowOff](https://github.com/schacon/showoff).
|
31
|
+
Slide'em up is only a copy of ShowOff, where sinatra was replaced by Goliath.
|
32
|
+
|
33
|
+
Copyright (c) 2011 Bruno Michel <bruno.michel@af83.com>
|
34
|
+
Released under the MIT license
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require "time"
|
2
|
+
require "rack/utils"
|
3
|
+
require "rack/mime"
|
4
|
+
require "goliath/api"
|
5
|
+
|
6
|
+
|
7
|
+
module SlideEmUp
|
8
|
+
class AssetsAPI < Goliath::API
|
9
|
+
def initialize(presentation)
|
10
|
+
@presentation = presentation
|
11
|
+
end
|
12
|
+
|
13
|
+
def response(env)
|
14
|
+
path_info = Rack::Utils.unescape(env["PATH_INFO"])
|
15
|
+
path = @presentation.path_for_asset(path_info)
|
16
|
+
if path_info == "/"
|
17
|
+
[302, {
|
18
|
+
"Location" => "http://#{env["HTTP_HOST"]}/slides",
|
19
|
+
"Content-Length" => "0"
|
20
|
+
}, [] ]
|
21
|
+
elsif path_info.include? ".."
|
22
|
+
[403, {
|
23
|
+
"Content-Type" => "text/plain",
|
24
|
+
"Content-Length" => "0"
|
25
|
+
}, ["Forbidden\n"] ]
|
26
|
+
elsif path
|
27
|
+
body = File.read(path)
|
28
|
+
[200, {
|
29
|
+
"Last-Modified" => File.mtime(path).httpdate,
|
30
|
+
"Content-Length" => Rack::Utils.bytesize(body).to_s,
|
31
|
+
"Content-Type" => Rack::Mime.mime_type(File.extname(path), 'text/plain'),
|
32
|
+
}, [body] ]
|
33
|
+
else
|
34
|
+
[404, {
|
35
|
+
"Content-Type" => "text/plain",
|
36
|
+
"Content-Length" => "0"
|
37
|
+
}, ["File not found: #{path_info}\n"] ]
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
require "nolate"
|
2
|
+
require "redcarpet"
|
3
|
+
require "yajl"
|
4
|
+
|
5
|
+
|
6
|
+
module SlideEmUp
|
7
|
+
class Presentation
|
8
|
+
Meta = Struct.new(:title, :dir, :css, :js)
|
9
|
+
Theme = Struct.new(:title, :dir, :css, :js)
|
10
|
+
Section = Struct.new(:number, :title, :slides)
|
11
|
+
Slide = Struct.new(:number, :classes, :markdown, :html)
|
12
|
+
|
13
|
+
attr_accessor :meta, :theme
|
14
|
+
|
15
|
+
def initialize(dir)
|
16
|
+
infos = extract_normal_infos(dir) || extract_infos_from_showoff(dir) || {}
|
17
|
+
infos = { :title => "No title", :theme => "default" }.merge(infos)
|
18
|
+
@meta = build_meta(infos[:title], dir)
|
19
|
+
@theme = build_theme(infos[:theme])
|
20
|
+
@titles = infos[:sections]
|
21
|
+
end
|
22
|
+
|
23
|
+
def html
|
24
|
+
str = File.read("#{theme.dir}/index.nlt")
|
25
|
+
nolate str, :meta => meta, :theme => theme, :sections => sections
|
26
|
+
end
|
27
|
+
|
28
|
+
def path_for_asset(asset)
|
29
|
+
try = "#{theme.dir}/#{asset}"
|
30
|
+
return try if File.exists? try
|
31
|
+
Dir["#{meta.dir}/**/#{asset}"].first
|
32
|
+
end
|
33
|
+
|
34
|
+
protected
|
35
|
+
|
36
|
+
def extract_normal_infos(dir)
|
37
|
+
filename = "#{dir}/presentation.json"
|
38
|
+
return unless File.exists?(filename)
|
39
|
+
Yajl::Parser.parse(File.read filename)
|
40
|
+
end
|
41
|
+
|
42
|
+
def extract_infos_from_showoff(dir)
|
43
|
+
filename = "#{dir}/showoff.json"
|
44
|
+
return unless File.exists?(filename)
|
45
|
+
infos = Yajl::Parser.parse(File.read filename)
|
46
|
+
sections = infos["sections"].map {|s| s["section"] }
|
47
|
+
{ :title => infos["name"], :theme => "showoff", :sections => sections }
|
48
|
+
end
|
49
|
+
|
50
|
+
def build_meta(title, dir)
|
51
|
+
Meta.new.tap do |m|
|
52
|
+
m.title = title
|
53
|
+
m.dir = dir
|
54
|
+
Dir.chdir(m.dir) do
|
55
|
+
m.css = Dir["**/*.css"]
|
56
|
+
m.js = Dir["**/*.js"]
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def build_theme(title)
|
62
|
+
Theme.new.tap do |t|
|
63
|
+
t.title = title
|
64
|
+
t.dir = File.expand_path("../../../themes/#{title}", __FILE__)
|
65
|
+
Dir.chdir(t.dir) do
|
66
|
+
t.css = Dir["**/*.css"]
|
67
|
+
t.js = Dir["**/*.js"]
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def sections
|
73
|
+
@titles.map.with_index do |title,i|
|
74
|
+
raw = Dir["#{meta.dir}/#{title}/**/*.md"].sort.map { |f| File.read(f) }.join("\n\n")
|
75
|
+
parts = raw.split(/!SLIDE */)
|
76
|
+
parts.delete('')
|
77
|
+
slides = parts.map.with_index do |slide,j|
|
78
|
+
classes, md = slide.split("\n", 2)
|
79
|
+
html = Redcarpet.new(md).to_html
|
80
|
+
Slide.new(j, classes, md, html)
|
81
|
+
end
|
82
|
+
Section.new(i, title, slides)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require "rack/utils"
|
2
|
+
require "goliath/api"
|
3
|
+
|
4
|
+
|
5
|
+
module SlideEmUp
|
6
|
+
class SlidesAPI < Goliath::API
|
7
|
+
use ::Rack::ContentLength
|
8
|
+
|
9
|
+
def initialize(presentation)
|
10
|
+
@presentation = presentation
|
11
|
+
end
|
12
|
+
|
13
|
+
def response(env)
|
14
|
+
body = @presentation.html
|
15
|
+
[200, {
|
16
|
+
"Content-Type" => "text/html; charset=utf-8",
|
17
|
+
"Content-Length" => Rack::Utils.bytesize(body).to_s
|
18
|
+
}, [body] ]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/slide-em-up.rb
ADDED
metadata
ADDED
@@ -0,0 +1,148 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: slide-em-up
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Bruno Michel
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-04-15 00:00:00 +02:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: goliath
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 25
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
- 9
|
33
|
+
version: "0.9"
|
34
|
+
type: :runtime
|
35
|
+
version_requirements: *id001
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: redcarpet
|
38
|
+
prerelease: false
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ~>
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
hash: 1
|
45
|
+
segments:
|
46
|
+
- 1
|
47
|
+
- 7
|
48
|
+
version: "1.7"
|
49
|
+
type: :runtime
|
50
|
+
version_requirements: *id002
|
51
|
+
- !ruby/object:Gem::Dependency
|
52
|
+
name: nolate
|
53
|
+
prerelease: false
|
54
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
55
|
+
none: false
|
56
|
+
requirements:
|
57
|
+
- - ~>
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
hash: 11
|
60
|
+
segments:
|
61
|
+
- 0
|
62
|
+
- 0
|
63
|
+
version: "0.0"
|
64
|
+
type: :runtime
|
65
|
+
version_requirements: *id003
|
66
|
+
- !ruby/object:Gem::Dependency
|
67
|
+
name: yajl-ruby
|
68
|
+
prerelease: false
|
69
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
70
|
+
none: false
|
71
|
+
requirements:
|
72
|
+
- - ~>
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
hash: 27
|
75
|
+
segments:
|
76
|
+
- 0
|
77
|
+
- 8
|
78
|
+
version: "0.8"
|
79
|
+
type: :runtime
|
80
|
+
version_requirements: *id004
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
name: minitest
|
83
|
+
prerelease: false
|
84
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
85
|
+
none: false
|
86
|
+
requirements:
|
87
|
+
- - ~>
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
hash: 3
|
90
|
+
segments:
|
91
|
+
- 2
|
92
|
+
- 0
|
93
|
+
version: "2.0"
|
94
|
+
type: :development
|
95
|
+
version_requirements: *id005
|
96
|
+
description: Slide'em up is a presentation tool that displays markdown-formatted slides
|
97
|
+
email: bruno.michel@af83.com
|
98
|
+
executables: []
|
99
|
+
|
100
|
+
extensions: []
|
101
|
+
|
102
|
+
extra_rdoc_files:
|
103
|
+
- README.md
|
104
|
+
files:
|
105
|
+
- MIT-LICENSE
|
106
|
+
- README.md
|
107
|
+
- Gemfile
|
108
|
+
- lib/slide-em-up.rb
|
109
|
+
- lib/slide-em-up/slides_api.rb
|
110
|
+
- lib/slide-em-up/assets_api.rb
|
111
|
+
- lib/slide-em-up/presentation.rb
|
112
|
+
- lib/slide-em-up/version.rb
|
113
|
+
has_rdoc: true
|
114
|
+
homepage: http://github.com/nono/slide-em-up
|
115
|
+
licenses: []
|
116
|
+
|
117
|
+
post_install_message:
|
118
|
+
rdoc_options: []
|
119
|
+
|
120
|
+
require_paths:
|
121
|
+
- lib
|
122
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
123
|
+
none: false
|
124
|
+
requirements:
|
125
|
+
- - ">="
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
hash: 3
|
128
|
+
segments:
|
129
|
+
- 0
|
130
|
+
version: "0"
|
131
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
132
|
+
none: false
|
133
|
+
requirements:
|
134
|
+
- - ">="
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
hash: 3
|
137
|
+
segments:
|
138
|
+
- 0
|
139
|
+
version: "0"
|
140
|
+
requirements: []
|
141
|
+
|
142
|
+
rubyforge_project:
|
143
|
+
rubygems_version: 1.5.2
|
144
|
+
signing_key:
|
145
|
+
specification_version: 3
|
146
|
+
summary: Slide'em up is a presentation tool that displays markdown-formatted slides
|
147
|
+
test_files: []
|
148
|
+
|