Sha256: a0e0f5678bbecdf1e150975cf36512a23d243ba45f2d8671036fef01e2a0da6a

Contents?: true

Size: 1.22 KB

Versions: 15

Compression:

Stored size: 1.22 KB

Contents

module Locomotive
  module Wagon
    module Liquid
      module Filters
        module Text

          # right justify and padd a string
          def rjust(input, integer, padstr = '')
            input.to_s.rjust(integer, padstr)
          end

          # left justify and padd a string
          def ljust(input, integer, padstr = '')
            input.to_s.ljust(integer, padstr)
          end

          def underscore(input)
            input.to_s.gsub(' ', '_').gsub('/', '_').underscore
          end

          def dasherize(input)
            input.to_s.gsub(' ', '-').gsub('/', '-').dasherize
          end

          # alias newline_to_br
          def multi_line(input)
            input.to_s.gsub("\n", '<br/>')
          end

          def concat(input, *args)
            result = input.to_s
            args.flatten.each { |a| result << a.to_s }
            result
          end

          def encode(input)
            Rack::Utils.escape(input)
          end

          def textile(input)
            ::RedCloth.new(input).to_html
          end

          def markdown(input)
            Locomotive::Wagon::Markdown.render(input)
          end

        end

        ::Liquid::Template.register_filter(Text)

      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
locomotivecms_wagon-1.5.8 lib/locomotive/wagon/liquid/filters/text.rb
locomotivecms_wagon-1.5.7 lib/locomotive/wagon/liquid/filters/text.rb
locomotivecms_wagon-1.5.6 lib/locomotive/wagon/liquid/filters/text.rb
locomotivecms_wagon-1.5.5 lib/locomotive/wagon/liquid/filters/text.rb
locomotivecms_wagon-1.5.4 lib/locomotive/wagon/liquid/filters/text.rb
locomotivecms_wagon-1.5.3 lib/locomotive/wagon/liquid/filters/text.rb
locomotivecms_wagon-1.5.2 lib/locomotive/wagon/liquid/filters/text.rb
locomotivecms_wagon-1.5.1 lib/locomotive/wagon/liquid/filters/text.rb
locomotivecms_wagon-1.5.0 lib/locomotive/wagon/liquid/filters/text.rb
locomotivecms_wagon-1.5.0.rc1 lib/locomotive/wagon/liquid/filters/text.rb
locomotivecms_wagon-1.4.0 lib/locomotive/wagon/liquid/filters/text.rb
locomotivecms_wagon-1.3.3 lib/locomotive/wagon/liquid/filters/text.rb
locomotivecms_wagon-1.3.2 lib/locomotive/wagon/liquid/filters/text.rb
locomotivecms_wagon-1.3.1 lib/locomotive/wagon/liquid/filters/text.rb
locomotivecms_wagon-1.3.0 lib/locomotive/wagon/liquid/filters/text.rb