Compare commits

...

3 Commits

Author SHA1 Message Date
60f80182ae Merge branch 'main' of https://git.vienalatina.com/pablo/vienalatina
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2026-10-14 13:43:25 +00:00
5c27494059 Merge branch 'claude/relaxed-faraday-h4zd09' of https://github.com/pablovolenski/vienalatina 2026-10-14 13:41:53 +00:00
Claude
ff8effaf3a
Fix a build break I shipped in the last commit
`{{ partial "t.html" (dict "key" "by" "lang" .Site.Language.Lang) }}`
inside `{{ with .Params.author }}`, where the dot is the author *string*.
`.Site` on a string is an execution error, so the build fails — and with
--panicOnWarning in the pipeline, the whole publish fails with it. Same
again for `faq`, where the dot is a slice.

It would have gone red on your first deploy: Salvador's post carries an
author.

My build check passed because every post in the fixture had neither an
author nor a faq, so the two broken branches were never rendered. That
is the actual mistake — not the dot, which is an easy slip, but checking
a change to an optional branch with content that never takes it. The
fixture now carries a post with author, author_url, faq, event, image,
ai_generated and pinned all set at once.

The rule is now "always `$.`" rather than "think about where you are":
`$` is the page in every context, a bare `.` is only the page at top
level, and the difference is invisible until a post happens to have the
field. All sixteen call sites converted, and a test holds every one of
them to it — proved by putting the bug back and watching it fail.

Also the doc comment in t.html, which still claimed eleven keys. My
replacement for it last commit silently matched nothing: I asserted on
every other replacement in that script and not on this one.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NizVpJ2dwzCbjCrTLCjeHn
2026-10-14 13:19:08 +00:00
6 changed files with 55 additions and 16 deletions

View File

