Skip to content

Instantly share code, notes, and snippets.

@siannopollo
Created March 12, 2011 05:04
Show Gist options
  • Save siannopollo/867045 to your computer and use it in GitHub Desktop.
Save siannopollo/867045 to your computer and use it in GitHub Desktop.
For Brandon
module MyCustomFilters
def full_urls(input)
input.gsub /(<\s*(a|img|video|audio)\s+[^>]*(href|src)\s*=\s*[\"'])(?!http:\/\/|https:\/\/|sftp:\/\/)([^\"'>]+)[\"'>]/ do
"#{$1}http://example.com#{$2}"
end
end
end
Liquid::Template.register_filter MyCustomFilters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment