summaryrefslogtreecommitdiff
path: root/src/lua-script/script.lua
diff options
context:
space:
mode:
Diffstat (limited to 'src/lua-script/script.lua')
-rw-r--r--src/lua-script/script.lua41
1 files changed, 35 insertions, 6 deletions
diff --git a/src/lua-script/script.lua b/src/lua-script/script.lua
index 733c494..ef2ef8f 100644
--- a/src/lua-script/script.lua
+++ b/src/lua-script/script.lua
@@ -10,7 +10,7 @@ return function(config)
if type(array) ~= 'table' then return nil end
local transform = transform or function(x) return x end
-
+
local set = {}
for _, element in ipairs(array) do
set[transform(element)] = true
@@ -18,6 +18,19 @@ return function(config)
return set
end
+ function set_tostring(set)
+ local str = '[empty]'
+ for element in pairs(set) do
+ if str == '[empty]' then
+ str = tostring(element)
+ else
+ str = str .. '; '.. tostring(element)
+ end
+ end
+
+ return str
+ end
+
function add_end_slash(str)
if type(str) ~= 'string' then return nil end
@@ -33,11 +46,14 @@ return function(config)
function setup(config)
+ argent.log('debug', 'begin setup')
+ local fmt = string.format
+
argent.config = {
site_directory = add_end_slash(config.site_directory) or 'site/',
output_directory = add_end_slash(config.output_directory) or 'public/',
- layout_directory = add_end_slash(config.layout_directory) or 'layouts/',
- plugin_directory = add_end_slash(config.layout_directory) or 'plugins/',
+ layout_directory = add_end_slash(config.layout_directory) or nil,
+ plugin_directory = add_end_slash(config.layout_directory) or nil,
exclude = Set(config.exclude, strip_end_slash) or {},
include = Set(config.include, strip_end_slash) or {},
keep = Set(config.keep, strip_end_slash) or {},
@@ -45,7 +61,21 @@ return function(config)
rss_include = Set(config.rss_include, strip_end_slash) or {},
}
- package.path = argent.config.plugin_directory..'?.lua;'..package.path
+ argent.log('info', fmt('site directory: %s', argent.config.site_directory))
+ argent.log('info', fmt('output directory: %s', argent.config.output_directory))
+ argent.log('info', fmt('layout directory: %s', tostring(argent.config.layout_directory)))
+ argent.log('info', fmt('plugin directory: %s', tostring(argent.config.plugin_directory)))
+
+ argent.log('info', 'exclusions: '..set_tostring(argent.config.exclude))
+ argent.log('info', 'inclusions: '..set_tostring(argent.config.include))
+ argent.log('info', 'files to keep: '..set_tostring(argent.config.keep))
+ argent.log('info', 'noprocess: '..set_tostring(argent.config.noprocess))
+ argent.log('info', 'rss files: '..set_tostring(argent.config.rss_include))
+
+ if argent.config.plugin_directory then
+ package.path = argent.config.plugin_directory..'?.lua;'..package.path
+ end
+ argent.log('debug', 'end setup')
end
@@ -105,7 +135,7 @@ return function(config)
function obliterate_directory(dirname, parent)
local dirname = add_end_slash(dirname) or ''
local parent = parent or ''
-
+
if argent.config.keep[dirname] then return true end
local keep_self = (dirname == '')
@@ -204,4 +234,3 @@ return function(config)
end
process_directory()
end
-