|
@@ -85,21 +85,20 @@ M.deposit = function(path)
|
|
-- Move md to an ordered list.
|
|
-- Move md to an ordered list.
|
|
mdlist = {}
|
|
mdlist = {}
|
|
for _, v in pairs(md) do table.insert(mdlist, v) end
|
|
for _, v in pairs(md) do table.insert(mdlist, v) end
|
|
-
|
|
|
|
table.sort(mdlist, function (a, b) return (a._sort < b._sort) end)
|
|
table.sort(mdlist, function (a, b) return (a._sort < b._sort) end)
|
|
|
|
|
|
-- Infer structure from paths and row ordering.
|
|
-- Infer structure from paths and row ordering.
|
|
for i, v in ipairs(mdlist) do
|
|
for i, v in ipairs(mdlist) do
|
|
for j = i + 1, #mdlist do
|
|
for j = i + 1, #mdlist do
|
|
- print(string.format("comparing %s : %s", v.path, mdlist[j].path))
|
|
|
|
|
|
+ --print(string.format("comparing %s : %s", v.path, mdlist[j].path))
|
|
if not v["next"] and
|
|
if not v["next"] and
|
|
mdlist[j].path:match("(.*/)") == v.path:match("(.*/)") then
|
|
mdlist[j].path:match("(.*/)") == v.path:match("(.*/)") then
|
|
- print("next match.")
|
|
|
|
|
|
+ --print("next match.")
|
|
v["next"] = mdlist[j].path
|
|
v["next"] = mdlist[j].path
|
|
end
|
|
end
|
|
if not v.firstChild and
|
|
if not v.firstChild and
|
|
mdlist[j].path:match("^" .. escape_pattern(v.path)) then
|
|
mdlist[j].path:match("^" .. escape_pattern(v.path)) then
|
|
- print("First child match.")
|
|
|
|
|
|
+ --print("First child match.")
|
|
v.firstChild = mdlist[j].path
|
|
v.firstChild = mdlist[j].path
|
|
end
|
|
end
|
|
end
|
|
end
|