Bootstrapped during the 2026-06-06 BlockNinja consolidation. Was previously an unversioned directory inside ~/src/blockninja-themes/editorial. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
27 lines
724 B
Go
27 lines
724 B
Go
package main
|
|
|
|
import (
|
|
"bytes"
|
|
"context"
|
|
)
|
|
|
|
// EditorialImageBlock overrides the built-in `image` block for the editorial
|
|
// template. The image is wrapped in a <figure>; the caption is rendered as
|
|
// Source Serif italic 14px, preceded by a 1px hairline rule (UAT §13.12).
|
|
//
|
|
// Content shape: { "src", "alt", "caption" }.
|
|
func EditorialImageBlock(ctx context.Context, content map[string]any) string {
|
|
src := getString(content, "src")
|
|
alt := getString(content, "alt")
|
|
caption := getString(content, "caption")
|
|
|
|
if src == "" {
|
|
// Match built-in fallback: render nothing for an empty image.
|
|
return ""
|
|
}
|
|
|
|
var buf bytes.Buffer
|
|
_ = editorialImageComponent(src, alt, caption).Render(ctx, &buf)
|
|
return buf.String()
|
|
}
|