Sha256: 10f8ca133cf396b9b32005ff6abdcb52d74283f9465589d809f6cb795fdeaaa9

Contents?: true

Size: 988 Bytes

Versions: 9

Compression:

Stored size: 988 Bytes

Contents

module Locomotive
  module Liquid
    module Filters
      module Text

        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

        # 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 textile(input)
          ::RedCloth.new(input).to_html
        end

      end

      ::Liquid::Template.register_filter(Text)

    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
locomotive_cms-2.1.4 lib/locomotive/liquid/filters/text.rb
locomotive_cms-2.1.3 lib/locomotive/liquid/filters/text.rb
locomotive_cms-2.1.2 lib/locomotive/liquid/filters/text.rb
locomotive_cms-2.1.1 lib/locomotive/liquid/filters/text.rb
locomotive_cms-2.1.0 lib/locomotive/liquid/filters/text.rb
locomotive_cms-2.0.3 lib/locomotive/liquid/filters/text.rb
locomotive_cms-2.0.2 lib/locomotive/liquid/filters/text.rb
locomotive_cms-2.0.1 lib/locomotive/liquid/filters/text.rb
locomotive_cms-2.0.0 lib/locomotive/liquid/filters/text.rb