Sha256: 66acea6daf491dbb228016bf5efc664483311838c4a228c1485772f63a7bb425

Contents?: true

Size: 713 Bytes

Versions: 1

Compression:

Stored size: 713 Bytes

Contents

module Jekyll

  class Site
    def read_events
      unfinished_events = []

      self.data['events'].each do |event_id, event_data|
        event_start = event_data['time']['from']['date']
        event_end = event_data['time']['to']['date']

        if event_end >= (Date.today + 1)
          event = event_data.clone

          event['id'] = event_id

          if event_start < (Date.today - 1)
            event['current'] = true
          end 

          unfinished_events << event
        end
      end

      self.data['unfinished_events'] = unfinished_events
    end
  end

  class EventReader < Generator
    safe true
    priority :low

    def generate(site)
      site.read_events
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jekyll-theme-isotc154-helpers-0.0.1 lib/jekyll-theme-isotc154-helpers/events.rb