n3bulous-infuse 0.9.1 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
data/bin/infuse CHANGED
@@ -31,6 +31,15 @@ def background(text)
31
31
  InfuseDSL.instance.background = text
32
32
  end
33
33
 
34
+ def format(text)
35
+ InfuseDSL.instance.format = text
36
+ end
37
+
38
+ def transition(text)
39
+ InfuseDSL.instance.transition = text
40
+ end
41
+
42
+
34
43
  def slide(title, *content)
35
44
  s = Slide.new(title, content)
36
45
  InfuseDSL.instance.add_slide(s)
@@ -3,15 +3,26 @@ require 'singleton'
3
3
  class InfuseDSL
4
4
  include Singleton
5
5
 
6
- attr_accessor :slides, :title, :author, :company, :copyright, :subtitle, :background
6
+ # Specified
7
+ attr_accessor :slides, :title, :author, :company, :copyright, :subtitle, :background, :format, :transition
8
+ # Derived
7
9
  attr_accessor :source_file, :output_dir
8
10
 
9
11
  def initialize
10
12
  @slides = []
11
13
 
12
- @header_template = File.dirname(__FILE__) + "/themes/plain/header.html.erb"
13
- @footer_template = File.dirname(__FILE__) + "/themes/plain/footer.html.erb"
14
- @slide_template = File.dirname(__FILE__) + "/themes/plain/slide.html.erb"
14
+ @template_dir = File.dirname(__FILE__) + "/themes/plain/"
15
+ @operashow_templates = {
16
+ :header => "operashow-header.html.erb",
17
+ :footer => "operashow-footer.html.erb",
18
+ :slide => "slide.html.erb"
19
+ }
20
+
21
+ @html_templates = {
22
+ :header => "header.html.erb",
23
+ :footer => "footer.html.erb",
24
+ :slide => "slide.html.erb"
25
+ }
15
26
  end
16
27
 
17
28
  def add_slide(slide)
@@ -19,35 +30,56 @@ class InfuseDSL
19
30
  end
20
31
 
21
32
  def run
22
- header_tpl = IO.read(@header_template)
23
- footer_tpl = IO.read(@footer_template)
24
- slide_tpl = IO.read(@slide_template)
33
+ html_output = generate_html_slideshow
34
+ operashow_output = generate_operashow_slideshow
25
35
 
36
+ prepare_target_dir
37
+
38
+ begin
39
+ File.new(output_file, "w").puts(html_output)
40
+ File.new(output_file('operashow-'), "w").puts(operashow_output)
41
+ rescue
42
+ puts $!
43
+ exit
44
+ end
45
+
46
+ end
47
+
48
+ private
49
+
50
+ def generate_slide_output(header_tpl, footer_tpl, slide_tpl)
26
51
  header_with_data = ERB.new(header_tpl, 0, ">").result(self.send(:binding))
27
52
  footer_with_data = ERB.new(footer_tpl, 0, ">").result(self.send(:binding))
28
53
 
29
54
  slides_with_data = ""
30
55
  @slides.each do |s|
31
- slides_with_data << s.convert(slide_tpl)
56
+ slides_with_data << s.convert(slide_tpl) + "\n\n"
32
57
  end
33
58
 
34
59
  output = header_with_data + "\n" + slides_with_data + "\n" + footer_with_data
60
+ end
35
61
 
36
- prepare_target_dir
62
+ def generate_html_slideshow
63
+ header_tpl = IO.read(@template_dir + @html_templates[:header])
64
+ footer_tpl = IO.read(@template_dir + @html_templates[:footer])
65
+ slide_tpl = IO.read(@template_dir + @html_templates[:slide])
37
66
 
38
- begin
39
- File.new(output_file, "w").puts(output)
40
- rescue
41
- puts ""
42
- end
67
+ generate_slide_output(header_tpl, footer_tpl, slide_tpl)
68
+ end
43
69
 
70
+ def generate_operashow_slideshow
71
+ header_tpl = IO.read(@template_dir + @operashow_templates[:header])
72
+ footer_tpl = IO.read(@template_dir + @operashow_templates[:footer])
73
+ slide_tpl = IO.read(@template_dir + @operashow_templates[:slide])
74
+
75
+ generate_slide_output(header_tpl, footer_tpl, slide_tpl)
44
76
  end
45
77
 
46
- private
47
- def output_file
48
- @output_dir + "/" + File.basename(@source_file, ".#{INFUSE_EXTENSION}") + ".html"
78
+ def output_file(name_prefix="")
79
+ @output_dir + "/" + name_prefix + File.basename(@source_file, ".#{INFUSE_EXTENSION}") + ".html"
49
80
  end
50
81
 
82
+ # TODO: Update files based on differences, at least missing files.
51
83
  def prepare_target_dir
52
84
  begin
53
85
  FileUtils.mkdir(@output_dir)
@@ -59,8 +91,10 @@ private
59
91
  end
60
92
 
61
93
  def copy_default_files
62
- FileUtils.cp_r(File.dirname(__FILE__) + "/../s6/shared/", @output_dir)
63
- FileUtils.cp_r(File.dirname(__FILE__) + "/themes/plain/css/custom.css", @output_dir)
94
+ FileUtils.cp_r(File.dirname(__FILE__) + "/../s6/shared", @output_dir)
95
+ FileUtils.cp_r(File.dirname(__FILE__) + "/themes/plain/custom.css", @output_dir)
96
+ FileUtils.cp_r(File.dirname(__FILE__) + "/themes/plain/operashow.css", @output_dir + "/shared")
97
+ FileUtils.cp_r(File.dirname(__FILE__) + "/themes/plain/operashow-custom.css", @output_dir)
64
98
  end
