Sha256: ead71b826e6f0dc8356a1b37e0f26ee2b17ec138590461dda6a4b19a27a83c74

Contents?: true

Size: 460 Bytes

Versions: 6

Compression:

Stored size: 460 Bytes

Contents

module ClWiki
  class CustomFormatters
    include Singleton

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

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

    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
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
clwiki-3.3.2 lib/cl_wiki/custom_formatters.rb
clwiki-3.3.0 lib/cl_wiki/custom_formatters.rb
clwiki-3.2.6 lib/cl_wiki/custom_formatters.rb
clwiki-3.2.5 lib/cl_wiki/custom_formatters.rb
clwiki-3.2.4 lib/cl_wiki/custom_formatters.rb
clwiki-3.2.3 lib/cl_wiki/custom_formatters.rb