From 3e4629d92e7e39d3f4895fcf65e0b00ee3baad6e Mon Sep 17 00:00:00 2001 From: Catalin Mititiuc Date: Fri, 9 May 2025 14:21:04 -0700 Subject: [PATCH] WIP: clean up --- site.moon | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/site.moon b/site.moon index 79b9f51..b95247a 100644 --- a/site.moon +++ b/site.moon @@ -13,25 +13,16 @@ split = (str, delimiter="/") -> join = (first, last, delimiter="/") -> table.concat({first, last}, delimiter) target = (path, prefix) -> join(prefix, rootname(last(split path))) +-- posts = (path=".") -> +-- {join(path, file), target(file, "/posts") for file in lfs.dir path when file != "." and file != ".."} + posts = (path=".") -> - {join(path, file), target(file, "/posts") for file in lfs.dir path when file != "." and file != ".."} - -path = "docs" - -names = [file for file in lfs.dir(path) when file != "." and file != ".."] - -tuples = for _, file in ipairs names + files = [file for file in lfs.dir(path) when file != "." and file != ".."] + tuples = for _, file in ipairs files {join(path, file), target(file, "/posts")} - -new_posts = (path=".") -> - t = for _, file in ipairs names - {join(path, file), target(file, "/posts")} - t - -news = new_posts("docs") -posts = {unpack tup for tup in *news} + {unpack tup for tup in *tuples} sitegen.create => @title = "Hello World" add "index.md" - add path, target: target for path, target in pairs posts + add path, target: target for path, target in pairs posts "docs"