Created
June 11, 2011 19:11
-
-
Save phaer/1020852 to your computer and use it in GitHub Desktop.
Raw tag for jekyll. Keeps liquid from parsing text betweeen {% raw %} and {% endraw %}
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This gist is a bit over 8 years old, which is quite some time in software development. Please take the discussion to liquid and see if it's still supported there. I've long stopped using liquid as well as jekyll myself.
Turned out Jekyll 3 has the raw tag built in, so this code isn't needed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I get the same error as @JonnoFTW after upgrading to Jekyll 3. My guess is the class name in Jekyll or Liquid changed.