mirror of
https://github.com/moparisthebest/android.moparisthebest.org
synced 2024-11-16 14:15:04 -05:00
25 lines
561 B
Ruby
25 lines
561 B
Ruby
module Jekyll
|
|
class IncludeSidebarTag < Liquid::Tag
|
|
def initialize(tag_name, file, tokens)
|
|
super
|
|
@file = file.strip
|
|
end
|
|
|
|
def render(context)
|
|
file = (@file == "" ? context['page.sidebar'] : @file)
|
|
if file.include? 'site.'
|
|
file = context[file]
|
|
end
|
|
render_include "sidebars/#{file}", context
|
|
end
|
|
|
|
def render_include(file, context)
|
|
tag = Tags::IncludeTag.new('', file, [])
|
|
tag.render(context)
|
|
end
|
|
end
|
|
|
|
end
|
|
|
|
Liquid::Template.register_tag('include_sidebar', Jekyll::IncludeSidebarTag)
|