<commit_before>require_relative 'helpers'

module DoxyHaml

  module HtmlUtilities
    include Helpers

    def link_to *args, &block
      if block_given?
        # TODO url = args[0]
      else
        name, url = args[0], args[1]
        "<a href='#{url}'>#{name}</a>"
      end
    end

    def anchor_for id
      "<a id='#{id}'/>"
    end

    def link_to_refs node
      list = map_node node.children do |child|
        child = (!child.text? and child.name == "ref") ? link_to(child.content, id_to_href(child['refid'])) : child
      end
      list.join.strip
    end

    def id_to_href id
      "#{id}.html"
    end

    def id_to_href_anchor id
      *a, b = id.split('_', -1)
      "#{a.join('_')}.html##{b}"
    end

    def id_to_a_id id
      id.split('_').last
    end

  end

end<commit_msg>Adding exception to id_to_a_id method<commit_after>require_relative 'helpers'

module DoxyHaml

  module HtmlUtilities
    include Helpers

    def link_to *args, &block
      if block_given?
        # TODO url = args[0]
      else
        name, url = args[0], args[1]
        "<a href='#{url}'>#{name}</a>"
      end
    end

    def anchor_for id
      "<a id='#{id}'/>"
    end

    def link_to_refs node
      list = map_node node.children do |child|
        child = (!child.text? and child.name == "ref") ? link_to(child.content, id_to_href(child['refid'])) : child
      end
      list.join.strip
    end

    def id_to_href id
      "#{id}.html"
    end

    def id_to_href_anchor id
      *a, b = id.split('_', -1)
      "#{a.join('_')}.html##{b}"
    end

    def id_to_a_id id
      raise "String does not contain an id" unless id =~ /[a-zA-Z0-9]{34}$/
      id.split('_').last
    end

  end

end
{'fraction_non_alphanumeric': 0.14002333722287047, 'fraction_numerical': 0.007001166861143524, 'mean_word_length': 2.146788990825688, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '1510585', 'n_tokens_mistral': 641, 'n_tokens_neox': 637, 'n_words': 157}