Class: HoboFields::Types::TextileString

Inherits:
Text
  • Object
show all
Includes:
SanitizeHtml
Defined in:
lib/hobo_fields/types/textile_string.rb

Constant Summary

Constants included from SanitizeHtml

SanitizeHtml::PERMITTED_ATTRIBUTES, SanitizeHtml::PERMITTED_TAGS

Constants inherited from Text

HoboFields::Types::Text::COLUMN_TYPE

Instance Method Summary collapse

Methods included from SanitizeHtml

sanitize

Instance Method Details

#to_html(xmldoctype = true) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/hobo_fields/types/textile_string.rb', line 7

def to_html(xmldoctype = true)
  require 'redcloth'

  if blank?
    ""
  else
    textilized = RedCloth.new(self, [ :hard_breaks ])
    textilized.hard_breaks = true if textilized.respond_to?("hard_breaks=")
    HoboFields::SanitizeHtml.sanitize(textilized.to_html)
  end
end