Module: HasMarkup::Textile

Defined in:
lib/has_markup/textile.rb

Overview

Provides HasMarkup with textile support

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Instance Method Summary collapse

Instance Method Details

#sprinkle_textile_magic(column) ⇒ Object

Sprinkles the magic needed to support textile. In particular, it will define a method column_html which uses RedCloth to generate HTML.



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/has_markup/textile.rb', line 6

def sprinkle_textile_magic(column)
  require 'redcloth'

  extend HasMarkup::Textile::ClassMethods
  include HasMarkup::Textile::InstanceMethods

  validates_textile_syntax column
  define_method "#{column}_html" do
    markdown = self.send(column)
    self.generate_html_from_markdown(markdown)
  end
end