From 655cd79991ec9204afb9f5acf52495c13af14d25 Mon Sep 17 00:00:00 2001 From: sanine Date: Thu, 12 Jan 2023 17:24:25 -0600 Subject: begin go refactor --- plugins/navigation.lua | 0 plugins/toolkit.lua | 42 ------------------------------------------ 2 files changed, 42 deletions(-) delete mode 100644 plugins/navigation.lua delete mode 100644 plugins/toolkit.lua (limited to 'plugins') diff --git a/plugins/navigation.lua b/plugins/navigation.lua deleted file mode 100644 index e69de29..0000000 diff --git a/plugins/toolkit.lua b/plugins/toolkit.lua deleted file mode 100644 index e5f162a..0000000 --- a/plugins/toolkit.lua +++ /dev/null @@ -1,42 +0,0 @@ -local toolkit = {} - -toolkit.file_iterator = function(directory) - local _, files = argent.scanDirectory(directory) - local i = 0 - local n = table.getn(files) - return function() - i = i+1 - if i<=n then return files[i] end - end -end - - -toolkit.basename = function(filename) - return string.gsub(filename, '%.lua$', '') -end - - -local function extract_page(file) - if not string.match(file, '%.lua$') then return nil end - - local success, result = pcall(loadfile(file), 0, 1) - if not success then return nil end - return result -end - -toolkit.pages = function(directory) - page_array = {} - local path = argent.config.site_directory..directory - for file in toolkit.file_iterator(path) do - local page = extract_page(path..file) - if page then - page.href = '/'..directory..toolkit.basename(file)..'.html' - table.insert(page_array, page) - end - end - - return page_array -end - - -return toolkit -- cgit v1.2.1