slideshow 0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/slideshow +4 -0
- data/lib/slideshow.rb +98 -0
- metadata +54 -0
data/bin/slideshow
ADDED
data/lib/slideshow.rb
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
require 'optparse'
|
2
|
+
require 'RedCloth'
|
3
|
+
|
4
|
+
module Slideshow
|
5
|
+
|
6
|
+
def Slideshow.create_slideshow( fn )
|
7
|
+
|
8
|
+
header = <<EOS
|
9
|
+
<html>
|
10
|
+
<head>
|
11
|
+
|
12
|
+
<meta name="slideselector" content=".slide">
|
13
|
+
<meta name="titleselector" content="h1">
|
14
|
+
<meta name="stepselector" content=".step">
|
15
|
+
|
16
|
+
<title>Slideshow</title>
|
17
|
+
|
18
|
+
<style type="text/css">
|
19
|
+
@media projection {
|
20
|
+
|
21
|
+
body
|
22
|
+
{
|
23
|
+
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
|
24
|
+
}
|
25
|
+
|
26
|
+
A:hover { background-color: cyan; }
|
27
|
+
|
28
|
+
h1, h2 { font-size: 40pt; color: black; }
|
29
|
+
h3 { font-size: 25pt; color: black; }
|
30
|
+
p, li, td, th { font-size: 18pt; color: black; }
|
31
|
+
|
32
|
+
pre { font-size: 16pt; color: black; }
|
33
|
+
pre.code { font-size: 16pt; color: black; background-color: silver; }
|
34
|
+
|
35
|
+
}
|
36
|
+
</style>
|
37
|
+
|
38
|
+
|
39
|
+
</head>
|
40
|
+
<body>
|
41
|
+
EOS
|
42
|
+
|
43
|
+
footer = <<EOS
|
44
|
+
</body>
|
45
|
+
</html>
|
46
|
+
EOS
|
47
|
+
|
48
|
+
basename = File.basename( fn, '.*' )
|
49
|
+
extname = File.extname( fn )
|
50
|
+
|
51
|
+
extname = ".textile" if extname.eql?("")
|
52
|
+
|
53
|
+
inname = "#{basename}#{extname}"
|
54
|
+
outname = "#{basename}.html"
|
55
|
+
|
56
|
+
puts "Preparing slidshow '#{outname}'..."
|
57
|
+
|
58
|
+
content = ''
|
59
|
+
slide_counter = 0
|
60
|
+
|
61
|
+
infile = File.new( inname )
|
62
|
+
infile.each { |line|
|
63
|
+
if line.include?( 'h1.' ) then
|
64
|
+
content << "\n\n</div>" if slide_counter > 0
|
65
|
+
content << "<div class='slide'>\n\n"
|
66
|
+
slide_counter += 1
|
67
|
+
end
|
68
|
+
content << line
|
69
|
+
}
|
70
|
+
|
71
|
+
content << "\n\n</div>" if slide_counter > 0
|
72
|
+
|
73
|
+
out = File.new( outname, "w+")
|
74
|
+
out << header
|
75
|
+
out << RedCloth.new( content ).to_html
|
76
|
+
out << footer
|
77
|
+
out.flush
|
78
|
+
out.close
|
79
|
+
|
80
|
+
puts "Done."
|
81
|
+
end
|
82
|
+
|
83
|
+
|
84
|
+
def Slideshow.main
|
85
|
+
|
86
|
+
$options = {}
|
87
|
+
|
88
|
+
opt=OptionParser.new do |opts|
|
89
|
+
opts.banner = "Usage: #{$0} [options] name"
|
90
|
+
# opts.on( "-s", "--style STYLE", "Select Stylesheet" ) { |s| $options[:style]=s }
|
91
|
+
opts.on_tail( "-h", "--help", "Show this message" ) { puts opts.help; exit }
|
92
|
+
end
|
93
|
+
|
94
|
+
opt.parse!
|
95
|
+
ARGV.each { |fn| Slideshow.create_slideshow( fn ) }
|
96
|
+
end
|
97
|
+
|
98
|
+
end
|
metadata
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: slideshow
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: "0.1"
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Gerald Bauer
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-02-16 00:00:00 -08:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description:
|
17
|
+
email: geraldbauer2007@gmail.com
|
18
|
+
executables:
|
19
|
+
- slideshow
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files: []
|
23
|
+
|
24
|
+
files:
|
25
|
+
- lib/slideshow.rb
|
26
|
+
- bin/slideshow
|
27
|
+
has_rdoc: false
|
28
|
+
homepage: http://slideshow.rubyforge.org
|
29
|
+
post_install_message:
|
30
|
+
rdoc_options: []
|
31
|
+
|
32
|
+
require_paths:
|
33
|
+
- lib
|
34
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
35
|
+
requirements:
|
36
|
+
- - ">="
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: "0"
|
39
|
+
version:
|
40
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: "0"
|
45
|
+
version:
|
46
|
+
requirements: []
|
47
|
+
|
48
|
+
rubyforge_project:
|
49
|
+
rubygems_version: 1.0.1
|
50
|
+
signing_key:
|
51
|
+
specification_version: 2
|
52
|
+
summary: Slideshow - A Web Alternative to PowerPoint and KeyNote in Ruby
|
53
|
+
test_files: []
|
54
|
+
|