From fa10a813f214af66622025044e412735cbe4729d Mon Sep 17 00:00:00 2001 From: Daniel Fichtinger Date: Tue, 15 Jul 2025 16:48:03 -0400 Subject: [PATCH 1/6] add to .kakrc --- .kakrc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.kakrc b/.kakrc index 7a60b1f..688bcbe 100644 --- a/.kakrc +++ b/.kakrc @@ -15,6 +15,10 @@ define-command readme %{ root-edit README.md } +define-command kakrc %{ + root-edit .kakrc +} + # change working directory to the package hook global -once BufCreate .* %{ change-directory %exp{%opt{project_root}/src/zona} From bafe70ed3728682af41597e908b7b5ad97ef496b Mon Sep 17 00:00:00 2001 From: Daniel Fichtinger Date: Tue, 15 Jul 2025 16:52:58 -0400 Subject: [PATCH 2/6] fix post-nav button order Navigation now follows newer/older logic. click right to go older, left to go newer. --- src/zona/builder.py | 14 ++++++++++---- src/zona/data/templates/post_nav.html | 12 +++++++----- src/zona/models.py | 4 ++-- src/zona/templates.py | 9 ++++----- 4 files changed, 23 insertions(+), 16 deletions(-) diff --git a/src/zona/builder.py b/src/zona/builder.py index 5c8af6b..416edc8 100644 --- a/src/zona/builder.py +++ b/src/zona/builder.py @@ -99,6 +99,8 @@ class ZonaBuilder: def _build(self): assert self.items + # sort according to date + # descending order post_list: list[Item] = sorted( [item for item in self.items if item.post], key=lambda item: item.metadata.date @@ -106,12 +108,16 @@ class ZonaBuilder: else date.min, reverse=True, ) + # number of posts posts = len(post_list) + # link post chronology for i, item in enumerate(post_list): - prev = post_list[i - 1] if i > 0 else None - next = post_list[i + 1] if i < posts - 2 else None - item.previous = prev - item.next = next + # prev: older post + older = post_list[i + 1] if i + 1 < posts else None + # next: newer post + newer = post_list[i - 1] if i > 0 else None + item.older = older + item.newer = newer templater = Templater( config=self.config, diff --git a/src/zona/data/templates/post_nav.html b/src/zona/data/templates/post_nav.html index 86ac330..1e96ff5 100644 --- a/src/zona/data/templates/post_nav.html +++ b/src/zona/data/templates/post_nav.html @@ -1,9 +1,11 @@
- <{% if previous %}prev{% endif %}{% if previous and next %}|{% endif %}{% if next %}next{% endif - %}> + <{% if newer %}newr{% + else %}null{% endif %}{% if older %}oldr{% else %}null{% endif %}>
diff --git a/src/zona/models.py b/src/zona/models.py index d009476..7f67015 100644 --- a/src/zona/models.py +++ b/src/zona/models.py @@ -23,8 +23,8 @@ class Item: type: ItemType | None = None copy: bool = True post: bool = False - next: Item | None = None - previous: Item | None = None + newer: Item | None = None + older: Item | None = None # @dataclass diff --git a/src/zona/templates.py b/src/zona/templates.py index d5e0f22..4529143 100644 --- a/src/zona/templates.py +++ b/src/zona/templates.py @@ -27,7 +27,6 @@ def get_footer(template_dir: Path) -> str | None: return html_footer.read_text() -# TODO: add next/prev post button logic to posts # TODO: add a recent posts element that can be included elsewhere? class Templater: def __init__( @@ -79,11 +78,11 @@ class Templater: header=header, footer=footer, is_post=item.post, - next=util.normalize_url(item.next.url) - if item.next + newer=util.normalize_url(item.newer.url) + if item.newer else None, - previous=util.normalize_url(item.previous.url) - if item.previous + older=util.normalize_url(item.older.url) + if item.older else None, post_list=self.post_list, ) From c33acfa1c86e4ca37ab4ba7d87630b35014e53ce Mon Sep 17 00:00:00 2001 From: Daniel Fichtinger Date: Tue, 15 Jul 2025 17:52:49 -0400 Subject: [PATCH 3/6] added hover symbols to page titles --- src/zona/data/content/static/style.css | 109 ++++++++++++++++++++----- src/zona/data/templates/title.html | 2 +- 2 files changed, 88 insertions(+), 23 deletions(-) diff --git a/src/zona/data/content/static/style.css b/src/zona/data/content/static/style.css index f02717e..cd78efa 100644 --- a/src/zona/data/content/static/style.css +++ b/src/zona/data/content/static/style.css @@ -1,4 +1,5 @@ :root { + --main-placeholder-color: #b14242; --main-text-color: #b4b4b4; --main-text-opaque-color: rgba(180, 180, 180, 0.8); --main-bg-color: #121212; @@ -33,21 +34,65 @@ header { .post-nav { font-family: monospace; + font-size: 0.95em; + white-space: nowrap; +} + +.post-nav .bar { + position: relative; + bottom: 0.05em; + display: inline-block; + width: 1px; + height: 0.8em; + background-color: currentColor; + vertical-align: middle; + margin: 0 0.3em; +} + +.post-nav .placeholder { + color: var(--main-placeholder-color); } .post-nav .symbol { color: var(--main-bullet-color); + margin: 0; + padding: 0; + display: inline; } -.post-nav a { - margin: 0 2px; +.site-logo.hover-symbol::before { + content: "@"; } -.site-logo { +.title.hover-symbol::before { + content: ">"; + color: var(--main-bullet-color); +} + +.hover-symbol { color: inherit; + position: relative; font-weight: bold; text-decoration: none; - /* font-size: 1.75rem;*/ +} + +.hover-symbol::before { + font-family: monospace; + content: "#"; + position: absolute; + right: 100%; + margin-right: 0.25em; + top: 50%; + transform: translateY(-50%); + opacity: 0; + transition: opacity 0.2s ease; +} + +.hover-symbol:hover::before { + opacity: 1; +} +.hover-symbol:hover { + background-color: transparent; } .toclink { @@ -111,6 +156,11 @@ h1 { font-family: monospace; } +.title a { + color: inherit; + text-decoration: none; +} + article h1:first-of-type { margin-block-start: 1.67rem; } @@ -164,30 +214,45 @@ li::marker { /* Change this to your desired color */ } +/*a {*/ +/* color: var(--main-link-color);*/ +/* text-decoration: none;*/ +/* position: relative;*/ +/*}*/ + +/*a::after {*/ +/* content: "";*/ +/* position: absolute;*/ +/* left: 0;*/ +/* bottom: -2px;*/ +/* width: 100%;*/ +/* height: 1px;*/ +/* background-color: currentColor;*/ +/* transform: scaleX(0);*/ +/* transform-origin: center;*/ +/* transition: transform 0.1s ease;*/ +/*}*/ + +/*a:hover::after {*/ +/* transform: scaleX(1);*/ +/*}*/ +/*a:has(> code)::after {*/ +/* display: none;*/ +/*}*/ + a { color: var(--main-link-color); - text-decoration: none; - position: relative; + text-decoration: underline; + text-decoration-color: rgba(0, 0, 0, 0); + text-underline-offset: 2px; /* Optional: tweak spacing */ } -a::after { - content: ""; - position: absolute; - left: 0; - bottom: -2px; - width: 100%; - height: 1px; - background-color: currentColor; - transform: scaleX(0); - transform-origin: center; - transition: transform 0.1s ease; +a { + transition: text-decoration-color 0.15s ease; } -a:hover::after { - transform: scaleX(1); -} -a:has(> code)::after { - display: none; +a:hover { + text-decoration-color: currentColor; } max-width: 100%; diff --git a/src/zona/data/templates/title.html b/src/zona/data/templates/title.html index 9753365..1541095 100644 --- a/src/zona/data/templates/title.html +++ b/src/zona/data/templates/title.html @@ -1,2 +1,2 @@ -

