Some refactor

This commit is contained in:
Catalin Constantin Mititiuc 2025-06-16 20:18:05 -07:00
parent ba287b90e5
commit 53e608abd2

View File

@ -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) =>