satelito

Static [web] site (or page) generator (ssg) made with Lua script.
git clone git://soucy.cc/satelito.git
Log | Files | Refs | README

commit 1f9b42ba50e05ab1301d97480f84845e9a27fa6a
parent 344e4a682b8d8d86d6ce06cf439667feb3609ba9
Author: Hugo Soucy <hugo@soucy.cc>
Date:   Fri,  9 Apr 2021 14:40:45 -0400

Remove unused method

Diffstat:
Msatelito/template.lua | 63---------------------------------------------------------------
1 file changed, 0 insertions(+), 63 deletions(-)

diff --git a/satelito/template.lua b/satelito/template.lua @@ -1,25 +1,9 @@ -- @module template local template = {} -- -local etlua = require 'etlua' local lume = require 'satelito.lib.lume.lume' -local dirtree = require 'satelito.dirtree' -local file = require 'satelito.file' -local site = require 'satelito.site' -local inspect = require 'inspect' -- Find the path to a template file from his name -local function find_template(templatedir, templatename) - return lume.match( - -- Make an array with all template files - lume.array(dirtree.get(templatedir)), - function(tpl) - -- Try to find a match - return string.gsub(tpl, '(.*/)(.*)', '%2') == templatename .. '.html' - end - ) -end - function template.find(templates, templatename) local _template = lume.match( templates, @@ -32,51 +16,4 @@ function template.find(templates, templatename) return _template end -function template.set_post(parameters, filepath) - local config = assert(site.set_config(filepath)) - local post_template = assert(parameters.posttype and parameters.posttype or parameters.template or 'default') - local templates_dir = assert(site.get_root(filepath) .. '/' .. config.paths.templates) - local template_file = assert( - find_template(templates_dir, post_template) or find_template(templates_dir, 'default'), - 'The template of this type of post (' .. post_template .. '.html) is missing!' - ) - - return etlua.compile(file.read(template_file)) -end - -function template.set_layout(parameters, filepath) - local config = assert(site.set_config(filepath)) - local layout = assert(parameters.layout and parameters.layout or 'layout') - local templates_dir = assert(site.get_root(filepath) .. '/' .. config.paths.templates) - local template_file = assert(find_template(templates_dir, layout), 'The "layout.html" template is missing!') - - return etlua.compile(file.read(template_file)) -end - -function template.set_head(filepath) - local config = assert(site.set_config(filepath)) - local templates_dir = assert(site.get_root(filepath) .. '/' .. config.paths.templates) - local template_file = assert(find_template(templates_dir, 'head'), 'The "head.html" template is missing!') - - return etlua.compile(file.read(template_file)) -end - -function template.set_navigation(filepath) - local config = assert(site.set_config(filepath)) - local templates_dir = assert(site.get_root(filepath) .. '/' .. config.paths.templates) - local template_file = assert( - find_template(templates_dir, 'navigation'), 'The "navigation.html" template is missing!' - ) - - return etlua.compile(file.read(template_file)) -end - -function template.set_feed(filepath) - local config = assert(site.set_config(filepath)) - local templates_dir = assert(site.get_root(filepath) .. '/' .. config.paths.templates) - local template_file = assert(find_template(templates_dir, 'feed.xml'), 'The "feed.xml" template is missing!') - - return etlua.compile(file.read(template_file)) -end - return template