Sha256: c8b5ac7fca1ce33a02a67d3876b2a44555bde22f253fad15fd98ad1940321c9b

Contents?: true

Size: 505 Bytes

Versions: 2

Compression:

Stored size: 505 Bytes

Contents

# -*- encoding: utf-8 -*-

require 'uri'

module Genit

  # Base class for builder that should relativize
  # some links in a XHTML document.
  class Relativizer < BuilderBase
  
    def not_an_internal_link?
      @path.nil? or @path =~ URI::regexp
    end
    
    private
    
    def update link, field
      @path = link[field]
      return if not_an_internal_link?
      nb = BuilderBase::get_number_of_base_dirs @page_name
      make_relative nb
      link[field] = @path
    end
    
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
genit-1.0.1 lib/genit/builders/relativizer.rb
genit-1.0 lib/genit/builders/relativizer.rb