ferron

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

commit 460f5fc1feaf15562fe9a0cd5e49f48a834a35a9
parent 02f78031ca87c8f3fde41642b2ef73b073ff68b0
Author: Hugo Soucy <hugo@soucy.cc>
Date:   Sun, 15 Apr 2018 12:22:11 -0400

Add `lua-slugify` for create the slug in `content.lua`

Diffstat:
A.gitmodules | 3+++
Mferron/content.lua | 5++---
Aferron/utilities/lua-slugify | 1+
3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/.gitmodules b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "ferron/utilities/lua-slugify"] + path = ferron/utilities/lua-slugify + url = git@github.com:hs0ucy/lua-slugify.git diff --git a/ferron/content.lua b/ferron/content.lua @@ -5,6 +5,7 @@ -- Required Packages local path = require "path" local fileutils = require "ferron.utilities.file-utils" +local slugify = require "ferron.utilities.lua-slugify.slugify" local tableutils = require "ferron.utilities.table-utils" local templateutils = require "ferron.utilities.template-utils" @@ -66,9 +67,7 @@ function content.makecontent(contenttype, contenttitle) local archetypepath = Ferron.site.path .. Ferron.site.siteconfig.paths.archetypes .. "/" archetype.title = title - -- string.gsub(string.gsub(str,"[^ A-Za-z]",""),"[ ]+","-") better for the slug? - -- archetype.filename = string.lower(archetype.title:gsub('%p','-'):gsub('%s','-')) - archetype.filename = (archetype.title:gsub("[%s_]+", "-"):gsub("[^%w%-]+", ""):gsub("-+", "-")):lower() + archetype.filename = slugify(archetype.title) archetype.date = os.date("%Y-%m-%d") archetype.datetime = os.date("%H:%M:%S") archetype.template = archetypetype diff --git a/ferron/utilities/lua-slugify b/ferron/utilities/lua-slugify @@ -0,0 +1 @@ +Subproject commit bc859d92e80fa9dd26d4aff4b9b745d28dd60596