diff options
Diffstat (limited to '')
-rw-r--r-- | plugins/raw.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/plugins/raw.rb b/plugins/raw.rb index 2deb5d10..4b002625 100644 --- a/plugins/raw.rb +++ b/plugins/raw.rb @@ -1,3 +1,19 @@ +# Author: Brandon Mathis +# Description: Provides plugins with a method for wrapping and unwrapping input to prevent Markdown and Textile from parsing it. +# Purpose: This is useful for preventing Markdown and Textile from being too aggressive and incorrectly parsing in-line HTML. +module TemplateWrapper + # Wrap input with a <div> + def safe_wrap(input) + "<div class='bogus-wrapper'><notextile>#{input}</notextile></div>" + end + # This must be applied after the + def unwrap(input) + input.gsub /<div class='bogus-wrapper'><notextile>(.+?)<\/notextile><\/div>/m do + $1 + end + end +end + # 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 %} |