Return a list comprehension

This commit is contained in:
Catalin Constantin Mititiuc 2025-06-16 20:18:05 -07:00
parent 4cf5ed2aa8
commit a49813e279

View File

@ -91,18 +91,18 @@ sitegen.create =>
@site_title = "WebDevCat.me" @site_title = "WebDevCat.me"
@app_name = "stasis" @app_name = "stasis"
@version = "0.2.12" @version = "0.2.12"
@just_render_the_damn_list = (arg={}, _) => @just_render_the_damn_list = (arg={}, _) =>
posts = [listing_info post for post in *get_posts @, arg.limit] posts = [listing_info post for post in *get_posts @, arg.limit]
html.build -> html.build ->
import section, h3, time, a from tag import section, h3, time, a from tag
return for { :title, :url, :blurb, publish_date: { iso, pretty }} in *posts [section {
section {
h3 { a { title, href: url }} h3 { a { title, href: url }}
time { pretty, datetime: iso } time { pretty, datetime: iso }
"—", blurb, a { "Read post →", class: "read-post-link", href: url } "—", blurb, a { "Read post →", class: "read-post-link", href: url }
} } for { :title, :url, :blurb, publish_date: { iso, pretty }} in *posts]
add_all = (files) -> add_all = (files) ->
for path in *files for path in *files
@ -116,7 +116,6 @@ sitegen.create =>
add "index.html", title: "Catalin Mititiuc" add "index.html", title: "Catalin Mititiuc"
add "blog.html", title: "Posts", target: "posts/index", template: "blog" add "blog.html", title: "Posts", target: "posts/index", template: "blog"
add_all files_from "docs" add_all files_from "docs"
-- add_all files_from "docs", to: "/posts", as: "post"
-- replace post markdown yaml headers with moonscript headers -- replace post markdown yaml headers with moonscript headers
filter "docs", (body) => filter "docs", (body) =>