chrome

package
v1.2.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 20, 2026 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
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

func ReadBaseInput(in map[string]any) (string, bool)

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

func ResolveBaseSections(in map[string]any) map[string]struct{}

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

func TruthyInput(in map[string]any, key string) bool

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 {
	// IncludePrivateNotice prepends a "These metrics include private
	// 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.

type Styles

type Styles struct {
	Fonts string
	Style string
	// contains filtered or unexported fields
}

Styles caches the classic-template fonts.css + style.css contents. Both templates render with the same CSS, so each template embeds one of these and calls Load on first render.

func (*Styles) Load

func (s *Styles) Load(classicFS fs.FS) error

Load reads fonts.css and style.css from the given filesystem (expected to be the classic template's embedded FS) the first time it is called. Subsequent calls are no-ops.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL