<commit_before>def init
  @breadcrumb = []

  if @file
    @contents = IO.read(@file)
    @file = File.basename(@file)
    @fname = @file.gsub(/\..+$/, '')
    @breadcrumb_title = "File: " + @fname
    sections :header, [:diskfile]
  elsif object
    case object
    when 'glossary.html'
      sections :header, [:glossary]
    when CodeObjects::Base
      if object != Registry.root
        cur = object.namespace
        while cur != Registry.root
          @breadcrumb.unshift(cur)
          cur = cur.namespace
        end
      end
    
      @page_title = format_object_title(object)
      type = object == Registry.root ? :module : object.type
      sections :header, [T("../#{type}")]
    end
  else
    sections :header, [:contents]
  end
end

def contents
  @contents
end

def glossary
  @objects_by_letter = {}
  @page_title = options[:title] || "Project Documentation (yard #{YARD::VERSION})"
  objects = @objects.reject {|o| o == Registry.root }.sort_by {|o| o.name.to_s }
  objects.each {|o| (@objects_by_letter[o.name[0].upcase] ||= []) << o }
  erb(:glossary)
end

def diskfile
  "<div id='filecontents'>" +
  case (File.extname(@file)[1..-1] || '').downcase
  when 'textile', 'txtile'
    htmlify(@contents, :textile)
  when 'markdown', 'md', 'mdown'
    htmlify(@contents, :markdown)
  when 'rdoc'
    htmlify(@contents, :rdoc)
  else
    "<pre>#{@contents}</pre>"
  end +<commit_msg>Use rdoc if no extension is specified<commit_after>def init
  @breadcrumb = []

  if @file
    @contents = IO.read(@file)
    @file = File.basename(@file)
    @fname = @file.gsub(/\..+$/, '')
    @breadcrumb_title = "File: " + @fname
    sections :header, [:diskfile]
  elsif object
    case object
    when 'glossary.html'
      sections :header, [:glossary]
    when CodeObjects::Base
      if object != Registry.root
        cur = object.namespace
        while cur != Registry.root
          @breadcrumb.unshift(cur)
          cur = cur.namespace
        end
      end
    
      @page_title = format_object_title(object)
      type = object == Registry.root ? :module : object.type
      sections :header, [T("../#{type}")]
    end
  else
    sections :header, [:contents]
  end
end

def contents
  @contents
end

def glossary
  @objects_by_letter = {}
  @page_title = options[:title] || "Project Documentation (yard #{YARD::VERSION})"
  objects = @objects.reject {|o| o == Registry.root }.sort_by {|o| o.name.to_s }
  objects.each {|o| (@objects_by_letter[o.name[0].upcase] ||= []) << o }
  erb(:glossary)
end

def diskfile
  "<div id='filecontents'>" +
  case (File.extname(@file)[1..-1] || '').downcase
  when 'txt'
    "<pre>#{@contents}</pre>"
  when 'textile', 'txtile'
    htmlify(@contents, :textile)
  when 'markdown', 'md', 'mdown'
    htmlify(@contents, :markdown)
  else
    htmlify(@contents, :rdoc)
  end +
{'fraction_non_alphanumeric': 0.16342412451361868, 'fraction_numerical': 0.0021223912274495934, 'mean_word_length': 2.9442119944211993, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 9, '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': '227031', 'n_tokens_mistral': 1005, 'n_tokens_neox': 994, 'n_words': 226}