<commit_before>module Munge
  module Helpers
    module Link
      def path_to(item)
        system.router.route(item)
      end

      def link_to(item, text = nil, opts = {})
        link = path_to(item)

        if text.is_a?(Hash)
          opts = text
          text = nil
        end

        href_with_options = { href: link }.merge(opts)

        content_tag(:a, text || link, href_with_options)
      end
    end
  end
end<commit_msg>Allow string input for #link_to and #path_to<commit_after>module Munge
  module Helpers
    module Link
      def path_to(itemish)
        item =
          if item.is_a?(String)
            system.items[itemish]
          else
            itemish
          end

        system.router.route(item)
      end

      def link_to(itemish, text = nil, opts = {})
        link = path_to(itemish)

        if text.is_a?(Hash)
          opts = text
          text = nil
        end

        href_with_options = { href: link }.merge(opts)

        content_tag(:a, text || link, href_with_options)
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.08514664143803216, 'fraction_numerical': 0.0, 'mean_word_length': 1.6989795918367347, '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': '3068903', 'n_tokens_mistral': 337, 'n_tokens_neox': 332, 'n_words': 84}