Add CleanLocalUrls filter for removing localhost URLs

Enabled by default in FileScraper
pull/15/head
Thibaut 11 years ago
parent 9089d03211
commit 24347f312b

@ -13,6 +13,8 @@ module Docs
self.base_url = 'http://localhost/'
html_filters.push 'clean_local_urls'
private
def request_one(url)

@ -0,0 +1,16 @@
module Docs
class CleanLocalUrlsFilter < Filter
def call
if base_url.host == 'localhost'
css('img[src^="http://localhost"]', 'iframe[src^="http://localhost"]').remove
css('a[href^="http://localhost"]').each do |node|
node.name = 'span'
node.remove_attribute 'href'
end
end
doc
end
end
end
Loading…
Cancel
Save