From 6c60c1230e83fb90f2ace58642c23ac7e83080ae Mon Sep 17 00:00:00 2001 From: Catalin Mititiuc Date: Thu, 22 May 2025 16:52:57 -0700 Subject: [PATCH] WIP --- site.moon | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/site.moon b/site.moon index 1413a48..8e9ed57 100644 --- a/site.moon +++ b/site.moon @@ -126,16 +126,19 @@ test = (args={}, has_block) => -- page.template_stack = common.Stack! -- html\render page, assert args[1] or template, "missing html string" +listing_info = (page) -> + { :title, :id, publish_date: pub_date, :blurb } = page.meta + title = title or titleize_slug id + url = rootname page\url_for! + { title: title, publish_date: pub_date, blurb: blurb, url: url } + list3 = (args={}, has_block) => pages = @site\query_pages { is_a: "post" } table.sort pages, (a, b) -> a.source > b.source limit_or_page_count = math.min args.limit or #pages, #pages result = for page in *pages[1, limit_or_page_count] - { :title, :id, publish_date: pub_date, :blurb } = page.meta - title = title or titleize_slug id - url = rootname page\url_for! - vals = { title: title, publish_date: pub_date, blurb: blurb, url: url } + vals = listing_info page if has_block then cosmo.yield vals else common.fill_ignoring_pre template, vals return result unless has_block