Sha256: 9317f2ad8a62e863144e8ce1e5b94e7807748a3a0856f0bc143b7403a4e7d904

Contents?: true

Size: 924 Bytes

Versions: 5

Compression:

Stored size: 924 Bytes

Contents

#                                                                          
# File 'url.rb' created on 09 mag 2008 at 19:13:53.                    
#
# See 'dokkit.rb' or +LICENSE+ for licence information.                      
#                                                                          
# (C)2006-2008 Andrea Fazzi <andrea.fazzi@alca.le.it> (and contributors). 
#                                                                          

module Dokkit
  module Resource
    module Extension
      module Url
        def relative(href)
          thr = href
          if thr.is_a?(String) && href[0,1] == '/'     
            dtfn = File.dirname(source_fn[/^#{configuration[:document_dir]}\/(.*)/,1]) + '/'
            count = dtfn == './' ? 0 : dtfn.split('/').length
            thr = ('../' * count) + href[1..href.length]
          end        
          thr
        end      
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
dokkit-0.4.0 lib/dokkit/resource/extensions/url.rb
dokkit-0.4.1 lib/dokkit/resource/extensions/url.rb
dokkit-0.4.2 lib/dokkit/resource/extensions/url.rb
dokkit-0.4.3 lib/dokkit/resource/extensions/url.rb
dokkit-0.4.4 lib/dokkit/resource/extensions/url.rb