# File lib/yard/templates/helpers/html_helper.rb, line 180
      def resolve_links(text)
        code_tags = 0
        text.gsub(/<(\/)?(pre|code|tt)|(\\|!)?\{(?!\})(\S+?)(?:\s([^\}]*?\S))?\}(?=[\W<]|.+<\/|$)/m) do |str|
          closed, tag, escape, name, title, match = $1, $2, $3, $4, $5, $&
          if tag
            code_tags += (closed ? -1 : 1)
            next str
          end
          next str unless code_tags == 0

          next(match[1..-1]) if escape

          next(match) if name[0,1] == '|'

          if name == '<a' && title =~ /href=["'](.+?)["'].*>.*<\/a>\s*(.*)\Z/
            name, title = $1, $2
            title = nil if title.empty?
          end

          name = CGI.unescapeHTML(name)

          if object.is_a?(String)
            object
          else
            link = linkify(name, title)
            if (link == name || link == title) && (name+' '+link !~ /\A<a\s.*>/)
              match = /(.+)?(\{#{Regexp.quote name}(?:\s.*?)?\})(.+)?/.match(text)
              file = (@file ? @file.filename : object.file) || '(unknown)'
              line = (@file ? 1 : (object.docstring.line_range ? object.docstring.line_range.first : 1)) + (match ? $`.count("\n") : 0)
              log.warn "In file `#{file}':#{line}: Cannot resolve link to #{name} from text" + (match ? ":" : ".")
              log.warn((match[1] ? '...' : '') + match[2].gsub("\n","") + (match[3] ? '...' : '')) if match
            end

            link
          end
        end
      end