Class: ClWiki::CustomFormatters

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/cl_wiki/custom_formatters.rb

Instance Method Summary collapse

Instance Method Details

#process_formatters(content, page) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/cl_wiki/custom_formatters.rb', line 14

def process_formatters(content, page)
  @formatters&.each do |f|
    if content&.match?(f.match_re)
      content.gsub!(f.match_re) { |match| f.format_content(match, page) }
    end
  end
end

#register(class_ref) ⇒ Object



5
6
7
8
# File 'lib/cl_wiki/custom_formatters.rb', line 5

def register(class_ref)
  @formatters ||= []
  @formatters << class_ref
end

#unregister(class_ref) ⇒ Object



10
11
12
# File 'lib/cl_wiki/custom_formatters.rb', line 10

def unregister(class_ref)
  @formatters.delete(class_ref)
end