Sha256: 7ec23bb5168210563ad22abc0fdf23a66db92a2f2680c8116584a84f4e4b19a8
Contents?: true
Size: 691 Bytes
Versions: 1
Compression:
Stored size: 691 Bytes
Contents
require 'redcloth' module HoboFields class TextileString < HoboFields::Text def to_html if blank? "" else textilized = RedCloth.new(self, [ :hard_breaks ]) textilized.hard_breaks = true if textilized.respond_to?("hard_breaks=") textilized.to_html end end HoboFields.register_type(:textile, self) end end class RedCloth # Patch for RedCloth. Fixed in RedCloth r128 but _why hasn't released it yet. # http://code.whytheluckystiff.net/redcloth/changeset/128 def hard_break( text ) text.gsub!( /(.)\n(?!\n|\Z| *([#*=]+(\s|$)|[{|]))/, "\\1<br />" ) if hard_breaks && RedCloth::VERSION == "3.0.4" end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hobofields-0.7.5 | lib/hobo_fields/textile_string.rb |