ferron

Ferron is a fast and simple static website generator made with Lua.
Log | Files | Refs | Submodules | README | LICENSE

commit 77475664d716c7862231d8def650e48612a78597
parent e11273df662dae3a96a1f8642e3c998801b78017
Author: Hugo Soucy <hugo@soucy.cc>
Date:   Thu, 23 Nov 2017 08:28:39 -0500

Change a function name.

Diffstat:
Mconfig.lua | 30+++++++++++++++---------------
Mferron.lua | 2++
Mfunctions/make-lists-of-pages.lua | 6+-----
Afunctions/make-non-textuals-exports.lua | 34++++++++++++++++++++++++++++++++++
Dfunctions/make-symlinks-for-non-textuals.lua | 21---------------------
5 files changed, 52 insertions(+), 41 deletions(-)

diff --git a/config.lua b/config.lua @@ -3,28 +3,28 @@ -- local config = { - source = { - url = "https://github.com/hs0ucy/ferron-ssg" - }, + source = { + url = "https://github.com/hs0ucy/ferron-ssg" + }, - description = { - homepage = "https://github.com/hs0ucy/ferron-ssg", - license = "MIT" - }, - + description = { + homepage = "https://github.com/hs0ucy/ferron-ssg", + license = "MIT" + }, + paths = { functions = "./functions", sites = "./sites" }, dependencies = { - "lua ~> 5.3", - "luafilesystem", - "lustache", - "lua-path", - "dkjson", - "markdown", - "mimetype" + "lua ~> 5.3", + "luafilesystem", + "lustache", + "lua-path", + "dkjson", + "markdown", + "mimetype" } } diff --git a/ferron.lua b/ferron.lua @@ -18,6 +18,7 @@ local createarchetypecontent = require("functions.create-archetype-content") local makepages = require("functions.make-pages") local makelistsofpages = require("functions.make-lists-of-pages") local makeatomfeed = require("functions.make-atom-feed") +local makenontextualsexport = require("functions.make-non-textuals-exports") local movetopublichtml = require("functions.move-to-publichtml") local exec = require("functions.exec") @@ -39,6 +40,7 @@ Ferron.buildfunctions = { makepages, makelistsofpages, makeatomfeed, + makenontextualsexport, movetopublichtml } diff --git a/functions/make-lists-of-pages.lua b/functions/make-lists-of-pages.lua @@ -5,7 +5,6 @@ local path = require("path") local fileutils = require("functions.file-utils") local tableutils = require("functions.table-utils") local templateutils = require("functions.template-utils") -local makesymlinksfornontextuals = require("functions.make-symlinks-for-non-textuals") local function makelistsofpages() for file, attr in fileutils.getdirtree(Ferron.site.path .. Ferron.site.config.SITE.PATHS.CONTENT) do @@ -38,10 +37,7 @@ local function makelistsofpages() if section == listindex_section then table.insert(listindex_table["entries"], v) end - end - - -- Create symlinks for images in section's landing page - makesymlinksfornontextuals(listindex, listindex_section) + end if path.isdir(listindex_pathhtml) == false then fileutils.mkdir(listindex_pathhtml) diff --git a/functions/make-non-textuals-exports.lua b/functions/make-non-textuals-exports.lua @@ -0,0 +1,34 @@ +-- +local lfs = require("lfs") +local mimetypes = require('mimetypes') +local path = require("path") +local tableutils = require("functions.table-utils") + +local function makenontextualsexports() + local mimetypes = {"image/svg+xml", "image/jpeg", "image/png"} + + path.each( + Ferron.site.path .. Ferron.site.config.SITE.PATHS.CONTENT .. "/*", "f", + function(f) + if tableutils.hasvalue(mimetypes, mimetypes.guess(f)) then + print(f) + end + end, {recurse = true} + ) + + -- Create symlinks for images in section's landing page + -- @TODO Create a table with all mime/type accpeted instead of a list of extensions + -- path.each( + -- path.dirname(file) .. "/*", "f", + -- function(f) + -- if path.extension(f) == ".jpg" or path.extension(f) == ".png" then + -- print(mimetypes.guess(f)) + -- -- lfs.link("." .. f:sub((Ferron.site.path .. Ferron.site.config.SITE.PATHS.CONTENT .. "/" .. filesection):len() + 1), path.dirname(file) .. "/" .. f:match("^.+/(.+)$"), true) + -- print(f) + -- end + -- end, + -- {recurse = true} + -- ) +end + +return makenontextualsexports diff --git a/functions/make-symlinks-for-non-textuals.lua b/functions/make-symlinks-for-non-textuals.lua @@ -1,21 +0,0 @@ --- -local lfs = require("lfs") -local mimetypes = require('mimetypes') -local path = require("path") - -local function movenontextuals(file, filesection) - -- Create symlinks for images in section's landing page - -- @TODO Create a table with all mime/type accpeted instead of a list of extensions - path.each( - path.dirname(file) .. "/*", "f", - function(f) - if path.extension(f) == ".jpg" or path.extension(f) == ".png" then - -- lfs.link("." .. f:sub((Ferron.site.path .. Ferron.site.config.SITE.PATHS.CONTENT .. "/" .. filesection):len() + 1), path.dirname(file) .. "/" .. f:match("^.+/(.+)$"), true) - print(f) - end - end, - {recurse = true} - ) -end - -return movenontextuals