<commit_before>require "jekyll_archive/version"

# Jekyll plugin for generating archive pages for tags and categories
# No config. Assumes: layout archives_page.html exists. Creates tag and category dirs.
# Creates subdirs of category or tag name
# returns page object with: title, header, posts

module Jekyll

  class TaxonomyPage < Page
    def initialize(site, base, dir, obj, type)
      @site = site
      @base = base
      @dir = dir
      @name = 'index.html'

      page_data = case type
              when 'tag'
                {
                  :posts => site.tags[obj],
                  :page_title_prefix => site.config["tag_title_prefix"] || 'Tag: '
                }
              when 'category'
                {
                  :posts => site.categories[obj],
                  :page_title_prefix => site.config["category_title_prefix"] || 'Category: '
                }
              end

      layout_file = site.config["archive_layout"].nil? ? 'archive_page.html' : site.config["archive_layout"] + '.html'

      self.process(@name)
      self.read_yaml(File.join(base, '_layouts'), layout_file)

      self.data['posts'] = page_data[:posts]
      prefix = page_data[:page_title_prefix]
      self.data['header'] = "#{prefix}#{obj}"

      self.data['title'] = "#{self.data['header']}: "
    end
  end

  class TaxonomyPageGenerator < Generator
    safe true

    def generate(site)
      if site.layouts.key? site.config["archive_layout"] || 'archive_page'
        dir = site.config["category_dir_name"] || 'category'
        site.categories.keys.each do |category|
          site.pages << TaxonomyPage.new(site, site.source, File.join(dir, category), category, 'category')
        end

        dir = 'tag'
        site.tags.keys.each do |tag|
          site.pages << TaxonomyPage.new(site, site.source, File.join(dir, tag), tag, 'tag')
        end
      end
    end
  end

end<commit_msg>Rename Classes with Archive wording<commit_after>require "jekyll_archive/version"

# Jekyll plugin for generating archive pages for tags and categories
# No config. Assumes: layout archives_page.html exists. Creates tag and category dirs.
# Creates subdirs of category or tag name
# returns page object with: title, header, posts

module Jekyll

  class ArchivePage < Page
    def initialize(site, base, dir, obj, type)
      @site = site
      @base = base
      @dir = dir
      @name = 'index.html'

      page_data = case type
              when 'tag'
                {
                  :posts => site.tags[obj],
                  :page_title_prefix => site.config["tag_title_prefix"] || 'Tag: '
                }
              when 'category'
                {
                  :posts => site.categories[obj],
                  :page_title_prefix => site.config["category_title_prefix"] || 'Category: '
                }
              end

      layout_file = site.config["archive_layout"].nil? ? 'archive_page.html' : site.config["archive_layout"] + '.html'

      self.process(@name)
      self.read_yaml(File.join(base, '_layouts'), layout_file)

      self.data['posts'] = page_data[:posts]
      prefix = page_data[:page_title_prefix]
      self.data['header'] = "#{prefix}#{obj}"

      self.data['title'] = "#{self.data['header']}: "
    end
  end

  class ArchivePageGenerator < Generator
    safe true

    def generate(site)
      if site.layouts.key? site.config["archive_layout"] || 'archive_page'
        dir = site.config["category_dir_name"] || 'category'
        site.categories.keys.each do |category|
          site.pages << ArchivePage.new(site, site.source, File.join(dir, category), category, 'category')
        end

        dir = 'tag'
        site.tags.keys.each do |tag|
          site.pages << ArchivePage.new(site, site.source, File.join(dir, tag), tag, 'tag')
        end
      end
    end
  end

end
{'fraction_non_alphanumeric': 0.12305295950155763, 'fraction_numerical': 0.0, 'mean_word_length': 2.2959794696321643, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 11, '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': '2319378', 'n_tokens_mistral': 1151, 'n_tokens_neox': 1109, 'n_words': 273}