class TextFilterPlugin
Public Class Methods
available_filter_types()
click to toggle source
# File lib/text_filter_plugin.rb, line 30 def self.available_filter_types unless @cached_filter_types types = { "macropre" => [], "macropost" => [], "markup" => [], "postprocess" => [], "other" => [] } available_filters.each { |filter| types[filter.filter_type].push(filter) } @cached_filter_types = types end @cached_filter_types end
available_filters()
click to toggle source
# File lib/text_filter_plugin.rb, line 26 def self.available_filters filter_map.values end
component_name()
click to toggle source
The name that needs to be used when refering to the plugin's controller in render statements
# File lib/text_filter_plugin.rb, line 58 def self.component_name if to_s =~ /::([a-zA-Z]+)$/ "plugins/textfilters/#{Regexp.last_match[1]}".downcase else raise "I don't know who I am: #{self}" end end
config_value(params, name)
click to toggle source
Look up a config paramater, falling back to the default as needed.
# File lib/text_filter_plugin.rb, line 91 def self.config_value(params, name) params[:filterparams][name] || default_config[name][:default] end
default_config()
click to toggle source
# File lib/text_filter_plugin.rb, line 76 def self.default_config {} end
default_helper_module!()
click to toggle source
# File lib/text_filter_plugin.rb, line 88 def self.default_helper_module!; end
filter_map()
click to toggle source
# File lib/text_filter_plugin.rb, line 22 def self.filter_map @@filter_map end
filter_type()
click to toggle source
# File lib/text_filter_plugin.rb, line 72 def self.filter_type "other" end
help_text()
click to toggle source
# File lib/text_filter_plugin.rb, line 80 def self.help_text "" end
inherited(sub)
click to toggle source
Calls superclass method
# File lib/text_filter_plugin.rb, line 13 def self.inherited(sub) super if sub.to_s.start_with?("Plugin", "PublifyApp::Textfilter") name = sub.short_name @@filter_map[name] = sub end end
logger()
click to toggle source
# File lib/text_filter_plugin.rb, line 95 def self.logger @logger ||= ::Rails.logger || Logger.new($stdout) end
macro_filters()
click to toggle source
# File lib/text_filter_plugin.rb, line 45 def self.macro_filters available_filters.select { |filter| TextFilterPlugin::Macro > filter } end
reloadable?()
click to toggle source
# File lib/text_filter_plugin.rb, line 52 def self.reloadable? false end
sanitize(*args)
click to toggle source
# File lib/text_filter_plugin.rb, line 84 def self.sanitize(*args) (@sanitizer ||= Rails::Html::WhiteListSanitizer.new).sanitize(*args) end
short_name()
click to toggle source
The name that's stored in the DB. This is the final chunk of the controller name, like 'markdown' or 'smartypants'.
# File lib/text_filter_plugin.rb, line 68 def self.short_name component_name.split(%r{/}).last end