Permalink
Browse files

Added {% raw %} liquid block, allowing for blocks of code which are n…

…ot parsed by Liquid
  • Loading branch information...
1 parent 3d05721 commit 9d2c76e189bac81c1d46b1f93967ad1f493a9ac8 @imathis imathis committed Sep 7, 2011
Showing with 24 additions and 0 deletions.
  1. +24 −0 plugins/raw.rb
View
@@ -0,0 +1,24 @@
+# Author: phaer, https://github.com/phaer
+# Source: https://gist.github.com/1020852
+# Description: Raw tag for jekyll. Keeps liquid from parsing text betweeen {% raw %} and {% endraw %}
+
+module Jekyll
+ class RawTag < Liquid::Block
+ def parse(tokens)
+ @nodelist ||= []
+ @nodelist.clear
+
+ while token = tokens.shift
+ if token =~ FullToken
+ if block_delimiter == $1
+ end_tag
+ return
+ end
+ end
+ @nodelist << token if not token.empty?
+ end
+ end
+ end
+end
+
+Liquid::Template.register_tag('raw', Jekyll::RawTag)

0 comments on commit 9d2c76e

Please sign in to comment.