summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2026-07-28 14:34:36 -0700
committeryum <yum.food.vr@gmail.com>2026-07-28 14:34:36 -0700
commit9ae2381d49aaff705fe5966de399f41fc7521798 (patch)
treed83dc2d9a0ebd60766404d26167220a7f419946a
parentc64eef9968f9a38e3ec3e2b083ce982f8625ecf9 (diff)
Add dates to home page
-rw-r--r--article-dates.lua19
-rwxr-xr-xmake_html2
-rwxr-xr-xtemplate.html16
3 files changed, 36 insertions, 1 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
diff --git a/make_html b/make_html
index ec4d16d..f36d616 100755
--- a/make_html
+++ b/make_html
@@ -12,6 +12,7 @@ mkdir "$OUTPUT_DIR"
pandoc \
--mathml \
+ --lua-filter article-dates.lua \
--template template.html \
--toc \
--toc-depth 1 \
@@ -26,4 +27,3 @@ unzip -o "$OUTPUT_DIR/site.zip" -d /var/www/html/
sed -E -i 's/(href="[^"#]+\.html)#[^"]+"/\1"/g' /var/www/html/index.html || true
cp -r vr_assets /var/www/html/
cp -r images /var/www/html/
-
diff --git a/template.html b/template.html
index 2b1b899..1bf6217 100755
--- a/template.html
+++ b/template.html
@@ -84,6 +84,22 @@ $endif$
a:hover {
color: var(--aqua-color);
}
+ .article-date {
+ display: none;
+ }
+ #TOC a {
+ display: grid;
+ grid-template-columns: minmax(0, 1fr) 9em;
+ gap: 1em;
+ align-items: baseline;
+ }
+ #TOC .article-date {
+ display: block;
+ color: var(--comment-color);
+ text-align: right;
+ white-space: nowrap;
+ font-variant-numeric: tabular-nums;
+ }
blockquote {
color: var(--foreground-color);
border-left: 4px solid var(--current-line-color);