ferron

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

commit 07baea4b8aaf1553f7d4fb175dae9693cca25279
Author: Hugo Soucy <hugo@soucy.cc>
Date:   Fri, 17 Nov 2017 21:11:58 -0500

Make the first commit.

Diffstat:
Aconfig.lua | 13+++++++++++++
Aferron | 3+++
Aferron.lua | 50++++++++++++++++++++++++++++++++++++++++++++++++++
Afunctions/create-archetype-content.lua | 47+++++++++++++++++++++++++++++++++++++++++++++++
Afunctions/exec.lua | 14++++++++++++++
Afunctions/file-utils.lua | 76++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Afunctions/get-archetypes.lua | 21+++++++++++++++++++++
Afunctions/get-sites.lua | 28++++++++++++++++++++++++++++
Afunctions/make-atom-feed.lua | 32++++++++++++++++++++++++++++++++
Afunctions/make-lists-of-pages.lua | 65+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Afunctions/make-pages.lua | 61+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Afunctions/move-to-publichtml.lua | 44++++++++++++++++++++++++++++++++++++++++++++
Afunctions/set-site.lua | 26++++++++++++++++++++++++++
Afunctions/string-utils.lua | 17+++++++++++++++++
Afunctions/table-utils.lua | 60++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Afunctions/template-utils.lua | 20++++++++++++++++++++
Asites/.gitignore | 6++++++
Asites/samplesite.tld/content/index.json | 10++++++++++
Asites/samplesite.tld/content/index.md | 7+++++++
Asites/samplesite.tld/public_html/.gitignore | 5+++++
Asites/samplesite.tld/site.config.lua | 38++++++++++++++++++++++++++++++++++++++
Asites/samplesite.tld/static/css/style.css | 461+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asites/samplesite.tld/templates/default-index.mustache | 20++++++++++++++++++++
Asites/samplesite.tld/templates/default.mustache | 14++++++++++++++
Asites/samplesite.tld/templates/partials/footer.mustache | 5+++++
Asites/samplesite.tld/templates/partials/head.mustache | 23+++++++++++++++++++++++
26 files changed, 1166 insertions(+), 0 deletions(-)

