gist: 16132 Download_button fork
public
Public Clone URL: git://gist.github.com/16132.git
strip_textile.rb
1
2
3
4
5
6
# Basic regex + Ruby method to strip textile formatting.
# Handles all test cases at http://hobix.com/textile/ down to "Phrase Attributes."
 
  def strip_textile(text)
    text.gsub(/\b[_+^*~@%\-]{1,2}|[_+^*~@%\-]{1,2}\b|\b\?\?|\?\?\b|h\d\.\s|bq.\s|fn\d\.\s|\D\{.*\}\.\s?|\{.*\}\.\s?|\%\{.*\}|\D\(.*\)\.\s?|\{%.*\%\}\s|<.*?>/, "")
  end

Owner

cscotta

Revisions