miti.sh/posts.moon
2025-05-12 16:10:12 -07:00

81 lines
2.2 KiB
Plaintext

-- html ->
--
-- posts = [{
-- id: p.meta.id
-- target: p.meta.target
-- source: p.source
-- } for _, p in pairs site.pages when p.meta.template == "blog"]
--
-- require("moon").p posts
-- div { "this is a post" }
-- div { "this anoter post" }
-- date = require "date"
-- return {
-- format: "markdown"
-- title: "My Site's Title"
-- {
-- title: "The First Post"
-- date: date 2011, 11, 26
-- link: "/my-post"
-- description: [[
-- The things I did.
--
-- * ordered pizza
-- * ate it
-- ]]
-- }
-- }
-- <section>
-- <h3>
-- <a href="/posts/publish-markdown-documents-as-static-web-pages-with-pandoc-and-phoenix">
-- Publish Markdown Documents As Static Web Pages with Pandoc and Phoenix
-- </a>
-- </h3>
--
-- <time datetime="2025-01-18">Jan 18, 2025</time>
-- — We thought we wanted a static website generator. It turns out what we really wanted was Phoenix, with an option to convert markdown to HTML. Here is our implementation of a solution, using our very own, recently-released, Pandoc Hex package!
-- <a href="/posts/publish-markdown-documents-as-static-web-pages-with-pandoc-and-phoenix" class="read-post-link">
-- Read post →
-- </a>
-- </section>
date = require "date"
date!
-- return {
-- format: "markdown"
-- title: "My Site's Title"
-- {
-- title: "The First Post"
-- date: date 2011, 11, 26
-- require("moon").p tostring(date(2011, 11, 26))
path = require "sitegen.path"
moon = require("moon")
common = require("sitegen.common")
get_date = (str) -> str
html ->
posts = [{
id: p.meta.id
target: p.meta.target
source: p.source
} for _, p in pairs page.site.pages when p.meta.template == "blog"]
[tag["section"] {
tag["h3"] { tag["a"] { href: p.target .. ".html", p.id }}
tag["time"] {
-- p.source
-- tostring(date(2011, 11, 26))
-- one = string.match(path.filename(p.source), "%d+%-%d%d%-%d%d%-")
-- r = string.gsub(one, "%-", " ")
-- r
get_date string.match(path.filename(p.source), "%d+%-%d%d%-%d%d")
-- common.slugify path.filename(p.target)
}
"— blurb here"
tag["a"] { class: "read-post-link", href: p.target .. ".html", "Read post →"}
} for _, p in ipairs posts]