Method: Slideshow::TextFilter#directives_bang_style_to_percent_style

Defined in:
lib/slideshow/filters/text_filter.rb

#directives_bang_style_to_percent_style(content) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/slideshow/filters/text_filter.rb', line 19

def directives_bang_style_to_percent_style( content )

  # for compatibility allow !SLIDE/!STYLE as an alternative to %slide/%style-directive
  
  bang_count = 0

  # get unparsed helpers e.g. SLIDE|STYLE  
  unparsed = DIRECTIVES_UNPARSED.map { |item| item.upcase }.join( '|' )                                                                   
  
  content.gsub!(/^!(#{unparsed})(.*)$/) do |match|
    bang_count += 1
    "<%= #{$1.downcase} '#{$2 ? $2 : ''}' %>"
  end

  puts "  Patching !-directives (#{bang_count} #{DIRECTIVES_UNPARSED.join('/')}-directives)..."

  content
end