This commit is contained in:
Catalin Constantin Mititiuc 2025-05-22 19:13:02 -07:00
parent 6c60c1230e
commit 544bb20c2d
2 changed files with 23 additions and 0 deletions

View File

@ -2,6 +2,12 @@
date: "Thu May 08 2025 19:41:30.000000000" date: "Thu May 08 2025 19:41:30.000000000"
} }
$one{some_var = "paris"}
$two{limit = "here"}[[the limit is $limit]]
<hr />
$list3{ limit = 2 }[[ $list3{ limit = 2 }[[
<section><h3>$title</h3></section> <section><h3>$title</h3></section>
]] ]]

View File

@ -143,6 +143,11 @@ list3 = (args={}, has_block) =>
return result unless has_block return result unless has_block
-- use in templates -- use in templates
-- $list2{[[<p>$title</p>]], limit = 2} -- $list2{[[<p>$title</p>]], limit = 2}
-- $each{$list2({limit = 3}), "item"}[[$item]] -- $each{$list2({limit = 3}), "item"}[[$item]]
@ -165,6 +170,15 @@ list2 = (args={}) =>
return if args[1] then table.concat result else result return if args[1] then table.concat result else result
one = (template) =>
(arg, _has_block) =>
common.fill_ignoring_pre template, arg
two = (arg, has_block) =>
common.throw_error "expecting a block" if not has_block
cosmo.yield arg
nil -- VERY IMPORTANT!
sitegen.create => sitegen.create =>
@site_title = "WebDevCat.me" @site_title = "WebDevCat.me"
@app_name = "stasis" @app_name = "stasis"
@ -174,6 +188,9 @@ sitegen.create =>
@list2 = list2 @list2 = list2
@list3 = list3 @list3 = list3
@one = one @, [[inline template $some_var]]
@two = two
add_all = (files) -> add_all = (files) ->
for path in *files for path in *files
add path, add path,