diff --git a/config.lua b/config.lua @@ -0,0 +1,13 @@ +-- +-- FakeStache SSG Configuration File +-- +local lfs = require("lfs") + +local config = { + paths = { + functions = lfs.currentdir() .. "/functions", + sites = lfs.currentdir() .. "/sites" + } +} + +return config diff --git a/ferron b/ferron @@ -0,0 +1,3 @@ +#!/usr/bin/env lua53 + +print("!!! !!!") diff --git a/ferron.lua b/ferron.lua @@ -0,0 +1,50 @@ +-- +-- Ferron SSG +-- + +-- Init the main module +Ferron = {} + +local Ferron = Ferron + +inspect = require("inspect") +--local iconv = require("iconv") + +-- Ferron submodules +local config = require("config") +local getsites = require("functions.get-sites") +local getarchetypes = require("functions.get-archetypes") +local setsite = require("functions.set-site") +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 movetopublichtml = require("functions.move-to-publichtml") +local exec = require("functions.exec") + +Ferron.config = config +Ferron.sites = {} +Ferron.sitesarray = {} +Ferron.site = {} +Ferron.archetypes = {} +Ferron.devmode = (arg[1] == "--dev" and true or false) + +Ferron.initfunctions = { + getsites, + setsite, + getarchetypes, + createarchetypecontent +} + +Ferron.buildfunctions = { + makepages, + makelistsofpages, + makeatomfeed, + movetopublichtml +} + +exec(Ferron.initfunctions, Ferron.buildfunctions) + +-- print(inspect(Ferron.site)) + +return Ferron diff --git a/functions/create-archetype-content.lua b/functions/create-archetype-content.lua @@ -0,0 +1,47 @@ +-- +local fileutils = require("functions.file-utils") +local path = require("path") +local tableutils = require("functions.table-utils") +local templateutils = require("functions.template-utils") + +local function createarchetypecontent() + if tableutils.hasvalue(Ferron.archetypes, arg[1]) and type(arg[2]) == "string" then + local archetype = {} + local contentpath = Ferron.site.path .. Ferron.site.config.SITE.PATHS.CONTENT .. "/" .. arg[1] .. "/" .. os.date("%Y") .."/"..os.date("%m") .. "/" + local archetypepath = Ferron.site.path .. Ferron.site.config.SITE.PATHS.ARCHETYPES .. "/" + + archetype.title = arg[2] + archetype.filename = string.lower(archetype.title:gsub('%p','-'):gsub('%s','-')) + archetype.date = os.date("%Y-%m-%d") + archetype.datetime = os.date("%H:%M:%S") + archetype.template = arg[1] + + if path.isdir(contentpath) == false then + fileutils.mkdir(contentpath) + end + + -- Build the markdown file + fileutils.pushfilecontent( + contentpath .. archetype.filename .. ".md", + templateutils.setmustache( + fileutils.pullfilecontent(archetypepath .. arg[1] .. ".md" ), + Ferron.site.path .. Ferron.site.config.SITE.PATHS.TEMPLATES .. "/partials", + archetype + ) + ) + + -- Build the JSON file + fileutils.pushfilecontent( + contentpath .. archetype.filename .. ".json", + templateutils.setmustache( + fileutils.pullfilecontent(archetypepath .. arg[1] .. ".json"), + Ferron.site.path .. Ferron.site.config.SITE.PATHS.TEMPLATES .. "/partials", + archetype + ) + ) + + os.exit() + end +end + +return createarchetypecontent diff --git a/functions/exec.lua b/functions/exec.lua @@ -0,0 +1,14 @@ +-- +local function exec(...) + for argkey, argval in pairs({...}) do + if type(argval) == "table" then + for funckey, funcval in ipairs(argval) do + if type(funcval) == "function" then + funcval() + end + end + end + end +end + +return exec diff --git a/functions/file-utils.lua b/functions/file-utils.lua @@ -0,0 +1,76 @@ +-- +local lfs = require("lfs") + +local fileutils = {} + +-- loadlocalconfig +function fileutils.loadlocalconfig(file) + local env = {} + local chunk, err = loadfile(file, 'bt', env) + + if not err then + chunk() + end + + return env, err +end + +-- getdirtree +function fileutils.getdirtree(dir) + assert(dir and dir ~= "", "directory parameter is missing or empty") + + if string.sub(dir, -1) == "/" then + dir = string.sub(dir, 1, -2) + end + + local function yieldtree(dir) + for entry in lfs.dir(dir) do + if entry ~= "." and entry ~= ".." then + entry = dir.."/"..entry + + local attr = lfs.attributes(entry) + + coroutine.yield(entry,attr) + + if attr.mode == "directory" then + yieldtree(entry) + end + end + end + end + + return coroutine.wrap(function() yieldtree(dir) end) +end + +-- mkdir +function fileutils.mkdir(path) + local sep, pStr = package.config:sub(1, 1), "" + + for dir in path:gmatch("[^" .. sep .. "]+") do + pStr = pStr .. sep .. dir + + lfs.mkdir(pStr) + end +end + +-- pullfilecontent +function fileutils.pullfilecontent(pathtofile) + local file = assert(io.open(pathtofile, "r")) + local content = file:read "*a" + + file:close() + + return content +end + +-- pushfilecontent +function fileutils.pushfilecontent(pathtofile, data) + local file = io.open(pathtofile, "w+") + + file:write(data) + file:close() +end + + +-- Export `fileutils` module +return fileutils diff --git a/functions/get-archetypes.lua b/functions/get-archetypes.lua @@ -0,0 +1,21 @@ +-- +local path = require("path") +local fileutils = require("functions.file-utils") + +local function getarchetypes() + local archetypesdir = Ferron.site.path .. Ferron.site.config.SITE.PATHS.ARCHETYPES + + if path.isdir(archetypesdir) then + for archetype, attr in fileutils.getdirtree(archetypesdir) do + if attr.mode ~= "directory" + and archetype:match("^.+(%..+)$") == ".json" + then + Ferron.archetypes[#Ferron.archetypes+1] = archetype:match("^.+/(.+)$"):match("(.+)%..*") + end + end + + return Ferron.archetypes + end +end + +return getarchetypes diff --git a/functions/get-sites.lua b/functions/get-sites.lua @@ -0,0 +1,28 @@ +-- +local path = require("path") +local fileutils = require("functions.file-utils") + +local function getsites() + -- Create a table with the content of `Ferron.config.paths.sites` + for site in path.each(Ferron.config.paths.sites .. "/*", "f", {delay = true; reverse = true;}) do + if path.isdir(site) then + -- Load site configuration + local siteconfig, siteconfig_err = fileutils.loadlocalconfig(site .. "/site.config.lua") + + -- Create a table with the basic infos of the site + Ferron.sites[site:match("^.+/(.+)$")] = { + path = site, + config = siteconfig, + pagestable = {} + } + + -- Create a simple array with the name of the sites + Ferron.sitesarray[#Ferron.sitesarray+1] = site:match("^.+/(.+)$") + + end + end + + return Ferron.sites, Ferron.sitesarray +end + +return getsites diff --git a/functions/make-atom-feed.lua b/functions/make-atom-feed.lua @@ -0,0 +1,32 @@ +-- +local path = require("path") +local fileutils = require("functions.file-utils") +local tableutils = require("functions.table-utils") +local templateutils = require("functions.template-utils") + +local function makeatomfeed() + local feed = {} + local feedtemplate = path.isfile(Ferron.site.path .. Ferron.site.config.SITE.PATHS.TEMPLATES .. "/feed.mustache") + local feedpartials = path.isdir(Ferron.site.path .. Ferron.site.config.SITE.PATHS.TEMPLATES .. "/partials") + local feedfile = Ferron.site.path .. Ferron.site.config.SITE.PATHS.HTML .. "/feed.atom.xml" + + feed["SITE"] = Ferron.site.config.SITE + feed["entries"] = {} + + for k, v in tableutils.sortdescendingpairs(Ferron.site.pagestable) do + table.insert(feed["entries"], v) + end + + -- Build the Atom XML file + fileutils.pushfilecontent( + feedfile, + templateutils.setmustache( + fileutils.pullfilecontent(feedtemplate), + feedpartials, + feed + ) + ) + +end + +return makeatomfeed diff --git a/functions/make-lists-of-pages.lua b/functions/make-lists-of-pages.lua @@ -0,0 +1,65 @@ +-- +local json = require("dkjson") +local markdown = require("markdown") +local path = require("path") +local fileutils = require("functions.file-utils") +local tableutils = require("functions.table-utils") +local templateutils = require("functions.template-utils") + +local function makelistsofpages() + for file, attr in fileutils.getdirtree(Ferron.site.path .. Ferron.site.config.SITE.PATHS.CONTENT) do + if attr.mode ~= "directory" + and file:match("^.+/(.+)$") == "index.md" + and file ~= Ferron.site.path .. Ferron.site.config.SITE.PATHS.CONTENT .. "/index.md" + then + local listindex = file + local listindex_section = path.dirname(listindex):match("^.+/(.+)$") + local listindex_table = {} + local listindex_metadatas = json.decode(fileutils.pullfilecontent(listindex:match("(.+)%..*") .. ".json")) + + -- Convert the markdown file to HTML + listindex_metadatas.content = markdown(fileutils.pullfilecontent(listindex)) + + listindex_table = listindex_metadatas + listindex_table["SITE"] = Ferron.site.config.SITE + listindex_table["entries"] = {} + + for k, v in tableutils.sortdescendingpairs(Ferron.site.pagestable) do + local date, datetime, section, relpath = k:match("(.-)|(.-)|(.-)|(.-)$") + + if section == listindex_section then + table.insert(listindex_table["entries"], v) + end + end + + -- 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(listindex) .. "/*", "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 .. "/" .. listindex_section):len() + 1), path.dirname(listindex) .. "/" .. f:match("^.+/(.+)$"), true) + end + end, + {recurse = true} + ) + + -- Build the HTML file + fileutils.pushfilecontent( + listindex:match("(.+)%..*") .. ".html", + templateutils.setmustache( + fileutils.pullfilecontent(Ferron.site.path .. Ferron.site.config.SITE.PATHS.TEMPLATES .. "/" .. listindex_metadatas.template .. ".mustache"), + Ferron.site.path .. Ferron.site.config.SITE.PATHS.TEMPLATES .. "/partials", + listindex_table + ) + ) + + -- Update the JSON file data + listindex_metadatas["entries"] = nil + listindex_metadatas["SITE"] = nil + fileutils.pushfilecontent(listindex:match("(.+)%..*") .. ".json", json.encode(listindex_metadatas, {indent = true})) + end + end +end + +return makelistsofpages diff --git a/functions/make-pages.lua b/functions/make-pages.lua @@ -0,0 +1,61 @@ +-- +local json = require("dkjson") +local markdown = require("markdown") +local path = require("path") +local fileutils = require("functions.file-utils") +local templateutils = require("functions.template-utils") + +local function makepages() + -- Loop in the content directory + for file, attr in fileutils.getdirtree(Ferron.site.path .. Ferron.site.config.SITE.PATHS.CONTENT) do + if attr.mode ~= "directory" + and file:match("^.+(%..+)$") == ".md" + and file:match("^.+/(.+)$") ~= "index.md" + or file == Ferron.site.path .. Ferron.site.config.SITE.PATHS.CONTENT .. "/index.md" + then + local md = file + local md_noextension = md:match("(.+)%..*") + local md_plainname = md:match("^.+/(.+)$"):match("(.+)%..*") + local md_folder = path.dirname(md) + local md_relpath = md_noextension:sub((Ferron.site.path .. Ferron.site.config.SITE.PATHS.CONTENT):len() + 1) + local md_section = md_relpath:match("/(%a-)/") + local md_metadatas = json.decode(fileutils.pullfilecontent(md_noextension .. ".json")) + local md_updated = os.date("%Y-%m-%dT%H:%M:%S", attr.modification) + local md_id = "tag:" .. Ferron.site.config.SITE.DOMAINNAME .. "," .. md_metadatas.date .. ":" .. string.sub(md_metadatas.date, 0, 4) .. "/" .. string.sub(md_metadatas.date, 6, 7) .. "/" .. md_plainname + local md_key = md_metadatas.date .. "|" .. md_metadatas.datetime .. "|" .. (md_section ~= nil and md_section or "root") .. "|" .. md_relpath + local md_table = {} + + -- Convert the markdown file to HTML + md_metadatas.content = markdown(fileutils.pullfilecontent(md)) + + md_metadatas.section = md_section + md_metadatas.updated = md_updated + md_metadatas.id = md_id + md_metadatas.permalink = (Ferron.devmode == true and Ferron.site.config.SITE.URLDEV or Ferron.site.config.SITE.URL) .. md_relpath .. ".html" + + Ferron.site.pagestable[md_key] = md_metadatas + + md_table = md_metadatas + md_table["SITE"] = Ferron.site.config.SITE + + -- Build the HTML file + fileutils.pushfilecontent( + md_noextension .. ".html", + templateutils.setmustache( + fileutils.pullfilecontent(Ferron.site.path .. Ferron.site.config.SITE.PATHS.TEMPLATES .. "/" .. md_metadatas.template .. ".mustache"), + Ferron.site.path .. Ferron.site.config.SITE.PATHS.TEMPLATES .. "/partials", + md_table + ) + ) + + -- Update the JSON file data + md_metadatas["SITE"] = nil + fileutils.pushfilecontent(md_noextension .. ".json", json.encode(md_metadatas, {indent = true})) + + end + end + + return (type(callback) == "function" and callback() or nil) +end + +return makepages diff --git a/functions/move-to-publichtml.lua b/functions/move-to-publichtml.lua @@ -0,0 +1,44 @@ +-- +local path = require("path") + +local function movetopublichtml() + -- Copy the entire `SITE.PATHS.CONTENT` folder in `SITE.PATHS.HTML` + path.copy(Ferron.site.path .. Ferron.site.config.SITE.PATHS.CONTENT .. "/*", Ferron.site.path .. Ferron.site.config.SITE.PATHS.HTML, {recurse = true}) + + -- Then remove all non Web files + path.each( + Ferron.site.path .. Ferron.site.config.SITE.PATHS.HTML .. "/*", "f", + function(f) + if path.extension(f) == ".md" + or path.extension(f) == ".json" + then + path.remove(f) + end + end, + { + delay = true; -- use snapshot of directory + recurse = true; -- include subdirs + reverse = true; -- subdirs at first + } + ) + + -- And after that remove all HTML files in the `Ferron.PATHS.CONTENT` folder + path.each( + Ferron.site.path .. Ferron.site.config.SITE.PATHS.CONTENT .. "/*", "f", + function(f) + if path.extension(f) == ".html" then + path.remove(f) + end + end, + { + delay = true; -- use snapshot of directory + recurse = true; -- include subdirs + reverse = true; -- subdirs at first + } + ) + + -- Copy the entire `SITE.PATHS.STATIC` folder in `SITE.PATHS.HTML` + path.copy(Ferron.site.path .. Ferron.site.config.SITE.PATHS.STATIC .. "/*", Ferron.site.path .. Ferron.site.config.SITE.PATHS.HTML, {recurse = true}) +end + +return movetopublichtml diff --git a/functions/set-site.lua b/functions/set-site.lua @@ -0,0 +1,26 @@ +-- +local tableutils = require("functions.table-utils") + +local function setsite() + -- Site chooser: Which site do you want to build? + local answer + + repeat + io.write("Welcome to Ferron! Which site do you want to build? \n") + + for k, v in ipairs(Ferron.sitesarray) do + io.write(k .. ") " .. v .. "\n") + end + + io.write("Please enter the number... \n") + io.flush() + + answer=io.read() + until (tableutils.haskey(Ferron.sitesarray, tonumber(answer))) == true + + Ferron.site = Ferron.sites[Ferron.sitesarray[tonumber(answer)]] + + return Ferron.site +end + +return setsite diff --git a/functions/string-utils.lua b/functions/string-utils.lua @@ -0,0 +1,17 @@ +-- +local stringutils = {} + +--print(string.gsub("J'aime à parler ô grace à toi", "à", "a")) + +-- ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝàáâãäåæçèéêëìíîïðñòóôõöùúûüýþÿ + +-- local charstable = { +-- "ÀÁÂÃÄÅ" = "A", +-- ÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝàáâãäåæçèéêëìíîïðñòóôõöùúûüýþÿ + + + + +-- } + +return stringutils diff --git a/functions/table-utils.lua b/functions/table-utils.lua @@ -0,0 +1,60 @@ +-- +local tableutils = {} + +-- protecttable +function tableutils.protecttable(tbl) + return setmetatable({}, { + __index = tbl, + __newindex = function(t, key, value) + error("attempting to change constant " .. + tostring(key) .. " to " .. tostring(value), 2) + end + }) +end + +-- sortdescendingpairs +function tableutils.sortdescendingpairs(t) + local keys = {} + local i = 0 + + for k in pairs(t) do table.insert(keys, k) end + + table.sort(keys, function(a,b) + if tonumber(a) and tonumber(b) then + return a > b + else + return tostring(a)>tostring(b) + end + end) + + return function() + if i < #keys then + i = i + 1 + return keys[i], t[keys[i]] + end + end +end + +-- hasvalue +function tableutils.hasvalue(tab, val) + for index, value in ipairs(tab) do + if value == val then + return true + end + end + + return false +end + +-- haskey +function tableutils.haskey(tab, key) + for k, v in ipairs(tab) do + if k == key then + return true + end + end + + return false +end + +return tableutils diff --git a/functions/template-utils.lua b/functions/template-utils.lua @@ -0,0 +1,20 @@ +-- +local lustache = require("lustache") +local fileutils = require("functions.file-utils") + +local templateutils = {} + +-- setmustache +function templateutils.setmustache(tpl, partialspath, data) + local partials = {} + + for i,v in ipairs(lustache:parse(tpl)) do + if v.type == ">" then + partials[v.value] = fileutils.pullfilecontent(partialspath .. "/" .. v.value .. ".mustache") + end + end + + return lustache:render(tpl, data, partials) +end + +return templateutils diff --git a/sites/.gitignore b/sites/.gitignore @@ -0,0 +1,6 @@ +# Ignore everything in this directory +* +# Except those files +!.gitignore +!/samplesite.tld +!/samplesite.tld/**/* diff --git a/sites/samplesite.tld/content/index.json b/sites/samplesite.tld/content/index.json @@ -0,0 +1,10 @@ +{ + "id":"tag:samplesite.tld,0000-00-00:0000/00/index", + "content":"\n<h1>Welcome to Ferron SSG</h1>\n\n<p>Sed tamen haec cum ita tutius observentur, quidam vigore artuum inminuto rogati ad nuptias ubi aurum dextris manibus cavatis offertur, inpigre vel usque Spoletium pergunt. haec nobilium sunt instituta.</p>\n\n<p>Illud autem non dubitatur quod cum esset aliquando virtutum omnium domicilium Roma, ingenuos advenas plerique nobilium, ut Homerici bacarum suavitate Lotophagi, humanitatis multiformibus officiis retentabant.</p>\n\n<p>Quibus ita sceleste patratis Paulus cruore perfusus reversusque ad principis castra multos coopertos paene catenis adduxit in squalorem deiectos atque maestitiam, quorum adventu intendebantur eculei uncosque parabat carnifex et tormenta. et ex is proscripti sunt plures actique in exilium alii, non nullos gladii consumpsere poenales. nec enim quisquam facile meminit sub Constantio, ubi susurro tenus haec movebantur, quemquam absolutum.</p>\n\n", + "title":"Welcome to Ferron SSG", + "updated":"2017-11-11T15:18:54", + "date":"0000-00-00", + "datetime":"00:00:00", + "permalink":"http://samplesite.tld/index.html", + "template":"default" +} diff --git a/sites/samplesite.tld/content/index.md b/sites/samplesite.tld/content/index.md @@ -0,0 +1,7 @@ +# Welcome to Ferron SSG + +Sed tamen haec cum ita tutius observentur, quidam vigore artuum inminuto rogati ad nuptias ubi aurum dextris manibus cavatis offertur, inpigre vel usque Spoletium pergunt. haec nobilium sunt instituta. + +Illud autem non dubitatur quod cum esset aliquando virtutum omnium domicilium Roma, ingenuos advenas plerique nobilium, ut Homerici bacarum suavitate Lotophagi, humanitatis multiformibus officiis retentabant. + +Quibus ita sceleste patratis Paulus cruore perfusus reversusque ad principis castra multos coopertos paene catenis adduxit in squalorem deiectos atque maestitiam, quorum adventu intendebantur eculei uncosque parabat carnifex et tormenta. et ex is proscripti sunt plures actique in exilium alii, non nullos gladii consumpsere poenales. nec enim quisquam facile meminit sub Constantio, ubi susurro tenus haec movebantur, quemquam absolutum. diff --git a/sites/samplesite.tld/public_html/.gitignore b/sites/samplesite.tld/public_html/.gitignore @@ -0,0 +1,4 @@ +# Ignore everything in this directory +* +# Except those files +!.gitignore+ \ No newline at end of file diff --git a/sites/samplesite.tld/site.config.lua b/sites/samplesite.tld/site.config.lua @@ -0,0 +1,38 @@ +-- +-- Website Configuration File +-- + +DOMAINNAME = "samplesite.tld" + +SITE = { + DOMAINNAME = DOMAINNAME, + URL = "http://" .. DOMAINNAME, + URLDEV = "http://localhost:8181", + PORTDEV = "8181", + BASEURL = "http://localhost:8181", + LANGUAGE = "fr", + + METAS = { + DESCRIPTION = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit.", + KEYWORDS = "SSG, lua", + GENERATOR = "FakeStache SSG" + }, + + AUTHOR = { + NAME = "John Doe", + JOBTITLE = "Web Developper", + EMAIL = "john@samplesite.tld", + PHONE = "555-555-5555", + LOCALITY ="Quebec city", + REGION = "Qc", + URI = "http://johndoe.tld/#i" + }, + + PATHS = { + ARCHETYPES = "/archetypes", + CONTENT = "/content", + HTML = "/public_html", + STATIC = "/static", + TEMPLATES = "/templates" + } +} diff --git a/sites/samplesite.tld/static/css/style.css b/sites/samplesite.tld/static/css/style.css @@ -0,0 +1,461 @@ +/*! normalize.css v5.0.0 | MIT License | github.com/necolas/normalize.css */ + +/** + * 1. Change the default font family in all browsers (opinionated). + * 2. Correct the line height in all browsers. + * 3. Prevent adjustments of font size after orientation changes in + * IE on Windows Phone and in iOS. + */ + +/* Document + ========================================================================== */ + +html { + font-family: sans-serif; /* 1 */ + line-height: 1.15; /* 2 */ + -ms-text-size-adjust: 100%; /* 3 */ + -webkit-text-size-adjust: 100%; /* 3 */ +} + +/* Sections + ========================================================================== */ + +/** + * Remove the margin in all browsers (opinionated). + */ + +body { + margin: 0; +} + +/** + * Add the correct display in IE 9-. + */ + +article, +aside, +footer, +header, +nav, +section { + display: block; +} + +/** + * Correct the font size and margin on `h1` elements within `section` and + * `article` contexts in Chrome, Firefox, and Safari. + */ + +h1 { + font-size: 2em; + margin: 0.67em 0; +} + +/* Grouping content + ========================================================================== */ + +/** + * Add the correct display in IE 9-. + * 1. Add the correct display in IE. + */ + +figcaption, +figure, +main { /* 1 */ + display: block; +} + +/** + * Add the correct margin in IE 8. + */ + +figure { + margin: 1em 40px; +} + +/** + * 1. Add the correct box sizing in Firefox. + * 2. Show the overflow in Edge and IE. + */ + +hr { + box-sizing: content-box; /* 1 */ + height: 0; /* 1 */ + overflow: visible; /* 2 */ +} + +/** + * 1. Correct the inheritance and scaling of font size in all browsers. + * 2. Correct the odd `em` font sizing in all browsers. + */ + +pre { + font-family: monospace, monospace; /* 1 */ + font-size: 1em; /* 2 */ +} + +/* Text-level semantics + ========================================================================== */ + +/** + * 1. Remove the gray background on active links in IE 10. + * 2. Remove gaps in links underline in iOS 8+ and Safari 8+. + */ + +a { + background-color: transparent; /* 1 */ + -webkit-text-decoration-skip: objects; /* 2 */ +} + +/** + * Remove the outline on focused links when they are also active or hovered + * in all browsers (opinionated). + */ + +a:active, +a:hover { + outline-width: 0; +} + +/** + * 1. Remove the bottom border in Firefox 39-. + * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari. + */ + +abbr[title] { + border-bottom: none; /* 1 */ + text-decoration: underline; /* 2 */ + text-decoration: underline dotted; /* 2 */ +} + +/** + * Prevent the duplicate application of `bolder` by the next rule in Safari 6. + */ + +b, +strong { + font-weight: inherit; +} + +/** + * Add the correct font weight in Chrome, Edge, and Safari. + */ + +b, +strong { + font-weight: bolder; +} + +/** + * 1. Correct the inheritance and scaling of font size in all browsers. + * 2. Correct the odd `em` font sizing in all browsers. + */ + +code, +kbd, +samp { + font-family: monospace, monospace; /* 1 */ + font-size: 1em; /* 2 */ +} + +/** + * Add the correct font style in Android 4.3-. + */ + +dfn { + font-style: italic; +} + +/** + * Add the correct background and color in IE 9-. + */ + +mark { + background-color: #ff0; + color: #000; +} + +/** + * Add the correct font size in all browsers. + */ + +small { + font-size: 80%; +} + +/** + * Prevent `sub` and `sup` elements from affecting the line height in + * all browsers. + */ + +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +sub { + bottom: -0.25em; +} + +sup { + top: -0.5em; +} + +/* Embedded content + ========================================================================== */ + +/** + * Add the correct display in IE 9-. + */ + +audio, +video { + display: inline-block; +} + +/** + * Add the correct display in iOS 4-7. + */ + +audio:not([controls]) { + display: none; + height: 0; +} + +/** + * Remove the border on images inside links in IE 10-. + */ + +img { + border-style: none; +} + +/** + * Hide the overflow in IE. + */ + +svg:not(:root) { + overflow: hidden; +} + +/* Forms + ========================================================================== */ + +/** + * 1. Change the font styles in all browsers (opinionated). + * 2. Remove the margin in Firefox and Safari. + */ + +button, +input, +optgroup, +select, +textarea { + font-family: sans-serif; /* 1 */ + font-size: 100%; /* 1 */ + line-height: 1.15; /* 1 */ + margin: 0; /* 2 */ +} + +/** + * Show the overflow in IE. + * 1. Show the overflow in Edge. + */ + +button, +input { /* 1 */ + overflow: visible; +} + +/** + * Remove the inheritance of text transform in Edge, Firefox, and IE. + * 1. Remove the inheritance of text transform in Firefox. + */ + +button, +select { /* 1 */ + text-transform: none; +} + +/** + * 1. Prevent a WebKit bug where (2) destroys native `audio` and `video` + * controls in Android 4. + * 2. Correct the inability to style clickable types in iOS and Safari. + */ + +button, +html [type="button"], /* 1 */ +[type="reset"], +[type="submit"] { + -webkit-appearance: button; /* 2 */ +} + +/** + * Remove the inner border and padding in Firefox. + */ + +button::-moz-focus-inner, +[type="button"]::-moz-focus-inner, +[type="reset"]::-moz-focus-inner, +[type="submit"]::-moz-focus-inner { + border-style: none; + padding: 0; +} + +/** + * Restore the focus styles unset by the previous rule. + */ + +button:-moz-focusring, +[type="button"]:-moz-focusring, +[type="reset"]:-moz-focusring, +[type="submit"]:-moz-focusring { + outline: 1px dotted ButtonText; +} + +/** + * Change the border, margin, and padding in all browsers (opinionated). + */ + +fieldset { + border: 1px solid #c0c0c0; + margin: 0 2px; + padding: 0.35em 0.625em 0.75em; +} + +/** + * 1. Correct the text wrapping in Edge and IE. + * 2. Correct the color inheritance from `fieldset` elements in IE. + * 3. Remove the padding so developers are not caught out when they zero out + * `fieldset` elements in all browsers. + */ + +legend { + box-sizing: border-box; /* 1 */ + color: inherit; /* 2 */ + display: table; /* 1 */ + max-width: 100%; /* 1 */ + padding: 0; /* 3 */ + white-space: normal; /* 1 */ +} + +/** + * 1. Add the correct display in IE 9-. + * 2. Add the correct vertical alignment in Chrome, Firefox, and Opera. + */ + +progress { + display: inline-block; /* 1 */ + vertical-align: baseline; /* 2 */ +} + +/** + * Remove the default vertical scrollbar in IE. + */ + +textarea { + overflow: auto; +} + +/** + * 1. Add the correct box sizing in IE 10-. + * 2. Remove the padding in IE 10-. + */ + +[type="checkbox"], +[type="radio"] { + box-sizing: border-box; /* 1 */ + padding: 0; /* 2 */ +} + +/** + * Correct the cursor style of increment and decrement buttons in Chrome. + */ + +[type="number"]::-webkit-inner-spin-button, +[type="number"]::-webkit-outer-spin-button { + height: auto; +} + +/** + * 1. Correct the odd appearance in Chrome and Safari. + * 2. Correct the outline style in Safari. + */ + +[type="search"] { + -webkit-appearance: textfield; /* 1 */ + outline-offset: -2px; /* 2 */ +} + +/** + * Remove the inner padding and cancel buttons in Chrome and Safari on macOS. + */ + +[type="search"]::-webkit-search-cancel-button, +[type="search"]::-webkit-search-decoration { + -webkit-appearance: none; +} + +/** + * 1. Correct the inability to style clickable types in iOS and Safari. + * 2. Change font properties to `inherit` in Safari. + */ + +::-webkit-file-upload-button { + -webkit-appearance: button; /* 1 */ + font: inherit; /* 2 */ +} + +/* Interactive + ========================================================================== */ + +/* + * Add the correct display in IE 9-. + * 1. Add the correct display in Edge, IE, and Firefox. + */ + +details, /* 1 */ +menu { + display: block; +} + +/* + * Add the correct display in all browsers. + */ + +summary { + display: list-item; +} + +/* Scripting + ========================================================================== */ + +/** + * Add the correct display in IE 9-. + */ + +canvas { + display: inline-block; +} + +/** + * Add the correct display in IE. + */ + +template { + display: none; +} + +/* Hidden + ========================================================================== */ + +/** + * Add the correct display in IE 10-. + */ + +[hidden] { + display: none; +} diff --git a/sites/samplesite.tld/templates/default-index.mustache b/sites/samplesite.tld/templates/default-index.mustache @@ -0,0 +1,20 @@ +<!DOCTYPE html> +<html lang="{{ SITE.LANGUAGE }}"> + {{> head }} + + <body id="list" class="list"> + <main> + <div> + {{{ content }}} + + <ol class="list__list"> + {{# entries }} + {{{ content }}} + {{/ entries }} + </ol> + </div> + </main> + + {{> footer }} + </body> +</html> diff --git a/sites/samplesite.tld/templates/default.mustache b/sites/samplesite.tld/templates/default.mustache @@ -0,0 +1,14 @@ +<!DOCTYPE html> +<html lang="{{ SITE.LANGUAGE }}"> + {{> head }} + + <body id="single" class="single"> + <article class="h-entry hentry"> + <div class="e-content p-name single"> + {{{ content }}} + + {{> footer }} + </div> + </article> + </body> +</html> diff --git a/sites/samplesite.tld/templates/partials/footer.mustache b/sites/samplesite.tld/templates/partials/footer.mustache @@ -0,0 +1,5 @@ +<footer id="footer"> + <p> + <time datetime="{{ DATE.UPDATE }}T{{ DATE.UPDATETIME }}">{{ DATE.UPDATE }}</time>. + </p> +</footer> diff --git a/sites/samplesite.tld/templates/partials/head.mustache b/sites/samplesite.tld/templates/partials/head.mustache @@ -0,0 +1,23 @@ +<head> + <meta charset="utf-8" /> + <meta http-equiv="X-UA-Compatible" content="IE=edge" /> + <meta name="viewport" content="width=device-width, initial-scale=1" /> + + <title>{{ title }} &mdash; {{ SITE.DOMAINNAME }}</title> + + <link rel="stylesheet" href="{{{ SITE.BASEURL }}}/css/styles.css" /> + <link href="{{{ SITE.BASEURL }}}/feed.atom.xml" rel="alternate" title="Feed de tous les contenus" type="application/atom+xml" /> + <link href="{{ permalink }}" hreflang="{{ SITE.LANGUAGE }}" rel="canonical" /> + + <meta name="robots" content="index, follow" /> + <meta name="author" content="{{ SITE.AUTHOR.NAME }}" /> + <meta name="generator" content="{{ SITE.METAS.GENERATOR }}" /> + + {{# description }} + <meta name="description" content="{{ description }}" /> + {{/ description }} + + {{# keywords }} + <meta name="keywords" content="{{ keywords }}" /> + {{/ keywords }} +</head>