Sha256: f0b7df67adad9b50d7803a753b925e14c60fce5e005d6c19de10a7abb7ae72ea

Contents?: true

Size: 406 Bytes

Versions: 2

Compression:

Stored size: 406 Bytes

Contents

require 'bbcoder'

module HTML
  class Pipeline
    class BbcodeFilter < TextFilter
      def initialize(text, context = {}, result = nil)
        super text, context, result
        @context = context
        @text = @text.gsub "\r", ''
      end

      def call
        html = BBCoder.new(@text).to_html.gsub(/\n|\r\n/, '<br />')
        html.rstrip!
        "<p>#{html}</p>"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
thredded-0.2.2 lib/html/pipeline/bbcode_filter.rb
thredded-0.0.12 lib/html/pipeline/bbcode_filter.rb