This commit is contained in:
Catalin Constantin Mititiuc 2025-06-16 20:18:05 -07:00
parent d1339160f0
commit 21a4d933ba
2 changed files with 14 additions and 6 deletions

View File

@ -6,6 +6,11 @@ $render{"templates/wares"}
<h2>Posts</h2>
$({{hi = "there"}})[[$hi]]
$(test1({limit = 2}))[[<p>inline template $title</p>]]
$each{test2({limit = 2}), "post"}[[$post]]
$(list_posts1({limit = 2}))[[<p>$title</p>]]
$each{list_posts2({limit = 2}), "post"}[[$post]]

View File

@ -120,10 +120,9 @@ get_posts = (args={}) =>
url: rootname page\url_for!
}
test = (arg) =>
(a, b, c) =>
p arg
"hi"
test = (args={}, template) =>
vals = { title: "yoayasdf" }
if template then common.fill_ignoring_pre template, vals else { vals }
-- replace '$if' helper function with cosmo's 'cif'
html_renderer.cosmo_helpers.if = (args, has_block) => cosmo.cif args, has_block
@ -134,6 +133,9 @@ documents = (path=".") ->
files = reverse get_files path
{join(path, file), target(file, "/posts") for file in *files}
test3 = (args, template) =>
p two
sitegen.create =>
@site_title = "WebDevCat.me"
@app_name = "stasis"
@ -142,8 +144,9 @@ sitegen.create =>
@list_posts1 = list_posts @
@list_posts2 = list_posts @, template
@get_posts = get_posts
-- @list_posts1 = list_posts @, [[$title]]
-- @list_posts2 = list_posts @
@test1 = (args) => test @, args
@test2 = (args) => test @, args, [[passed template $title]]
@test3 = test3
add_all = (name="", files) ->
for path, target in pairs files