<commit_before>module HelpControllerMixin
  def index
    @categories = HelpCategory.active
  end
  
  def by_category
    @category = HelpCategory.find_by_permalink!(params[:permalink], :conditions => {:active => true})
    @topics   = @category.topics.active
  end
  
  def show
    @topic = HelpTopic.find_by_permalink!(params[:permalink], :conditions => {:active => true}, :include => :category)
    
    data = {
      :topic    => {:name => @topic.title, :content => @topic.formatted_content, :permalink => @topic.permalink},
      :category => {:name => @topic.category.title, :permalink => @topic.category.permalink}
    }
    
    respond_to do |wants|
      wants.html { 
        if request.xhr?
          render :html => content_tag(:h3, @topic.name) + @topic.formatted_content
        else
          redirect_to help_category_path(@topic.category, :anchor => @topic.permalink), :status => :moved_permanently
        end
      }
      wants.json { render :text => data.to_json }
      wants.xml  { render :xml  => data.to_xml }
    end
  end
end<commit_msg>Adding div container when rendering through AJAX. Fixing typo<commit_after>module HelpControllerMixin
  def index
    @categories = HelpCategory.active
  end
  
  def by_category
    @category = HelpCategory.find_by_permalink!(params[:permalink], :conditions => {:active => true})
    @topics   = @category.topics.active
  end
  
  def show
    @topic = HelpTopic.find_by_permalink!(params[:permalink], :conditions => {:active => true}, :include => :category)
    
    data = {
      :topic    => {:name => @topic.title, :content => @topic.formatted_content, :permalink => @topic.permalink},
      :category => {:name => @topic.category.title, :permalink => @topic.category.permalink}
    }
    
    respond_to do |wants|
      wants.html { 
        if request.xhr?
          render :html => content_tag(:h3, @topic.title) + 
                          content_tag(:div, @topic.formatted_content, :class => "content")
        else
          redirect_to help_category_path(@topic.category, :anchor => @topic.permalink), :status => :moved_permanently
        end
      }
      wants.json { render :text => data.to_json }
      wants.xml  { render :xml  => data.to_xml }
    end
  end
end
{'fraction_non_alphanumeric': 0.1327708703374778, 'fraction_numerical': 0.0008880994671403197, 'mean_word_length': 2.8911917098445596, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 38, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, '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': '6787429', 'n_tokens_mistral': 722, 'n_tokens_neox': 714, 'n_words': 148}