mirror of
https://github.com/sbrow/thor.git
synced 2026-08-26 11:23:32 -04:00
refactor!: replaced year with now.year in template data.
This commit is contained in:
@@ -24,6 +24,7 @@
|
|||||||
guide
|
guide
|
||||||
- [ ] Search for grammars in multiple places
|
- [ ] Search for grammars in multiple places
|
||||||
- [ ] Download missing grammars.
|
- [ ] 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).
|
- [ ] 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.
|
- [ ] 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`.
|
- [ ] 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
|
- [ ] Free cmark HTML output (`body_html`) — cmark allocates via C malloc, not the arena, so it leaks per iteration in watch mode
|
||||||
- [ ] commands
|
- [ ] commands
|
||||||
- [ ] Add spall and find ways to reduce run time. (Getting close to 1/2sec here.)
|
- [ ] 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 every file in thor
|
||||||
- [ ] Review alerts.odin
|
- [ ] Review alerts.odin
|
||||||
- [ ] Review content.odin
|
- [ ] Review content.odin
|
||||||
|
|||||||
+41
-41
@@ -139,25 +139,25 @@ render_page_html :: proc(page: Page, config: Site) -> string {
|
|||||||
is_article := page.type == .Post
|
is_article := page.type == .Post
|
||||||
|
|
||||||
data := map[string]any {
|
data := map[string]any {
|
||||||
"title" = fmt.tprintf("%s | %s", page.title, config.title),
|
"title" = fmt.tprintf("%s | %s", page.title, config.title),
|
||||||
"page_title" = page.title,
|
"page_title" = page.title,
|
||||||
"body_html" = page.body_html,
|
"body_html" = page.body_html,
|
||||||
"has_date" = page.date != "",
|
"has_date" = page.date != "",
|
||||||
"date_iso" = page.date,
|
"date_iso" = page.date,
|
||||||
"date_display" = format_date(page.date),
|
"date_display" = format_date(page.date),
|
||||||
"is_post" = is_article,
|
"is_post" = is_article,
|
||||||
"year" = "2026",
|
"now" = map[string]any{"year" = fmt.tprintf("%d", time.year(time.now()))},
|
||||||
"author" = config.author,
|
"author" = config.author,
|
||||||
"params" = config.params,
|
"params" = config.params,
|
||||||
"og_url" = fmt.tprintf("%s%s", config.base_url, page.permalink),
|
"og_url" = fmt.tprintf("%s%s", config.base_url, page.permalink),
|
||||||
"og_site_name" = config.title,
|
"og_site_name" = config.title,
|
||||||
"og_title" = strip_html_tags(page.title),
|
"og_title" = strip_html_tags(page.title),
|
||||||
"og_description" = config.description,
|
"og_description" = config.description,
|
||||||
"og_type" = og_type(is_article),
|
"og_type" = og_type(is_article),
|
||||||
"is_article" = is_article,
|
"is_article" = is_article,
|
||||||
"og_section" = "posts",
|
"og_section" = "posts",
|
||||||
"og_published" = page.date,
|
"og_published" = page.date,
|
||||||
"og_image" = fmt.tprintf("%s/avatar.jpg", config.base_url),
|
"og_image" = fmt.tprintf("%s/avatar.jpg", config.base_url),
|
||||||
}
|
}
|
||||||
|
|
||||||
partials := load_partials(config.layouts_dir)
|
partials := load_partials(config.layouts_dir)
|
||||||
@@ -234,19 +234,19 @@ render_home_html :: proc(home: Page, pages: []Page, config: Site) -> string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
data := map[string]any {
|
data := map[string]any {
|
||||||
"title" = config.title,
|
"title" = config.title,
|
||||||
"home_body" = home.body_html,
|
"home_body" = home.body_html,
|
||||||
"list_pages" = list_pages[:],
|
"list_pages" = list_pages[:],
|
||||||
"year" = "2026",
|
"now" = map[string]any{"year" = fmt.tprintf("%d", time.year(time.now()))},
|
||||||
"author" = config.author,
|
"author" = config.author,
|
||||||
"params" = config.params,
|
"params" = config.params,
|
||||||
"og_url" = fmt.tprintf("%s/", config.base_url),
|
"og_url" = fmt.tprintf("%s/", config.base_url),
|
||||||
"og_site_name" = config.title,
|
"og_site_name" = config.title,
|
||||||
"og_title" = config.title,
|
"og_title" = config.title,
|
||||||
"og_description" = config.description,
|
"og_description" = config.description,
|
||||||
"og_type" = "website",
|
"og_type" = "website",
|
||||||
"is_article" = false,
|
"is_article" = false,
|
||||||
"og_image" = fmt.tprintf("%s/avatar.jpg", config.base_url),
|
"og_image" = fmt.tprintf("%s/avatar.jpg", config.base_url),
|
||||||
}
|
}
|
||||||
|
|
||||||
partials := load_partials(config.layouts_dir)
|
partials := load_partials(config.layouts_dir)
|
||||||
@@ -292,18 +292,18 @@ render_posts_html :: proc(pages: []Page, config: Site) -> string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
data := map[string]any {
|
data := map[string]any {
|
||||||
"title" = fmt.tprintf("Posts | %s", config.title),
|
"title" = fmt.tprintf("Posts | %s", config.title),
|
||||||
"year_sections" = year_slices[:],
|
"year_sections" = year_slices[:],
|
||||||
"year" = "2026",
|
"now" = map[string]any{"year" = fmt.tprintf("%d", time.year(time.now()))},
|
||||||
"author" = config.author,
|
"author" = config.author,
|
||||||
"params" = config.params,
|
"params" = config.params,
|
||||||
"og_url" = fmt.tprintf("%s/posts/", config.base_url),
|
"og_url" = fmt.tprintf("%s/posts/", config.base_url),
|
||||||
"og_site_name" = config.title,
|
"og_site_name" = config.title,
|
||||||
"og_title" = "Posts",
|
"og_title" = "Posts",
|
||||||
"og_description" = config.description,
|
"og_description" = config.description,
|
||||||
"og_type" = "website",
|
"og_type" = "website",
|
||||||
"is_article" = false,
|
"is_article" = false,
|
||||||
"og_image" = fmt.tprintf("%s/avatar.jpg", config.base_url),
|
"og_image" = fmt.tprintf("%s/avatar.jpg", config.base_url),
|
||||||
}
|
}
|
||||||
|
|
||||||
partials := load_partials(config.layouts_dir)
|
partials := load_partials(config.layouts_dir)
|
||||||
|
|||||||
Reference in New Issue
Block a user