|
|
|
@ -26,9 +26,14 @@ require 'pathname'
|
|
|
|
|
module Jekyll
|
|
|
|
|
|
|
|
|
|
class RenderPartialTag < Liquid::Tag
|
|
|
|
|
def initialize(tag_name, file, tokens)
|
|
|
|
|
def initialize(tag_name, markup, tokens)
|
|
|
|
|
@file = nil
|
|
|
|
|
@raw = false
|
|
|
|
|
if markup =~ /^(\S+)\s?(\w+)?/
|
|
|
|
|
@file = $1.strip
|
|
|
|
|
@raw = $2 == 'raw'
|
|
|
|
|
end
|
|
|
|
|
super
|
|
|
|
|
@file = file.strip
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def render(context)
|
|
|
|
@ -45,6 +50,9 @@ module Jekyll
|
|
|
|
|
if contents =~ /\A-{3}.+[^\A]-{3}\n(.+)/m
|
|
|
|
|
contents = $1.lstrip
|
|
|
|
|
end
|
|
|
|
|
if @raw
|
|
|
|
|
contents
|
|
|
|
|
else
|
|
|
|
|
partial = Liquid::Template.parse(contents)
|
|
|
|
|
context.stack do
|
|
|
|
|
partial.render(context)
|
|
|
|
@ -53,5 +61,6 @@ module Jekyll
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
Liquid::Template.register_tag('render_partial', Jekyll::RenderPartialTag)
|
|
|
|
|