<commit_before>module HasMarkup
  def self.included(base)
    base.extend ClassMethods
  end

  THEME = 'mac_classic'
  LANGUAGE = 'ruby_on_rails'
  NUMBERS = true
  
  module ClassMethods
    def has_markup(*attr_names)
      attr_names.each do |attr_name|
        before_save "self.#{attr_name}_html = self.class.markup(#{attr_name}, #{attr_name}_markup)"
        validates_inclusion_of "#{attr_name}_markup", :in => %w(HTML Markdown Plain\ text Textile), :unless => "#{attr_name}.blank?"
      end
    end
    
    def markup(markup, markup_type)
      case markup_type
      when 'HTML'
        colourize(markup)<commit_msg>add method to access plain-text version (for full text indexing)... remove all entities and then use Hpricot to strip tags<commit_after>module HasMarkup
  def self.included(base)
    base.extend ClassMethods
  end
  
  THEME = 'mac_classic'
  LANGUAGE = 'ruby_on_rails'
  NUMBERS = true
  
  module ClassMethods
    def has_markup(*attr_names)
      attr_names.each do |attr_name|
        before_save "self.#{attr_name}_html = self.class.markup(#{attr_name}, #{attr_name}_markup)"
        validates_inclusion_of "#{attr_name}_markup", :in => %w(HTML Markdown Plain\ text Textile), :unless => "#{attr_name}.blank?"
        class_eval "def #{attr_name}_text; @#{attr_name}_plain_text ||= Hpricot(#{attr_name}_html.gsub(/&[a-z]+?;/,'')).to_plain_text; end", __FILE__, __LINE__
      end
    end
    
    def markup(markup, markup_type)
      case markup_type
      when 'HTML'
        colourize(markup)
{'fraction_non_alphanumeric': 0.11853307138179436, 'fraction_numerical': 0.0, 'mean_word_length': 3.602409638554217, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3695056', 'n_tokens_mistral': 544, 'n_tokens_neox': 521, 'n_words': 114}