aboutsummaryrefslogtreecommitdiff
path: root/plugins/raw.rb
diff options
context:
space:
mode:
authorBrandon Mathis <brandon@imathis.com>2011-09-07 17:49:20 -0500
committerBrandon Mathis <brandon@imathis.com>2011-09-07 17:49:20 -0500
commit9d2c76e189bac81c1d46b1f93967ad1f493a9ac8 (patch)
tree574a6822211fa4deb7ceb5f91096994ecb9befcf /plugins/raw.rb
parent3d0572190873bec3336fb25d5bdcfab659dbf015 (diff)
downloadmy_new_personal_website-9d2c76e189bac81c1d46b1f93967ad1f493a9ac8.tar.xz
my_new_personal_website-9d2c76e189bac81c1d46b1f93967ad1f493a9ac8.zip
Added {% raw %} liquid block, allowing for blocks of code which are not parsed by Liquid
Diffstat (limited to 'plugins/raw.rb')
-rw-r--r--plugins/raw.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/plugins/raw.rb b/plugins/raw.rb
new file mode 100644
index 00000000..2deb5d10
--- /dev/null
+++ b/plugins/raw.rb
@@ -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)