@ -58,6 +58,30 @@ def test_every_key_in_the_catalogue_is_used():
assert not orphans, f"defined but never shown: {orphans}"
def test_every_theme_call_site_passes_the_page_explicitly():
"""`$.Site.Language.Lang`, never `.Site.Language.Lang`.
Inside a `{{ with }}` the dot is whatever that block holds — `.Params.author`
is a string, `.Params.faq` is a slice — and `.Site` on a string is an
execution error, not a wrong word. Two call sites shipped exactly that way,
and the build only went red on a post that happened to carry an `author`:
every post in the test fixture had neither, so a clean build proved nothing.
`$` is the page in every context, so the rule is "always `$.`" rather than
"think about where you are", and this is what holds it.
"""
offenders = []
for path in THEME.rglob("*"):
if not path.is_file() or path.suffix in (".css", ".js", ".toml"):
continue
for line_no, line in enumerate(path.read_text(encoding="utf-8").splitlines(), 1):
if 't.html"' in line and re.search(r'"lang"\s+\.', line):
offenders.append(f"{path.relative_to(THEME)}:{line_no}")
assert not offenders, (
"these pass `.Site…` to t.html instead of `$.Site…`, which fails the "
f"build inside a `with`: {offenders}")
def test_the_theme_and_the_catalogue_agree_on_the_public_defaults():
"""Two copies, deliberately — Hugo reads the repository and the members area
reads its own image, and neither can read the other's file. The same trade

View File

@ -7,8 +7,8 @@
<article class="article-card">
<div class="article-card__meta">
<time datetime="{{ .Date.Format "2006-01-02" }}">{{ .Date.Format "2 Jan 2006" }}</time>
{{ if .Params.ai_generated }}<span class="tag-ai" title="{{ partial "t.html" (dict "key" "aifull" "lang" .Site.Language.Lang) }}">{{ partial "t.html" (dict "key" "ai" "lang" .Site.Language.Lang) }}</span>{{ end }}
{{ if .Params.pinned }}<span class="tag-pin">{{ partial "t.html" (dict "key" "pinned" "lang" .Site.Language.Lang) }}</span>{{ end }}
{{ if .Params.ai_generated }}<span class="tag-ai" title="{{ partial "t.html" (dict "key" "aifull" "lang" $.Site.Language.Lang) }}">{{ partial "t.html" (dict "key" "ai" "lang" $.Site.Language.Lang) }}</span>{{ end }}
{{ if .Params.pinned }}<span class="tag-pin">{{ partial "t.html" (dict "key" "pinned" "lang" $.Site.Language.Lang) }}</span>{{ end }}
</div>
<h2 class="article-card__title"><a href="{{ .Permalink }}">{{ .Title }}</a></h2>
<p class="article-card__excerpt">{{ .Description | default (.Summary | plainify | truncate 200) }}</p>

View File

@ -19,7 +19,7 @@
nothing. */}}
{{ with .Params.author }}
<span class="article-card__by">
{{ partial "t.html" (dict "key" "by" "lang" .Site.Language.Lang) }}
{{ partial "t.html" (dict "key" "by" "lang" $.Site.Language.Lang) }}
{{ with $.Params.author_url }}
<a href="{{ . | relURL }}">{{ $.Params.author }}</a>
{{ else }}
@ -33,11 +33,11 @@
into the German and Portuguese siblings by itself, which is right:
a translated post was still machine-written. */}}
{{ if .Params.ai_generated }}
<span class="tag-ai" title="{{ partial "t.html" (dict "key" "aifull" "lang" .Site.Language.Lang) }}">{{ partial "t.html" (dict "key" "ai" "lang" .Site.Language.Lang) }}</span>
<span class="tag-ai" title="{{ partial "t.html" (dict "key" "aifull" "lang" $.Site.Language.Lang) }}">{{ partial "t.html" (dict "key" "ai" "lang" $.Site.Language.Lang) }}</span>
{{ end }}
{{/* And whether somebody put it at the top on purpose, so a reader
arriving from the home page knows why it was first. */}}
{{ if .Params.pinned }}<span class="tag-pin">{{ partial "t.html" (dict "key" "pinned" "lang" .Site.Language.Lang) }}</span>{{ end }}
{{ if .Params.pinned }}<span class="tag-pin">{{ partial "t.html" (dict "key" "pinned" "lang" $.Site.Language.Lang) }}</span>{{ end }}
</div>
</div>
</header>
@ -96,7 +96,7 @@
cannot see is exactly what search engines penalise. */}}
{{ with .Params.faq }}
<section class="faq">
<h2>{{ partial "t.html" (dict "key" "faq" "lang" .Site.Language.Lang) }}</h2>
<h2>{{ partial "t.html" (dict "key" "faq" "lang" $.Site.Language.Lang) }}</h2>
<dl>
{{ range . }}
{{ $parts := split . "|" }}
@ -112,7 +112,7 @@
{{ partial "share.html" . }}
<a class="back-link" href="{{ .Site.Home.Permalink }}">
{{ partial "t.html" (dict "key" "back" "lang" .Site.Language.Lang) }}
{{ partial "t.html" (dict "key" "back" "lang" $.Site.Language.Lang) }}
</a>
{{/* Only on this template: the home page and the lists carry no share

View File

@ -5,8 +5,8 @@
<article class="article-card">
<div class="article-card__meta">
<time datetime="{{ .Date.Format "2006-01-02" }}">{{ .Date.Format "2 Jan 2006" }}</time>
{{ if .Params.ai_generated }}<span class="tag-ai" title="{{ partial "t.html" (dict "key" "aifull" "lang" .Site.Language.Lang) }}">{{ partial "t.html" (dict "key" "ai" "lang" .Site.Language.Lang) }}</span>{{ end }}
{{ if .Params.pinned }}<span class="tag-pin">{{ partial "t.html" (dict "key" "pinned" "lang" .Site.Language.Lang) }}</span>{{ end }}
{{ if .Params.ai_generated }}<span class="tag-ai" title="{{ partial "t.html" (dict "key" "aifull" "lang" $.Site.Language.Lang) }}">{{ partial "t.html" (dict "key" "ai" "lang" $.Site.Language.Lang) }}</span>{{ end }}
{{ if .Params.pinned }}<span class="tag-pin">{{ partial "t.html" (dict "key" "pinned" "lang" $.Site.Language.Lang) }}</span>{{ end }}
</div>
<h2 class="article-card__title"><a href="{{ .Permalink }}">{{ .Title }}</a></h2>
<p class="article-card__excerpt">{{ .Description | default (.Summary | plainify | truncate 200) }}</p>

View File

@ -3,7 +3,7 @@
sans-serif, keeping the site free of third-party requests (GDPR). */}}
<header class="site-bar">
<div class="site-bar__inner">
<a class="site-bar__brand" href="{{ .Site.Home.Permalink }}" aria-label="{{ partial "t.html" (dict "key" "home" "lang" .Site.Language.Lang) }}">
<a class="site-bar__brand" href="{{ .Site.Home.Permalink }}" aria-label="{{ partial "t.html" (dict "key" "home" "lang" $.Site.Language.Lang) }}">
{{/* The logo uploaded in Gestión → Marca, and the site's name in
letters when there is none. The alt text is the name either way,
so a reader who does not see the picture reads the same thing.
@ -36,7 +36,7 @@
who has an account needs to find the door at a glance, and somebody
who does not should see that there is one. In the bar at every width,
so a phone never has to open a menu to find it. */}}
<a class="site-bar__cta" href="/comunidad/">{{ partial "t.html" (dict "key" "community" "lang" .Site.Language.Lang) }}</a>
<a class="site-bar__cta" href="/comunidad/">{{ partial "t.html" (dict "key" "community" "lang" $.Site.Language.Lang) }}</a>
{{/* The ☰ itself. A <label> can sit anywhere in the document, so the
checkbox it drives lives below, as a sibling of the menu it opens —
@ -63,7 +63,7 @@
so the menu opens from a keyboard. The ☰ above is aria-hidden because it
would otherwise be read a second time as the same control. */}}
<input id="site-menu" class="site-menu__state" type="checkbox"
aria-label="{{ partial "t.html" (dict "key" "menu" "lang" .Site.Language.Lang) }}">
aria-label="{{ partial "t.html" (dict "key" "menu" "lang" $.Site.Language.Lang) }}">
{{/* The menu is built from the pages themselves, not from a list in
config.yaml. It used to be three names written there, which meant a page

View File

@ -1,11 +1,26 @@
{{- /* The handful of words the templates themselves say.
Everything else on this site is content and arrives already translated by
the pipeline. These are the labels around it — "Lugar", "Hoy" — and there
are eleven of them, which is a table rather than a reason to install i18n
files and a translation workflow for the theme.
the pipeline. These are the labels around it — "Lugar", "Compartir" — and
they are a table rather than a reason to install i18n files and a
translation workflow for the theme.
What is below is the *default*. Gestión → Textos can say something else,
and that is read first, out of data/ui.yaml. The same defaults also live
in apps/board/strings/sitio.yaml so the screen can show them as
placeholders — two copies, unavoidably, because Hugo reads the repository
and the members area reads its own image and neither can read the other's
file. test_strings.py fails if they drift, the way brand.FACTORY is held
to the two `:root` blocks.
Usage: {{ partial "t.html" (dict "key" "place" "lang" $.Site.Language.Lang) }}
**`$.` and never a bare `.`** Inside a `{{ with }}` the dot is whatever
that block holds — a string, a slice — and `.Site` on a string fails the
build rather than producing a wrong word. Two call sites shipped that way
and the build only broke on a post that happened to carry an `author`.
`$` is the page everywhere, and a test holds every call site to it.
Usage: {{ partial "t.html" (dict "key" "place" "lang" .Site.Language.Lang) }}
An unknown key returns itself, so a typo is visible on the page instead of
rendering as nothing. */ -}}
{{- $words := dict