Sha256: b5f29cc81892ef60d1f3299e88e7cbaf0cde80d950cd01862215be945fc47274

Contents?: true

Size: 815 Bytes

Versions: 4

Compression:

Stored size: 815 Bytes

Contents

module Jekyll

  module Filters
    def textilize(input)
      TextileConverter.new.convert(input)
    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)
      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

4 entries across 4 versions & 3 rubygems

Version Path
realityforge-jekyll-0.7.1-java lib/jekyll/filters.rb
jekyll-0.7.0 lib/jekyll/filters.rb
cartera-jekyll-0.6.2 lib/jekyll/filters.rb
jekyll-0.6.2 lib/jekyll/filters.rb