Sha256: 571dc4a6803596c34145c5132f26c1b1c87c0254be1e9c354cdfa15a46f1c3bb

Contents?: true

Size: 696 Bytes

Versions: 1

Compression:

Stored size: 696 Bytes

Contents

module Jekyll
  module Filters
    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("<", "&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

1 entries across 1 versions & 1 rubygems

Version Path
tristandunn-jekyll-0.3.0 lib/jekyll/filters.rb