Sha256: 52800129e0f264456b289907f590f24969020a583151f0f585fc92569e05f2dd

Contents?: true

Size: 916 Bytes

Versions: 1

Compression:

Stored size: 916 Bytes

Contents

#                                                                          
# File 'filehelper.rb' created on 28 feb 2008 at 16:40:57.                    
#
# See 'dokkit.rb' or +LICENSE+ for licence information.                      
#                                                                          
# (C) 2008 Andrea Fazzi <andrea.fazzi@alca.le.it> (and contributors). 
#                                                                          

require 'dokkit/extension/extension'

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dokkit-0.3.0 lib/dokkit/extension/filehelper.rb