<commit_before>module Jekyll
  class SeoTag < Liquid::Tag

    attr_accessor :context

    def render(context)
      @context = context
      output = Liquid::Template.parse(template_contents).render!(payload, info)

      # Minify
      output.gsub!(/[\s]{2,}/, "\n")

      # Encode smart quotes. See https://github.com/benbalter/jekyll-seo-tag/pull/6
      output.gsub!("\u201c", "&ldquo;")
      output.gsub!("\u201d", "&rdquo;")

      output
    end

    private

    def payload
      {
        "page" => context.registers[:page],
        "site" => context.registers[:site].site_payload["site"]
      }
    end

    def info
      {
        :registers => context.registers,
        :filters   => [Jekyll::Filters]
      }<commit_msg>Combine two gsubs into one<commit_after>module Jekyll
  class SeoTag < Liquid::Tag

    attr_accessor :context

    HTML_ESCAPE = {
      "\u201c".freeze => '&ldquo;'.freeze,
      "\u201d".freeze => '&rdquo;'.freeze
    }
    HTML_ESCAPE_REGEX = Regexp.union(HTML_ESCAPE.keys).freeze

    def render(context)
      @context = context
      output = Liquid::Template.parse(template_contents).render!(payload, info)

      # Minify
      output.gsub!(/[\s]{2,}/, "\n")

      # Encode smart quotes. See https://github.com/benbalter/jekyll-seo-tag/pull/6
      output.gsub!(HTML_ESCAPE_REGEX, HTML_ESCAPE)

      output
    end

    private

    def payload
      {
        "page" => context.registers[:page],
        "site" => context.registers[:site].site_payload["site"]
      }
    end

    def info
      {
        :registers => context.registers,
        :filters   => [Jekyll::Filters]
      }
{'fraction_non_alphanumeric': 0.14590964590964592, 'fraction_numerical': 0.009768009768009768, 'mean_word_length': 2.3655030800821355, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 2, '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': '1266799', 'n_tokens_mistral': 587, 'n_tokens_neox': 550, 'n_words': 93}