Skip to content

Commit c5880ba

Browse files
TMHSDigitalclaude
andcommitted
fix(site): landing showcase cards caption the piece, not the shared pipeline
Every showcase `teaches` ends in the same "through UVs, bake, LOD, collider, and Unity glTF, asserting recomputed budgets" tail, which the section lede already states, and the one-line ellipsis cut every card to that boilerplate. build_site.py now derives `caption` (the piece-specific clause; 73 of 76 pieces match, the rest fall back to the full sentence), and card captions clamp to two lines instead of one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent a882bd6 commit c5880ba

2 files changed

Lines changed: 27 additions & 6 deletions

File tree

‎scripts/site/build_site.py‎

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,9 +311,31 @@ def load_examples(repo_root: Path) -> list[dict]:
311311
return load_gallery_items(repo_root, "examples/gallery.json", "examples")
312312

313313

314+
# Every showcase `teaches` reads "A procedural <piece> ... through UVs, bake,
315+
# LOD, collider, and Unity glTF, asserting recomputed budgets ...". The tail is
316+
# the same for all pieces and the section lede already says it, so a card that
317+
# shows the sentence from the start spends its line on boilerplate.
318+
_SHOWCASE_TEACHES = re.compile(
319+
r"^A procedural (.+?)[\s,:;—–-]*\b(?:carried |taken |run |all |then |and )?"
320+
r"through UVs, bake\b", re.S)
321+
322+
323+
def showcase_caption(teaches: str) -> str:
324+
"""The piece-specific clause of a showcase ``teaches``, or the whole
325+
sentence when it does not follow the template."""
326+
m = _SHOWCASE_TEACHES.match(teaches)
327+
if not m:
328+
return teaches
329+
cap = m.group(1).strip()
330+
return cap[:1].upper() + cap[1:]
331+
332+
314333
def load_showcase(repo_root: Path) -> list[dict]:
315334
"""Read showcase/gallery.json. Empty or absent is fine — not an error."""
316-
return load_gallery_items(repo_root, "showcase/gallery.json", "pieces")
335+
pieces = load_gallery_items(repo_root, "showcase/gallery.json", "pieces")
336+
for piece in pieces:
337+
piece["caption"] = showcase_caption(piece.get("teaches", ""))
338+
return pieces
317339

318340

319341
def pick_featured(examples: list[dict]) -> list[dict]:

‎scripts/site/template.html.j2‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,8 @@
161161
.render-card img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
162162
.render-meta { display: flex; align-items: baseline; gap: 0.75rem; padding: 0.6rem 0.9rem; }
163163
.render-meta .name { font-family: var(--font-mono); font-size: var(--fs-sm); color: var(--text); white-space: nowrap; }
164-
.render-meta .teach { color: var(--dim); font-size: var(--fs-sm); white-space: nowrap; overflow: hidden;
165-
text-overflow: ellipsis; }
164+
.render-meta .teach { color: var(--dim); font-size: var(--fs-sm); overflow: hidden;
165+
display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
166166
.panel-cta { display: inline-block; margin-top: 1.25rem; font-weight: 500; font-size: var(--fs-md); color: var(--select); }
167167
.panel-cta:hover { text-decoration: underline; }
168168
/* featured subset: gallery link is the section's primary call to action */
@@ -253,7 +253,6 @@
253253
@media (max-width: 820px) {
254254
.skill-grid, .render-grid { grid-template-columns: 1fr; }
255255
.recent-grid { grid-template-columns: 1fr 1fr; }
256-
.render-meta .teach { white-space: normal; }
257256
}
258257
@media (max-width: 640px) {
259258
/* The gizmo would sit on the version label; the mode label goes. */
@@ -354,7 +353,7 @@
354353
<img src="{{ ex.heroSite }}" srcset="{{ ex.thumbSite }} 640w, {{ ex.heroSite }} 1280w" sizes="(min-width: 821px) 500px, calc(100vw - 4.5rem)" alt="{{ ex.alt | default(ex.name ~ ' render', true) }}" loading="lazy" decoding="async" width="1280" height="720" />
355354
<div class="render-meta">
356355
<span class="name">{{ ex.name }}</span>
357-
<span class="teach">{{ ex.teaches }}</span>
356+
<span class="teach">{{ ex.caption or ex.teaches }}</span>
358357
</div>
359358
</a>
360359
{% endfor %}
@@ -399,7 +398,7 @@
399398
<img src="{{ ex.heroSite }}" srcset="{{ ex.thumbSite }} 640w, {{ ex.heroSite }} 1280w" sizes="(min-width: 821px) 500px, calc(100vw - 4.5rem)" alt="{{ ex.alt | default(ex.name ~ ' render', true) }}" loading="lazy" decoding="async" width="1280" height="720" />
400399
<div class="render-meta">
401400
<span class="name">{{ ex.name }}</span>
402-
<span class="teach">{{ ex.teaches }}</span>
401+
<span class="teach">{{ ex.caption or ex.teaches }}</span>
403402
</div>
404403
</a>
405404
{% endfor %}

0 commit comments

Comments
 (0)