diff --git a/blog.html b/blog.html
index f611c0c..3162ebb 100644
--- a/blog.html
+++ b/blog.html
@@ -1,11 +1,3 @@
Posts
$lp
-
-$list_posts[[
-
-]]
diff --git a/index.html b/index.html
index 2dfefb1..a4682a2 100644
--- a/index.html
+++ b/index.html
@@ -6,13 +6,7 @@ $render{"templates/wares"}
Posts
-$list_posts{limit = 5}[[
-
-]]
+$lp{limit = 5}
View more posts
diff --git a/site.moon b/site.moon
index 0de76f4..6171d18 100644
--- a/site.moon
+++ b/site.moon
@@ -5,6 +5,7 @@ html = require "sitegen.html"
cosmo = require "sitegen.cosmo"
date = require "date"
+html_renderer = require "sitegen.renderers.html"
import tag from html
import escape_patt from require "sitegen.common"
import p from require "moon"
@@ -76,7 +77,7 @@ titleize = (word) -> h(word), t(word)
titleize_slug = (slug) ->
words = [{ titleize word } for word in *common.split slug, "-"]
- table.concat [head .. tail for { head, tail } in *words]
+ table.concat [head .. tail for { head, tail } in *words], " "
template = [[
@@ -86,29 +87,16 @@ template = [[
]]
-list_posts = (page, limit) ->
+list_posts = (page, args={}) ->
posts = page.site\query_pages { is_a: "post" }
table.sort posts, (a, b) -> a.source > b.source
- table.concat [cosmo.f(template) {
+ table.concat [common.fill_ignoring_pre template, {
target: meta.target
post_title: meta.title or titleize_slug meta.id
publish_date: publish_date source
blurb: meta.blurb
- } for { meta: meta, source: source } in *posts[1, limit or #posts]]
- -- html.build ->
- -- import section, h3, a, time from tag
- --
- -- [section {
- -- h3 { a { href: meta.target, meta.title or titleize_slug meta.id }}
- -- time { publish_date source }
- -- { "—", if meta.blurb then html.builders.text! meta.blurb }
- -- a { class: "read-post-link", href: meta.target,
- -- "Read post →"
- -- }
- -- } for { meta: meta, source: source } in *posts[1, limit or #posts]]
-
-
+ } for { meta: meta, source: source } in *posts[1, args.limit or #posts]]
list_posts2 = (page, args={}) ->
pages = page.site\query_pages { is_a: "post" }
@@ -123,7 +111,6 @@ list_posts2 = (page, args={}) ->
for post in *posts do cosmo.yield post
-html_renderer = require "sitegen.renderers.html"
html_renderer.cosmo_helpers.if = (args, has_block) => cosmo.cif args, has_block
html_renderer.cosmo_helpers.titleize = (slug) => html.build ->
titleize_slug(slug) if slug
@@ -138,10 +125,10 @@ sitegen.create =>
add "index.html", title: "Catalin Mititiuc"
add "blog.html", title: "Posts", target: "posts/index", template: "blog"
- add "about.html", some: {
- { one: "alpha", two: "beta" },
- { one: "A", two: "B" }
- }, cif: cosmo.cif, math: math, x: 2
+ -- add "about.html", some: {
+ -- { one: "alpha", two: "beta" },
+ -- { one: "A", two: "B" }
+ -- }, cif: cosmo.cif, math: math, x: 2
for path, target in pairs posts "docs"
id = extract_id path