class Webby::Filters::Slides - webby-0.9.4 Documentation

# class Webby::Filters::Slides

The Slides filter is used to generate an S5 presentation from HTML input text. The input HTML is scanned for <h1> tags and slide divs are inserted before each <h1> tag found.

When the HTML is rendered into the presentation layout, the result is an S5 presentation – provided that the layout includes the appropriate S5 javascript and CSS files.

### Constants

END_SLIDE
START_SLIDE

### Public Class Methods

new( html ) click to toggle source

Creates a new slides filter that will operate on the given html string.

    # File lib/webby/filters/slides.rb, line 23
    def initialize( str )
      @str = str
      @open = false
    end

### Public Instance Methods

filter → html click to toggle source

Process the original html document passed to the filter when it was created. The document will be scanned for H1 heading tags and slide divs will be inserted into the page before each H1 tag that is found.

    # File lib/webby/filters/slides.rb, line 35
    def filter
      result = []

      @str.split(/\<h1/i).each do |slide|
        next if slide.strip.empty?
        result << START_SLIDE << '<h1' << slide << END_SLIDE
      end

      result.join
    end