{{ metadata.title }}

+

{{ metadata.title }}

From 4ea80a33f854d8a58f79abbefdcedd29f48ff635 Mon Sep 17 00:00:00 2001 From: Daniel Fichtinger Date: Tue, 15 Jul 2025 18:35:13 -0400 Subject: [PATCH 4/6] improved styling of hover symbols --- src/zona/data/content/static/style.css | 83 +++++++------------------- 1 file changed, 22 insertions(+), 61 deletions(-) diff --git a/src/zona/data/content/static/style.css b/src/zona/data/content/static/style.css index cd78efa..56644c3 100644 --- a/src/zona/data/content/static/style.css +++ b/src/zona/data/content/static/style.css @@ -62,11 +62,12 @@ header { .site-logo.hover-symbol::before { content: "@"; + /* color: var(--main-bullet-color);*/ } .title.hover-symbol::before { content: ">"; - color: var(--main-bullet-color); + /* color: var(--main-bullet-color);*/ } .hover-symbol { @@ -74,6 +75,7 @@ header { position: relative; font-weight: bold; text-decoration: none; + transition: color 0.15s ease; } .hover-symbol::before { @@ -85,20 +87,24 @@ header { top: 50%; transform: translateY(-50%); opacity: 0; - transition: opacity 0.2s ease; + transition: opacity 0.15s ease, color 0.15s ease; + color: var(--main-text-color); } .hover-symbol:hover::before { opacity: 1; + color: var(--main-placeholder-color); /* only the symbol changes color */ } .hover-symbol:hover { background-color: transparent; + /* color: var(--main-placeholder-color);*/ } .toclink { position: relative; text-decoration: none; color: inherit; + transition: color 0.15s ease; } .toclink::before { @@ -109,7 +115,16 @@ header { top: 50%; transform: translateY(-50%); opacity: 0; - transition: opacity 0.2s ease; + transition: opacity 0.15s ease, color 0.15s ease; + color: var(--main-link-color); +} + +.toclink:hover::before { + opacity: 1; + color: var(--main-placeholder-color); +} +.toclink:hover { + background-color: transparent; } h1 .toclink::before { @@ -128,13 +143,6 @@ h4 .toclink::before { content: "###"; } -.toclink:hover::before { - opacity: 1; -} -.toclink:hover { - background-color: transparent; -} - /* h1, */ h2, h3, @@ -206,53 +214,26 @@ h6 { ul { list-style-type: disc; - /* or any other list style */ } li::marker { color: var(--main-bullet-color); - /* Change this to your desired color */ } -/*a {*/ -/* color: var(--main-link-color);*/ -/* text-decoration: none;*/ -/* position: relative;*/ -/*}*/ - -/*a::after {*/ -/* content: "";*/ -/* position: absolute;*/ -/* left: 0;*/ -/* bottom: -2px;*/ -/* width: 100%;*/ -/* height: 1px;*/ -/* background-color: currentColor;*/ -/* transform: scaleX(0);*/ -/* transform-origin: center;*/ -/* transition: transform 0.1s ease;*/ -/*}*/ - -/*a:hover::after {*/ -/* transform: scaleX(1);*/ -/*}*/ -/*a:has(> code)::after {*/ -/* display: none;*/ -/*}*/ - a { color: var(--main-link-color); text-decoration: underline; text-decoration-color: rgba(0, 0, 0, 0); - text-underline-offset: 2px; /* Optional: tweak spacing */ + text-underline-offset: 2px; } a { - transition: text-decoration-color 0.15s ease; + transition: color 0.15s ease, text-decoration-color 0.15s ease; } a:hover { - text-decoration-color: currentColor; + text-decoration-color: var(--main-placeholder-color); + color: var(--main-bullet-color); } max-width: 100%; @@ -489,23 +470,3 @@ caption { font-size: 0.8rem; color: var(--main-small-text-color); } - -a > code { - text-decoration: none; - color: var(--main-link-color); - position: relative; -} - -a:has(> code) { - text-decoration: none; - background: none; - /* position: static;*/ -} - -a:hover > code { - text-decoration: underline; -} - -a:hover:has(> code) { - background: none; -} From d35d3f61fbfa5aad4555a9d7dc83373ab8a71331 Mon Sep 17 00:00:00 2001 From: Daniel Fichtinger Date: Tue, 15 Jul 2025 18:42:32 -0400 Subject: [PATCH 5/6] updated documentation --- README.md | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index bd7eb9b..c3facfb 100644 --- a/README.md +++ b/README.md @@ -101,10 +101,6 @@ If you don't want discovery, you can specify the project root as the first argument to `zona build`. You may specify a path for the output using the `--output/-o` flag. The `--draft/-d` flag includes draft posts in the output. -_Note: the previous build is _not_ cleaned before the new site is built. If -you've deleted some pages, you may need to remove the output directory before -rebuilding._ - ### Live Preview To make the writing process as frictionless as possible, zona ships with a live @@ -121,9 +117,10 @@ By default, the build outputs to a temporary directory. Use `-o/--output` to override this. **Note**: if the live preview isn't working as expected, try restarting the -server. If you change the configuration or any templates, the server must also -be restarted. The live preview uses the same function as `zona build` -internally; this means that the output is also written to disk. +server. If you change the configuration, the server must also be restarted. The +live preview uses the same function as `zona build` internally; this means that +the output is also written to disk --- a temporary directory by default, unless +overridden with `-o/--output`. #### Live Reload @@ -196,13 +193,17 @@ the packaged defaults. To apply a certain template to a page, set the `template` option in its [frontmatter](#frontmatter). The following public variables are made available to the template engine: -| Name | Description | -| ---------- | ------------------------------------------------------ | -| `content` | The content of this page. | -| `url` | The resolved URL of this page. | -| `metadata` | The frontmatter of this page (_merged with defaults_). | -| `header` | The sitemap header in HTML form. Can be `False`. | -| `footer` | The footer in HTML form. Can be `False`. | +| Name | Description | +| ----------- | -------------------------------------------------------- | +| `content` | The content of this page. | +| `url` | The resolved URL of this page. | +| `metadata` | The frontmatter of this page (_merged with defaults_). | +| `header` | The sitemap header in HTML form. Can be `False`. | +| `footer` | The footer in HTML form. Can be `False`. | +| `is_post` | Whether this page is a post. | +| `newer` | URL of the newer post in the post list. | +| `older` | URL of the older post in the post list. | +| `post_list` | A sorted list of `Item` objects. Meant for internal use. | #### Markdown Footer From 299d472d9bda6f021a3dbe436c60db77da180890 Mon Sep 17 00:00:00 2001 From: Daniel Fichtinger Date: Tue, 15 Jul 2025 18:43:28 -0400 Subject: [PATCH 6/6] release 1.2.0 --- pyproject.toml | 2 +- uv.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 6b517bc..7653d22 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "zona" -version = "1.1.0" +version = "1.2.0" description = "Opinionated static site generator." license = "BSD-3-Clause " license-files = ["LICENSE"] diff --git a/uv.lock b/uv.lock index c1a3f41..da3457f 100644 --- a/uv.lock +++ b/uv.lock @@ -459,7 +459,7 @@ wheels = [ [[package]] name = "zona" -version = "1.1.0" +version = "1.2.0" source = { editable = "." } dependencies = [ { name = "dacite" },