class Gollum::Filter

Constants

PLACEHOLDER_PATTERN

Attributes

close_pattern[R]
open_pattern[R]

Public Class Methods

new(markup) click to toggle source

Setup the object. Sets `@markup` to be the instance of Gollum::Markup that is running this filter chain, and sets `@map` to be an empty hash (for use in your extract/process operations).

# File lib/gollum-lib/filter.rb, line 56
def initialize(markup)
  @markup = markup
  @map    = {}
  @open_pattern = "%#{self.class.to_s.split('::').last}%"
  @close_pattern = "=#{self.class.to_s.split('::').last}="
end

Public Instance Methods

extract(data) click to toggle source
# File lib/gollum-lib/filter.rb, line 65
def extract(data)
  raise RuntimeError,
        "#{self.class} has not implemented ##extract!"
end
process(data) click to toggle source
# File lib/gollum-lib/filter.rb, line 70
def process(data)
  raise RuntimeError,
        "#{self.class} has not implemented ##process!"
end

Protected Instance Methods

html_error(message) click to toggle source

Render a (presumably) non-fatal error as HTML

# File lib/gollum-lib/filter.rb, line 83
def html_error(message)
  "<p class=\"gollum-error\">#{message}</p>"
end
sanitize(data) click to toggle source
# File lib/gollum-lib/filter.rb, line 77
def sanitize(data)
  @markup.wiki.sanitizer.clean(data, @markup.historical)
end