Class: Mail2FrontMatter::AutomaticEmbed

Inherits:
PreProcessor
  • Object
show all
Extended by:
AutoHtml
Defined in:
lib/mail2frontmatter/automatic-embeds.rb

Class Method Summary collapse

Class Method Details

.run(metadata, body) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/mail2frontmatter/automatic-embeds.rb', line 11

def self.run(, body)
  # I *could* introspect on auto_html here but I haven't vetted them all yet

  if @options[:white_list]
    filters = @options[:white_list]
  elsif @options[:black_list]
    filters = @all_filters - @options[:black_list]
  else
    filters = @all_filters
  end

  body = auto_html(body, { filters: filters, options: @options[:filters] }) { 
    # use options passed to us...
    @options[:filters].each do |filter|
      options_for_filter = @options[:options] ? (@options[:options][filter.to_sym] || {}) : {}
      self.send(filter.to_sym, options_for_filter)
    end

    # be sure to return @text here
    @text
  }

  return , body
end