|
@@ -3,7 +3,7 @@ local datafile = require "datafile"
|
|
local dir = require "pl.dir"
|
|
local dir = require "pl.dir"
|
|
local etlua = require "etlua"
|
|
local etlua = require "etlua"
|
|
local json = require "cjson"
|
|
local json = require "cjson"
|
|
-local plpath = require "pl.path"
|
|
|
|
|
|
+local path = require "pl.path"
|
|
local pp = require "pl.pretty"
|
|
local pp = require "pl.pretty"
|
|
|
|
|
|
local nsm = require "volksdata.namespace"
|
|
local nsm = require "volksdata.namespace"
|
|
@@ -27,9 +27,9 @@ local NT = {}
|
|
local subjects
|
|
local subjects
|
|
|
|
|
|
local asset_dir = pkar.config.htmlgen.out_dir
|
|
local asset_dir = pkar.config.htmlgen.out_dir
|
|
-local index_path = plpath.join(asset_dir, "js", "fuse_index.json")
|
|
|
|
-local keys_path = plpath.join(asset_dir, "js", "fuse_keys.json")
|
|
|
|
-local idx_ignore = {["pas_first"] = true, ["pas:next"] = true,}
|
|
|
|
|
|
+local index_path = path.join(asset_dir, "js", "fuse_index.json")
|
|
|
|
+local keys_path = path.join(asset_dir, "js", "fuse_keys.json")
|
|
|
|
+local idx_ignore = {first = true, next = true,}
|
|
-- Collector for all search term keys.
|
|
-- Collector for all search term keys.
|
|
local idx_keys = {}
|
|
local idx_keys = {}
|
|
|
|
|
|
@@ -50,12 +50,15 @@ end
|
|
|
|
|
|
-- HTML generator module.
|
|
-- HTML generator module.
|
|
local M = {
|
|
local M = {
|
|
- res_dir = plpath.join(pkar.config.htmlgen.out_dir, "res"),
|
|
|
|
|
|
+ res_dir = path.join(pkar.config.htmlgen.out_dir, "res"),
|
|
asset_dir = asset_dir,
|
|
asset_dir = asset_dir,
|
|
- media_dir = plpath.join(pkar.config.htmlgen.out_dir, "media"),
|
|
|
|
|
|
+ media_dir = path.join(pkar.config.htmlgen.out_dir, "media"),
|
|
webroot = "", -- TODO switch depending on local FS or webserver generation.
|
|
webroot = "", -- TODO switch depending on local FS or webserver generation.
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+local TN_FS_PATH = path.join(M.media_dir, "thumbnail")
|
|
|
|
+local TN_WEB_PATH = TN_FS_PATH:gsub(pkar.config.htmlgen.out_dir, "")
|
|
|
|
+
|
|
|
|
|
|
local function get_breadcrumbs(mconf)
|
|
local function get_breadcrumbs(mconf)
|
|
-- Breadcrumbs, from top class to current class.
|
|
-- Breadcrumbs, from top class to current class.
|
|
@@ -64,7 +67,7 @@ local function get_breadcrumbs(mconf)
|
|
for i = 1, #mconf.lineage do
|
|
for i = 1, #mconf.lineage do
|
|
breadcrumbs[i] = {
|
|
breadcrumbs[i] = {
|
|
mconf.lineage[i],
|
|
mconf.lineage[i],
|
|
- model.models[mconf.lineage[i]].label
|
|
|
|
|
|
+ model.types[mconf.lineage[i]].label
|
|
}
|
|
}
|
|
end
|
|
end
|
|
|
|
|
|
@@ -72,19 +75,31 @@ local function get_breadcrumbs(mconf)
|
|
end
|
|
end
|
|
|
|
|
|
|
|
|
|
-local function get_tn_url(s)
|
|
|
|
|
|
+--[[ Infer thumbnail web path from the resource subject URI.
|
|
|
|
+
|
|
|
|
+ If the resource is not a file and as such does not have a thumbnail of
|
|
|
|
+ its own, traverse the list of first children and use the first one found
|
|
|
|
+ with a thumbnail.
|
|
|
|
+
|
|
|
|
+ @TODO This should actually use the `pas:hasRepresentation` property
|
|
|
|
+ instead of the first child.
|
|
|
|
+
|
|
|
|
+ @param[in] s Subject (resource) URI.
|
|
|
|
+
|
|
|
|
+ @param[in] ext Optional extension to add, including the extension separator
|
|
|
|
+ (`.`). If not provided, `.jpg` is used.
|
|
|
|
+--]]
|
|
|
|
+local function get_tn_url(s, ext) -- TODO caller needs to pass correct ext
|
|
if repo.gr:attr(s, pkar.RDF_TYPE)[pkar.FILE_T.hash] then
|
|
if repo.gr:attr(s, pkar.RDF_TYPE)[pkar.FILE_T.hash] then
|
|
-- The subject is a file.
|
|
-- The subject is a file.
|
|
- tn_fname = (s.data:gsub(pkar.PAR_NS, "") .. ".jpg") -- FIXME do not hardcode.
|
|
|
|
- return plpath.join(
|
|
|
|
- M.media_dir, tn_fname:sub(1, 2), tn_fname:sub(3, 4), tn_fname)
|
|
|
|
|
|
+ return pkar.gen_pairtree(TN_WEB_PATH, s.data, ext or ".jpg", true)
|
|
end
|
|
end
|
|
|
|
|
|
-- Recurse through all first children until one with a thumbnail, or a
|
|
-- Recurse through all first children until one with a thumbnail, or a
|
|
-- leaf without children, is found.
|
|
-- leaf without children, is found.
|
|
local first_child
|
|
local first_child
|
|
_, first_child = next(repo.gr:attr(s, pkar.FIRST_P))
|
|
_, first_child = next(repo.gr:attr(s, pkar.FIRST_P))
|
|
- if first_child then return get_tn_url(first_child) end
|
|
|
|
|
|
+ if first_child then return get_tn_url(first_child, ext) end
|
|
end
|
|
end
|
|
|
|
|
|
|
|
|
|
@@ -96,15 +111,20 @@ local function generate_dres(s, mconf)
|
|
-- Metadata
|
|
-- Metadata
|
|
local attrs = repo.gr:connections(s, term.LINK_OUTBOUND)
|
|
local attrs = repo.gr:connections(s, term.LINK_OUTBOUND)
|
|
for p, ots in pairs(attrs) do
|
|
for p, ots in pairs(attrs) do
|
|
- local pname = nsm.denormalize_uri(p.data)
|
|
|
|
- p_label = ((mconf.properties or NT)[pname] or NT).label
|
|
|
|
|
|
+ local pname = model.uri_to_id[nsm.denormalize_uri(p.data)] or p.data
|
|
|
|
+ logger:debug("DRES pname: " .. pname)
|
|
|
|
+ local pconf = ((mconf.properties or NT)[pname] or NT)
|
|
-- RDF types are shown in in breadcrumbs.
|
|
-- RDF types are shown in in breadcrumbs.
|
|
- if pname == "rdf:type" then goto skip
|
|
|
|
|
|
+ if pname == pkar.RDF_TYPE.data then goto skip
|
|
elseif ((mconf.properties or NT)[pname] or NT).type == "rel" then
|
|
elseif ((mconf.properties or NT)[pname] or NT).type == "rel" then
|
|
-- Relationship.
|
|
-- Relationship.
|
|
- rel[pname] = {label = p_label, uri = pname}
|
|
|
|
|
|
+ rel[pname] = {
|
|
|
|
+ label = pconf.label,
|
|
|
|
+ description = pconf.description,
|
|
|
|
+ uri = pconf.uri
|
|
|
|
+ }
|
|
for _, o in pairs(ots) do table.insert(dmd[pname], o.data) end
|
|
for _, o in pairs(ots) do table.insert(dmd[pname], o.data) end
|
|
- elseif pname == "pas:first" then
|
|
|
|
|
|
+ elseif pname == "first" then
|
|
-- Build a linked list for every first found.
|
|
-- Build a linked list for every first found.
|
|
for _, o in pairs(ots) do
|
|
for _, o in pairs(ots) do
|
|
-- Loop through all first children.
|
|
-- Loop through all first children.
|
|
@@ -118,18 +138,17 @@ local function generate_dres(s, mconf)
|
|
if label then label = label.data
|
|
if label then label = label.data
|
|
else
|
|
else
|
|
_, label = next(repo.gr:attr(child_s, pkar.PATH_P))
|
|
_, label = next(repo.gr:attr(child_s, pkar.PATH_P))
|
|
- if label then label = plpath.basename(label.data)
|
|
|
|
|
|
+ if label then label = path.basename(label.data)
|
|
else label = child_s.data end
|
|
else label = child_s.data end
|
|
end
|
|
end
|
|
|
|
|
|
while child_s do
|
|
while child_s do
|
|
-- Loop trough all next nodes for each first child.
|
|
-- Loop trough all next nodes for each first child.
|
|
- --require "debugger".assert(get_tn_url(child_s))
|
|
|
|
table.insert(ll, {
|
|
table.insert(ll, {
|
|
href = pkar.gen_pairtree(
|
|
href = pkar.gen_pairtree(
|
|
"/res", child_s.data, ".html", true),
|
|
"/res", child_s.data, ".html", true),
|
|
label = label,
|
|
label = label,
|
|
- tn = get_tn_url(child_s):gsub(M.media_dir, "/media/tn"),
|
|
|
|
|
|
+ tn = get_tn_url(child_s),
|
|
})
|
|
})
|
|
logger:debug("Child label for ", child_s.data, ": ", ll[#ll].label or "nil")
|
|
logger:debug("Child label for ", child_s.data, ": ", ll[#ll].label or "nil")
|
|
-- There can only be one "next"
|
|
-- There can only be one "next"
|
|
@@ -137,12 +156,16 @@ local function generate_dres(s, mconf)
|
|
end
|
|
end
|
|
table.insert(children, ll)
|
|
table.insert(children, ll)
|
|
end
|
|
end
|
|
- elseif pname == "pas:next" then
|
|
|
|
|
|
+ elseif pname == "next" then
|
|
-- Sibling.
|
|
-- Sibling.
|
|
for _, o in pairs(ots) do ls_next = o.data break end
|
|
for _, o in pairs(ots) do ls_next = o.data break end
|
|
else
|
|
else
|
|
-- Descriptive metadata.
|
|
-- Descriptive metadata.
|
|
- local attr = {label = p_label, uri = pname}
|
|
|
|
|
|
+ local attr = {
|
|
|
|
+ label = pconf.label or pname,
|
|
|
|
+ description = pconf.description,
|
|
|
|
+ uri = pconf.uri,
|
|
|
|
+ }
|
|
-- TODO differentiate term types
|
|
-- TODO differentiate term types
|
|
for _, o in pairs(ots) do table.insert(attr, o.data) end
|
|
for _, o in pairs(ots) do table.insert(attr, o.data) end
|
|
table.sort(attr)
|
|
table.sort(attr)
|
|
@@ -195,20 +218,28 @@ local function generate_ores(s, mconf)
|
|
-- Metadata
|
|
-- Metadata
|
|
local attrs = repo.gr:connections(s, term.LINK_OUTBOUND)
|
|
local attrs = repo.gr:connections(s, term.LINK_OUTBOUND)
|
|
for p, ots in pairs(attrs) do
|
|
for p, ots in pairs(attrs) do
|
|
- local pname = nsm.denormalize_uri(p.data)
|
|
|
|
- p_label = ((mconf.properties or NT)[pname] or NT).label
|
|
|
|
|
|
+ local pname = model.uri_to_id[nsm.denormalize_uri(p.data)] or p.data
|
|
|
|
+ local pconf = ((mconf.properties or NT)[pname] or NT)
|
|
-- RDF types are shown in in breadcrumbs.
|
|
-- RDF types are shown in in breadcrumbs.
|
|
- if pname == "rdf:type" then goto skip
|
|
|
|
- elseif ((mconf.properties or NT)[pname] or NT).type == "rel" then
|
|
|
|
|
|
+ if pname == pkar.RDF_TYPE.data then goto skip
|
|
|
|
+ elseif pconf.type == "rel" then
|
|
-- Relationship.
|
|
-- Relationship.
|
|
- rel[pname] = {label = p_label, uri = pname}
|
|
|
|
|
|
+ rel[pname] = {
|
|
|
|
+ label = pconf.label,
|
|
|
|
+ description = pconf.description,
|
|
|
|
+ uri = pconf.uri
|
|
|
|
+ }
|
|
for _, o in pairs(ots) do table.insert(techmd[pname], o.data) end
|
|
for _, o in pairs(ots) do table.insert(techmd[pname], o.data) end
|
|
- elseif pname == "pas:next" then
|
|
|
|
|
|
+ elseif pname == "next" then
|
|
-- Sibling.
|
|
-- Sibling.
|
|
for _, o in pairs(ots) do ls_next = o.data break end
|
|
for _, o in pairs(ots) do ls_next = o.data break end
|
|
else
|
|
else
|
|
-- Descriptive metadata.
|
|
-- Descriptive metadata.
|
|
- techmd[pname] = {label = p_label, uri = pname}
|
|
|
|
|
|
+ techmd[pname] = {
|
|
|
|
+ label = pconf.label,
|
|
|
|
+ description = pconf.description,
|
|
|
|
+ uri = pconf.uri,
|
|
|
|
+ }
|
|
-- TODO differentiate term types
|
|
-- TODO differentiate term types
|
|
for _, o in pairs(ots) do table.insert(techmd[pname], o.data) end
|
|
for _, o in pairs(ots) do table.insert(techmd[pname], o.data) end
|
|
table.sort(techmd[pname])
|
|
table.sort(techmd[pname])
|
|
@@ -225,43 +256,40 @@ local function generate_ores(s, mconf)
|
|
-- Transform and move media assets.
|
|
-- Transform and move media assets.
|
|
local dest_fname, dest_dir, dest -- Reused for thumbnail.
|
|
local dest_fname, dest_dir, dest -- Reused for thumbnail.
|
|
logger:info("Transforming resource file.")
|
|
logger:info("Transforming resource file.")
|
|
- local res_path = techmd["pas:path"]
|
|
|
|
|
|
+ local res_path = techmd.archive_path
|
|
if not res_path then error("No file path for File resource!") end
|
|
if not res_path then error("No file path for File resource!") end
|
|
- local txconf = (mconf.transformers or NT).deliverable or {fn = "copy"}
|
|
|
|
|
|
+ local txconf = (mconf.gen or NT).transformers or {}
|
|
|
|
+
|
|
|
|
+ local pres_conf = txconf.pres or {fn = "copy"}
|
|
-- Set file name to resource ID + source extension.
|
|
-- Set file name to resource ID + source extension.
|
|
dest_fname = (
|
|
dest_fname = (
|
|
s.data:gsub(pkar.PAR_NS, "") ..
|
|
s.data:gsub(pkar.PAR_NS, "") ..
|
|
- (txconf.ext or plpath.extension(res_path[1])))
|
|
|
|
- dest_dir = plpath.join(
|
|
|
|
|
|
+ (pres_conf.ext or path.extension(res_path[1])))
|
|
|
|
+ dest_dir = path.join(
|
|
M.media_dir, dest_fname:sub(1, 2), dest_fname:sub(3, 4))
|
|
M.media_dir, dest_fname:sub(1, 2), dest_fname:sub(3, 4))
|
|
- dir.makepath(dest_dir)
|
|
|
|
- dest = plpath.join(dest_dir, dest_fname)
|
|
|
|
- assert(transformers[txconf.fn](
|
|
|
|
- res_path[1], dest, table.unpack(txconf or NT)))
|
|
|
|
- local deliverable = dest:gsub(pkar.config.htmlgen.out_dir, "")
|
|
|
|
- logger:info("Access file: ", deliverable)
|
|
|
|
|
|
+ dest = path.join(dest_dir, dest_fname)
|
|
|
|
+ assert(transformers[pres_conf.fn](
|
|
|
|
+ res_path[1], dest, table.unpack(pres_conf or NT)))
|
|
|
|
+ local pres = dest:gsub(pkar.config.htmlgen.out_dir, "")
|
|
|
|
+ logger:info("Presentation file: ", pres)
|
|
|
|
|
|
-- Thumbnail.
|
|
-- Thumbnail.
|
|
local tn
|
|
local tn
|
|
- txconf = (mconf.transformers or NT).thumbnail
|
|
|
|
- if txconf then
|
|
|
|
- if txconf.ext then
|
|
|
|
- dest_fname = plpath.splitext(dest_fname) .. txconf.ext
|
|
|
|
|
|
+ if txconf.thumbnail then
|
|
|
|
+ if txconf.thumbnail.ext then
|
|
|
|
+ dest_fname = path.splitext(dest_fname) .. txconf.thumbnail.ext
|
|
end
|
|
end
|
|
- dest_dir = plpath.join(
|
|
|
|
- M.media_dir, "tn", dest_fname:sub(1, 2), dest_fname:sub(3, 4))
|
|
|
|
- dir.makepath(dest_dir)
|
|
|
|
- dest = plpath.join(dest_dir, dest_fname)
|
|
|
|
- assert(transformers[txconf.fn](
|
|
|
|
- res_path[1], dest, table.unpack(txconf or NT)))
|
|
|
|
- tn = dest:gsub(M.media_dir, "/media/tn")
|
|
|
|
|
|
+ dest = pkar.gen_pairtree(TN_FS_PATH, dest_fname)
|
|
|
|
+ assert(transformers[txconf.thumbnail.fn](
|
|
|
|
+ res_path[1], dest, table.unpack(txconf.thumbnail or NT)))
|
|
|
|
+ tn = dest:gsub(M.media_dir, TN_WEB_PATH)
|
|
logger:info("Thumbnail: ", tn)
|
|
logger:info("Thumbnail: ", tn)
|
|
end
|
|
end
|
|
|
|
|
|
out_html = templates.ores.data({
|
|
out_html = templates.ores.data({
|
|
--webroot = M.webroot,
|
|
--webroot = M.webroot,
|
|
site_title = pkar.config.site.title or pkar.default_title,
|
|
site_title = pkar.config.site.title or pkar.default_title,
|
|
- pname = plpath.basename(techmd["pas:sourcePath"][1]),
|
|
|
|
|
|
+ fname = path.basename(techmd.source_path[1]),
|
|
head_tpl = templates.head.data,
|
|
head_tpl = templates.head.data,
|
|
header_tpl = templates.header.data,
|
|
header_tpl = templates.header.data,
|
|
mconf = mconf,
|
|
mconf = mconf,
|
|
@@ -270,7 +298,7 @@ local function generate_ores(s, mconf)
|
|
rel = rel,
|
|
rel = rel,
|
|
ls_next = ls_next,
|
|
ls_next = ls_next,
|
|
breadcrumbs = get_breadcrumbs(mconf),
|
|
breadcrumbs = get_breadcrumbs(mconf),
|
|
- deliverable = deliverable,
|
|
|
|
|
|
+ pres = pres,
|
|
thumbnail = tn,
|
|
thumbnail = tn,
|
|
rdf_href = pkar.gen_pairtree("/res", s.data, ".ttl", true),
|
|
rdf_href = pkar.gen_pairtree("/res", s.data, ".ttl", true),
|
|
})
|
|
})
|
|
@@ -287,7 +315,7 @@ end
|
|
M.generate_res_idx = function(s, mconf)
|
|
M.generate_res_idx = function(s, mconf)
|
|
local rrep = {
|
|
local rrep = {
|
|
id = nsm.denormalize_uri(s.data),
|
|
id = nsm.denormalize_uri(s.data),
|
|
- tn = get_tn_url(s):gsub(M.media_dir, "/media/tn"),
|
|
|
|
|
|
+ tn = get_tn_url(s),
|
|
href = pkar.gen_pairtree("/res", s.data, ".html", true),
|
|
href = pkar.gen_pairtree("/res", s.data, ".html", true),
|
|
}
|
|
}
|
|
|
|
|
|
@@ -296,7 +324,7 @@ M.generate_res_idx = function(s, mconf)
|
|
local function format_value(pname, o)
|
|
local function format_value(pname, o)
|
|
logger:debug("Adding value to " .. pname .. ": " .. ((o or NT).data or "nil"))
|
|
logger:debug("Adding value to " .. pname .. ": " .. ((o or NT).data or "nil"))
|
|
local v
|
|
local v
|
|
- if pname == "rdf:type" or pname == "pas:contentType" then
|
|
|
|
|
|
+ if pname == "type" or pname == "content_type" then
|
|
v = nsm.denormalize_uri(o.data)
|
|
v = nsm.denormalize_uri(o.data)
|
|
else v = o.data
|
|
else v = o.data
|
|
end
|
|
end
|
|
@@ -357,16 +385,17 @@ end
|
|
M.generate_resource = function(s)
|
|
M.generate_resource = function(s)
|
|
local res_type
|
|
local res_type
|
|
_, res_type = next(repo.gr:attr(s, pkar.CONTENT_TYPE_P))
|
|
_, res_type = next(repo.gr:attr(s, pkar.CONTENT_TYPE_P))
|
|
- local mconf = model.models[res_type.data]
|
|
|
|
|
|
+ local mconf = model.from_uri(res_type)
|
|
|
|
|
|
-- Generate RDF/Turtle doc.
|
|
-- Generate RDF/Turtle doc.
|
|
local res_path = pkar.gen_pairtree(M.res_dir, s.data, ".ttl")
|
|
local res_path = pkar.gen_pairtree(M.res_dir, s.data, ".ttl")
|
|
|
|
+ dir.makepath(path.dirname(res_path))
|
|
local ofh = assert(io.open(res_path, "w"))
|
|
local ofh = assert(io.open(res_path, "w"))
|
|
- ofh:write(repo.serialze_rsrc(s, "ttl"))
|
|
|
|
|
|
+ ofh:write(repo.serialize_rsrc(s, "ttl"))
|
|
ofh:close()
|
|
ofh:close()
|
|
|
|
|
|
-- Generate HTML doc.
|
|
-- Generate HTML doc.
|
|
- if mconf.types["pas:File"] then assert(generate_ores(s, mconf))
|
|
|
|
|
|
+ if mconf.types.file then assert(generate_ores(s, mconf))
|
|
else assert(generate_dres(s, mconf)) end
|
|
else assert(generate_dres(s, mconf)) end
|
|
|
|
|
|
-- Generate JSON rep and append to search index.
|
|
-- Generate JSON rep and append to search index.
|
|
@@ -418,19 +447,19 @@ M.generate_idx = function()
|
|
term.new_iriref_ns("pas:Artifact"), triple.POS_O
|
|
term.new_iriref_ns("pas:Artifact"), triple.POS_O
|
|
)
|
|
)
|
|
for _, s in pairs(s_ts) do
|
|
for _, s in pairs(s_ts) do
|
|
- local title, created
|
|
|
|
|
|
+ local title, submitted
|
|
_, title = next(repo.gr:attr(s, pkar.DC_TITLE_P))
|
|
_, title = next(repo.gr:attr(s, pkar.DC_TITLE_P))
|
|
- _, created = next(repo.gr:attr(s, pkar.DC_CREATED_P))
|
|
|
|
|
|
+ _, submitted = next(repo.gr:attr(s, pkar.SUBMITTED_P))
|
|
|
|
|
|
local obj = {
|
|
local obj = {
|
|
href = pkar.gen_pairtree("/res", s.data, ".html", true),
|
|
href = pkar.gen_pairtree("/res", s.data, ".html", true),
|
|
title = title,
|
|
title = title,
|
|
- created = created.data,
|
|
|
|
- tn = get_tn_url(s):gsub(M.media_dir, "/media/tn"),
|
|
|
|
|
|
+ submitted = submitted.data,
|
|
|
|
+ tn = get_tn_url(s),
|
|
}
|
|
}
|
|
table.insert(obj_idx, obj)
|
|
table.insert(obj_idx, obj)
|
|
end
|
|
end
|
|
- table.sort(obj_idx, function(a, b) return a.created < b.created end)
|
|
|
|
|
|
+ table.sort(obj_idx, function(a, b) return a.submitted < b.submitted end)
|
|
|
|
|
|
logger:debug(pp.write(obj_idx))
|
|
logger:debug(pp.write(obj_idx))
|
|
out_html = templates.idx.data({
|
|
out_html = templates.idx.data({
|
|
@@ -443,7 +472,7 @@ M.generate_idx = function()
|
|
obj_idx = obj_idx,
|
|
obj_idx = obj_idx,
|
|
})
|
|
})
|
|
|
|
|
|
- local idx_path = plpath.join(pkar.config.htmlgen.out_dir, "index.html")
|
|
|
|
|
|
+ local idx_path = path.join(pkar.config.htmlgen.out_dir, "index.html")
|
|
local ofh = assert(io.open(idx_path, "w"))
|
|
local ofh = assert(io.open(idx_path, "w"))
|
|
|
|
|
|
logger:debug("Writing info at ", idx_path)
|
|
logger:debug("Writing info at ", idx_path)
|
|
@@ -458,14 +487,12 @@ M.generate_site = function()
|
|
-- Reset target folders.
|
|
-- Reset target folders.
|
|
-- TODO for larger sites, a selective update should be implemented by
|
|
-- TODO for larger sites, a selective update should be implemented by
|
|
-- comparing RDF resource timestamps with HTML page timestamps. Post-MVP.
|
|
-- comparing RDF resource timestamps with HTML page timestamps. Post-MVP.
|
|
- if plpath.isdir(M.res_dir) then dir.rmtree(M.res_dir) end
|
|
|
|
- dir.makepath(M.res_dir)
|
|
|
|
|
|
+ if path.isdir(pkar.config.htmlgen.out_dir) then
|
|
|
|
+ dir.rmtree(pkar.config.htmlgen.out_dir) end
|
|
--[[
|
|
--[[
|
|
- if plpath.isdir(M.asset_dir) then dir.rmtree(M.asset_dir) end
|
|
|
|
|
|
+ if path.isdir(M.asset_dir) then dir.rmtree(M.asset_dir) end
|
|
dir.makepath(M.asset_dir)
|
|
dir.makepath(M.asset_dir)
|
|
--]]
|
|
--]]
|
|
- if plpath.isdir(M.media_dir) then dir.rmtree(M.media_dir) end
|
|
|
|
- dir.makepath(plpath.join(M.media_dir, "tn"))
|
|
|
|
|
|
|
|
-- Copy static assets.
|
|
-- Copy static assets.
|
|
dir.clonetree("templates/assets", M.asset_dir, dir.copyfile)
|
|
dir.clonetree("templates/assets", M.asset_dir, dir.copyfile)
|