Sha256: d3176ed6bd794da6c46e2e6dcf20e482c606eee426e26184298147bfd7264de9
Contents?: true
Size: 351 Bytes
Versions: 1
Compression:
Stored size: 351 Bytes
Contents
module Nanoc2::Filters class RelativizePathsInHTML < Nanoc2::Filter identifier :relativize_paths_in_html require 'nanoc2/helpers/link_to' include Nanoc2::Helpers::LinkTo def run(content) content.gsub(/(src|href)=(['"]?)(\/.+?)\2([ >])/) do $1 + '=' + $2 + relative_path_to($3) + $2 + $4 end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
nanoc2-2.2.3 | lib/nanoc2/filters/relativize_paths_in_html.rb |