Browse code

added a raw option to render_partial. Now you can import partials without having them parsed by the Liquid template parser

Brandon Mathis authored on 01/08/2011 at 20:24:06
Showing 1 changed files
... ...
@@ -26,9 +26,14 @@ require 'pathname'
26 26
 module Jekyll
27 27
 
28 28
   class RenderPartialTag < Liquid::Tag
29
-    def initialize(tag_name, file, tokens)
29
+    def initialize(tag_name, markup, tokens)
30
+      @file = nil
31
+      @raw = false
32
+      if markup =~ /^(\S+)\s?(\w+)?/
33
+        @file = $1.strip
34
+        @raw = $2 == 'raw'
35
+      end
30 36
       super
31
-      @file = file.strip
32 37
     end
33 38
 
34 39
     def render(context)
... ...
@@ -45,9 +50,13 @@ module Jekyll
45 45
         if contents =~ /\A-{3}.+[^\A]-{3}\n(.+)/m
46 46
           contents = $1.lstrip
47 47
         end
48
-        partial = Liquid::Template.parse(contents)
49
-        context.stack do
50
-          partial.render(context)
48
+        if @raw
49
+          contents
50
+        else
51
+          partial = Liquid::Template.parse(contents)
52
+          context.stack do
53
+            partial.render(context)
54
+          end
51 55
         end
52 56
       end
53 57
     end