From 9d2c76e189bac81c1d46b1f93967ad1f493a9ac8 Mon Sep 17 00:00:00 2001 From: Brandon Mathis Date: Wed, 7 Sep 2011 17:49:20 -0500 Subject: Added {% raw %} liquid block, allowing for blocks of code which are not parsed by Liquid --- plugins/raw.rb | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 plugins/raw.rb (limited to 'plugins/raw.rb') 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) -- cgit v1.2.1