mirror of
https://github.com/moparisthebest/android.moparisthebest.org
synced 2024-11-16 06:05:00 -05:00
25 lines
555 B
Ruby
25 lines
555 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 = IncludeTag.new('', file, [])
|
||
|
tag.render(context)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
end
|
||
|
|
||
|
Liquid::Template.register_tag('include_sidebar', Jekyll::IncludeSidebarTag)
|