lib/anemone/page.rb
#
# Converts relative URL *link* into an absolute URL based on the
# location of the page
#
Converts relative URL *link* into an absolute URL based on the
location of the page
Converts relative URL * link * into an absolute URL based on the location of the page
def to_absolute(link)
      return nil if link.nil?
      link = URI.encode(URI.decode(link.to_s.gsub(/#[a-zA-Z0-9_-]*$/,'')))
      relative = URI(link)
      absolute = base ? base.merge(relative) : URI(url).merge(relative)
      absolute.path = '/' if absolute.path.empty?
      return absolute
    end
def to_absolute ( link ) return nil if link . nil? link = URI . encode ( URI . decode ( link . to_s . gsub ( / #[a-zA-Z0-9_-]*$ / , '' ) ) ) relative = URI ( link ) absolute = base ? base . merge ( relative ) : URI ( url ) . merge ( relative ) absolute . path = '/' if absolute . path . empty? return absolute end
Converts relative URL *link* into an absolute URL based on the
location of the page
Converts relative URL * link * into an absolute URL based on the location of the page
# remove anchor
link
<not_specific>