satelito

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

commit 267a705e46409e52565bee56c1e78f3d7258ef9a
parent 2c0fd5eccb29c9aa9d1c502eb050fe35deaae519
Author: Hugo Soucy <hugo@soucy.cc>
Date:   Tue,  6 Apr 2021 08:48:50 -0400

Remove the build method

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

diff --git a/satelito/page.lua b/satelito/page.lua @@ -1,11 +1,8 @@ local page = {} -- -local markdown = require 'discount' -- lua-discount local etlua = require 'etlua' local lume = require 'satelito.lib.lume.lume' local file = require 'satelito.file' -local list = require 'satelito.list' -local site = require 'satelito.site' local template = require 'satelito.template' local inspect = require 'inspect' @@ -13,48 +10,6 @@ local inspect = require 'inspect' -- @name page.build -- @param filepath a pathname to a markdown file -- @return a string that is an HTML code block -function page.build(filepath, filemeta) - if file.is_markdown(filepath) then - -- Post - local post_content = { content = assert(markdown(file.read(filepath))) } - local post_meta = filemeta - local post_children = { children = (file.is_index(filepath) and list.build(filepath)) } - local post_template = assert(template.set_post(post_meta, filepath)) - local post_html - - if post_children then - post_html = post_template(lume.extend({}, post_content, post_meta, post_children)) - else - post_html = post_template(lume.extend({}, post_content, post_meta)) - end - - -- Head - local head_template = assert(template.set_head(filepath)) - local head_html = head_template(lume.extend({}, post_meta)) - - -- Navigation - local navigation_template = assert(template.set_navigation(filepath)) - local navigation_html = navigation_template(lume.extend({}, post_meta)) - - -- Page - local page_layout = assert(template.set_layout(post_meta, filepath)) - local page_html = page_layout( - lume.extend({}, - post_meta, - {head = head_html}, - {navigation = navigation_html}, - {post = post_html} - ) - ) - local page_html_path = assert( - site.get_root(filepath) .. '/' .. post_meta.paths.public_html .. post_meta.relpath:match('(.+)%..*') .. '.html' - ) - - return page_html, page_html_path - else - return print("Sorry i have nothing to do ...") - end -end function page.make(filemeta, templates) local post = etlua.compile(file.read(template.find(templates, filemeta.template))) @@ -73,15 +28,4 @@ function page.make(filemeta, templates) return html, html_path end ---- Export an HTML file to a specific location --- @name page.export --- @param htmlpath a pathname to the HTML file --- @param html a string that is an HTML code block --- @return a file.write function -function page.export(htmlpath, html) - file.mkdir(file.get_dirname(htmlpath)) - - return file.write(htmlpath, html) -end - return page