|
@@ -67,7 +67,6 @@ local M = {
|
|
|
asset_dir = asset_dir,
|
|
|
icon_dir = path.join(asset_dir, "icons"),
|
|
|
media_dir = path.join(pkar.config.pres_gen.out_dir, "media"),
|
|
|
- webroot = "", -- TODO switch depending on local FS or webserver generation.
|
|
|
}
|
|
|
|
|
|
local MEDIA_WEB_PATH = M.media_dir:gsub(pkar.config.pres_gen.out_dir, "")
|
|
@@ -138,10 +137,10 @@ end
|
|
|
|
|
|
--[[ Find closest available type icon to the given type.
|
|
|
--]]
|
|
|
-local function get_icon_url(lineage)
|
|
|
+local function get_icon_url(lineage, webroot)
|
|
|
for i = #lineage, 1, -1 do
|
|
|
if path.isfile(path.join(M.icon_dir, lineage[i] .. ICON_EXT)) then
|
|
|
- return M.webroot .. "/icons/" .. lineage[i] .. ICON_EXT
|
|
|
+ return webroot .. "/icons/" .. lineage[i] .. ICON_EXT
|
|
|
end
|
|
|
end
|
|
|
end
|
|
@@ -192,7 +191,7 @@ local function generate_coll(s, mconf)
|
|
|
end
|
|
|
if child_label.data then child_label = child_label.data end
|
|
|
table.insert(members, {
|
|
|
- icon = get_icon_url(child_mconf.lineage),
|
|
|
+ icon = get_icon_url(child_mconf.lineage, "../../.."),
|
|
|
tn = get_tn_url(child_s),
|
|
|
href = pkar.gen_pairtree("/res", child_ref.data, ".html", true),
|
|
|
label = child_label,
|
|
@@ -216,7 +215,7 @@ local function generate_coll(s, mconf)
|
|
|
end
|
|
|
|
|
|
out_html = templates.coll.data({
|
|
|
- --webroot = M.webroot,
|
|
|
+ webroot = "../../..",
|
|
|
site_title = pkar.config.pres_gen.title,
|
|
|
title = (title or NT).data or "[No title]",
|
|
|
description = (description or NT).data,
|
|
@@ -232,7 +231,7 @@ local function generate_coll(s, mconf)
|
|
|
url = pref_rep_url,
|
|
|
file = pref_rep_file,
|
|
|
},
|
|
|
- icon_url = get_icon_url(mconf.lineage),
|
|
|
+ icon_url = get_icon_url(mconf.lineage, "../../.."),
|
|
|
--breadcrumbs = get_breadcrumbs(mconf),
|
|
|
rdf_href = pkar.gen_pairtree("/res", s.data, ".ttl", true),
|
|
|
})
|
|
@@ -350,7 +349,7 @@ local function generate_dres(s, mconf)
|
|
|
end
|
|
|
|
|
|
out_html = templates.dres.data({
|
|
|
- --webroot = M.webroot,
|
|
|
+ webroot = "../../..",
|
|
|
site_title = pkar.config.pres_gen.title,
|
|
|
title = title or s.data,
|
|
|
head_tpl = templates.head.data,
|
|
@@ -366,7 +365,7 @@ local function generate_dres(s, mconf)
|
|
|
url = pref_rep_url,
|
|
|
file = pref_rep_file,
|
|
|
},
|
|
|
- icon_url = get_icon_url(mconf.lineage),
|
|
|
+ icon_url = get_icon_url(mconf.lineage, "../../.."),
|
|
|
breadcrumbs = get_breadcrumbs(mconf),
|
|
|
rdf_href = pkar.gen_pairtree("/res", s.data, ".ttl", true),
|
|
|
permalink = pkar.gen_pairtree("/res", s.data, ".html", true),
|
|
@@ -461,7 +460,7 @@ local function generate_ores(s, mconf)
|
|
|
end
|
|
|
|
|
|
out_html = templates.ores.data({
|
|
|
- --webroot = M.webroot,
|
|
|
+ webroot = "../../..",
|
|
|
site_title = pkar.config.pres_gen.title,
|
|
|
fname = path.basename(techmd.source_path[1]),
|
|
|
head_tpl = templates.head.data,
|
|
@@ -471,7 +470,7 @@ local function generate_ores(s, mconf)
|
|
|
techmd = techmd,
|
|
|
rel = rel,
|
|
|
ls_next = ls_next,
|
|
|
- icon_url = get_icon_url(mconf.lineage),
|
|
|
+ icon_url = get_icon_url(mconf.lineage, "../../.."),
|
|
|
breadcrumbs = get_breadcrumbs(mconf),
|
|
|
pres = pres,
|
|
|
thumbnail = tn,
|
|
@@ -495,7 +494,7 @@ M.generate_search_idx = function(s, mconf)
|
|
|
href = pkar.gen_pairtree("/res", s.data, ".html", true),
|
|
|
content_type = mconf.id,
|
|
|
type = mconf.lineage,
|
|
|
- icon = get_icon_url(mconf.lineage),
|
|
|
+ icon = get_icon_url(mconf.lineage, "."),
|
|
|
}
|
|
|
|
|
|
local function format_value(pname, o)
|
|
@@ -724,7 +723,7 @@ M.generate_homepage = function()
|
|
|
logger:debug(pp.write(idx_data))
|
|
|
|
|
|
out_html = templates.idx.data({
|
|
|
- webroot = M.webroot,
|
|
|
+ webroot = ".",
|
|
|
site_title = pkar.config.pres_gen.title,
|
|
|
head_tpl = templates.head.data,
|
|
|
header_tpl = templates.header.data,
|