Documentation
¶
Overview ¶
Package calendar owns the M4 "calendar" plugin. It collapses the per-day contribution data already populated by base.runIndepth (Computed.ContributionCalendar) into a per-year × per-month histogram.
Index ¶
Constants ¶
const Name = "calendar"
Name is the canonical plugin slug.
Variables ¶
var Plugin plugins.Plugin = &calendarPlugin{}
Plugin is the singleton registered with the global plugin registry.
Functions ¶
func Partial ¶
Partial renders the classic SVG fragment for the calendar plugin. Multi-year heatmap matching upstream org_repo/source/templates/classic/partials/calendar.ejs.
Settings: mjun0812 uses plugin_calendar: yes, plugin_calendar_limit: 3.
func SetNowForTest ¶ added in v1.2.0
SetNowForTest overrides the calendar clock and returns a restore function.
Types ¶
type CalendarWeek ¶ added in v1.1.0
type CalendarWeek struct {
ContributionDays []ContributionCell `json:"contributionDays"`
}
CalendarWeek mirrors upstream `week.contributionDays`. May have 1-7 entries; a year-boundary week is short (1-6 days) and the partial offsets it so the cells align with the right weekday rows.
type ContributionCell ¶ added in v1.1.0
type ContributionCell struct {
Date string `json:"date"`
Color string `json:"color"`
Count int `json:"count"`
}
ContributionCell mirrors one cell in the heatmap — `{date, color}` per upstream EJS line 21. Count is included as additional metadata (upstream's GraphQL exposes it; the EJS doesn't render it, but downstream consumers may use it).
type Result ¶
type Result struct {
Skipped bool `json:"skipped,omitempty"`
SkippedReason string `json:"-"`
Years []YearCalendar `json:"years"`
Limit int `json:"limit"`
}
Result is the JSON payload published under data.Plugins["calendar"].
type YearCalendar ¶
type YearCalendar struct {
Year int `json:"year"`
Total int `json:"total"`
Months [12]int `json:"months"`
Weeks []CalendarWeek `json:"weeks"`
}
YearCalendar carries one calendar year's contribution histogram + per-week per-day cells for the upstream-equivalent heatmap render. Months[12] is preserved for backward compat with the v1 JSON shape (Principle II additive extension).