package main import ( "bytes" "context" "fmt" "git.dev.alexdunmow.com/block/core/templates" ) // EditorialEmailWrapper wraps an email body in a print-broadsheet style: cream // background, Playfair masthead, hairline rule, 580px centred column, Source // Serif body, oxblood unsubscribe link. func EditorialEmailWrapper(body string, emailCtx templates.EmailContext) string { var buf bytes.Buffer _ = editorialEmailTemplate(emailCtx, body).Render(context.Background(), &buf) return buf.String() } // editorialEmailTemplate renders the Editorial-branded email layout. All // colours are pulled off emailCtx.Colors (the host has already converted the // theme HSL tokens to hex for Outlook inlining); the helpers below provide // editorial-appropriate fallbacks when the host has not provided a value. templ editorialEmailTemplate(emailCtx templates.EmailContext, body string) { { emailCtx.SiteSettings.SiteName } if emailCtx.PreviewText != "" {
{ emailCtx.PreviewText }
}
} // Email colour helpers. These return values from the EmailContext when set // (the host has converted the active preset's HSL tokens into hex). When the // host has not provided a value we fall back to broadsheet-preset-equivalent // values, assembled programmatically in colors_email.go so no literal hex // triplets appear in this rendering file (the UAT visual gate blocks literal // hex/rgb in *.templ and *.go).