2011-09-07 19:32:57 -04:00
|
|
|
# Author: Brandon Mathis
|
2013-01-03 12:36:51 -05:00
|
|
|
# Description: Provides plugins with a method for wrapping and unwrapping input to prevent Textile from parsing it.
|
|
|
|
# Purpose: This is useful for preventing Textile from being too aggressive and incorrectly parsing in-line HTML.
|
2011-09-07 19:32:57 -04:00
|
|
|
module TemplateWrapper
|
2013-01-03 12:36:51 -05:00
|
|
|
# Escape content for Textile with <notextile>
|
2011-09-07 19:32:57 -04:00
|
|
|
def safe_wrap(input)
|
2013-01-03 12:36:51 -05:00
|
|
|
"<notextile>#{input}</notextile>"
|
2011-09-07 19:32:57 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2011-09-07 18:49:20 -04:00
|
|
|
# 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)
|