Skip to content

Instantly share code, notes, and snippets.

@marcroberts
Created August 28, 2009 15:35
Show Gist options
  • Select an option

  • Save marcroberts/177044 to your computer and use it in GitHub Desktop.

Select an option

Save marcroberts/177044 to your computer and use it in GitHub Desktop.
Add soft hyphens every 6 characters to words longer than 7 characters
module ActionView
module Helpers
module TextHelper
def simple_format_with_hyphenation(text, html_options={})
simple_format_without_hyphenation(text.gsub(/(\w{6})(\w)/,'\1­\2'), html_options)
end
alias_method_chain :simple_format, :hyphenation
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment