module JekyllBuildEbook::Filters::URLFilters
Public Instance Methods
relative_url(input)
click to toggle source
# File lib/jekyll-build-ebook/filters.rb, line 10 def relative_url(input) return if input.nil? input = input.url if input.respond_to?(:url) return input if Addressable::URI.parse(input.to_s).absolute? page = @context.registers[:page] page_dir = Pathname.new(page.url).dirname Pathname.new(ensure_leading_slash(input)).relative_path_from(page_dir).to_s end
Also aliased as: absolute_url