Skip to content

Instantly share code, notes, and snippets.

@nbrew
Created March 8, 2011 22:35
Show Gist options
  • Save nbrew/861253 to your computer and use it in GitHub Desktop.
Save nbrew/861253 to your computer and use it in GitHub Desktop.
RedCloth initializer for rails app to enable no_span_caps by default
require 'redcloth/textile_doc'
module RedCloth
class TextileDoc
def initialize( string, restrictions = [:no_span_caps] )
restrictions.each { |r| method("#{r}=").call( true ) }
super( string )
end
end
end
require 'action_view/helpers/text_helper'
module ActionView
module Helpers
module TextHelper
def textilize(text, *options)
options = [:hard_breaks, :no_span_caps] if options.nil? or options.size == 0
if text.blank?
""
else
textilized = RedCloth.new(text, options)
textilized.to_html
end
end
end
end
end
@danielavdh
Copy link

Thanks!
Daniela

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment