Sha256: 2d7db0c43c9d551db62ed31a922f02b2dcc9ea68bb2978e1b1ffd5d89e5ad241

Contents?: true

Size: 1.12 KB

Versions: 19

Compression:

Stored size: 1.12 KB

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

        def encode(input)
          Rack::Utils.escape(input)
        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

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

      end

      ::Liquid::Template.register_filter(Text)

    end
  end
end

Version data entries

19 entries across 19 versions & 2 rubygems

Version Path
locomotive_cms-2.5.7 lib/locomotive/liquid/filters/text.rb
locomotivecms-3.0.0.pre.alpha.2 lib/locomotive/previous_liquid/filters/text.rb
locomotivecms-3.0.0.pre.alpha lib/locomotive/previous_liquid/filters/text.rb
locomotive_cms-2.5.6 lib/locomotive/liquid/filters/text.rb
locomotive_cms-2.5.6.rc2 lib/locomotive/liquid/filters/text.rb
locomotive_cms-2.5.6.rc1 lib/locomotive/liquid/filters/text.rb
locomotive_cms-2.5.5 lib/locomotive/liquid/filters/text.rb
locomotive_cms-2.5.4 lib/locomotive/liquid/filters/text.rb
locomotive_cms-2.5.3 lib/locomotive/liquid/filters/text.rb
locomotive_cms-2.5.2 lib/locomotive/liquid/filters/text.rb
locomotive_cms-2.5.1 lib/locomotive/liquid/filters/text.rb
locomotive_cms-2.5.0 lib/locomotive/liquid/filters/text.rb
locomotive_cms-2.5.0.rc3 lib/locomotive/liquid/filters/text.rb
locomotive_cms-2.5.0.rc2 lib/locomotive/liquid/filters/text.rb
locomotive_cms-2.5.0.rc1 lib/locomotive/liquid/filters/text.rb
locomotive_cms-2.4.1 lib/locomotive/liquid/filters/text.rb
locomotive_cms-2.4.0 lib/locomotive/liquid/filters/text.rb
locomotive_cms-2.3.1 lib/locomotive/liquid/filters/text.rb
locomotive_cms-2.3.0 lib/locomotive/liquid/filters/text.rb