Module: Slideshow::SlideFilter

Included in:
Gen
Defined in:
lib/slideshow/filters/slide_filter.rb

Instance Method Summary collapse

Instance Method Details

#takahashi_slide_breaks(content) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/slideshow/filters/slide_filter.rb', line 7

def takahashi_slide_breaks( content )
  
  inline_count = 0
  line_count = 0

  ###########################
  ## allows   one // two // three
  
  content.gsub!( /\b[ ]+\/{2}[ ]+\b/) do |match|
    inline_count += 1
    ## todo: use slide('') directive helper?
    "\n\n<!-- _S9SLIDE_  -->\n\n"
  end
  
  ############################
  ## allows
  ##
  ##  one
  ##  //
  ##  two
  ##  //
  ##  three
  
  content.gsub!( /^[ ]*\/{2}[ ]*$/ ) do |match|
    line_count += 1
    ## todo: use slide('') directive helper?
    "\n\n<!-- _S9SLIDE_  -->\n\n"
  end

  puts "  Adding #{inline_count+line_count} takahashi slide breaks (#{inline_count} //-inline, #{line_count} //-line)..."
      
  content
end