<commit_before># Copyright (C) 2009 <NAME>.


class Blog::RssHandler

  def self.feed_rss_handler_info
    {
    :name => "Blog RSS Feed"
    }
  end

  def initialize(options)
    @options = options
    @feed_id = @options.feed_identifier
    @feed_site_node,@feed_blog_id,@detail_page_id = @feed_id.split(",")
  end

  def set_path(path)
    @path = path
    if @path && @options.subfeed_options.present?
      @list_by = @options.subfeed_options
      @list_type = @path[0].to_s.downcase
    end

  end
  
  def get_feed
    @node = SiteNode.find_by_id(@feed_site_node)
    @blog = Blog::BlogBlog.find_by_id(@feed_blog_id)
    @detail_page = SiteNode.find_by_id(@detail_page_id)
    
    limit = @options.limit > 0 ? @options.limit : 10
    
    if @node && @blog
      data = { :title => @blog.name,
               :description => @blog.name,
               :link => Configuration.domain_link(@node.node_path),
               :items => []}

      if @list_by.to_s == 'category'
        pages,posts = @blog.paginate_posts_by_category(1,@list_type,limit)
      elsif @list_by.to_s == 'tag'
        pages,posts = @blog.paginate_posts_by_tag(1,@list_type,limit)
      else
        pages,posts = @blog.paginate_posts(1,limit)
      end

      posts.each do |post|
        item = { :title => post.title,
                 :guid => post.id,
                 :published_at => post.published_at.to_s(:rfc822),
                 :description => Util::HtmlReplacer.replace_relative_urls(@options.full ? post.body_content : post.preview)
                }
        item[:creator] = post.author unless post.author.blank?
        post.blog_categories.each do |cat|
          item[:categories] ||= []
          item[:categories] << cat.name
        end
        if @detail_page
          item[:link] = Configuration.domain_link(@detail_page.node_path + "/" +  post.permalink)
          item[:guid] = item[:link]
        end
        
        if post.media_file
          item[:enclosure] = post.media_file
        end

        if post.domain_file
          item[:thumbnail] = post.domain_file
        end

        data[:items] << item
      end
      
      data
    else
      nil
    end<commit_msg>Fix to preview content<commit_after># Copyright (C) 2009 <NAME>.


class Blog::RssHandler

  def self.feed_rss_handler_info
    {
    :name => "Blog RSS Feed"
    }
  end

  def initialize(options)
    @options = options
    @feed_id = @options.feed_identifier
    @feed_site_node,@feed_blog_id,@detail_page_id = @feed_id.split(",")
  end

  def set_path(path)
    @path = path
    if @path && @options.subfeed_options.present?
      @list_by = @options.subfeed_options
      @list_type = @path[0].to_s.downcase
    end

  end
  
  def get_feed
    @node = SiteNode.find_by_id(@feed_site_node)
    @blog = Blog::BlogBlog.find_by_id(@feed_blog_id)
    @detail_page = SiteNode.find_by_id(@detail_page_id)
    
    limit = @options.limit > 0 ? @options.limit : 10
    
    if @node && @blog
      data = { :title => @blog.name,
               :description => @blog.name,
               :link => Configuration.domain_link(@node.node_path),
               :items => []}

      if @list_by.to_s == 'category'
        pages,posts = @blog.paginate_posts_by_category(1,@list_type,limit)
      elsif @list_by.to_s == 'tag'
        pages,posts = @blog.paginate_posts_by_tag(1,@list_type,limit)
      else
        pages,posts = @blog.paginate_posts(1,limit)
      end

      posts.each do |post|
        item = { :title => post.title,
                 :guid => post.id,
                 :published_at => post.published_at.to_s(:rfc822),
                 :description => Util::HtmlReplacer.replace_relative_urls(@options.full ? post.body_content : post.preview_content)
                }
        item[:creator] = post.author unless post.author.blank?
        post.blog_categories.each do |cat|
          item[:categories] ||= []
          item[:categories] << cat.name
        end
        if @detail_page
          item[:link] = Configuration.domain_link(@detail_page.node_path + "/" +  post.permalink)
          item[:guid] = item[:link]
        end
        
        if post.media_file
          item[:enclosure] = post.media_file
        end

        if post.domain_file
          item[:thumbnail] = post.domain_file
        end

        data[:items] << item
      end
      
      data
    else
      nil
    end
{'fraction_non_alphanumeric': 0.12081148848871666, 'fraction_numerical': 0.0063824937314793705, 'mean_word_length': 2.1797101449275362, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 25, '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': '1556939', 'n_tokens_mistral': 1470, 'n_tokens_neox': 1427, 'n_words': 250}