Sha256: 232c7edad955c367f59900a0f7460fba5d8c795ee86326c8d53e9fbc5efc68ac

Contents?: true

Size: 701 Bytes

Versions: 31

Compression:

Stored size: 701 Bytes

Contents

module BeautifulScaffoldModule
  def generate_fulltext_field(fields)
    fields.each{ |f|
      html, clear = htmlize(self[f], self[f + '_typetext'])
      self[f + '_fulltext'] = clear
    }
  end
  
  def htmlize(text, type)
    case type
      when 'bbcode' then
        require 'bb-ruby'
        html = text.bbcode_to_html
      when 'html' then
        html = text
      when 'textile' then
        html = RedCloth.new(text).to_html
      when 'markdown' then
        require 'rdiscount'
        html = RDiscount.new(text).to_html
      when 'wiki' then
        html = WikiCloth::Parser.new({:data => text}).to_html
      else
        html
    end
    return html, Sanitize.clean(html)
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
beautiful_scaffold-0.3.4 lib/generators/templates/modules/beautiful_scaffold_module.rb
beautiful_scaffold-0.3.3 lib/generators/templates/modules/beautiful_scaffold_module.rb
beautiful_scaffold-0.3.2 lib/generators/templates/modules/beautiful_scaffold_module.rb
beautiful_scaffold-0.3.1 lib/generators/templates/modules/beautiful_scaffold_module.rb
beautiful_scaffold-0.3.0.rc6 lib/generators/templates/modules/beautiful_scaffold_module.rb
beautiful_scaffold-0.3.0.rc5 lib/generators/templates/modules/beautiful_scaffold_module.rb
beautiful_scaffold-0.3.0.rc4 lib/generators/templates/modules/beautiful_scaffold_module.rb
beautiful_scaffold-0.3.0.rc3 lib/generators/templates/modules/beautiful_scaffold_module.rb
beautiful_scaffold-0.3.0.rc2 lib/generators/templates/modules/beautiful_scaffold_module.rb
beautiful_scaffold-0.3.0.rc1 lib/generators/templates/modules/beautiful_scaffold_module.rb
beautiful_scaffold-0.3.0.pre lib/generators/templates/modules/beautiful_scaffold_module.rb
beautiful_scaffold-0.2.7 lib/generators/templates/modules/beautiful_scaffold_module.rb
beautiful_scaffold-0.2.6 lib/generators/templates/modules/beautiful_scaffold_module.rb
beautiful_scaffold-0.2.5 lib/generators/templates/modules/beautiful_scaffold_module.rb
beautiful_scaffold-0.2.4 lib/generators/templates/modules/beautiful_scaffold_module.rb
beautiful_scaffold-0.2.3 lib/generators/templates/modules/beautiful_scaffold_module.rb
beautiful_scaffold-0.2.2 lib/generators/templates/modules/beautiful_scaffold_module.rb
beautiful_scaffold-0.2.1 lib/generators/templates/modules/beautiful_scaffold_module.rb
beautiful_scaffold-0.2.0 lib/generators/templates/modules/beautiful_scaffold_module.rb
beautiful_scaffold-0.1.9 lib/generators/templates/modules/beautiful_scaffold_module.rb