<commit_before>module ApplicationHelper
  include WordBreakHelper

  CATEGORIES = %w[academics career donations effective\ altruism lodging programming
    self-improvement writing other]

  def markdown(text)
    text ||= ""
    break_words(markdown_renderer.render(text), 40, escape_first: false).html_safe
  end

  def markdown_renderer
    markdown_options = {
      no_intra_emphasis: true,
      autolink: true,
      lax_spacing: true,
      quote: true
    }
    html_options = { filter_html: true, link_attributes: { rel: "nofollow" } }
    Redcarpet::Markdown.new(Redcarpet::Render::HTML.new(html_options), markdown_options)
  end

  def alert_type(level)
    case level
    when "notice"  then "alert alert-info"
    when "success" then "alert alert-success"
    when "alert"   then "alert alert-warning"
    when "error"   then "alert alert-danger"
    end
  end

  def active?(path = nil, **options)
    return "active" if current_page? path
  end

  def title(page_title)
    content_for(:title) { page_title }
  end

  def avatar_url(user, size = "large")
    if user.avatar_url
      "#{user.avatar_url}?type=#{size}"
    else
      gravatar_id = Digest::MD5.hexdigest(user.email.downcase)
      size = case size
             when "square" then "s=50"
             when "small" then "s=50"
             when "normal" then "s=100"
             when "large" then "s=200"
             end
      "http://gravatar.com/avatar/#{gravatar_id}.png?#{size}&d=mm"
    end
  end

  def name_for(klass, plural: false, capitalized: false)
    name = klass.to_s
    name = "request" if klass.downcase == "wanted"
    name = name.pluralize if plural
    name = name.capitalize if capitalized
    name
  end
end<commit_msg>Fix bug.<commit_after>module ApplicationHelper
  include WordBreakHelper

  CATEGORIES = %w[academics career donations effective\ altruism lodging programming
    self-improvement writing other]

  def markdown(text)
    text ||= ""
    break_words(markdown_renderer.render(text), 40, escape_first: false).html_safe
  end

  def markdown_renderer
    markdown_options = {
      no_intra_emphasis: true,
      autolink: true,
      lax_spacing: true,
      quote: true
    }
    html_options = { filter_html: true, link_attributes: { rel: "nofollow" } }
    Redcarpet::Markdown.new(Redcarpet::Render::HTML.new(html_options), markdown_options)
  end

  def alert_type(level)
    case level
    when "notice"  then "alert alert-info"
    when "success" then "alert alert-success"
    when "alert"   then "alert alert-warning"
    when "error"   then "alert alert-danger"
    end
  end

  def active?(path = nil, **options)
    return "active" if current_page? path
  end

  def title(page_title)
    content_for(:title) { page_title }
  end

  def avatar_url(user, size = "large")
    if user.avatar_url
      "#{user.avatar_url}?type=#{size}"
    else
      gravatar_id = Digest::MD5.hexdigest(user.email.downcase)
      size = case size
             when "square" then "s=50"
             when "small" then "s=50"
             when "normal" then "s=100"
             when "large" then "s=200"
             end
      "http://gravatar.com/avatar/#{gravatar_id}.png?#{size}&d=mm"
    end
  end

  def name_for(klass, plural: false, capitalized: false)
    name = klass.to_s
    name = "request" if name.downcase == "wanted"
    name = name.pluralize if plural
    name = name.capitalize if capitalized
    name
  end
end
{'fraction_non_alphanumeric': 0.1067481093659104, 'fraction_numerical': 0.0075625363583478765, 'mean_word_length': 2.9213226909920182, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7638341', 'n_tokens_mistral': 1178, 'n_tokens_neox': 1130, 'n_words': 282}