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> <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>]] $(list_posts1({limit = 2}))[[<p>$title</p>]]
$each{list_posts2({limit = 2}), "post"}[[$post]] $each{list_posts2({limit = 2}), "post"}[[$post]]

View File

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