From 53e608abd29b4785ef61aadd2753bf544ebd5ffb Mon Sep 17 00:00:00 2001 From: Catalin Constantin Mititiuc Date: Mon, 16 Jun 2025 20:18:05 -0700 Subject: [PATCH] Some refactor --- site.moon | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/site.moon b/site.moon index a8bacc5..3f58d3e 100644 --- a/site.moon +++ b/site.moon @@ -51,12 +51,12 @@ extract_date = (source) -> string.match Path.filename(source), "%d+%-%d%d%-%d%d" format_date = (str) -> date(str)\fmt "%b %d, %Y" publish_date = (path) -> format_date extract_date path -sanitize = (filename) -> +strip_date = (filename) -> filename\gsub "#{escape_patt(extract_date(filename) .. "-")}/?", "" target = (path, prefix=".") -> - filename = rootname(last(common.split path, "/")) - Path.join prefix, sanitize(filename) + filename = rootname last common.split path, "/" + Path.join prefix, strip_date filename h = (word) -> word\sub(1, 1)\upper! t = (word) -> word\sub(2, -1)\lower! @@ -130,6 +130,7 @@ sitegen.create => add "index.html", title: "Catalin Mititiuc" add "blog.html", title: "Posts", target: "posts/index", template: "blog" add_all files_from "docs" + -- add_all files_from "docs", to: "/posts", as: "post" -- replace post markdown yaml headers with moonscript headers filter "docs", (body) =>