Markdown/Textile escape system is more flexible and strips goofy parsing glitches much better. Fixes #500

This commit is contained in:
Brandon Mathis 2012-05-21 20:16:06 -05:00
parent adc4e1f2ef
commit ca470417e5

View File

@ -4,12 +4,12 @@
module TemplateWrapper
# Wrap input with a <div>
def safe_wrap(input)
"<div class='bogus-wrapper'><notextile>#{input}</notextile></div>"
"<!--escape--><div class='escape-wrapper'><notextile><!--content-->#{input}<!--end-content--></notextile></div><!--end-escape-->"
end
# This must be applied after the
def unwrap(input)
input.gsub /<div class='bogus-wrapper'><notextile>(.+?)<\/notextile><\/div>/m do
$1
input.gsub /<!--escape-->([\s\S]*?)<!--content-->(.+?)<!--end-content-->([\s\S]*?)<!--end-escape-->/m do
$2
end
end
end