sitegen = require "sitegen" tools = require "sitegen.tools" site = require "sitegen.site" lfs = require "lfs" rootname = (str) -> result = string.gsub str, "%..+", "" result split = (str, delimiter="/") -> [capture for capture in string.gmatch str, "[^#{delimiter}]+"] last = (list) -> list[#list] join = (first, last, delimiter="/") -> table.concat {first, last}, delimiter target = (path, prefix) -> join prefix, rootname(last(split path)) posts = (path=".") -> files = [file for file in lfs.dir path when file != "." and file != ".."] {join(path, file), target(file, "/posts") for _, file in ipairs files} -- Change output dir to what Openresty prefers site = site! site.config.out_dir = "html/" css = tools.system_command "cat < %s > %s", "css" sitegen.create => @title = "WebDevCat.me ยท Catalin Mititiuc" @app_name = "stasis" @version = "0.2.12" @val = "yes" add "index.md" add path, target: out, template: "blog" for path, out in pairs posts "docs" build css, "app.css"