class Parade::Slide

The Slide is the core class of the Presentation. The slide aggregates the markdown content, the slide metadata, and the slide template to create the HTML representation of the slide for Parade.

Attributes

content[R]

The raw, unformatted slide content.

metadata[RW]

A slide can contain various metadata to help define additional information about it.

@param [Parade::Metadata] value metadata object which contains

information for the slide
section[RW]
sequence[RW]

TODO: Previously this was #{name}#{sequence}, this is likely needing to be set by the slideshow itself to ensure that the content is unique and displayed in the correct order.

Public Class Methods

new(params={}) click to toggle source

@param [Hash] params contains the parameters to help create the slide

that is going to be displayed.
# File lib/parade/slide.rb, line 31
def initialize(params={})
  @content = ""
  @metadata = Metadata.new
  params.each {|k,v| send("#{k}=",v) if respond_to? "#{k}=" }
end

Public Instance Methods

<<(append_raw_content) click to toggle source

@param [String] append_raw_content this is additional raw content to add

to the slide.
# File lib/parade/slide.rb, line 52
def <<(append_raw_content)
  @content << "#{append_raw_content}\n"
end
content=(value) click to toggle source

@param [String] value this is the new content initially is set or overrides

the existing content within the slide
# File lib/parade/slide.rb, line 44
def content=(value)
  @content = "#{value}\n"
end
content_as_html() click to toggle source

@return [String] HTML rendering of the slide’s raw contents.

# File lib/parade/slide.rb, line 105
def content_as_html
  pre_renderers.inject(content) {|content,renderer| renderer.render(content) }
end
content_classes() click to toggle source

@return [String] the CSS classes for the content section of the slide

# File lib/parade/slide.rb, line 77
def content_classes
  metadata.classes
end
empty?() click to toggle source

@return [Boolean] true if the slide has no content and not intentionly marked blank.

# File lib/parade/slide.rb, line 58
def empty?
  @content.to_s.strip == "" && !content_classes.include?('blank')
end
hierarchy() click to toggle source
# File lib/parade/slide.rb, line 23
def hierarchy
  section.hierarchy
end
id() click to toggle source

@return [String] an id for the slide

# File lib/parade/slide.rb, line 92
def id
  metadata.id.to_s
end
post_renderers() click to toggle source
# File lib/parade/slide.rb, line 100
def post_renderers
  SlidePostRenderers.renderers
end
pre_renderers() click to toggle source
# File lib/parade/slide.rb, line 96
def pre_renderers
  SlidePreRenderers.renderers
end
section_classes() click to toggle source

@return [String] the CSS classes specifed at the section level

# File lib/parade/slide.rb, line 82
def section_classes
  section.css_classes
end
slide_classes() click to toggle source

@return [String] the CSS classes for the slide

# File lib/parade/slide.rb, line 72
def slide_classes
  [ title.downcase.gsub(' ','-') ] + section_classes + content_classes
end
slides() click to toggle source
# File lib/parade/slide.rb, line 109
def slides
  self
end
template_file() click to toggle source

@return [ERB] an ERB template that this slide will be rendered into

# File lib/parade/slide.rb, line 114
def template_file
  erb_template_file = section.template metadata.template
  ERB.new File.read(erb_template_file)
end
title() click to toggle source
# File lib/parade/slide.rb, line 19
def title
  section ? section.title : "Slide"
end
to_html() click to toggle source

@return [String] the HTML representation of the slide

# File lib/parade/slide.rb, line 120
def to_html
  content = template_file.result(binding)
  post_renderers.inject(content) {|content,renderer| renderer.render(content) }
end
transition() click to toggle source

@return [String] the transition style for the slide

# File lib/parade/slide.rb, line 87
def transition
  metadata.transition || "none"
end