Documentation
¶
Overview ¶
Package partials hosts the repository-template-specific partials the M7 layout needs. They are NOT registered in the global classic partials registry — instead the parent repository package consumes them through the per-template lookup table in repository.go.
All four functions follow the M2 partial contract (nil-safe, XML-escaped, single-line SVG fragment string).
Index ¶
- func BaseActivity(_ context.Context, pc *templates.PartialContext) (string, error)
- func BaseCommunity(_ context.Context, pc *templates.PartialContext) (string, error)
- func BaseHeader(_ context.Context, pc *templates.PartialContext) (string, error)
- func Introduction(_ context.Context, pc *templates.PartialContext) (string, error)
- func Lookup(name string) (templates.PartialFunc, bool)
- func PartialEnabledByBase(name string, sections map[string]struct{}) bool
- func ResolveBaseSections(in map[string]any) map[string]struct{}
- func SetNow(now func() time.Time) func()
- func TruthyInput(in map[string]any, key string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BaseActivity ¶
BaseActivity renders the recent commits / open issues / open PRs triple. Returns "" when data.Repo is nil OR the repo is archived AND has no activity to show.
func BaseCommunity ¶
BaseCommunity renders contributors / stargazers / forks counts. Returns "" when data.Repo is nil OR all counts are zero (so empty repos do not render a stray empty section).
func BaseHeader ¶
BaseHeader renders the upstream `base.header.ejs`-equivalent repo chrome: the repository name plus the two-column stats row (Created / Deployed / disk-usage on the left, the contribution mini-calendar / Environments on the right). Returns "" when data.Repo is nil so the dispatch path stays nil-safe. #464.
func Introduction ¶
Introduction surfaces the repo's about text + primary language / license badges. Returns "" when data.Repo is nil.
func Lookup ¶
func Lookup(name string) (templates.PartialFunc, bool)
Lookup returns the repository-template partial for the given name, or nil when none is owned by this package. Plugin partial names (`languages`, `activity`, etc.) are intentionally absent — the repository template's Run resolves those through the shared classic partials registry where the per-plugin packages already register them by name.
func PartialEnabledByBase ¶ added in v1.1.0
PartialEnabledByBase reports whether the named repository-owned partial should render given the resolved base sections. Only `base.header` is gated here (mapped to the "header" section); every other `_.json` entry is a plugin partial that passes through (its `plugin_<slug>` toggle is applied separately by the caller). #464.
func ResolveBaseSections ¶ added in v1.1.0
ResolveBaseSections reads the `base` input and returns the set of enabled base section names. Mirrors the classic template:
- input absent → all sections on (default render).
- input present but empty string → no base sections (`base=` / per-plugin renders strip the base.header chrome).
- input is a CSV → split, trim, lowercase each entry.
#464.
func SetNow ¶ added in v1.1.0
SetNow overrides the BaseHeader clock for tests and returns a restore function. Not safe for concurrent use across parallel tests sharing the clock.
func TruthyInput ¶ added in v1.1.0
TruthyInput reports whether the input keyed by `key` is a truthy toggle ("true" / "yes" / "1" / bool true). Mirrors the classic dispatcher's gate so the repository template applies identical `plugin_<slug>` semantics. #464.
Types ¶
This section is empty.