Class: ClWiki::CustomFormatters

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

Instance Method Summary collapse

Instance Method Details

#process_formatters(content, page) ⇒ Object



371
372
373
374
375
376
377
# File 'lib/cl_wiki/page.rb', line 371

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



362
363
364
365
# File 'lib/cl_wiki/page.rb', line 362

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

#unregister(class_ref) ⇒ Object



367
368
369
# File 'lib/cl_wiki/page.rb', line 367

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