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
The raw, unformatted slide content.
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
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
@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
@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
@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
@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
@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
@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
# File lib/parade/slide.rb, line 23 def hierarchy section.hierarchy end
@return [String] an id for the slide
# File lib/parade/slide.rb, line 92 def id metadata.id.to_s end
# File lib/parade/slide.rb, line 100 def post_renderers SlidePostRenderers.renderers end
# File lib/parade/slide.rb, line 96 def pre_renderers SlidePreRenderers.renderers end
@return [String] the CSS classes specifed at the section level
# File lib/parade/slide.rb, line 82 def section_classes section.css_classes end
@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
# File lib/parade/slide.rb, line 109 def slides self end
@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
# File lib/parade/slide.rb, line 19 def title section ? section.title : "Slide" end
@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
@return [String] the transition style for the slide
# File lib/parade/slide.rb, line 87 def transition metadata.transition || "none" end