Skip to content

Instantly share code, notes, and snippets.

@digitalpardoe
Created July 16, 2011 17:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save digitalpardoe/1086554 to your computer and use it in GitHub Desktop.
Save digitalpardoe/1086554 to your computer and use it in GitHub Desktop.
Textilize Alternative
def custom_text(text)
if text.blank?
""
else
text = RedCloth.new(text).to_html
if text[0..2] == "<p>" then text = text[3..-1] end
if text[-4..-1] == "</p>" then text = text[0..-5] end
text = text.gsub("<p>", "")
text = text.gsub("</p>", "")
return text
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment