<commit_before>require 'kramdown'

module UsesThis
  class Interview < Salt::Post

    def self.path
      "interviews"
    end

    def initialize(path)
      super

      @layout = 'interview'
      @wares = {}
    end

    def scan_links
      site = UsesThis::Site.instance

      @contents.scan(/\[([^\[\(\)]+)\]\[([a-z0-9\.\-]+)?\]/).each do |link|
        slug = (link[1] ? link[1] : link[0].downcase)
        @wares[slug] = site.wares[slug] if site.wares[slug] && @wares[slug].nil?
      end
    end

    def contents
      output = @contents

      if @wares.length > 0
        output += "\n\n"

        @wares.each_value do |ware|
          output += "[#{ware.slug}]: #{ware.url} \"#{ware.description}\"\n"
        end
      end

      Kramdown::Document.new(output, auto_ids: false).to_html
    end
  end
end<commit_msg>Don't try to generate the Markdown contents every single time. This speeds the shit out of things.<commit_after>require 'kramdown'

module UsesThis
  class Interview < Salt::Post

    def self.path
      "interviews"
    end

    def initialize(path)
      super

      @layout = 'interview'
      @wares = {}
      @markdown_contents = nil
    end

    def scan_links
      site = UsesThis::Site.instance

      @contents.scan(/\[([^\[\(\)]+)\]\[([a-z0-9\.\-]+)?\]/).each do |link|
        slug = (link[1] ? link[1] : link[0].downcase)
        @wares[slug] = site.wares[slug] if site.wares[slug] && @wares[slug].nil?
      end
    end

    def contents
      if @markdown_contents.nil?
        output = @contents

        if @wares.length > 0
          output += "\n\n"

          @wares.each_value do |ware|
            output += "[#{ware.slug}]: #{ware.url} \"#{ware.description}\"\n"
          end
        end

        @markdown_contents = Kramdown::Document.new(output, auto_ids: false).to_html
      end

      @markdown_contents
    end
  end
end
{'fraction_non_alphanumeric': 0.15658174097664543, 'fraction_numerical': 0.006369426751592357, 'mean_word_length': 2.0901639344262297, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': 1, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7287884', 'n_tokens_mistral': 662, 'n_tokens_neox': 643, 'n_words': 142}