require 'active_support/core_ext/object/inclusion'
module RailsGuides
module TextileExtensions
def notestuff(body)
body.gsub!(/^(IMPORTANT|CAUTION|WARNING|NOTE|INFO)[.:](.*)$/) do |m|
css_class = $1.downcase
css_class = 'warning' if css_class.either?('caution', 'important')
result = "
"
result << $2.strip
result << '
'
result
end
end
def tip(body)
body.gsub!(/^TIP[.:](.*)$/) do |m|
result = ""
result << $1.strip
result << '
'
result
end
end
def plusplus(body)
body.gsub!(/\+(.*?)\+/) do |m|
"#{$1}"
end
# The real plus sign
body.gsub!('', '+')
end
def code(body)
body.gsub!(%r{<(yaml|shell|ruby|erb|html|sql|plain)>(.*?)\1>}m) do |m|
es = ERB::Util.h($2)
css_class = $1.either?('erb', 'shell') ? 'html' : $1
%{#{es}
}
end
end
end
end