WIP
This commit is contained in:
parent
544bb20c2d
commit
3c293d2320
@ -2,10 +2,18 @@
|
||||
date: "Thu May 08 2025 19:41:30.000000000"
|
||||
}
|
||||
|
||||
$map{{'one', 'Spades', 3}, {'two', 'Hearts', 4}}[[$1 and $2 or $3]]
|
||||
|
||||
<hr />
|
||||
|
||||
$one{some_var = "paris"}
|
||||
|
||||
$two{limit = "here"}[[the limit is $limit]]
|
||||
|
||||
$three{$some_list}[[say $say]]
|
||||
|
||||
$map{$four{limit = 2}}
|
||||
|
||||
<hr />
|
||||
|
||||
$list3{ limit = 2 }[[
|
||||
|
40
site.moon
40
site.moon
@ -162,14 +162,9 @@ list2 = (args={}) =>
|
||||
url = rootname page\url_for!
|
||||
vals = { title: title, publish_date: pub_date, blurb: blurb, url: url }
|
||||
|
||||
html = page.site\get_renderer "sitegen.renderers.html"
|
||||
page\merge_meta vals
|
||||
page.tpl_scope = page.meta
|
||||
page.template_stack = common.Stack!
|
||||
html\render page, assert args[1] or template, "missing html string"
|
||||
|
||||
return if args[1] then table.concat result else result
|
||||
|
||||
|
||||
one = (template) =>
|
||||
(arg, _has_block) =>
|
||||
common.fill_ignoring_pre template, arg
|
||||
@ -179,6 +174,23 @@ two = (arg, has_block) =>
|
||||
cosmo.yield arg
|
||||
nil -- VERY IMPORTANT!
|
||||
|
||||
three = (arg, has_block) =>
|
||||
common.throw_error "expecting a block" if not has_block
|
||||
{ list } = arg
|
||||
cosmo.yield item for item in *list
|
||||
nil -- VERY IMPORTANT!
|
||||
|
||||
four1 = (template) =>
|
||||
(arg, _has_block) =>
|
||||
{ list } = arg
|
||||
return [common.fill_ignoring_pre template, item for item in *list]
|
||||
|
||||
-- four = (arg) =>
|
||||
-- p arg
|
||||
-- { list } = arg
|
||||
-- p list
|
||||
-- return [common.fill_ignoring_pre template, item for item in *list]
|
||||
|
||||
sitegen.create =>
|
||||
@site_title = "WebDevCat.me"
|
||||
@app_name = "stasis"
|
||||
@ -188,8 +200,24 @@ sitegen.create =>
|
||||
@list2 = list2
|
||||
@list3 = list3
|
||||
|
||||
@some_list = {
|
||||
{say: "this"}
|
||||
{say: "that"}
|
||||
{say: "the other"}
|
||||
}
|
||||
|
||||
@one = one @, [[inline template $some_var]]
|
||||
@two = two
|
||||
@three = three
|
||||
@four = (arg, _) =>
|
||||
pages = @site\query_pages { is_a: "post" }
|
||||
table.sort pages, (a, b) -> a.source > b.source
|
||||
limit_or_page_count = math.min arg.limit or #pages, #pages
|
||||
|
||||
unpack for page in *pages[1, limit_or_page_count]
|
||||
common.fill_ignoring_pre template, listing_info page
|
||||
|
||||
@map = (...) => cosmo.map ...
|
||||
|
||||
add_all = (files) ->
|
||||
for path in *files
|
||||
|
Loading…
x
Reference in New Issue
Block a user