Class: Gary::Builder

Inherits:
Markaby::Builder
  • Object
show all
Defined in:
lib/gary.rb

Overview

Build de presentation slides.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#presentation_optionsObject (readonly)

Returns the value of attribute presentation_options.



72
73
74
# File 'lib/gary.rb', line 72

def presentation_options
  @presentation_options
end

Instance Method Details

#code(options = {}) ⇒ Object

Generates synta hightlight for code using albino



134
135
136
# File 'lib/gary.rb', line 134

def code(options = {})
  self << Albino.new(options[:code], options[:type]).colorize
end

#presentation(options = {}, &block) ⇒ Object

You must pass the presentation title.



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/gary.rb', line 81

def presentation(options = {}, &block)
  raise "Must have a title" unless options.has_key? :title

  @presentation_options = options
  html do
    head do
      meta :name=>"defaultView", :content=>"slideshow"
      link.outlineStyle! :rel => 'stylesheet', :type => 'text/css',
      :href => 'assets/outline.css', :media => 'screen'
      link.slideStyle! :rel => 'stylesheet', :type => 'text/css',
      :href => '/print.css', :media => 'print'
      link.slideProj! :rel => 'stylesheet', :type => 'text/css',
      :href => 'assets/style.css', :media => 'projection'
      link :rel => 'stylesheet', :type => 'text/css',
      :href => 'assets/prettify.css', :media => 'screen'
      
      script :src => "assets/jquery.js", :type => "text/javascript"
      script :src => "assets/slides.js", :type => "text/javascript"
      script :src => "assets/gary.js", :type => "text/javascript"          
      
      title @presentation_options[:title]
    end
    body do
      
      div.layout! do
        div.controls! { }
        div.currentSlide! { }
        div.header! { }
        div.footer! do
          h1  @presentation_options[:title]
        end
        div.microsoft! do
          self << "Microsoft's Internet Explorer browser
        has no built-in vector graphics machinery
         required for \"loss-free\" gradient background themes."
        end
      end
      
      div.presentation do
        instance_eval(&block)
      end
    end
  end            
end

#renderObject

Render the slideshow HTML.



75
76
77
# File 'lib/gary.rb', line 75

def render
  to_s
end

#slide(options = {}, &block) ⇒ Object

Create a slide, you can pass some options, same options accepted by “div” tag.



127
128
129
130
131
# File 'lib/gary.rb', line 127

def slide(options = {}, &block)
  div.slide options do
    div.container { instance_eval(&block) }
  end
end