|
@@ -121,27 +121,21 @@ M.generate_sip = function(path)
|
|
for i, v in ipairs(sip) do
|
|
for i, v in ipairs(sip) do
|
|
local rmod = model.types[v.content_type]
|
|
local rmod = model.types[v.content_type]
|
|
--dbg.assert(rmod)
|
|
--dbg.assert(rmod)
|
|
- if rmod.properties.next then
|
|
|
|
- for j = i + 1, #sip do
|
|
|
|
- if not v.next and
|
|
|
|
- sip[j].source_path:match("(.*/)") ==
|
|
|
|
- v.source_path:match("(.*/)") then
|
|
|
|
- v.next = sip[j].id
|
|
|
|
- end
|
|
|
|
- end
|
|
|
|
- end
|
|
|
|
- if rmod.properties.first then
|
|
|
|
- for j = i + 1, #sip do
|
|
|
|
- if not v.first and
|
|
|
|
- sip[j].source_path:match(
|
|
|
|
- "^" .. pkar.escape_pattern(v.source_path)
|
|
|
|
- ) then
|
|
|
|
- v.first = sip[j].id
|
|
|
|
|
|
+ v.has_member = v.has_member or {}
|
|
|
|
+ for j = i + 1, #sip do
|
|
|
|
+ if sip[j].source_path:match(
|
|
|
|
+ "^" .. pkar.escape_pattern(v.source_path))
|
|
|
|
+ then
|
|
|
|
+ local rel_path = sip[j].source_path:sub(#v.source_path + 2)
|
|
|
|
+ logger:debug("rel_path: " .. rel_path)
|
|
|
|
+ if not rel_path:match("/") then
|
|
|
|
+ logger:debug(("Adding member %s to %s"):format(
|
|
|
|
+ rel_path, v.source_path))
|
|
|
|
+ table.insert(v.has_member, sip[j].id)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
- --require "debugger"()
|
|
|
|
|
|
|
|
return sip
|
|
return sip
|
|
end
|
|
end
|