Class: Webby::Filters::Slides
- Inherits:
-
Object
- Object
- Webby::Filters::Slides
- Defined in:
- lib/webby/filters/slides.rb
Overview
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.
Constant Summary collapse
- START_SLIDE =
%{<div class="slide">#$/}
- END_SLIDE =
%{</div>#$/#$/}
Instance Method Summary collapse
-
#filter ⇒ Object
call-seq: filter => html.
-
#initialize(str) ⇒ Slides
constructor
call-seq: Slides.new( html ).
Constructor Details
Instance Method Details
#filter ⇒ Object
call-seq:
filter => html
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.
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/webby/filters/slides.rb', line 35 def filter result = [] @str.split(%r/\<h1\>/i).each do || next if .strip.empty? result << START_SLIDE << '<h1>' << << END_SLIDE end result.join end |