diff options
author | Brandon Mathis <brandon@imathis.com> | 2011-08-01 16:24:06 -0400 |
---|---|---|
committer | Brandon Mathis <brandon@imathis.com> | 2011-08-01 16:28:30 -0400 |
commit | 08dc63a95e071401d4724ca8c9b9270eaf843012 (patch) | |
tree | 8ab5274498a28565a12998114b1f25a0a9efb0a3 /plugins/render_partial.rb | |
parent | 6009daa8a215903506509227380a4ea09b8b6f25 (diff) | |
download | my_new_personal_website-08dc63a95e071401d4724ca8c9b9270eaf843012.tar.xz my_new_personal_website-08dc63a95e071401d4724ca8c9b9270eaf843012.zip |
added a raw option to render_partial. Now you can import partials without having them parsed by the Liquid template parser
Diffstat (limited to 'plugins/render_partial.rb')
-rw-r--r-- | plugins/render_partial.rb | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/plugins/render_partial.rb b/plugins/render_partial.rb index 3cb74c21..9f665644 100644 --- a/plugins/render_partial.rb +++ b/plugins/render_partial.rb @@ -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,9 +50,13 @@ module Jekyll if contents =~ /\A-{3}.+[^\A]-{3}\n(.+)/m contents = $1.lstrip end - partial = Liquid::Template.parse(contents) - context.stack do - partial.render(context) + if @raw + contents + else + partial = Liquid::Template.parse(contents) + context.stack do + partial.render(context) + end end end end |