<commit_before>module LinkHelper
  
  def fancy_link(resource)
    clazz = resource.class
    clazz = 'Ontology' if clazz.to_s.include?('Ontology')
    
    unless resource.is_a? Array then
      link_to resource, resource,
        'data-type' => clazz.to_s,
        :title      => resource.respond_to?(:title) ? resource.title : nil
    else
      
      name = yield resource.last      
      link_to name, resource,
        'data-type' => clazz.to_s,
        :title      => resource.last.respond_to?(:title) ? resource.last.title : nil
    end
  end
  
  def counter_link(url, counter, subject)
    text = content_tag(:strong, counter || '?')
    text << content_tag(:span, counter==1 ? subject : subject.pluralize)
    
    link_to text, url
  end
  
  def format_links(*args, &block)
    options = args.extract_options!
    args    = %w(xml json) if args.empty?
    args.flatten!
    
    options[:url]  ||= {}
    
    links = ''
    links << capture(&block) << ' ' if block_given?
    links << args.collect{ |f|
      content_tag :li, link_to(f.to_s.upcase, params.merge(options[:url]).merge(:format => f), :title => "Get this page as #{f.upcase}")
    }.join("")
    
    content_tag('ul', links.html_safe, :class => 'formats')
  end
  
end<commit_msg>add spezific name with blocks to fancy_link<commit_after>module LinkHelper
  
  def fancy_link(resource)
    clazz = resource.class
    clazz = 'Ontology' if clazz.to_s.include?('Ontology')
    
    unless resource.is_a? Array then

      if block_given?
        name = yield resource
      else
        name = resource
      end

      link_to name, resource,
        'data-type' => clazz.to_s,
        :title      => resource.respond_to?(:title) ? resource.title : nil
    else

      if block_given?
        name = yield resource
      else
        name = resource
      end

      link_to name, resource,
        'data-type' => clazz.to_s,
        :title      => resource.last.respond_to?(:title) ? resource.last.title : nil
    end
  end
  
  def counter_link(url, counter, subject)
    text = content_tag(:strong, counter || '?')
    text << content_tag(:span, counter==1 ? subject : subject.pluralize)
    
    link_to text, url
  end
  
  def format_links(*args, &block)
    options = args.extract_options!
    args    = %w(xml json) if args.empty?
    args.flatten!
    
    options[:url]  ||= {}
    
    links = ''
    links << capture(&block) << ' ' if block_given?
    links << args.collect{ |f|
      content_tag :li, link_to(f.to_s.upcase, params.merge(options[:url]).merge(:format => f), :title => "Get this page as #{f.upcase}")
    }.join("")
    
    content_tag('ul', links.html_safe, :class => 'formats')
  end
  
end
{'fraction_non_alphanumeric': 0.134173461823573, 'fraction_numerical': 0.0007412898443291327, 'mean_word_length': 2.48258064516129, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '2102118', 'n_tokens_mistral': 908, 'n_tokens_neox': 899, 'n_words': 204}