module FulltextConcern
Public Instance Methods
fulltext_field_processing()
click to toggle source
Méthode d'instance
# File lib/generators/templates/app/models/concerns/fulltext_concern.rb, line 18 def fulltext_field_processing # You can preparse with own things here generate_fulltext_field end
generate_fulltext_field()
click to toggle source
# File lib/generators/templates/app/models/concerns/fulltext_concern.rb, line 23 def generate_fulltext_field fields = (self.class.fulltext_fields || []) fields.each{ |f| html, clear = htmlize(self[f], self[f + '_typetext']) self[f + '_fulltext'] = clear } end
htmlize(text, type)
click to toggle source
# File lib/generators/templates/app/models/concerns/fulltext_concern.rb, line 31 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