# # File 'filehelper.rb' created on 28 feb 2008 at 16:40:57. # # See 'dokkit.rb' or +LICENSE+ for licence information. # # (C) 2008 Andrea Fazzi (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