Sha256: 350fa5e23e6abf44bc22074526860de7473a1fbbe9a7bfef17e4f9113dac10eb

Contents?: true

Size: 479 Bytes

Versions: 4

Compression:

Stored size: 479 Bytes

Contents

module Jekyll
  module Timeago
    class Tag < Liquid::Tag
      include Jekyll::Timeago::Filter

      def initialize(tag_name, dates, tokens)
        super
        @dates = dates.strip.split(' ')
      end

      def render(context)
        from, to = @dates[0], @dates[1]

        if to
          timeago(from, to)
        else
          timeago(from)
        end
      end
    end
  end
end

Liquid::Template.register_tag('timeago', Jekyll::Timeago::Tag) if defined?(Liquid)

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
jekyll-timeago-0.8.2 lib/jekyll-timeago/tag.rb
jekyll-timeago-0.8.1 lib/jekyll-timeago/tag.rb
jekyll-timeago-0.8.0 lib/jekyll-timeago/tag.rb
jekyll-timeago-0.7.0 lib/jekyll-timeago/tag.rb