refactor!: replaced year with now.year in template data.

This commit is contained in:
Spencer Brower
2026-07-15 13:09:47 -04:00
parent 5a1ceb617c
commit 618e08a718
2 changed files with 43 additions and 41 deletions
+2
View File
@@ -24,6 +24,7 @@
guide
- [ ] Search for grammars in multiple places
- [ ] Download missing grammars.
- [ ] Add reflection support to mustache / consider rewriting from scratch.
- [ ] Syntax highlighting in production: CI (`nix build` on ubuntu-latest) has no grammar `.so`s and a machine-specific `QUERIES_PATH` nix store hash, so the deployed site renders unhighlighted. Provide grammars + queries as nix build inputs and pass paths to thor at runtime (env vars/flags).
- [ ] Durable highlight paths: read `GRAPHS_PATH`/`QUERIES_PATH` from env vars set by the flake instead of hardcoded nix store hashes, so they survive `nix flake update` and let the grammar/query version-mismatch detector fire automatically.
- [ ] Unit tests for highlighting helpers: `capture_name_to_css`, `escape_html`, `unescape_html`, `extract_query_token`, `helix_version_from_path`.
@@ -36,6 +37,7 @@
- [ ] Free cmark HTML output (`body_html`) — cmark allocates via C malloc, not the arena, so it leaks per iteration in watch mode
- [ ] commands
- [ ] Add spall and find ways to reduce run time. (Getting close to 1/2sec here.)
- [ ] warn/error when unknown key used in mustache.
- [ ] Review every file in thor
- [ ] Review alerts.odin
- [ ] Review content.odin
+3 -3
View File
@@ -146,7 +146,7 @@ render_page_html :: proc(page: Page, config: Site) -> string {
"date_iso" = page.date,
"date_display" = format_date(page.date),
"is_post" = is_article,
"year" = "2026",
"now" = map[string]any{"year" = fmt.tprintf("%d", time.year(time.now()))},
"author" = config.author,
"params" = config.params,
"og_url" = fmt.tprintf("%s%s", config.base_url, page.permalink),
@@ -237,7 +237,7 @@ render_home_html :: proc(home: Page, pages: []Page, config: Site) -> string {
"title" = config.title,
"home_body" = home.body_html,
"list_pages" = list_pages[:],
"year" = "2026",
"now" = map[string]any{"year" = fmt.tprintf("%d", time.year(time.now()))},
"author" = config.author,
"params" = config.params,
"og_url" = fmt.tprintf("%s/", config.base_url),
@@ -294,7 +294,7 @@ render_posts_html :: proc(pages: []Page, config: Site) -> string {
data := map[string]any {
"title" = fmt.tprintf("Posts | %s", config.title),
"year_sections" = year_slices[:],
"year" = "2026",
"now" = map[string]any{"year" = fmt.tprintf("%d", time.year(time.now()))},
"author" = config.author,
"params" = config.params,
"og_url" = fmt.tprintf("%s/posts/", config.base_url),