<commit_before>module Jekyll

  class Test < Jekyll::Generator
    def generate(site)
      # Retrieve the latest version and put it in `site.data.kong_latest.version`
      latest = site.data["kong_versions"].last
      site.data["kong_latest"] = latest

      # Add a `version` property to every versioned page
      site.pages.each do |page|
        parts = Pathname(page.path).each_filename.to_a
        if site.config["documentation"] == parts[0]
          page.data["kong_version"] = parts[1]

          # Set alias for latest docs version to /docs
          if parts.last == "index.md" and latest["version"] == parts[1]
            page.data["alias"] = "/#{site.config["documentation"]}/"
          end
        end
      end
    end
  end

end
<commit_msg>versions plugin refactor<commit_after>module Jekyll

  class Versions < Jekyll::Generator
    def generate(site)
      # Retrieve the latest version and put it in `site.data.kong_latest.version`
      latest = site.data["kong_versions"].last
      site.data["kong_latest"] = latest

      # Add a `version` property to every versioned page
      site.pages.each do |page|
        parts = Pathname(page.path).each_filename.to_a
        if site.config["documentation"] == parts[0]
          page.data["kong_version"] = parts[1]
        end
      end
    end
  end

end

{'fraction_non_alphanumeric': 0.11127819548872181, 'fraction_numerical': 0.0037593984962406013, 'mean_word_length': 2.577956989247312, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '7367418', 'n_tokens_mistral': 408, 'n_tokens_neox': 399, 'n_words': 105}