Sha256: 2453f6a3c39cf945bdf5462eac0b0c79608f4dfdf02144983545f32b2c71ac51

Contents?: true

Size: 850 Bytes

Versions: 2

Compression:

Stored size: 850 Bytes

Contents

require 'rabbit/element/slide-element'
require 'rabbit/element/text-container-element'

module Rabbit
  module Element
    class Slide
      include SlideElement

      def initialize(title)
        super
      end

      def headline
        @elements[0]
      end

      def body
        @elements[1]
      end

      def to_html(generator)
        "<div class=\"slide\">\n#{super}\n</div>"
      end

      def hide_title?
        self["hide-title"] == "true"
      end
    end

    class HeadLine
      include TextBlockElement

      def to_rd
        "= #{text}"
      end

      def to_html(generator)
        "<h1>#{super}</h1>"
      end

      def draw_elements(canvas, x, y, w, h, simulation)
        return [x, y, w, h] if slide.hide_title?
        super
      end
    end

    class Body
      include ContainerElement
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rabbit-0.9.1 lib/rabbit/element/slide.rb
rabbit-0.9.0 lib/rabbit/element/slide.rb