<commit_before>require 'open-uri'

module Jekyll
	# Add accessor for directory
	class Page
		attr_reader :dir
	end
	
	class BreadCrumbs < Liquid::Tag
    def render(context)
      site = context.registers[:site]
      @page_url = context.environments.first["page"]["url"]
      @dirs = {}

      site.pages.each do |page|
        path = page.url
        path = path.index('/')==0 ? path[1..-1] : path
        @dirs[path] = page.data
      end
      
      output='<ul class="breadcrumb">'
      
      output+='<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><a href="/index.html" itemprop="url"><span itemprop="title">Documentation</span></a><span class="divider">/</span></li>'
      
      levels = @page_url.split('/') #break up url into different levels
      levels.each_with_index do |level, index|
        unless level.empty?
          if index == levels.size-1 || 
             (level == levels[levels.size-2] && levels[levels.size-1].to_i > 0)
            path = @page_url[1..-1]
            if  @dirs[path]["navigation"]["show"] == true
              path = @dirs[path]["title"] || path
              output += "<li itemscope itemtype=\"http://data-vocabulary.org/Breadcrumb\"><span itemprop=\"title\">#{path}</span><meta itemprop=\"url\" content=\"#{@page_url}\" /></li>" unless level.to_i > 0
            end
          else
              link = "/"
              i = 1
              while i <= index
                link += "#{URI::encode levels[i]}/"
                i+=1
              end
              
              if !link.index('.')
                
                path = Pathname.new(site.source + link + 'index.html')
                if path.exist?
                  link = link + 'index.html'
                else
                  link = ""
                end
               end
              
              inner = link.length > 0 ? "<a href=\"#{link}\" itemprop=\"url\"><span itemprop=\"title\">#{level.gsub(/_/, ' ')}</span></a>" : "#{level.gsub(/_/, ' ')}"
              output += "<li itemscope itemtype=\"http://data-vocabulary.org/Breadcrumb\">#{inner}<span class=\"divider\">/</span></li>"
          end
        end
      end
      
      output += "</ul>"
      puts "generating breadcrumbs for #{@page_url}"
      output
    end
	end<commit_msg>change breadcrumbs separator to ><commit_after>require 'open-uri'

module Jekyll
	# Add accessor for directory
	class Page
		attr_reader :dir
	end
	
	class BreadCrumbs < Liquid::Tag
    def render(context)
      site = context.registers[:site]
      @page_url = context.environments.first["page"]["url"]
      @dirs = {}

      site.pages.each do |page|
        path = page.url
        path = path.index('/')==0 ? path[1..-1] : path
        @dirs[path] = page.data
      end
      
      output='<ul class="breadcrumb">'
      
      output+='<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><a href="/index.html" itemprop="url"><span itemprop="title">Documentation</span></a><span class="divider">&gt;</span></li>'
      
      levels = @page_url.split('/') #break up url into different levels
      levels.each_with_index do |level, index|
        unless level.empty?
          if index == levels.size-1 || 
             (level == levels[levels.size-2] && levels[levels.size-1].to_i > 0)
            path = @page_url[1..-1]
            if  @dirs[path]["navigation"]["show"] == true
              path = @dirs[path]["title"] || path
              output += "<li itemscope itemtype=\"http://data-vocabulary.org/Breadcrumb\"><span itemprop=\"title\">#{path}</span><meta itemprop=\"url\" content=\"#{@page_url}\" /></li>" unless level.to_i > 0
            end
          else
              link = "/"
              i = 1
              while i <= index
                link += "#{URI::encode levels[i]}/"
                i+=1
              end
              
              if !link.index('.')
                
                path = Pathname.new(site.source + link + 'index.html')
                if path.exist?
                  link = link + 'index.html'
                else
                  link = ""
                end
               end
              
              inner = link.length > 0 ? "<a href=\"#{link}\" itemprop=\"url\"><span itemprop=\"title\">#{level.gsub(/_/, ' ')}</span></a>" : "#{level.gsub(/_/, ' ')}"
              output += "<li itemscope itemtype=\"http://data-vocabulary.org/Breadcrumb\">#{inner}<span class=\"divider\">&gt;</span></li>"
          end
        end
      end
      
      output += "</ul>"
      puts "generating breadcrumbs for #{@page_url}"
      output
    end
	end
{'fraction_non_alphanumeric': 0.16955391944564746, 'fraction_numerical': 0.00563014291901256, 'mean_word_length': 1.741246290801187, 'pattern_counts': {'":': 0, '<': 53, '<?xml version=': 0, '>': 56, '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': '6474429', 'n_tokens_mistral': 1417, 'n_tokens_neox': 1399, 'n_words': 281}