Module: FeedNormalizer::RewriteRelativeLinks

Included in:
Entry
Defined in:
lib/structures.rb

Instance Method Summary collapse

Instance Method Details



136
137
138
139
140
141
142
# File 'lib/structures.rb', line 136

def rewrite_relative_links(text, url)
  if host = url_host(url)
    text.to_s.gsub(/(href|src)=('|")\//, '\1=\2http://' + host + '/')
  else
    text
  end
end