<commit_before>require 'open-uri'

class MarkdownRenderer < Redcarpet::Render::HTML
  def link(link, title, alt_text)
    link ||= "#"
    safelink = URI.escape(link).gsub(/%23/, '#')
"<a target=\"_blank\" href=\"#{safelink}\">#{alt_text}</a>"
  end

  def autolink(link, link_type)
    link ||= "#"
    safelink = URI.escape(link).gsub(/%23/, '#')
    if link_type == :email
"<a target=\"_blank\" href=\"mailto:#{link}\">#{link}</a>"
    else
"<a target=\"_blank\" href=\"#{safelink}\">#{link}</a>"
    end
  end
end<commit_msg>Change empty link behaviour<commit_after>require 'open-uri'

class MarkdownRenderer < Redcarpet::Render::HTML
  def link(link, title, alt_text)
    if link
      safelink = URI.escape(link).gsub(/%23/, '#')
      "<a target=\"_blank\" href=\"#{safelink}\">#{alt_text}</a>"
    else
      "#"
      "<a href=\"#\">#{alt_text}</a>"
    end
  end

  def autolink(link, link_type)
    safelink = URI.escape(link).gsub(/%23/, '#')
    if link_type == :email
      "<a target=\"_blank\" href=\"mailto:#{link}\">#{link}</a>"
    else
      "<a target=\"_blank\" href=\"#{safelink}\">#{link}</a>"
    end
  end
end
{'fraction_non_alphanumeric': 0.23700440528634362, 'fraction_numerical': 0.007048458149779736, 'mean_word_length': 3.4375, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 17, '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': '6120143', 'n_tokens_mistral': 431, 'n_tokens_neox': 443, 'n_words': 76}