# File lib/webby/helpers/url_helper.rb, line 91
  def link_to( name, *args )
    opts = Hash === args.last ? args.pop : {}
    obj = args.first
    attrs = opts.delete(:attrs)

    url = case obj
      when String, Webby::Resources::Resource
        self.url_for(obj, opts)
      when ::Webby::Paginator::Page
        self.url_for(obj.url, opts)
      when :back
        'javascript:history.back()'
      else
        self.url_for(name, opts)
      end

    if attrs
      html_opts = attrs.stringify_keys
      href = html_opts.has_key? 'href'
      attrs = tag_options(html_opts)
    else
      href = false
      attrs = nil
    end

    href_attr = href ? nil : %Q(href="#{url}")
    "<a #{href_attr}#{attrs}>#{name || h(url)}</a>"
  end