class Jekyll::AttendeasePlugin::NavigationTag

Public Class Methods

new(tag_name, params, tokens) click to toggle source
Calls superclass method
# File lib/jekyll/attendease_plugin/tags.rb, line 116
def initialize(tag_name, params, tokens)
  super
  @options = {}
  params.split(/\s/).each do |keypair|
    opt = keypair.split('=')
    @options[opt[0]] = opt[1] if opt.length == 2
  end
end

Public Instance Methods

render(context) click to toggle source
Calls superclass method
# File lib/jekyll/attendease_plugin/tags.rb, line 125
def render(context)
  pages = context.registers[:site].data['pages']

  nav = []
  if pages.is_a?(Array)
    pages.sort! { |a, b| a['weight'] <=> b['weight'] }
    pages.select { |p| p['top_level'] }.each do |page|
      if page['active'] && !page['hidden']
        template = Liquid::Template.parse(super)
        template.assigns['page'] = page
        nav << template.render
      end
    end
    nav.join("\n")
  else
    ''
  end
end