Documentation
¶
Overview ¶
Package chrome owns the rendering bits both templates share — the metadata footer, the BaseHeader mini-contribution row, the `base` section resolver, and the lazy CSS asset loader. classic and repository each only customise what is genuinely different (header layout, plugin partial set), and lean on this package for the envelope.
Index ¶
- Constants
- func ContributionRow(days []plugins.ContributionDay) string
- func MetadataFooter(pc *templates.PartialContext, sections map[string]struct{}, opts FooterOpts) string
- func ReadBaseInput(in map[string]any) (string, bool)
- func ResolveBaseSections(in map[string]any) map[string]struct{}
- func TruthyInput(in map[string]any, key string) bool
- type FooterOpts
- type Styles
Constants ¶
const AllBaseSections = "header, activity, community, repositories, metadata"
AllBaseSections is the default `base` section set when the user does not pin specific sections — header, activity, community, repositories, metadata. (`introduction` is upstream-defined but gated separately by `plugin_introduction`.)
Variables ¶
This section is empty.
Functions ¶
func ContributionRow ¶
func ContributionRow(days []plugins.ContributionDay) string
ContributionRow renders the mini contribution calendar as a single horizontal row of day cells. Returns "" when no days are present so the partial can hide the block. Mirrors upstream `base.header.ejs`, which lays the most recent 14 days out left-to-right.
func MetadataFooter ¶
func MetadataFooter(pc *templates.PartialContext, sections map[string]struct{}, opts FooterOpts) string
MetadataFooter renders the metadata block when the `metadata` base section is enabled, or when the legacy expanded `base.metadata` input is truthy. The block is wrapped in `<section data-section="metadata">` so DOM diffing can locate it, and the inner `<footer>` is preserved so the M3 render.Hash footer-stripping rule still drops the timestamp before hashing.
func ReadBaseInput ¶
ReadBaseInput extracts the `base` input. Returns (value, true) when the key is present even if the value is "" — callers need to tell "user set base to empty" from "user did not set base".
func ResolveBaseSections ¶
ResolveBaseSections reads the `base` input and returns the set of enabled base section names. Mirrors upstream behaviour:
- input absent → default to all sections (preserves compatibility with pipelines that do not set `base`).
- input present but empty → no base sections (per-plugin renders strip the base chrome this way).
- input is a CSV → split, trim, lowercase each entry.
func TruthyInput ¶
TruthyInput reports whether in[key] reads as a truthy toggle ("true" / "yes" / "1" / bool true). Mirrors upstream metadata.mjs's boolean coercion so the per-plugin `plugin_<slug>` gates behave the same in classic and repository templates.
Types ¶
type FooterOpts ¶
type FooterOpts struct {
// contributions" span when pc.Data.Account == plugins.AccountUser.
// classic enables this; repository does not (its account is repo).
IncludePrivateNotice bool
}
FooterOpts toggles per-template differences in MetadataFooter.