forked from jekyll/jekyll
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed Jekyll:IncludeTag to render sub-templates correctly.
- Loading branch information
Showing
1 changed file
with
10 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |