Sha256: 92125dcb46ae6611b7c1865eede404486bdbf81071d4bde60d4eefdf1e12c7d9
Contents?: true
Size: 403 Bytes
Versions: 40
Compression:
Stored size: 403 Bytes
Contents
module HTML class Pipeline # HTML Filter for replacing http and https urls with protocol relative versions. class RelativeLinksFilter < Filter def call h = context[:host] doc.css("a[href^=\"http://#{h}\"],a[href^=\"https://#{h}\"]").each do |element| element['href'] = element['href'].sub(/^https?:/, '') end doc end end end end
Version data entries
40 entries across 40 versions & 1 rubygems