|
@@ -475,9 +475,9 @@ end
|
|
|
|
|
|
|
|
|
M.generate_idx = function()
|
|
|
- local obj_idx = {}
|
|
|
+ local idx_data = {objects = {}, collections = {}}
|
|
|
-- Get all subject of type: Artifact.
|
|
|
- s_ts = repo.gr:term_set(
|
|
|
+ local s_ts = repo.gr:term_set(
|
|
|
pkar.RDF_TYPE, triple.POS_P,
|
|
|
term.new_iriref_ns("pas:Artifact"), triple.POS_O
|
|
|
)
|
|
@@ -492,11 +492,37 @@ M.generate_idx = function()
|
|
|
submitted = submitted.data,
|
|
|
tn = get_tn_url(s),
|
|
|
}
|
|
|
- table.insert(obj_idx, obj)
|
|
|
+ table.insert(idx_data.objects, obj)
|
|
|
end
|
|
|
- table.sort(obj_idx, function(a, b) return a.submitted < b.submitted end)
|
|
|
+ table.sort(
|
|
|
+ idx_data.objects, function(a, b)
|
|
|
+ return a.submitted < b.submitted end
|
|
|
+ )
|
|
|
+
|
|
|
+ s_ts = repo.gr:term_set(
|
|
|
+ pkar.RDF_TYPE, triple.POS_P,
|
|
|
+ term.new_iriref_ns("pas:Collection"), triple.POS_O
|
|
|
+ )
|
|
|
+ for _, s in pairs(s_ts) do
|
|
|
+ local title, submitted
|
|
|
+ _, title = next(repo.gr:attr(s, pkar.DC_TITLE_P))
|
|
|
+ _, submitted = next(repo.gr:attr(s, pkar.SUBMITTED_P))
|
|
|
+
|
|
|
+ local coll = {
|
|
|
+ href = pkar.gen_pairtree("/res", s.data, ".html", true),
|
|
|
+ title = title,
|
|
|
+ submitted = submitted.data,
|
|
|
+ tn = get_tn_url(s),
|
|
|
+ }
|
|
|
+ table.insert(idx_data.collections, coll)
|
|
|
+ end
|
|
|
+ table.sort(
|
|
|
+ idx_data.collections, function(a, b)
|
|
|
+ return a.submitted < b.submitted end
|
|
|
+ )
|
|
|
+
|
|
|
+ logger:debug(pp.write(idx_data))
|
|
|
|
|
|
- logger:debug(pp.write(obj_idx))
|
|
|
out_html = templates.idx.data({
|
|
|
webroot = M.webroot,
|
|
|
title = pkar.config.site.title or pkar.default_title,
|
|
@@ -504,7 +530,7 @@ M.generate_idx = function()
|
|
|
head_tpl = templates.head.data,
|
|
|
header_tpl = templates.header.data,
|
|
|
nsm = nsm,
|
|
|
- obj_idx = obj_idx,
|
|
|
+ idx_data = idx_data,
|
|
|
})
|
|
|
|
|
|
local idx_path = path.join(pkar.config.htmlgen.out_dir, "index.html")
|