ContentUrls

Find and rewrite URLs in different types of content.

ContentUrls was developed to address two use cases:

Features

Examples

Find URLs in an HTML document

Provide the HTML content and the content type and obtain an array of unique URLs.

ContentUrls.urls(html, 'text/html').each do |url|
  puts "Found URL: #{url}"
end

Rewrite URLs in an HTML document

Provide the HTML content, the content type, and a block to rewrite each URL’s extension.

rewritten_html = ContentUrls.rewrite_each_url(html, 'text/html') {|url| url.sub(/.htm/, '.html'}

Requirements

Development

To test and develop this gem, additional requirements are:

Goals for ContentUrls

Contributing to content_urls

Copyright © 2013 Dennis Sutch. See LICENSE.txt for further details.