Skip to content

Commit

Permalink
Fixed Jekyll:IncludeTag to render sub-templates correctly.
Browse files Browse the repository at this point in the history
  • Loading branch information
metajack committed Dec 21, 2008
1 parent 02bd90c commit c72db0a
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions lib/jekyll/tags/include.rb
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
module Jekyll

# we are replacing Liquid's include tag because it is horribly, horribly
# broken.
class IncludeTag < Liquid::Tag
def initialize(tag_name, file, tokens)
def initialize(tag_name, markup, tokens)
super
@file = file.strip

@template = markup.strip
end

def render(context)
File.read(File.join(Jekyll.source, '_includes', @file))
file = File.join(Jekyll.source, '_includes', @template)
partial = Liquid::Template.parse(File.read(file))
partial.render(context, [Jekyll::Filters])
end
end

end

Liquid::Template.register_tag('include', Jekyll::IncludeTag)
Liquid::Template.register_tag('include', Jekyll::IncludeTag)

0 comments on commit c72db0a

Please sign in to comment.