From f8f678430540680fa71a7d0f2226664e4d363ebd Mon Sep 17 00:00:00 2001 From: "maul.esel" Date: Sat, 22 Jun 2013 15:30:10 +0200 Subject: [PATCH] move parameter parsing to render time --- lib/jekyll/tags/include.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/jekyll/tags/include.rb b/lib/jekyll/tags/include.rb index 68636890..b98b6041 100644 --- a/lib/jekyll/tags/include.rb +++ b/lib/jekyll/tags/include.rb @@ -10,14 +10,14 @@ module Jekyll if markup.include?(' ') separator = markup.index(' ') @file = markup[0..separator].strip - parse_params(markup[separator..-1]) + @params = markup[separator..-1] else @file = markup end end def parse_params(markup) - @params = {} + params = {} pos = 0 # ensure the entire markup string from start to end is valid syntax, and params are separated by spaces @@ -44,8 +44,9 @@ eos value = match[3].gsub(/\\'/, "'") end - @params[match[1]] = value + params[match[1]] = value end + params end def render(context) @@ -64,8 +65,9 @@ eos if choices.include?(@file) source = File.read(@file) partial = Liquid::Template.parse(source) - context['include'] = @params + context.stack do + context['include'] = parse_params(@params) if @params partial.render(context) end else