Sha256: 1a2e2f3a384607ec316abe62d907380c4bead814601814d7e185da87a0ec86f6

Contents?: true

Size: 857 Bytes

Versions: 3

Compression:

Stored size: 857 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 date_to_utc(date)
      date.utc
    end

    def xml_escape(input)
      CGI.escapeHTML(input)
    end

    def cgi_escape(input)
      CGI::escape(input)
    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

3 entries across 3 versions & 2 rubygems

Version Path
cypher-jekyll-0.5.2 lib/jekyll/filters.rb
jberkel-jekyll-0.5.7 lib/jekyll/filters.rb
jberkel-jekyll-0.5.4 lib/jekyll/filters.rb