Sha256: 38137d85720cd42979935fc043f4781efb9cc6cb8d81e62fdeeafb5bd7e31e25
Contents?: true
Size: 1020 Bytes
Versions: 1
Compression:
Stored size: 1020 Bytes
Contents
require 'mail2frontmatter' require 'auto_html' require 'byebug' module Mail2FrontMatter class AutomaticEmbed < PreProcessor extend AutoHtml @all_filters = [:youtube, :soundcloud, :link, :ted, :twitter, :vimeo, :google_map, :gist, :flickr] def self.run(metadata, 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 metadata, body end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
m2fm-automatic-embed-0.0.1 | lib/mail2frontmatter/automatic-embeds.rb |