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



376
377
378
379
380
381
382
# File 'lib/cl_wiki/page.rb', line 376

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



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

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

#unregister(class_ref) ⇒ Object



372
373
374
# File 'lib/cl_wiki/page.rb', line 372

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