Module: FeedNormalizer::RewriteRelativeLinks

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

Instance Method Summary collapse

Instance Method Details



148
149
150
151
152
153
154
# File 'lib/structures.rb', line 148

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