<commit_before>require 'mustache'
require 'pathname'

class Rocco::Layout < Mustache
  self.template_path = "#{File.dirname(__FILE__)}/.."

  def initialize(doc, file=nil)
    @doc = doc
    if not file.nil?
      Rocco::Layout.template_file = file
    end
  end

  def title
    File.basename(@doc.file)
  end

  def sections
    num = 0
    @doc.sections.map do |docs,code|
      is_header = /^<h.>(.+)<\/h.>$/.match( docs )
      header_text = is_header && is_header[1].split.join("_")
      num += 1
      {
        :docs       =>  docs,
        :docs?      =>  !docs.empty?,
        :header?    =>  is_header,

        :code       =>  code,
        :code?      =>  !code.empty?,

        :empty?     =>  ( code.empty? && docs.empty? ),<commit_msg>Fixing a bug in layout.rb's template directory location<commit_after>require 'mustache'
require 'pathname'

class Rocco::Layout < Mustache
  self.template_path = "#{File.dirname(__FILE__)}/."

  def initialize(doc, file=nil)
    @doc = doc
    if not file.nil?
      Rocco::Layout.template_file = file
    end
  end

  def title
    File.basename(@doc.file)
  end

  def sections
    num = 0
    @doc.sections.map do |docs,code|
      is_header = /^<h.>(.+)<\/h.>$/.match( docs )
      header_text = is_header && is_header[1].split.join("_")
      num += 1
      {
        :docs       =>  docs,
        :docs?      =>  !docs.empty?,
        :header?    =>  is_header,

        :code       =>  code,
        :code?      =>  !code.empty?,

        :empty?     =>  ( code.empty? && docs.empty? ),
{'fraction_non_alphanumeric': 0.15987055016181229, 'fraction_numerical': 0.003883495145631068, 'mean_word_length': 2.01953125, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 19, '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': '6468791', 'n_tokens_mistral': 560, 'n_tokens_neox': 533, 'n_words': 113}