Sha256: a3a3482c9997357786d57344430c8b8fa349fab81c431a57b3b90ff7f7711a54
Contents?: true
Size: 591 Bytes
Versions: 2
Compression:
Stored size: 591 Bytes
Contents
require 'pathname' module Awestruct module Extensions module Relative def relative(href, p = page) begin # Ignore absolute links if href.start_with?("http://") || href.start_with?("https://") result = href else result = Pathname.new(href).relative_path_from(Pathname.new(File.dirname(p.output_path))).to_s end result rescue Exception => e $LOG.error "#{e}" if $LOG.error? $LOG.error "#{e.backtrace.join("\n")}" if $LOG.error? end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
awestruct-0.5.4.rc | lib/awestruct/extensions/relative.rb |
awestruct-0.5.4.beta1 | lib/awestruct/extensions/relative.rb |