lib/madowu/directorymapper.rb in madowu-0.0.2 vs lib/madowu/directorymapper.rb in madowu-0.0.3
- old
+ new
@@ -10,21 +10,21 @@
#end
def self.dirmap(dir)
results = []
md_dir = Pathname.new(dir)
- results << "<p>Parent directory:</p>"
- results << "<ul>"
+ results << "Parent directory:"
+ results << ""
if File.exist?(md_dir.parent + 'index.html')
- results << " <li> <a href='../index.html'>../</a>"
+ results << "* [../](../index.html)"
else
- results << " <li> <a href='../'>../</a>"
+ results << "* [../](../)"
end
- results << "</ul>"
+ results << ""
- results << "<p>Current directory:</p>"
- results << "<ul>"
+ results << "Current directory:"
+ results << ""
current_entries = []
cur_dir_entries = Dir.entries(md_dir).sort.delete_if{|i| i =~ /^\./}
cur_dir_entries.each do |i|
path = md_dir + i
anchor = i
@@ -54,14 +54,14 @@
title = nil
end
end
link_path = link_path.to_s.sub(/^#{md_dir}\//, '')
anchor = anchor.to_s.sub(/^#{md_dir}\//, '')
- line = " <li> <a href='#{link_path}'>#{anchor}</a>"
+ line = "* [#{anchor}](#{link_path})"
line += " (#{title})" unless title.to_s.empty?
results << line
end
- results << "</ul>"
+ #results << "</ul>"
results
end
def self.get_title(path)
if FileTest.directory?(path)