65
99
 
66
100
  end
@@ -0,0 +1,12 @@
1
+ @import url(shared/operashow.css);
2
+
3
+ html, body {
4
+ color: black;
5
+ background-color: white;
6
+ font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
7
+ }
8
+
9
+ div#header, div#footer {
10
+ color: #ffe8b2;
11
+ background-color: #ce8b45;
12
+ }
@@ -0,0 +1,6 @@
1
+ <div id="footer">
2
+ <h1><%= title %></h1>
3
+ <h2>&copy; <%= copyright %></h2>
4
+ </div>
5
+ </body>
6
+ </html>
@@ -0,0 +1,21 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
2
+ <html>
3
+ <head>
4
+ <title><%= @title %></title>
5
+ <meta http-equiv=expires content="-1">
6
+ <meta http-equiv=Cache-Control CONTENT=no-cache>
7
+ <meta http-equiv=Pragma CONTENT=no-cache>
8
+
9
+ <link rel="stylesheet" href="operashow-custom.css" type="text/css">
10
+ </head>
11
+
12
+ <body>
13
+ <% if background.length > 0 %>
14
+ <div class="layout">
15
+ <div class="background">
16
+ <object data="<%= @background %>" width="100%" height="100%">
17
+ </object>
18
+ </div>
19
+ </div>
20
+ <% end %>
21
+
@@ -0,0 +1,78 @@
1
+ @media screen {
2
+ .layout { display: none; }
3
+
4
+ .banner {
5
+ display: block;
6
+ border: green solid thick;
7
+ padding: 1em;
8
+ font-family: sans-serif;
9
+ font-weight: bold;
10
+ margin-bottom: 2em;
11
+ }
12
+
13
+ a:link, a:visited { color: black; }
14
+ a:hover { background-color: yellow; }
15
+
16
+ body { color: black; }
17
+
18
+ pre.code {
19
+ background-color: black;
20
+ color: white;
21
+ padding: 5px;
22
+ }
23
+ }
24
+
25
+ @media projection {
26
+ body
27
+ {
28
+ height: 100%; margin: 0px; padding: 0px;
29
+ font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
30
+ color: white;
31
+ opacity: .99;
32
+ }
33
+
34
+ .slide
35
+ {
36
+ page-break-after: always;
37
+ padding-left: 2em;
38
+ padding-top: 2em;
39
+ }
40
+
41
+ .banner
42
+ {
43
+ display: none;
44
+ }
45
+
46
+ .layout
47
+ {
48
+ display: block;
49
+ }
50
+
51
+ div.background {
52
+ position: fixed;
53
+ left: 0px;
54
+ right: 0px;
55
+ top: 0px;
56
+ bottom: 0px;
57
+ z-index: -1;
58
+ }
59
+
60
+ a:link, a:visited {
61
+ color: white;
62
+ }
63
+ a:hover { background-color: yellow; }
64
+
65
+ h1, h2 { font-size: 36pt; }
66
+ h3 { font-size: 25pt; }
67
+ p, li, td, th { font-size: 18pt; }
68
+
69
+ pre { font-size: 16pt; }
70
+
71
+ pre.code { font-size: 16pt;
72
+ background-color: black;
73
+ color: white;
74
+ padding: 5px;
75
+ border: silver thick groove;
76
+ -moz-border-radius: 11px;
77
+ }
78
+ }
@@ -9,3 +9,4 @@
9
9
  -->
10
10
  <% end %>
11
11
  </div>
12
+
@@ -3,7 +3,7 @@ module Infuse
3
3
 
4
4
  MAJOR = 0
5
5
  MINOR = 9
6
- TINY = 1
6
+ TINY = 2
7
7
 
8
8
  def self.to_s # :nodoc:
9
9
  [MAJOR, MINOR, TINY].join('.')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: n3bulous-infuse
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin McFadden
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-03-03 00:00:00 -08:00
12
+ date: 2009-03-04 00:00:00 -08:00
13
13
  default_executable: infuse
14
14
  dependencies: []
15
15
 
@@ -29,11 +29,13 @@ files:
29
29
  - lib/infuse/slide.rb
30
30
  - lib/infuse/themes
31
31
  - lib/infuse/themes/plain
32
- - lib/infuse/themes/plain/css
33
- - lib/infuse/themes/plain/css/custom.css
32
+ - lib/infuse/themes/plain/custom.css
34
33
  - lib/infuse/themes/plain/footer.html.erb
35
34
  - lib/infuse/themes/plain/header.html.erb
36
- - lib/infuse/themes/plain/js
35
+ - lib/infuse/themes/plain/operashow-custom.css
36
+ - lib/infuse/themes/plain/operashow-footer.html.erb
37
+ - lib/infuse/themes/plain/operashow-header.html.erb
38
+ - lib/infuse/themes/plain/operashow.css
37
39
  - lib/infuse/themes/plain/slide.html.erb
38
40
  - lib/infuse/themes/plain/title-page.html.erb
39
41
  - lib/infuse/version.rb