diff --git a/index.html b/index.html index c5c9559..e679bf0 100644 --- a/index.html +++ b/index.html @@ -6,16 +6,6 @@ $render{"templates/wares"}
inline template $title
]] -$each{test2({limit = 2}), "post"}[[$post]] - -$(list_posts1({limit = 2}))[[$title
]] -$each{list_posts2({limit = 2}), "post"}[[$post]] - -$title
]] --- $each{list_posts({limit = 2}), "post"}[[$post]] - --- to inline a template, use like this --- @list_posts = list_posts @ --- and then call from template like this --- $(list_posts({limit = 2}))[[$title
]] --- to pass in a template, use like this --- @list_posts = list_posts @, [[$title
]] --- $each{list_posts({limit = 2}), "post"}[[$post]] +-- setup in create function: +-- +-- sitegen.create => +-- @list_posts = list_posts @, [template] +-- +-- use in templates: +-- +-- `list_posts @` expects $(list_posts({limit = 2}))[[$title
]] +-- `list_posts @, template` expects $each{list_posts({limit = 2}), "post"}[[$post]] list_posts = (template) => (args={}) => pages = @site\query_pages { is_a: "post" } table.sort pages, (a, b) -> a.source > b.source @@ -103,27 +95,6 @@ list_posts = (template) => (args={}) => if template then common.fill_ignoring_pre template, vals else vals --- call like this from a template: $(get_posts())[[$title
]] --- or like this: $(get_posts({limit = 5}))[[$title
]] -get_posts = (args={}) => - pages = @site\query_pages { is_a: "post" } - table.sort pages, (a, b) -> a.source > b.source - limit = math.min args.limit or #pages, #pages - - return for page in *pages[1, limit] - { title: title, id: id, publish_date: date, blurb: blurb } = page.meta - - { - title: title or titleize_slug id - publish_date: date - blurb: blurb - url: rootname page\url_for! - } - -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 -- add a '$titleize' helper function @@ -133,22 +104,13 @@ 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" @version = "0.2.12" - @list_posts = list_posts @ - @list_posts1 = list_posts @ - @list_posts2 = list_posts @, template - @get_posts = get_posts - @test1 = (args) => test @, args - @test2 = (args) => test @, args, [[passed template $title]] - @test3 = test3 + @list_posts = list_posts @, template - add_all = (name="", files) -> + add_all = (name, files) -> for path, target in pairs files id = extract_id path