Sha256: b2e948c59d387906b929406a74edaa1686c0b9c1ce86db4e6176cbebfa829758

Contents?: true

Size: 786 Bytes

Versions: 7

Compression:

Stored size: 786 Bytes

Contents

module Jekyll

  module Filters
    def textilize(input)
      RedCloth.new(input).to_html
    end

    def date_to_string(date)
      date.strftime("%d %b %Y")
    end

    def date_to_long_string(date)
      date.strftime("%d %B %Y")
    end

    def date_to_xmlschema(date)
      date.xmlschema
    end

    def xml_escape(input)
      input.gsub("&", "&amp;").gsub("<", "&lt;").gsub(">", "&gt;")
    end

    def number_of_words(input)
      input.split.length
    end

    def array_to_sentence_string(array)
      connector = "and"
      case array.length
      when 0
        ""
      when 1
        array[0].to_s
      when 2
        "#{array[0]} #{connector} #{array[1]}"
      else
        "#{array[0...-1].join(', ')}, #{connector} #{array[-1]}"
      end
    end

  end
end

Version data entries

7 entries across 7 versions & 5 rubygems

Version Path
codeslinger-jekyll-0.5.0 lib/jekyll/filters.rb
henrik-jekyll-0.5.0 lib/jekyll/filters.rb
mojombo-jekyll-0.5.0 lib/jekyll/filters.rb
qrush-jekyll-0.5.0 lib/jekyll/filters.rb
qrush-jekyll-0.5.1 lib/jekyll/filters.rb
sixones-jekyll-0.5.0 lib/jekyll/filters.rb
sixones-jekyll-0.5.1 lib/jekyll/filters.rb