<commit_before># Jekyll post excerpt and related filters, extracted from Octopress
#
# Originally written by <NAME>
# https://github.com/imathis/octopress/blob/master/plugins/octopress_filters.rb

module Jekyll
  module ExcerptFilter
    def excerpt(input)
      if input.index(/<!--\s*more\s*-->/i)
        input.split(/<!--\s*more\s*-->/i)[0]
      elsif input.index(/<\/p>/i)
        input.split(/<\/p>/i)[0]
      elsif input.index("\n\n")
        input.split("\n\n")[0]
      else
        input
      end
    end

    def has_excerpt(input)
      input =~ /<!--\s*more\s*-->/i ? true : false
    end

    def raw_content(input)
      /<section class="post_content">(?<content>[\s\S]*?)<\/section>\s*<(footer|\/article)>/ =~ input
      return (content.nil?) ? input : content
    end

    def truncate(input, length)
      if input.length > length && input[0..(length-1)] =~ /(.+)\b.+$/im
        $1.strip + '&hellip;'
      else
        input
      end
    end

    def condense_spaces(input)
      input.gsub(/\s{2,}/, ' ').strip
    end
  end
end

Liquid::Template.register_filter(Jekyll::ExcerptFilter)<commit_msg>Further excerpt improvements<commit_after># Jekyll post excerpt and related filters, extracted from Octopress
#
# Originally written by <NAME>
# https://github.com/imathis/octopress/blob/master/plugins/octopress_filters.rb

module Jekyll
  module ExcerptFilter
    def excerpt(input)
      if input.index(/<!--\s*more\s*-->/i)
        input.split(/<!--\s*more\s*-->/i)[0]
      elsif input.index(/<\/p>/i)
        input.split(/<\/p>/i)[0]
      elsif input.index("\n\n")
        input.split("\n\n")[0]
      else
        input
      end
    end

    def has_excerpt(input)
      input && (input.match(/<!--\s*more\s*-->/i) or input.match(/<\/p>/i) or input.match("\n\n"))
    end

    def raw_content(input)
      /<section class="post_content">(?<content>[\s\S]*?)<\/section>\s*<(footer|\/article)>/ =~ input
      return (content.nil?) ? input : content
    end

    def truncate(input, length)
      if input.length > length && input[0..(length-1)] =~ /(.+)\b.+$/im
        $1.strip + '&hellip;'
      else
        input
      end
    end

    def condense_spaces(input)
      input.gsub(/\s{2,}/, ' ').strip
    end
  end
end

Liquid::Template.register_filter(Jekyll::ExcerptFilter)
{'fraction_non_alphanumeric': 0.18839324382849718, 'fraction_numerical': 0.006063230835859679, 'mean_word_length': 2.3970588235294117, 'pattern_counts': {'":': 0, '<': 24, '<?xml version=': 0, '>': 26, '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': '2927495', 'n_tokens_mistral': 861, 'n_tokens_neox': 823, 'n_words': 149}