diff options
| author | yum <yum.food.vr@gmail.com> | 2026-07-28 14:34:36 -0700 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2026-07-28 14:34:36 -0700 |
| commit | 9ae2381d49aaff705fe5966de399f41fc7521798 (patch) | |
| tree | d83dc2d9a0ebd60766404d26167220a7f419946a /article-dates.lua | |
| parent | c64eef9968f9a38e3ec3e2b083ce982f8625ecf9 (diff) | |
Add dates to home page
Diffstat (limited to 'article-dates.lua')
| -rw-r--r-- | article-dates.lua | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/article-dates.lua b/article-dates.lua new file mode 100644 index 0000000..72bdba5 --- /dev/null +++ b/article-dates.lua @@ -0,0 +1,19 @@ +function Pandoc(doc) + local heading + + for _, block in ipairs(doc.blocks) do + if block.t == "Header" and block.level == 1 then + heading = block + elseif heading and block.t == "Para" then + local date = pandoc.utils.stringify(block.content) + table.insert(heading.content, pandoc.RawInline( + "html", '<span class="article-date">' .. date .. "</span>" + )) + heading = nil + else + heading = nil + end + end + + return doc +end |
